Ejemplo n.º 1
0
    public int CheckAndFixIOLevel(int level)
    {
        int num;

        if (this.TypeID != Enums.eType.InventO && this.TypeID != Enums.eType.SetO)
        {
            num = level - 1;
        }
        else
        {
            int iMax = 52;
            int iMin = 9;
            switch (this.TypeID)
            {
            case Enums.eType.InventO:
                iMax = this.LevelMax;
                iMin = this.LevelMin;
                break;

            case Enums.eType.SetO:
                if (this.nIDSet > -1)
                {
                    iMax = DatabaseAPI.Database.EnhancementSets[this.nIDSet].LevelMax;
                    iMin = DatabaseAPI.Database.EnhancementSets[this.nIDSet].LevelMin;
                    break;
                }
                break;
            }
            if (level > iMax)
            {
                level = iMax;
            }
            if (level < iMin)
            {
                level = iMin;
            }
            if (this.TypeID == Enums.eType.InventO)
            {
                if (iMax > 49)
                {
                    iMax = 49;
                }
                level = Enhancement.GranularLevelZb(level, iMin, iMax, 5);
            }
            num = level;
        }
        return(num);
    }
        static int FindItemID(int rIDX, int iLevel)

        {
            int num1 = -1;
            int num2 = 52;
            int num3 = 0;
            int num4 = DatabaseAPI.Database.Recipes[rIDX].Item.Length - 1;

            for (int index = 0; index <= num4; ++index)
            {
                if (DatabaseAPI.Database.Recipes[rIDX].Item[index].Level > num3)
                {
                    num3 = DatabaseAPI.Database.Recipes[rIDX].Item[index].Level;
                }
                if (DatabaseAPI.Database.Recipes[rIDX].Item[index].Level < num2)
                {
                    num2 = DatabaseAPI.Database.Recipes[rIDX].Item[index].Level;
                }
                if (DatabaseAPI.Database.Recipes[rIDX].Item[index].Level != iLevel)
                {
                    continue;
                }
                num1 = index;
                break;
            }

            if (num1 >= 0)
            {
                return(num1 >= 0 ? num1 : -1);
            }
            {
                iLevel = Enhancement.GranularLevelZb(iLevel, 0, 49);
                int num5 = DatabaseAPI.Database.Recipes[rIDX].Item.Length - 1;
                for (int index = 0; index <= num5; ++index)
                {
                    if (DatabaseAPI.Database.Recipes[rIDX].Item[index].Level != iLevel)
                    {
                        continue;
                    }
                    num1 = index;
                    break;
                }
            }
            return(num1 >= 0 ? num1 : -1);
        }