private void ParseTibiaPackets(InMessage message)
        {
            var packetCount = message.ReadUShort();

            for (int j = 0; j < packetCount; j++)
            {
                var packetSize    = message.ReadUShort();
                var packet        = message.ReadBytes(packetSize);
                var packetMessage = new InMessage(packet, packetSize);
                ParseTibiaPacket(packetMessage);
            }
        }
Beispiel #2
0
        private void ParseInitialize(InMessage message)
        {
            if (minorVersion >= 10)
            {
                message.ReadByte(); //?
            }
            int count = message.ReadUShort();

            for (int i = 0; i < count; i++)
            {
                var creature = new Creature(message.ReadUInt());
                creature.Type = (CreatureType)message.ReadByte();
                creature.Name = message.ReadString();

                //Trace.WriteLine(String.Format("Creature[{0}]: {1}", i, creature.Name));

                creature.Health = message.ReadByte();
                var direction = (Direction)message.ReadByte();
                creature.LookDirection = direction;
                creature.TurnDirection = direction;

                //Outfit
                creature.Outfit       = message.ReadOutfit();
                creature.LightLevel   = message.ReadByte();
                creature.LightColor   = message.ReadByte();
                creature.Speed        = message.ReadUShort();
                creature.Skull        = message.ReadByte();
                creature.Shield       = message.ReadByte();
                creature.Emblem       = message.ReadByte();
                creature.IsImpassable = message.ReadByte() == 0x01;

                //10.38+ includes an extra 5 bytes per creature
                //These bytes could alter the read order, but since I don't know what they are for yet, I'll read them out of the way.
                message.ReadBytes(5);
                client.BattleList.AddCreature(creature);
            }

            ParseTibiaPackets(message);
        }