Exemplo n.º 1
0
        private void ParseInitialize(InMessage message)
        {
            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;

                client.BattleList.AddCreature(creature);
            }

            ParseTibiaPackets(message);
        }
Exemplo n.º 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.20+ includes an extra 4 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.ReadUInt();

                //speech category?
                if (client.Version.Number >= ClientVersion.Version1036.Number)
                {
                    message.ReadByte();
                }

                client.BattleList.AddCreature(creature);
            }

            ParseTibiaPackets(message);
        }