public void SetItem(int itemID, int itemContext, Sprite iconSprite)
        {
            string str;
            string str1;

            this.m_rewardQuantity.text    = string.Empty;
            this.m_rewardName.text        = string.Empty;
            this.m_rewardDescription.text = string.Empty;
            this.m_rewardIcon.sprite      = iconSprite;
            ItemRec itemRec = StaticDB.itemDB.GetRecord(itemID);

            if (itemRec == null)
            {
                this.m_rewardName.text        = string.Concat("Unknown Item", itemID);
                this.m_rewardDescription.text = string.Empty;
            }
            else
            {
                WrapperItemStats?itemStats = ItemStatCache.instance.GetItemStats(itemID, itemContext);
                if (!itemStats.HasValue)
                {
                    this.m_rewardName.text = string.Concat(GeneralHelpers.GetItemQualityColorTag(itemRec.OverallQualityID), itemRec.Display, "</color>");
                }
                else
                {
                    Text             mRewardName = this.m_rewardName;
                    WrapperItemStats value       = itemStats.Value;
                    mRewardName.text = string.Concat(GeneralHelpers.GetItemQualityColorTag(value.Quality), itemRec.Display, "</color>");
                }
                this.m_rewardName.supportRichText = true;
                if (itemRec.ItemNameDescriptionID > 0)
                {
                    ItemNameDescriptionRec itemNameDescriptionRec = StaticDB.itemNameDescriptionDB.GetRecord(itemRec.ItemNameDescriptionID);
                    if (itemNameDescriptionRec != null)
                    {
                        Text text = this.m_rewardName;
                        str       = text.text;
                        text.text = string.Concat(new string[] { str, "\n<color=#", GeneralHelpers.GetColorFromInt(itemNameDescriptionRec.Color), "ff>", itemNameDescriptionRec.Description, "</color>" });
                    }
                }
                if (this.m_azeriteFrame != null)
                {
                    this.m_azeriteFrame.SetActive(StaticDB.azeriteEmpoweredItemDB.GetRecordFirstOrDefault((AzeriteEmpoweredItemRec record) => record.ItemID == itemID) != null);
                }
                if (itemRec.ClassID == 2 || itemRec.ClassID == 3 || itemRec.ClassID == 4 || itemRec.ClassID == 5 || itemRec.ClassID == 6)
                {
                    int itemLevel = itemRec.ItemLevel;
                    if (itemStats.HasValue)
                    {
                        itemLevel = itemStats.Value.ItemLevel;
                    }
                    Text mRewardName1 = this.m_rewardName;
                    str = mRewardName1.text;
                    mRewardName1.text = string.Concat(new string[] { str, "\n<color=#", GeneralHelpers.s_defaultColor, ">", StaticDB.GetString("ITEM_LEVEL", null), " ", itemLevel.ToString(), "</color>" });
                }
                if (itemRec.Bonding > 0)
                {
                    string empty = string.Empty;
                    if ((itemRec.Flags[0] & 134217728) != 0)
                    {
                        empty = ((itemRec.Flags[1] & 131072) == 0 ? StaticDB.GetString("ITEM_BIND_TO_ACCOUNT", null) : StaticDB.GetString("ITEM_BIND_TO_BNETACCOUNT", null));
                    }
                    else if (itemRec.Bonding == 1)
                    {
                        empty = StaticDB.GetString("ITEM_BIND_ON_PICKUP", null);
                    }
                    else if (itemRec.Bonding == 4)
                    {
                        empty = StaticDB.GetString("ITEM_BIND_QUEST", null);
                    }
                    else if (itemRec.Bonding == 2)
                    {
                        empty = StaticDB.GetString("ITEM_BIND_ON_EQUIP", null);
                    }
                    else if (itemRec.Bonding == 3)
                    {
                        empty = StaticDB.GetString("ITEM_BIND_ON_USE", null);
                    }
                    if (empty != string.Empty)
                    {
                        Text text1 = this.m_rewardName;
                        str        = text1.text;
                        text1.text = string.Concat(new string[] { str, "\n<color=#", GeneralHelpers.s_normalColor, ">", empty, "</color>" });
                    }
                }
                ItemSubClassRec itemSubclass = StaticDB.GetItemSubclass(itemRec.ClassID, itemRec.SubclassID);
                if (itemSubclass != null && itemSubclass.DisplayName != null && itemSubclass.DisplayName != string.Empty && (itemSubclass.DisplayFlags & 1) == 0 && itemRec.InventoryType != 16)
                {
                    if (this.m_rewardDescription.text != string.Empty)
                    {
                        Text mRewardDescription = this.m_rewardDescription;
                        mRewardDescription.text = string.Concat(mRewardDescription.text, "\n");
                    }
                    Text mRewardDescription1 = this.m_rewardDescription;
                    str = mRewardDescription1.text;
                    mRewardDescription1.text = string.Concat(new string[] { str, "<color=#", GeneralHelpers.s_normalColor, ">", itemSubclass.DisplayName, "</color>" });
                }
                string inventoryTypeString = GeneralHelpers.GetInventoryTypeString((INVENTORY_TYPE)itemRec.InventoryType);
                if (inventoryTypeString != null && inventoryTypeString != string.Empty)
                {
                    if (this.m_rewardDescription.text != string.Empty)
                    {
                        Text mRewardDescription2 = this.m_rewardDescription;
                        mRewardDescription2.text = string.Concat(mRewardDescription2.text, "\n");
                    }
                    Text text2 = this.m_rewardDescription;
                    str        = text2.text;
                    text2.text = string.Concat(new string[] { str, "<color=#", GeneralHelpers.s_normalColor, ">", inventoryTypeString, "</color>" });
                }
                if (itemStats.HasValue)
                {
                    if (itemStats.Value.MinDamage != 0 || itemStats.Value.MaxDamage != 0)
                    {
                        if (this.m_rewardDescription.text != string.Empty)
                        {
                            Text mRewardDescription3 = this.m_rewardDescription;
                            mRewardDescription3.text = string.Concat(mRewardDescription3.text, "\n");
                        }
                        if (itemStats.Value.MinDamage != itemStats.Value.MaxDamage)
                        {
                            Text             text3           = this.m_rewardDescription;
                            string           str2            = text3.text;
                            string           str3            = itemStats.Value.MinDamage.ToString();
                            WrapperItemStats wrapperItemStat = itemStats.Value;
                            text3.text = string.Concat(str2, GeneralHelpers.TextOrderString(string.Concat(str3, " - ", wrapperItemStat.MaxDamage.ToString()), StaticDB.GetString("DAMAGE", null)));
                        }
                        else
                        {
                            Text             mRewardDescription4 = this.m_rewardDescription;
                            string           str4   = mRewardDescription4.text;
                            WrapperItemStats value1 = itemStats.Value;
                            mRewardDescription4.text = string.Concat(str4, GeneralHelpers.TextOrderString(value1.MinDamage.ToString(), StaticDB.GetString("DAMAGE", null)));
                        }
                    }
                    if (itemStats.Value.EffectiveArmor > 0)
                    {
                        if (this.m_rewardDescription.text != string.Empty)
                        {
                            Text text4 = this.m_rewardDescription;
                            text4.text = string.Concat(text4.text, "\n");
                        }
                        Text mRewardDescription5 = this.m_rewardDescription;
                        str = mRewardDescription5.text;
                        string[]         sNormalColor     = new string[] { str, "<color=#", GeneralHelpers.s_normalColor, ">", null, null };
                        WrapperItemStats wrapperItemStat1 = itemStats.Value;
                        sNormalColor[4]          = GeneralHelpers.TextOrderString(wrapperItemStat1.EffectiveArmor.ToString(), StaticDB.GetString("ARMOR", null));
                        sNormalColor[5]          = "</color>";
                        mRewardDescription5.text = string.Concat(sNormalColor);
                    }
                    foreach (WrapperItemBonusStat bonusStat in itemStats.Value.BonusStats)
                    {
                        if (bonusStat.BonusAmount == 0)
                        {
                            continue;
                        }
                        if (this.m_rewardDescription.text != string.Empty)
                        {
                            Text text5 = this.m_rewardDescription;
                            text5.text = string.Concat(text5.text, "\n");
                        }
                        Text mRewardDescription6 = this.m_rewardDescription;
                        mRewardDescription6.text = string.Concat(mRewardDescription6.text, "<color=#", GeneralHelpers.GetMobileStatColorString(bonusStat.Color), ">");
                        str1 = (bonusStat.BonusAmount <= 0 ? "-" : "+");
                        Text text6 = this.m_rewardDescription;
                        text6.text = string.Concat(text6.text, GeneralHelpers.TextOrderString(string.Concat(str1, bonusStat.BonusAmount.ToString()), GeneralHelpers.GetBonusStatString((BonusStatIndex)bonusStat.StatID)), "</color>");
                    }
                }
                int requiredLevel = itemRec.RequiredLevel;
                if (itemStats.HasValue)
                {
                    requiredLevel = itemStats.Value.RequiredLevel;
                }
                if (requiredLevel > 1)
                {
                    if (this.m_rewardDescription.text != string.Empty)
                    {
                        Text mRewardDescription7 = this.m_rewardDescription;
                        mRewardDescription7.text = string.Concat(mRewardDescription7.text, "\n");
                    }
                    string mobileStatColorString = GeneralHelpers.s_normalColor;
                    if (GarrisonStatus.CharacterLevel() < requiredLevel)
                    {
                        mobileStatColorString = GeneralHelpers.GetMobileStatColorString(WrapperStatColor.MOBILE_STAT_COLOR_ERROR);
                    }
                    Text text7 = this.m_rewardDescription;
                    str        = text7.text;
                    text7.text = string.Concat(new object[] { str, "<color=#", mobileStatColorString, ">", StaticDB.GetString("ITEM_MIN_LEVEL", null), " ", requiredLevel, "</color>" });
                }
                string itemDescription = GeneralHelpers.GetItemDescription(itemRec);
                if (itemDescription != null && itemDescription != string.Empty)
                {
                    if (this.m_rewardDescription.text != string.Empty)
                    {
                        Text mRewardDescription8 = this.m_rewardDescription;
                        mRewardDescription8.text = string.Concat(mRewardDescription8.text, "\n");
                    }
                    Text text8 = this.m_rewardDescription;
                    text8.text = string.Concat(text8.text, itemDescription);
                }
                else if (!itemStats.HasValue)
                {
                    if (this.m_rewardDescription.text != string.Empty)
                    {
                        Text mRewardDescription9 = this.m_rewardDescription;
                        mRewardDescription9.text = string.Concat(mRewardDescription9.text, "\n");
                    }
                    Text text9 = this.m_rewardDescription;
                    text9.text = string.Concat(text9.text, "...");
                }
            }
        }
Ejemplo n.º 2
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)
            {
                WrapperItemStats?itemStats = ItemStatCache.instance.GetItemStats(itemID, itemContext);
                if (itemStats != null)
                {
                    this.m_rewardName.text = GeneralHelpers.GetItemQualityColorTag(itemStats.Value.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.Value.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[0] & 134217728) != 0)
                    {
                        if ((record.Flags[1] & 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.Value.MinDamage != 0 || itemStats.Value.MaxDamage != 0)
                    {
                        if (this.m_rewardDescription.text != string.Empty)
                        {
                            Text rewardDescription5 = this.m_rewardDescription;
                            rewardDescription5.text += "\n";
                        }
                        if (itemStats.Value.MinDamage == itemStats.Value.MaxDamage)
                        {
                            Text rewardDescription6 = this.m_rewardDescription;
                            rewardDescription6.text += GeneralHelpers.TextOrderString(itemStats.Value.MinDamage.ToString(), StaticDB.GetString("DAMAGE", null));
                        }
                        else
                        {
                            Text rewardDescription7 = this.m_rewardDescription;
                            rewardDescription7.text += GeneralHelpers.TextOrderString(itemStats.Value.MinDamage.ToString() + " - " + itemStats.Value.MaxDamage.ToString(), StaticDB.GetString("DAMAGE", null));
                        }
                    }
                    if (itemStats.Value.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.Value.EffectiveArmor.ToString(), StaticDB.GetString("ARMOR", null)),
                            "</color>"
                        });
                    }
                    foreach (WrapperItemBonusStat wrapperItemBonusStat in itemStats.Value.BonusStats)
                    {
                        if (wrapperItemBonusStat.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(wrapperItemBonusStat.Color) + ">";
                            string str;
                            if (wrapperItemBonusStat.BonusAmount > 0)
                            {
                                str = "+";
                            }
                            else
                            {
                                str = "-";
                            }
                            Text rewardDescription12 = this.m_rewardDescription;
                            rewardDescription12.text = rewardDescription12.text + GeneralHelpers.TextOrderString(str + wrapperItemBonusStat.BonusAmount.ToString(), GeneralHelpers.GetBonusStatString((BonusStatIndex)wrapperItemBonusStat.StatID)) + "</color>";
                        }
                    }
                }
                int requiredLevel = record.RequiredLevel;
                if (itemStats != null)
                {
                    requiredLevel = itemStats.Value.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(5);
                    }
                    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;
            }
        }