private void ShowILVL()
    {
        ItemRec record = StaticDB.itemDB.GetRecord(this.m_itemID);

        if (record == null)
        {
            Debug.LogWarning(string.Concat(new object[]
            {
                "Invalid Item ID ",
                this.m_itemID,
                " from Quest ID ",
                this.m_questID,
                ". Ignoring for showing iLevel on map."
            }));
            return;
        }
        if (AdventureMapPanel.instance.IsFilterEnabled(MapFilterType.Gear) && (record.ClassID == 2 || record.ClassID == 3 || record.ClassID == 4 || record.ClassID == 6))
        {
            MobileItemStats itemStats = ItemStatCache.instance.GetItemStats(this.m_itemID, this.m_itemContext);
            if (itemStats != null)
            {
                this.m_quantityArea.gameObject.SetActive(true);
                this.m_quantity.text = StaticDB.GetString("ILVL", null) + " " + itemStats.ItemLevel;
            }
            else
            {
                ItemStatCache instance = ItemStatCache.instance;
                instance.ItemStatCacheUpdateAction = (Action <int, int, MobileItemStats>)Delegate.Combine(instance.ItemStatCacheUpdateAction, new Action <int, int, MobileItemStats>(this.ItemStatsUpdated));
            }
        }
    }
Ejemplo n.º 2
0
 private void ItemStatsUpdated(int itemID, int itemContext, MobileItemStats itemStats)
 {
     if (this.m_rewardType == MissionRewardDisplay.RewardType.item)
     {
         this.SetItem(this.m_rewardID, itemContext, this.m_rewardIcon.sprite);
     }
 }
 private void ItemStatsUpdated(int itemID, int itemContext, MobileItemStats itemStats)
 {
     if (this.m_itemID == itemID && this.m_itemContext == itemContext)
     {
         ItemStatCache instance = ItemStatCache.instance;
         instance.ItemStatCacheUpdateAction = (Action <int, int, MobileItemStats>)Delegate.Remove(instance.ItemStatCacheUpdateAction, new Action <int, int, MobileItemStats>(this.ItemStatsUpdated));
         this.ShowILVL();
     }
 }
 public void AddMobileItemStats(int itemID, int itemContext, MobileItemStats stats)
 {
     if (this.m_records.get_Item(itemID) == null)
     {
         this.m_records.Add(itemID, stats);
     }
     else
     {
         this.m_records.set_Item(itemID, stats);
     }
     if (this.ItemStatCacheUpdateAction != null)
     {
         this.ItemStatCacheUpdateAction.Invoke(itemID, itemContext, stats);
     }
 }
    public MobileItemStats GetItemStats(int itemID, int itemContext)
    {
        MobileItemStats mobileItemStats = (MobileItemStats)this.m_records.get_Item(itemID);

        if (mobileItemStats != null)
        {
            return(mobileItemStats);
        }
        MobilePlayerGetItemTooltipInfo mobilePlayerGetItemTooltipInfo = new MobilePlayerGetItemTooltipInfo();

        mobilePlayerGetItemTooltipInfo.ItemID      = itemID;
        mobilePlayerGetItemTooltipInfo.ItemContext = itemContext;
        Login.instance.SendToMobileServer(mobilePlayerGetItemTooltipInfo);
        return(null);
    }
Ejemplo n.º 6
0
 public void AddMobileItemStats(int itemID, int itemContext, MobileItemStats stats)
 {
     if (this.m_records[itemID] == null)
     {
         this.m_records.Add(itemID, stats);
     }
     else
     {
         this.m_records[itemID] = stats;
     }
     if (this.ItemStatCacheUpdateAction != null)
     {
         this.ItemStatCacheUpdateAction(itemID, itemContext, stats);
     }
 }
Ejemplo n.º 7
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);
        }
    }