Пример #1
0
        private void ParseServerPlayerCash(InMessage message)
        {
            var cash = message.ReadUInt();
            var num  = message.ReadByte();

            message.ReadBytes(num * 3);
        }
Пример #2
0
        private void ParseServerBasicData(InMessage message)
        {
            var isPremmium = message.ReadByte();
            var vocation   = message.ReadByte();

            var knowSpells = message.ReadUShort();

            message.ReadBytes(knowSpells);
        }
Пример #3
0
        private void ParseServerMarketDetail(InMessage message)
        {
            message.ReadUShort();
            for (int i = 0; i < 15; i++)
            {
                message.ReadString();
            }

            var num2 = message.ReadByte();

            if (num2 > 0)
            {
                message.ReadBytes(num2 * 16);
            }
            num2 = message.ReadByte();
            if (num2 > 0)
            {
                message.ReadBytes(num2 * 16);
            }
        }
 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);
     }
 }
Пример #5
0
        public void ParseServerMessage(InMessage message)
        {
            var packets     = new List <byte>();
            var packetStart = 0;

            try
            {
                while (message.ReadPosition < message.Size)
                {
                    packetStart = message.ReadPosition;
                    byte cmd = message.ReadByte();
                    packets.Add(cmd);

                    switch (cmd)
                    {
                    case 0x0A:
                        ParseServerSelfAppear(message);
                        break;

                    case 0x0B:
                        ParseServerGMActions(message);
                        break;

                    case 0x14:
                        ParseServerErrorMessage(message);
                        break;

                    case 0x15:
                        ParseServerFYIMessage(message);
                        break;

                    case 0x16:
                        ParseServerWaitingList(message);
                        break;

                    case 0x1D:
                        ParseServerPing(message);
                        break;

                    case 0x1E:
                        ParseServerPingBack(message);
                        break;

                    case 0x28:
                        ParseServerDeath(message);
                        break;

                    case 0x32:
                        ParseServerCanReportBugs(message);
                        break;

                    case 0x64:
                        ParseServerMapDescription(message);
                        break;

                    case 0x65:
                        ParseServerMoveNorth(message);
                        break;

                    case 0x66:
                        ParseServerMoveEast(message);
                        break;

                    case 0x67:
                        ParseServerMoveSouth(message);
                        break;

                    case 0x68:
                        ParseServerMoveWest(message);
                        break;

                    case 0x69:
                        ParseServerUpdateTile(message);
                        break;

                    case 0x6A:
                        ParseServerTileAddThing(message);
                        break;

                    case 0x6B:
                        ParseServerTileTransformThing(message);
                        break;

                    case 0x6C:
                        ParseServerTileRemoveThing(message);
                        break;

                    case 0x6D:
                        ParseServerCreatureMove(message);
                        break;

                    case 0x6E:
                        ParseServerOpenContainer(message);
                        break;

                    case 0x6F:
                        ParseServerCloseContainer(message);
                        break;

                    case 0x70:
                        ParseServerContainerAddItem(message);
                        break;

                    case 0x71:
                        ParseServerContainerUpdateItem(message);
                        break;

                    case 0x72:
                        ParseServerContainerRemoveItem(message);
                        break;

                    case 0x78:
                        ParseServerInventorySetSlot(message);
                        break;

                    case 0x79:
                        ParseServerInventoryResetSlot(message);
                        break;

                    case 0x7D:
                        ParseServerSafeTradeRequestAck(message);
                        break;

                    case 0x7E:
                        ParseServerSafeTradeRequestNoAck(message);
                        break;

                    case 0x7F:
                        ParseServerSafeTradeClose(message);
                        break;

                    case 0x82:
                        ParseServerWorldLight(message);
                        break;

                    case 0x83:
                        ParseServerMagicEffect(message);
                        break;

                    case 0x84:
                        ParseServerAnimatedText(message);
                        break;

                    case 0x85:
                        ParseServerDistanceShot(message);
                        break;

                    case 0x86:
                        ParseServerCreatureSquare(message);
                        break;

                    case 0x87:
                        byte b = message.ReadByte();
                        if (b > 0)
                        {
                            message.ReadBytes(b * 4);
                        }
                        break;

                    case 0x8C:
                        ParseServerCreatureHealth(message);
                        break;

                    case 0x8D:
                        ParseServerCreatureLight(message);
                        break;

                    case 0x8E:
                        ParseServerCreatureOutfit(message);
                        break;

                    case 0x8F:
                        ParseServerCreatureSpeed(message);
                        break;

                    case 0x90:
                        ParseServerCreatureSkulls(message);
                        break;

                    case 0x91:
                        ParseServerCreatureShields(message);
                        break;

                    case 0x92:
                        ParseServerCreaturePassable(message);
                        break;

                    case 0x96:
                        ParseServerItemTextWindow(message);
                        break;

                    case 0x97:
                        ParseServerHouseTextWindow(message);
                        break;

                    case 0xA0:
                        ParseServerPlayerStats(message);
                        break;

                    case 0xA1:
                        ParseServerPlayerSkills(message);
                        break;

                    case 0xA2:
                        ParseServerPlayerIcons(message);
                        break;

                    case 0xA3:
                        ParseServerPlayerCancelAttack(message);
                        break;

                    case 0xA4:
                        ParseServerSpellCooldown(message);
                        break;

                    case 0xA5:
                        ParseServerSpellGroupCooldown(message);
                        break;

                    case 0xA6:     //desconhecido
                        message.ReadUInt();
                        break;

                    case 0xAA:
                        ParseServerCreatureSpeak(message);
                        break;

                    case 0xAB:
                        ParseServerChannelList(message);
                        break;

                    case 0xAC:
                        ParseServerOpenChannel(message);
                        break;

                    case 0xAD:
                        ParseServerOpenPrivatePlayerChat(message);
                        break;

                    case 0xAE:
                        ParseServerOpenRuleViolation(message);
                        break;

                    case 0xB2:
                        ParseServerCreatePrivateChannel(message);
                        break;

                    case 0xB3:
                        ParseServerClosePrivateChannel(message);
                        break;

                    case 0xB4:
                        ParseServerTextMessage(message);
                        break;

                    case 0xB5:
                        ParseServerPlayerCancelWalk(message);
                        break;

                    case 0xB6:
                        message.ReadUShort();
                        break;

                    case 0xBE:
                        ParseServerFloorChangeUp(message);
                        break;

                    case 0xBF:
                        ParseServerFloorChangeDown(message);
                        break;

                    case 0xC8:
                        ParseServerOutfitWindow(message);
                        break;

                    case 0xD2:
                        ParseServerVipState(message);
                        break;

                    case 0xD3:
                        ParseServerVipLogin(message);
                        break;

                    case 0xD4:
                        ParseServerVipLogout(message);
                        break;

                    case 0xF0:
                        ParseServerQuestList(message);
                        break;

                    case 0xF1:
                        ParseServerQuestPartList(message);
                        break;

                    case 0x7A:
                        ParseServerOpenShopWindow(message);
                        break;

                    case 0x7B:
                        ParseServerPlayerCash(message);
                        break;

                    case 0x7C:
                        ParseServerCloseShopWindow(message);
                        break;

                    case 0x9F:
                        ParseServerBasicData(message);
                        break;

                    case 0xDC:
                        ParseServerShowTutorial(message);
                        break;

                    case 0xDD:
                        ParseServerAddMapMarker(message);
                        break;

                    case 0xF3:
                        ParseServerChannelEvent(message);
                        break;

                    case 0xF6:
                        ParseServerMarketEnter(message);
                        break;

                    case 0xF7:
                        ParseServerMarketLeave(message);
                        break;

                    case 0xF8:
                        ParseServerMarketDetail(message);
                        break;

                    case 0xF9:
                        ParseServerMarketBrowser(message);
                        break;

                    default:
                        throw new Exception("ProtocolWorld [ParseServerMessage]: Unkonw packet type " + cmd.ToString("X2"));
                    }
                }
            }
            catch (Exception ex)
            {
                Trace.TraceWarning(ex.Message + "\nLast Packets: " + packets.ToArray().ToHexString() +
                                   "\nPacket Bytes: " + message.Buffer.ToHexString(packetStart, message.ReadPosition - packetStart));
            }
        }
        private void ParseServerMarketDetail(InMessage message)
        {
            message.ReadUShort();
            for (int i = 0; i < 15; i++)
                message.ReadString();

            var num2 = message.ReadByte();
            if (num2 > 0)
                message.ReadBytes(num2 * 16);
            num2 = message.ReadByte();
            if (num2 > 0)
                message.ReadBytes(num2 * 16);
        }
        public void ParseServerMessage(InMessage message)
        {
            var packets = new List<byte>();
            var packetStart = 0;
            try
            {
                while (message.ReadPosition < message.Size)
                {
                    packetStart = message.ReadPosition;
                    byte cmd = message.ReadByte();
                    packets.Add(cmd);

                    switch (cmd)
                    {
                        case 0x0A:
                            ParseServerSelfAppear(message);
                            break;
                        case 0x0B:
                            ParseServerGMActions(message);
                            break;
                        case 0x14:
                            ParseServerErrorMessage(message);
                            break;
                        case 0x15:
                            ParseServerFYIMessage(message);
                            break;
                        case 0x16:
                            ParseServerWaitingList(message);
                            break;
                        case 0x1D:
                            ParseServerPing(message);
                            break;
                        case 0x1E:
                            ParseServerPingBack(message);
                            break;
                        case 0x28:
                            ParseServerDeath(message);
                            break;
                        case 0x32:
                            ParseServerCanReportBugs(message);
                            break;
                        case 0x64:
                            ParseServerMapDescription(message);
                            break;
                        case 0x65:
                            ParseServerMoveNorth(message);
                            break;
                        case 0x66:
                            ParseServerMoveEast(message);
                            break;
                        case 0x67:
                            ParseServerMoveSouth(message);
                            break;
                        case 0x68:
                            ParseServerMoveWest(message);
                            break;
                        case 0x69:
                            ParseServerUpdateTile(message);
                            break;
                        case 0x6A:
                            ParseServerTileAddThing(message);
                            break;
                        case 0x6B:
                            ParseServerTileTransformThing(message);
                            break;
                        case 0x6C:
                            ParseServerTileRemoveThing(message);
                            break;
                        case 0x6D:
                            ParseServerCreatureMove(message);
                            break;
                        case 0x6E:
                            ParseServerOpenContainer(message);
                            break;
                        case 0x6F:
                            ParseServerCloseContainer(message);
                            break;
                        case 0x70:
                            ParseServerContainerAddItem(message);
                            break;
                        case 0x71:
                            ParseServerContainerUpdateItem(message);
                            break;
                        case 0x72:
                            ParseServerContainerRemoveItem(message);
                            break;
                        case 0x78:
                            ParseServerInventorySetSlot(message);
                            break;
                        case 0x79:
                            ParseServerInventoryResetSlot(message);
                            break;
                        case 0x7D:
                            ParseServerSafeTradeRequestAck(message);
                            break;
                        case 0x7E:
                            ParseServerSafeTradeRequestNoAck(message);
                            break;
                        case 0x7F:
                            ParseServerSafeTradeClose(message);
                            break;
                        case 0x82:
                            ParseServerWorldLight(message);
                            break;
                        case 0x83:
                            ParseServerMagicEffect(message);
                            break;
                        case 0x84:
                            ParseServerAnimatedText(message);
                            break;
                        case 0x85:
                            ParseServerDistanceShot(message);
                            break;
                        case 0x86:
                            ParseServerCreatureSquare(message);
                            break;
                        case 0x87:
                            byte b = message.ReadByte();
                            if (b > 0)
                                message.ReadBytes(b * 4);
                            break;
                        case 0x8C:
                            ParseServerCreatureHealth(message);
                            break;
                        case 0x8D:
                            ParseServerCreatureLight(message);
                            break;
                        case 0x8E:
                            ParseServerCreatureOutfit(message);
                            break;
                        case 0x8F:
                            ParseServerCreatureSpeed(message);
                            break;
                        case 0x90:
                            ParseServerCreatureSkulls(message);
                            break;
                        case 0x91:
                            ParseServerCreatureShields(message);
                            break;
                        case 0x92:
                            ParseServerCreaturePassable(message);
                            break;
                        case 0x96:
                            ParseServerItemTextWindow(message);
                            break;
                        case 0x97:
                            ParseServerHouseTextWindow(message);
                            break;
                        case 0xA0:
                            ParseServerPlayerStats(message);
                            break;
                        case 0xA1:
                            ParseServerPlayerSkills(message);
                            break;
                        case 0xA2:
                            ParseServerPlayerIcons(message);
                            break;
                        case 0xA3:
                            ParseServerPlayerCancelAttack(message);
                            break;
                        case 0xA4:
                            ParseServerSpellCooldown(message);
                            break;
                        case 0xA5:
                            ParseServerSpellGroupCooldown(message);
                            break;
                        case 0xA6: //desconhecido
                            message.ReadUInt();
                            break;
                        case 0xAA:
                            ParseServerCreatureSpeak(message);
                            break;
                        case 0xAB:
                            ParseServerChannelList(message);
                            break;
                        case 0xAC:
                            ParseServerOpenChannel(message);
                            break;
                        case 0xAD:
                            ParseServerOpenPrivatePlayerChat(message);
                            break;
                        case 0xAE:
                            ParseServerOpenRuleViolation(message);
                            break;
                        case 0xB2:
                            ParseServerCreatePrivateChannel(message);
                            break;
                        case 0xB3:
                            ParseServerClosePrivateChannel(message);
                            break;
                        case 0xB4:
                            ParseServerTextMessage(message);
                            break;
                        case 0xB5:
                            ParseServerPlayerCancelWalk(message);
                            break;
                        case 0xB6:
                            message.ReadUShort();
                            break;
                        case 0xBE:
                            ParseServerFloorChangeUp(message);
                            break;
                        case 0xBF:
                            ParseServerFloorChangeDown(message);
                            break;
                        case 0xC8:
                            ParseServerOutfitWindow(message);
                            break;
                        case 0xD2:
                            ParseServerVipState(message);
                            break;
                        case 0xD3:
                            ParseServerVipLogin(message);
                            break;
                        case 0xD4:
                            ParseServerVipLogout(message);
                            break;
                        case 0xF0:
                            ParseServerQuestList(message);
                            break;
                        case 0xF1:
                            ParseServerQuestPartList(message);
                            break;
                        case 0x7A:
                            ParseServerOpenShopWindow(message);
                            break;
                        case 0x7B:
                            ParseServerPlayerCash(message);
                            break;
                        case 0x7C:
                            ParseServerCloseShopWindow(message);
                            break;
                        case 0x9F:
                            ParseServerBasicData(message);
                            break;
                        case 0xDC:
                            ParseServerShowTutorial(message);
                            break;
                        case 0xDD:
                            ParseServerAddMapMarker(message);
                            break;
                        case 0xF3:
                            ParseServerChannelEvent(message);
                            break;
                        case 0xF6:
                            ParseServerMarketEnter(message);
                            break;
                        case 0xF7:
                            ParseServerMarketLeave(message);
                            break;
                        case 0xF8:
                            ParseServerMarketDetail(message);
                            break;
                        case 0xF9:
                            ParseServerMarketBrowser(message);
                            break;
                        default:
                            throw new Exception("ProtocolWorld [ParseServerMessage]: Unkonw packet type " + cmd.ToString("X2"));
                    }
                }

            }
            catch (Exception ex)
            {
                Trace.TraceWarning(ex.Message + "\nLast Packets: " + packets.ToArray().ToHexString() +
                    "\nPacket Bytes: " + message.Buffer.ToHexString(packetStart, message.ReadPosition - packetStart));
            }
        }
        private void ParseServerBasicData(InMessage message)
        {
            var isPremmium = message.ReadByte();
            var vocation = message.ReadByte();

            var knowSpells = message.ReadUShort();

            message.ReadBytes(knowSpells);
        }
 private void ParseServerPlayerCash(InMessage message)
 {
     var cash = message.ReadUInt();
     var num = message.ReadByte();
     message.ReadBytes(num * 3);
 }
Пример #10
0
        private void ParseServerPlayerCash(InMessage message)
        {
            ulong cash;

            if (client.Version.Number >= ClientVersion.Version981.Number)
                cash = message.ReadULong();
            else
                cash = message.ReadUInt();

            var num = message.ReadByte();
            message.ReadBytes(num * 3);
        }
Пример #11
0
        private void ParseServerBasicData(InMessage message)
        {
            var isPremmium = message.ReadByte();
            if (client.Version.Number >= ClientVersion.Version1038.Number)
                message.ReadUInt(); //PremiumTime
            var vocation = message.ReadByte();

            var knowSpells = message.ReadUShort();

            message.ReadBytes(knowSpells);
        }