예제 #1
0
 public void Deserialize(LittleEndianReader reader)
 {
     ItemId       = reader.ReadUInt();
     Slot         = reader.ReadByte();
     ItemsInSlot  = reader.ReadByte();
     SpellCharges = reader.ReadByte();
 }
예제 #2
0
 public override void Deserialize(LittleEndianReader reader)
 {
     spellSlotType = reader.ReadByte();
     slot          = reader.ReadByte();
     position      = Extensions.DeserializeVector2(reader);
     endPosition   = Extensions.DeserializeVector2(reader);
     targetNetId   = reader.ReadUInt();
 }
예제 #3
0
 public override void Deserialize(LittleEndianReader reader)
 {
     this.type        = (MovementType)reader.ReadByte();
     this.x           = reader.ReadFloat();
     this.y           = reader.ReadFloat();
     this.targetNetId = reader.ReadUInt();
     this.coordCount  = reader.ReadByte();
     this.netId2      = reader.ReadInt();
     this.moveData    = reader.ReadBytes((int)(reader.BaseStream.Length - reader.BaseStream.Position));
 }
예제 #4
0
        /// <summary>
        /// Build a messagePart and call the ConstructMessage(); method.
        /// </summary>
        /// <param name="buffer">data received</param>
        /// <returns>Message of your protocol, builted</returns>
        public static Message BuildMessage(ENetClient client, Channel channel, byte[] buffer)
        {
            var reader = new LittleEndianReader(buffer);

            PacketCmd messageId = (PacketCmd)reader.ReadByte();

            Message message;

            try
            {
                message = ConstructMessage(messageId, channel, reader);

                if (message == null)
                {
                    logger.Write("Message: " + messageId + " not registered in protocol", MessageState.WARNING);
                }
                return(message);
            }
            catch (Exception ex)
            {
                logger.Write("Exception while building Message : (" + messageId + ") =>" + ex.Message, MessageState.WARNING);
                return(null);
            }
            finally
            {
                reader.Dispose();
            }
        }
예제 #5
0
        public MovementDataNormal(LittleEndianReader reader)
        {
            byte bitfield = reader.ReadByte();
            byte size     = (byte)(bitfield >> 1);

            HasTeleportID = (bitfield & 1) != 0;
            if (size >= 2)
            {
                TeleportNetID = reader.ReadUInt();
                if (HasTeleportID)
                {
                    TeleportID = reader.ReadByte();
                }
                Waypoints = reader.ReadCompressedWaypoints(size / 2u);
            }
        }
예제 #6
0
        public override void Deserialize(LittleEndianReader reader)
        {
            byte itemCount = reader.ReadByte();

            Items = new ItemData[itemCount];
            for (int i = 0; i < itemCount; i++)
            {
                var item = new ItemData();
                item.Deserialize(reader);
                Items[i] = item;
            }

            bool hasShield = reader.ReadBool();

            if (hasShield)
            {
                ShieldValues = new ShieldValues();
                ShieldValues.Deserialize(reader);
            }

            int countCharStack = reader.ReadInt();

            CharacterDataStack = new CharacterStackData[countCharStack];

            for (int i = 0; i < countCharStack; i++)
            {
                var data = new CharacterStackData();
                data.Deserialize(reader);
                CharacterDataStack[i] = data;
            }

            LookAtNetId    = reader.ReadUInt();
            LookAtType     = (LookAtType)reader.ReadByte();
            LookAtPosition = Core.Extensions.DeserializeVector3(reader);

            int numOfBuffCount = reader.ReadInt();

            for (int i = 0; i < numOfBuffCount; i++)
            {
                byte slot  = reader.ReadByte();
                int  count = reader.ReadInt();
                BuffCount.Add(new KeyValuePair <byte, int>(slot, count));
            }

            UnknownIsHero = reader.ReadBool();
        }
예제 #7
0
        public override void Deserialize(LittleEndianReader reader)
        {
            this.playerId     = reader.ReadInt();
            this.botNetId     = reader.ReadInt();
            this.isBotMessage = reader.ReadByte();
            this.channel      = (ChatChannelType)reader.ReadInt();
            this.unk1         = reader.ReadInt();
            this.length       = reader.ReadInt();
            this.unk2         = reader.ReadBytes(32);

            var bytes = new List <byte>();

            for (var i = 0; i < length; i++)
            {
                bytes.Add(reader.ReadByte());
            }
            this.content = Encoding.UTF8.GetString(bytes.ToArray());
        }
 public override void Deserialize(LittleEndianReader reader)
 {
     this.unk1   = reader.ReadInt();
     this.userId = reader.ReadLong();
     this.loaded = reader.ReadFloat();
     this.ping   = reader.ReadFloat();
     this.unk2   = reader.ReadShort();
     this.unk3   = reader.ReadShort();
     this.unk4   = reader.ReadByte();
 }
예제 #9
0
        public void Deserialize(LittleEndianReader reader)
        {
            SkinName = reader.ReadSizedString();
            SkinId   = reader.ReadUInt();
            byte bitfield = reader.ReadByte();

            OverrideSpells          = (bitfield & 1) != 0;
            ModelOnly               = (bitfield & 2) != 0;
            ReplaceCharacterPackage = (bitfield & 4) != 0;
            Id = reader.ReadUInt();
        }
예제 #10
0
 public override void Deserialize(LittleEndianReader reader)
 {
     x         = reader.ReadFloat();
     y         = reader.ReadFloat();
     zoom      = reader.ReadFloat();
     y2        = reader.ReadFloat();
     width     = reader.ReadInt();
     height    = reader.ReadInt();
     unk2      = reader.ReadInt();
     requestNo = reader.ReadByte();
 }
예제 #11
0
        public static IChangeSpellData ReadChangeSpellData(this LittleEndianReader reader)
        {
            IChangeSpellData        data;
            ChangeSlotSpellDataType type = (ChangeSlotSpellDataType)reader.ReadByte();

            switch (type)
            {
            case ChangeSlotSpellDataType.TargetingType:
                data = new ChangeSpellDataTargetingType();
                break;

            case ChangeSlotSpellDataType.SpellName:
                data = new ChangeSpellDataSpellName();
                break;

            case ChangeSlotSpellDataType.Range:
                data = new ChangeSpellDataRange();
                break;

            case ChangeSlotSpellDataType.MaxGrowthRange:
                data = new ChangeSpellDataMaxGrowthRange();
                break;

            case ChangeSlotSpellDataType.RangeDisplay:
                data = new ChangeSpellDataRangeDisplay();
                break;

            case ChangeSlotSpellDataType.IconIndex:
                data = new ChangeSpellDataIconIndex();
                break;

            case ChangeSlotSpellDataType.OffsetTarget:
                data = new ChangeSpellDataOffsetTarget();
                break;

            default:
                data = new ChangeSpellDataUnknown();
                break;
            }
            data.Deserialize(reader);
            return(data);
        }
예제 #12
0
 public override void Deserialize(LittleEndianReader reader)
 {
     this.requestNo = reader.ReadByte();
 }
예제 #13
0
 public override void Deserialize(LittleEndianReader reader)
 {
     this.undefined = reader.ReadByte();
 }
예제 #14
0
 public override void Deserialize(LittleEndianReader reader)
 {
     this.slotFrom = reader.ReadByte();
     this.slotTo   = reader.ReadByte();
 }
예제 #15
0
 public override void Unpack(LittleEndianReader reader)
 {
     base.Unpack(reader);
     reader.ReadByte();
 }
예제 #16
0
 public static MovementDataType ReadMovementDataType(this LittleEndianReader reader)
 {
     return((MovementDataType)reader.ReadByte());
 }
예제 #17
0
 public override void Deserialize(LittleEndianReader reader)
 {
     slotId = reader.ReadByte();
 }
예제 #18
0
 public override void Deserialize(LittleEndianReader reader)
 {
     this.skillId = reader.ReadByte();
 }
 public override void Deserialize(LittleEndianReader reader)
 {
     this.position    = new Vector2(reader.ReadFloat(), reader.ReadFloat());
     this.targetNetId = reader.ReadUInt();
     this.pingType    = (PingTypeEnum)reader.ReadByte();
 }