private void OnEnable()
    {
        this.InitPlayerDisplay(GarrisonStatus.CharacterLevel());
        Main expr_10 = Main.instance;

        expr_10.PlayerLeveledUpAction = (Action <int>)Delegate.Combine(expr_10.PlayerLeveledUpAction, new Action <int>(this.HandlePlayerLeveledUp));
    }
Esempio n. 2
0
    private void OnEnable()
    {
        this.m_characterName.set_text(GarrisonStatus.CharacterName());
        if (Main.instance.GetLocale() == "frFR")
        {
            this.m_characterClassName.set_text(string.Concat(new string[]
            {
                GarrisonStatus.CharacterClassName(),
                " ",
                StaticDB.GetString("LEVEL", null),
                " ",
                GarrisonStatus.CharacterLevel().ToString()
            }));
        }
        else
        {
            this.m_characterClassName.set_text(GeneralHelpers.TextOrderString(StaticDB.GetString("LEVEL", null), GarrisonStatus.CharacterLevel().ToString()) + " " + GarrisonStatus.CharacterClassName());
        }
        this.m_characterListButton.set_text(StaticDB.GetString("CHARACTER_LIST", null));
        Sprite sprite = GeneralHelpers.LoadClassIcon(GarrisonStatus.CharacterClassID());

        if (sprite != null)
        {
            this.m_classIcon.set_sprite(sprite);
        }
    }
Esempio n. 3
0
    public void SetItem(int itemID, int itemContext, Sprite iconSprite)
    {
        this.m_rewardQuantity.text    = string.Empty;
        this.m_rewardName.text        = string.Empty;
        this.m_rewardDescription.text = string.Empty;
        this.m_rewardIcon.sprite      = iconSprite;
        ItemRec record = StaticDB.itemDB.GetRecord(itemID);

        if (record != null)
        {
            MobileItemStats itemStats = ItemStatCache.instance.GetItemStats(itemID, itemContext);
            if (itemStats != null)
            {
                this.m_rewardName.text = GeneralHelpers.GetItemQualityColorTag(itemStats.Quality) + record.Display + "</color>";
            }
            else
            {
                this.m_rewardName.text = GeneralHelpers.GetItemQualityColorTag(record.OverallQualityID) + record.Display + "</color>";
            }
            this.m_rewardName.supportRichText = true;
            if (record.ItemNameDescriptionID > 0)
            {
                ItemNameDescriptionRec record2 = StaticDB.itemNameDescriptionDB.GetRecord(record.ItemNameDescriptionID);
                if (record2 != null)
                {
                    Text   rewardName = this.m_rewardName;
                    string text       = rewardName.text;
                    rewardName.text = string.Concat(new string[]
                    {
                        text,
                        "\n<color=#",
                        GeneralHelpers.GetColorFromInt(record2.Color),
                        "ff>",
                        record2.Description,
                        "</color>"
                    });
                }
            }
            if (record.ClassID == 2 || record.ClassID == 3 || record.ClassID == 4 || record.ClassID == 5 || record.ClassID == 6)
            {
                int itemLevel = record.ItemLevel;
                if (itemStats != null)
                {
                    itemLevel = itemStats.ItemLevel;
                }
                Text   rewardName2 = this.m_rewardName;
                string text        = rewardName2.text;
                rewardName2.text = string.Concat(new string[]
                {
                    text,
                    "\n<color=#",
                    GeneralHelpers.s_defaultColor,
                    ">",
                    StaticDB.GetString("ITEM_LEVEL", null),
                    " ",
                    itemLevel.ToString(),
                    "</color>"
                });
            }
            if (record.Bonding > 0)
            {
                string text2 = string.Empty;
                if ((record.Flags & 134217728) != 0)
                {
                    if ((record.Flags1 & 131072) != 0)
                    {
                        text2 = StaticDB.GetString("ITEM_BIND_TO_BNETACCOUNT", null);
                    }
                    else
                    {
                        text2 = StaticDB.GetString("ITEM_BIND_TO_ACCOUNT", null);
                    }
                }
                else if (record.Bonding == 1)
                {
                    text2 = StaticDB.GetString("ITEM_BIND_ON_PICKUP", null);
                }
                else if (record.Bonding == 4)
                {
                    text2 = StaticDB.GetString("ITEM_BIND_QUEST", null);
                }
                else if (record.Bonding == 2)
                {
                    text2 = StaticDB.GetString("ITEM_BIND_ON_EQUIP", null);
                }
                else if (record.Bonding == 3)
                {
                    text2 = StaticDB.GetString("ITEM_BIND_ON_USE", null);
                }
                if (text2 != string.Empty)
                {
                    Text   rewardName3 = this.m_rewardName;
                    string text        = rewardName3.text;
                    rewardName3.text = string.Concat(new string[]
                    {
                        text,
                        "\n<color=#",
                        GeneralHelpers.s_normalColor,
                        ">",
                        text2,
                        "</color>"
                    });
                }
            }
            ItemSubClassRec itemSubclass = StaticDB.GetItemSubclass(record.ClassID, record.SubclassID);
            if (itemSubclass != null && itemSubclass.DisplayName != null && itemSubclass.DisplayName != string.Empty && (itemSubclass.DisplayFlags & 1) == 0 && record.InventoryType != 16)
            {
                if (this.m_rewardDescription.text != string.Empty)
                {
                    Text rewardDescription = this.m_rewardDescription;
                    rewardDescription.text += "\n";
                }
                Text   rewardDescription2 = this.m_rewardDescription;
                string text = rewardDescription2.text;
                rewardDescription2.text = string.Concat(new string[]
                {
                    text,
                    "<color=#",
                    GeneralHelpers.s_normalColor,
                    ">",
                    itemSubclass.DisplayName,
                    "</color>"
                });
            }
            string inventoryTypeString = GeneralHelpers.GetInventoryTypeString((INVENTORY_TYPE)record.InventoryType);
            if (inventoryTypeString != null && inventoryTypeString != string.Empty)
            {
                if (this.m_rewardDescription.text != string.Empty)
                {
                    Text rewardDescription3 = this.m_rewardDescription;
                    rewardDescription3.text += "\n";
                }
                Text   rewardDescription4 = this.m_rewardDescription;
                string text = rewardDescription4.text;
                rewardDescription4.text = string.Concat(new string[]
                {
                    text,
                    "<color=#",
                    GeneralHelpers.s_normalColor,
                    ">",
                    inventoryTypeString,
                    "</color>"
                });
            }
            if (itemStats != null)
            {
                if (itemStats.MinDamage != 0 || itemStats.MaxDamage != 0)
                {
                    if (this.m_rewardDescription.text != string.Empty)
                    {
                        Text rewardDescription5 = this.m_rewardDescription;
                        rewardDescription5.text += "\n";
                    }
                    if (itemStats.MinDamage == itemStats.MaxDamage)
                    {
                        Text rewardDescription6 = this.m_rewardDescription;
                        rewardDescription6.text += GeneralHelpers.TextOrderString(itemStats.MinDamage.ToString(), StaticDB.GetString("DAMAGE", null));
                    }
                    else
                    {
                        Text rewardDescription7 = this.m_rewardDescription;
                        rewardDescription7.text += GeneralHelpers.TextOrderString(itemStats.MinDamage.ToString() + " - " + itemStats.MaxDamage.ToString(), StaticDB.GetString("DAMAGE", null));
                    }
                }
                if (itemStats.EffectiveArmor > 0)
                {
                    if (this.m_rewardDescription.text != string.Empty)
                    {
                        Text rewardDescription8 = this.m_rewardDescription;
                        rewardDescription8.text += "\n";
                    }
                    Text   rewardDescription9 = this.m_rewardDescription;
                    string text = rewardDescription9.text;
                    rewardDescription9.text = string.Concat(new string[]
                    {
                        text,
                        "<color=#",
                        GeneralHelpers.s_normalColor,
                        ">",
                        GeneralHelpers.TextOrderString(itemStats.EffectiveArmor.ToString(), StaticDB.GetString("ARMOR", null)),
                        "</color>"
                    });
                }
                foreach (MobileItemBonusStat mobileItemBonusStat in itemStats.BonusStat)
                {
                    if (mobileItemBonusStat.BonusAmount != 0)
                    {
                        if (this.m_rewardDescription.text != string.Empty)
                        {
                            Text rewardDescription10 = this.m_rewardDescription;
                            rewardDescription10.text += "\n";
                        }
                        Text rewardDescription11 = this.m_rewardDescription;
                        rewardDescription11.text = rewardDescription11.text + "<color=#" + GeneralHelpers.GetMobileStatColorString(mobileItemBonusStat.Color) + ">";
                        string str;
                        if (mobileItemBonusStat.BonusAmount > 0)
                        {
                            str = "+";
                        }
                        else
                        {
                            str = "-";
                        }
                        Text rewardDescription12 = this.m_rewardDescription;
                        rewardDescription12.text = rewardDescription12.text + GeneralHelpers.TextOrderString(str + mobileItemBonusStat.BonusAmount.ToString(), GeneralHelpers.GetBonusStatString((BonusStatIndex)mobileItemBonusStat.StatID)) + "</color>";
                    }
                }
            }
            int requiredLevel = record.RequiredLevel;
            if (itemStats != null)
            {
                requiredLevel = itemStats.RequiredLevel;
            }
            if (requiredLevel > 1)
            {
                if (this.m_rewardDescription.text != string.Empty)
                {
                    Text rewardDescription13 = this.m_rewardDescription;
                    rewardDescription13.text += "\n";
                }
                string text3 = GeneralHelpers.s_normalColor;
                if (GarrisonStatus.CharacterLevel() < requiredLevel)
                {
                    text3 = GeneralHelpers.GetMobileStatColorString(MobileStatColor.MOBILE_STAT_COLOR_ERROR);
                }
                Text   rewardDescription14 = this.m_rewardDescription;
                string text = rewardDescription14.text;
                rewardDescription14.text = string.Concat(new object[]
                {
                    text,
                    "<color=#",
                    text3,
                    ">",
                    StaticDB.GetString("ITEM_MIN_LEVEL", null),
                    " ",
                    requiredLevel,
                    "</color>"
                });
            }
            string itemDescription = GeneralHelpers.GetItemDescription(record);
            if (itemDescription != null && itemDescription != string.Empty)
            {
                if (this.m_rewardDescription.text != string.Empty)
                {
                    Text rewardDescription15 = this.m_rewardDescription;
                    rewardDescription15.text += "\n";
                }
                Text rewardDescription16 = this.m_rewardDescription;
                rewardDescription16.text += itemDescription;
            }
            else if (itemStats == null)
            {
                if (this.m_rewardDescription.text != string.Empty)
                {
                    Text rewardDescription17 = this.m_rewardDescription;
                    rewardDescription17.text += "\n";
                }
                Text rewardDescription18 = this.m_rewardDescription;
                rewardDescription18.text += "...";
            }
        }
        else
        {
            this.m_rewardName.text        = "Unknown Item" + itemID;
            this.m_rewardDescription.text = string.Empty;
        }
    }
    public void SetItem(int itemID, int itemContext, Sprite iconSprite)
    {
        this.m_rewardQuantity.set_text(string.Empty);
        this.m_rewardName.set_text(string.Empty);
        this.m_rewardDescription.set_text(string.Empty);
        this.m_rewardIcon.set_sprite(iconSprite);
        ItemRec record = StaticDB.itemDB.GetRecord(itemID);

        if (record != null)
        {
            MobileItemStats itemStats = ItemStatCache.instance.GetItemStats(itemID, itemContext);
            if (itemStats != null)
            {
                this.m_rewardName.set_text(GeneralHelpers.GetItemQualityColorTag(itemStats.Quality) + record.Display + "</color>");
            }
            else
            {
                this.m_rewardName.set_text(GeneralHelpers.GetItemQualityColorTag(record.OverallQualityID) + record.Display + "</color>");
            }
            this.m_rewardName.set_supportRichText(true);
            if (record.ItemNameDescriptionID > 0)
            {
                ItemNameDescriptionRec record2 = StaticDB.itemNameDescriptionDB.GetRecord(record.ItemNameDescriptionID);
                if (record2 != null)
                {
                    Text   expr_E7 = this.m_rewardName;
                    string text    = expr_E7.get_text();
                    expr_E7.set_text(string.Concat(new string[]
                    {
                        text,
                        "\n<color=#",
                        GeneralHelpers.GetColorFromInt(record2.Color),
                        "ff>",
                        record2.Description,
                        "</color>"
                    }));
                }
            }
            if (record.ClassID == 2 || record.ClassID == 3 || record.ClassID == 4 || record.ClassID == 5 || record.ClassID == 6)
            {
                int itemLevel = record.ItemLevel;
                if (itemStats != null)
                {
                    itemLevel = itemStats.ItemLevel;
                }
                Text   expr_189 = this.m_rewardName;
                string text     = expr_189.get_text();
                expr_189.set_text(string.Concat(new string[]
                {
                    text,
                    "\n<color=#",
                    GeneralHelpers.s_defaultColor,
                    ">",
                    StaticDB.GetString("ITEM_LEVEL", null),
                    " ",
                    itemLevel.ToString(),
                    "</color>"
                }));
            }
            if (record.Bonding > 0)
            {
                string text2 = string.Empty;
                if ((record.Flags & 134217728) != 0)
                {
                    if ((record.Flags1 & 131072) != 0)
                    {
                        text2 = StaticDB.GetString("ITEM_BIND_TO_BNETACCOUNT", null);
                    }
                    else
                    {
                        text2 = StaticDB.GetString("ITEM_BIND_TO_ACCOUNT", null);
                    }
                }
                else if (record.Bonding == 1)
                {
                    text2 = StaticDB.GetString("ITEM_BIND_ON_PICKUP", null);
                }
                else if (record.Bonding == 4)
                {
                    text2 = StaticDB.GetString("ITEM_BIND_QUEST", null);
                }
                else if (record.Bonding == 2)
                {
                    text2 = StaticDB.GetString("ITEM_BIND_ON_EQUIP", null);
                }
                else if (record.Bonding == 3)
                {
                    text2 = StaticDB.GetString("ITEM_BIND_ON_USE", null);
                }
                if (text2 != string.Empty)
                {
                    Text   expr_2C9 = this.m_rewardName;
                    string text     = expr_2C9.get_text();
                    expr_2C9.set_text(string.Concat(new string[]
                    {
                        text,
                        "\n<color=#",
                        GeneralHelpers.s_normalColor,
                        ">",
                        text2,
                        "</color>"
                    }));
                }
            }
            ItemSubClassRec itemSubclass = StaticDB.GetItemSubclass(record.ClassID, record.SubclassID);
            if (itemSubclass != null && itemSubclass.DisplayName != null && itemSubclass.DisplayName != string.Empty && (itemSubclass.DisplayFlags & 1) == 0 && record.InventoryType != 16)
            {
                if (this.m_rewardDescription.get_text() != string.Empty)
                {
                    Text expr_382 = this.m_rewardDescription;
                    expr_382.set_text(expr_382.get_text() + "\n");
                }
                Text   expr_39D = this.m_rewardDescription;
                string text     = expr_39D.get_text();
                expr_39D.set_text(string.Concat(new string[]
                {
                    text,
                    "<color=#",
                    GeneralHelpers.s_normalColor,
                    ">",
                    itemSubclass.DisplayName,
                    "</color>"
                }));
            }
            string inventoryTypeString = GeneralHelpers.GetInventoryTypeString((INVENTORY_TYPE)record.InventoryType);
            if (inventoryTypeString != null && inventoryTypeString != string.Empty)
            {
                if (this.m_rewardDescription.get_text() != string.Empty)
                {
                    Text expr_429 = this.m_rewardDescription;
                    expr_429.set_text(expr_429.get_text() + "\n");
                }
                Text   expr_444 = this.m_rewardDescription;
                string text     = expr_444.get_text();
                expr_444.set_text(string.Concat(new string[]
                {
                    text,
                    "<color=#",
                    GeneralHelpers.s_normalColor,
                    ">",
                    inventoryTypeString,
                    "</color>"
                }));
            }
            if (itemStats != null)
            {
                if (itemStats.MinDamage != 0 || itemStats.MaxDamage != 0)
                {
                    if (this.m_rewardDescription.get_text() != string.Empty)
                    {
                        Text expr_4C2 = this.m_rewardDescription;
                        expr_4C2.set_text(expr_4C2.get_text() + "\n");
                    }
                    if (itemStats.MinDamage == itemStats.MaxDamage)
                    {
                        Text expr_4EE = this.m_rewardDescription;
                        expr_4EE.set_text(expr_4EE.get_text() + GeneralHelpers.TextOrderString(itemStats.MinDamage.ToString(), StaticDB.GetString("DAMAGE", null)));
                    }
                    else
                    {
                        Text expr_528 = this.m_rewardDescription;
                        expr_528.set_text(expr_528.get_text() + GeneralHelpers.TextOrderString(itemStats.MinDamage.ToString() + " - " + itemStats.MaxDamage.ToString(), StaticDB.GetString("DAMAGE", null)));
                    }
                }
                if (itemStats.EffectiveArmor > 0)
                {
                    if (this.m_rewardDescription.get_text() != string.Empty)
                    {
                        Text expr_59C = this.m_rewardDescription;
                        expr_59C.set_text(expr_59C.get_text() + "\n");
                    }
                    Text   expr_5B7 = this.m_rewardDescription;
                    string text     = expr_5B7.get_text();
                    expr_5B7.set_text(string.Concat(new string[]
                    {
                        text,
                        "<color=#",
                        GeneralHelpers.s_normalColor,
                        ">",
                        GeneralHelpers.TextOrderString(itemStats.EffectiveArmor.ToString(), StaticDB.GetString("ARMOR", null)),
                        "</color>"
                    }));
                }
                MobileItemBonusStat[] bonusStat = itemStats.BonusStat;
                for (int i = 0; i < bonusStat.Length; i++)
                {
                    MobileItemBonusStat mobileItemBonusStat = bonusStat[i];
                    if (mobileItemBonusStat.BonusAmount != 0)
                    {
                        if (this.m_rewardDescription.get_text() != string.Empty)
                        {
                            Text expr_659 = this.m_rewardDescription;
                            expr_659.set_text(expr_659.get_text() + "\n");
                        }
                        Text expr_674 = this.m_rewardDescription;
                        expr_674.set_text(expr_674.get_text() + "<color=#" + GeneralHelpers.GetMobileStatColorString(mobileItemBonusStat.Color) + ">");
                        string text3;
                        if (mobileItemBonusStat.BonusAmount > 0)
                        {
                            text3 = "+";
                        }
                        else
                        {
                            text3 = "-";
                        }
                        Text expr_6C0 = this.m_rewardDescription;
                        expr_6C0.set_text(expr_6C0.get_text() + GeneralHelpers.TextOrderString(text3 + mobileItemBonusStat.BonusAmount.ToString(), GeneralHelpers.GetBonusStatString((BonusStatIndex)mobileItemBonusStat.StatID)) + "</color>");
                    }
                }
            }
            int requiredLevel = record.RequiredLevel;
            if (itemStats != null)
            {
                requiredLevel = itemStats.RequiredLevel;
            }
            if (requiredLevel > 1)
            {
                if (this.m_rewardDescription.get_text() != string.Empty)
                {
                    Text expr_74C = this.m_rewardDescription;
                    expr_74C.set_text(expr_74C.get_text() + "\n");
                }
                string text4 = GeneralHelpers.s_normalColor;
                if (GarrisonStatus.CharacterLevel() < requiredLevel)
                {
                    text4 = GeneralHelpers.GetMobileStatColorString(MobileStatColor.MOBILE_STAT_COLOR_ERROR);
                }
                Text   expr_782 = this.m_rewardDescription;
                string text     = expr_782.get_text();
                expr_782.set_text(string.Concat(new object[]
                {
                    text,
                    "<color=#",
                    text4,
                    ">",
                    StaticDB.GetString("ITEM_MIN_LEVEL", null),
                    " ",
                    requiredLevel,
                    "</color>"
                }));
            }
            string itemDescription = GeneralHelpers.GetItemDescription(record);
            if (itemDescription != null && itemDescription != string.Empty)
            {
                if (this.m_rewardDescription.get_text() != string.Empty)
                {
                    Text expr_81C = this.m_rewardDescription;
                    expr_81C.set_text(expr_81C.get_text() + "\n");
                }
                Text expr_837 = this.m_rewardDescription;
                expr_837.set_text(expr_837.get_text() + itemDescription);
            }
            else if (itemStats == null)
            {
                if (this.m_rewardDescription.get_text() != string.Empty)
                {
                    Text expr_874 = this.m_rewardDescription;
                    expr_874.set_text(expr_874.get_text() + "\n");
                }
                Text expr_88F = this.m_rewardDescription;
                expr_88F.set_text(expr_88F.get_text() + "...");
            }
        }
        else
        {
            this.m_rewardName.set_text("Unknown Item" + itemID);
            this.m_rewardDescription.set_text(string.Empty);
        }
    }