PSO2SERVER/Server/Protocol/Handlers/04-ObjectHandler/04-3C-ActionUpdateHandler.cs

37 lines
1.3 KiB
C#

using PSO2SERVER.Models;
using PSO2SERVER.Protocol.Packets;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace PSO2SERVER.Protocol.Handlers
{
[PacketHandlerAttr(0x04, 0x3C)]
public class ActionUpdateHandler : PacketHandler
{
public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
{
PacketReader reader = new PacketReader(data);
reader.ReadObjectHeader(); // Read the blank
ObjectHeader actor = reader.ReadObjectHeader(); // Read the actor
byte[] rest = reader.ReadBytes(32); // TODO Map this out and do stuff with it!
foreach (var c in Server.Instance.Clients)
{
if (c == context || c.Character == null || c.CurrentMap != context.CurrentMap)
continue;
//PacketWriter writer = new PacketWriter();
//writer.WriteStruct(new ObjectHeader((uint)c._account.AccountId, ObjectType.Accounts));
//writer.WriteStruct(actor);
//writer.Write(rest);
//c.SendPacket(0x4, 0x81, 0x40, writer.ToArray());
c.SendPacket(new ActionUpdateServerPacket(c._account.AccountId, actor, rest));
}
}
}
}