예제 #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);
        }
예제 #2
0
        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);
            }
        }
예제 #3
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);
        }
예제 #4
0
        private void ParseMessage()
        {
            message.ReadPosition = 2;
            message.Encrypted    = false;

            if (Adler.Generate(message) != message.ReadUInt())
            {
                return;           //discart the message
            }
            message.ReadUShort(); //internal head
            var cmd = message.ReadByte();

            switch (cmd)
            {
            case 0x01:
                ParseTile();
                break;

            default:
                Console.WriteLine("[Error] Unknown packet type " + cmd.ToString("X2"));
                break;
            }
        }