예제 #1
0
        private void ParseMarketEnter(Internal.CommunicationStream 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
            }
        }
예제 #2
0
        private void ParseResourceBalance(Internal.CommunicationStream message)
        {
            byte  type    = message.ReadUnsignedByte();
            ulong balance = message.ReadUnsignedLong();

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

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

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

            case (int)ResourceType.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 + ".");
            }
        }
예제 #3
0
        private void ReadCyclopediaCharacterInfoGeneralStats(Internal.CommunicationStream message)
        {
            ulong  experience   = message.ReadUnsignedLong();
            ushort level        = message.ReadUnsignedShort();
            int    levelPercent = message.ReadUnsignedByte();

            float baseXpGain         = message.ReadUnsignedShort() / 100f;
            float grindingAddend     = message.ReadUnsignedShort() / 100f;
            float storeBoostAddend   = message.ReadUnsignedShort() / 100f;
            float huntingBoostFactor = message.ReadUnsignedShort() / 100f;

            message.ReadUnsignedShort(); // yet unknown
            bool canBuyXpBoost = message.ReadBoolean();

            int health    = message.ReadUnsignedShort();
            int maxHealth = message.ReadUnsignedShort();
            int mana      = message.ReadUnsignedShort();
            int maxMana   = message.ReadUnsignedShort();
            int soul      = message.ReadUnsignedByte();

            int ticks        = OpenTibiaUnity.TicksMillis;
            int stamina      = ticks + 60000 * message.ReadUnsignedShort();
            int regeneration = ticks + 1000 * message.ReadUnsignedShort();
            int training     = ticks + 60000 * message.ReadUnsignedShort();

            int speed     = message.ReadUnsignedShort();
            int baseSpeed = message.ReadUnsignedShort();

            uint totalCapacity = message.ReadUnsignedInt();
            uint baseCapacity  = message.ReadUnsignedInt();
            uint freeCapacity  = message.ReadUnsignedInt();

            int skillCount = message.ReadUnsignedByte();

            for (int i = 0; i < skillCount; i++)
            {
                var skillType = message.ReadEnum <SkillType>();
                var skill     = ReadSkill(message);
            }
        }