Example #1
0
        private void ParseResourceBalance(Internal.ByteArray message)
        {
            byte  type    = message.ReadUnsignedByte();
            ulong balance = message.ReadUnsignedLong();

            switch (type)
            {
            case (int)ResourceTypes.BankGold:
                //_player.BankGold = balance;
                break;

            case (int)ResourceTypes.InventoryGold:
                //_player.InventoryGold = balance;
                break;

            case (int)ResourceTypes.PreyBonusRerolls:
                if (!OpenTibiaUnity.GameManager.GetFeature(GameFeature.GamePrey))
                {
                    throw new System.Exception("ProtocolGame.ParseResourceBalance: Invalid resource type: " + type + ".");
                }
                //PreyManager.Insance.BonusRerollAmount = balance;
                break;

            case (int)ResourceTypes.CollectionTokens:
                if (!OpenTibiaUnity.GameManager.GetFeature(GameFeature.GameRewardWall))
                {
                    throw new System.Exception("ProtocolGame.ParseResourceBalance: Invalid resource type: " + type + ".");
                }
                break;

            default:
                throw new System.Exception("ProtocolGame.ParseResourceBalance: Invalid resource type: " + type + ".");
            }
        }
Example #2
0
        private void ParseMarketEnter(Internal.ByteArray message)
        {
            ulong balance;

            if (OpenTibiaUnity.GameManager.ClientVersion >= 981)
            {
                balance = message.ReadUnsignedLong();
            }
            else
            {
                balance = message.ReadUnsignedInt();
            }

            int vocation = -1;

            if (OpenTibiaUnity.GameManager.ClientVersion < 950)
            {
                vocation = message.ReadUnsignedByte();
            }

            int offers     = message.ReadUnsignedByte();
            int depotCount = message.ReadUnsignedByte();

            for (int i = 0; i < depotCount; i++)
            {
                message.ReadUnsignedShort(); // objectId
                message.ReadUnsignedShort(); // objectCount
            }
        }