using System;
using PSO2SERVER.Models;
using PSO2SERVER.Protocol.Packets;

namespace PSO2SERVER.Protocol.Handlers
{
    [PacketHandlerAttr(0x06, 0x01)]
    public class DealDamage : PacketHandler
    {
        public unsafe struct DealDamagePacket
        {
            /// Object that inflicted the damage.
            public ObjectHeader Inflicter;
            /// Object that received the damage.
            public ObjectHeader Target;
            public uint Attack_id;
            public ulong Unk2;
            /// Hitbox ID (?).
            public uint Hitbox_id;
            /// Hit x position.
            public Half X_pos;
            /// Hit y position.
            public Half Y_pos;
            /// Hit z position.
            public Half Z_pos;

            public ushort unk4;
            public ulong unk5;
            public fixed byte unk6[0x18];
        }

        public override void HandlePacket(Client context, byte flags, byte[] data, uint position, uint size)
        {
            var info = string.Format("[<--] 接收到的数据 (hex): {0} 字节", data.Length);
            Logger.WriteHex(info, data);
        }
    }
}
