Exemple #1
0
    private string ParseForArtifactXP(string input, int spellID)
    {
        string value = Regex.Match(input, "\\d+").get_Value();

        if (value == string.Empty)
        {
            return(input);
        }
        int inputAmount = int.Parse(value);

        return(input.Replace(value, GeneralHelpers.ApplyArtifactXPMultiplier(inputAmount, GarrisonStatus.ArtifactXpMultiplier).ToString()));
    }
    private string ParseForArtifactXP(string input, int spellID)
    {
        int num = 0;

        while (!this.CharacterIsNumeric(input[num]) && num < input.Length)
        {
            num++;
        }
        if (num >= input.Length)
        {
            return(input);
        }
        string text  = string.Empty;
        string text2 = string.Empty;

        while (num < input.Length && (this.CharacterIsNumeric(input[num]) || input[num] == ','))
        {
            if (input[num] != ',')
            {
                text += input[num];
            }
            text2 += input[num];
            num++;
        }
        if (text == string.Empty)
        {
            return(input);
        }
        long inputAmount = 0L;

        try
        {
            inputAmount = long.Parse(text);
        }
        catch (Exception)
        {
            return(input);
        }
        long num2 = GeneralHelpers.ApplyArtifactXPMultiplier(inputAmount, (double)GarrisonStatus.ArtifactXpMultiplier);

        if (num2 >= 1000000L)
        {
            long   num3    = num2 / 1000000L;
            long   num4    = num2 % 1000000L / 100000L;
            string @string = StaticDB.GetString("MILLION", "million");
            if (num2 > 1000000000L)
            {
                num3    = num2 / 1000000000L;
                num4    = num2 % 1000000000L / 100000000L;
                @string = StaticDB.GetString("BILLION", "billion");
            }
            string text3  = ".";
            string text4  = string.Empty;
            string locale = Main.instance.GetLocale();
            if (locale != null)
            {
                if (!(locale == "esES") && !(locale == "frFR"))
                {
                    if (!(locale == "itIT"))
                    {
                        if (locale == "deDE" || locale == "ruRU")
                        {
                            text3 = ",";
                        }
                    }
                    else
                    {
                        text3 = ",";
                        text4 = " di";
                    }
                }
                else
                {
                    text3 = ",";
                    text4 = " de";
                }
            }
            string newValue;
            if (num4 > 0L)
            {
                newValue = string.Format("{0:D}{1}{2:D} {3}{4}", new object[]
                {
                    num3,
                    text3,
                    num4,
                    @string,
                    text4
                });
            }
            else
            {
                newValue = string.Format("{0:D} {3}{4}", new object[]
                {
                    num3,
                    text3,
                    num4,
                    @string,
                    text4
                });
            }
            return(input.Replace(text2, newValue));
        }
        if (num2 > 999L)
        {
            string newValue2 = string.Format("{0},{1:D3}", num2 / 1000L, num2 % 1000L);
            return(input.Replace(text2, newValue2));
        }
        return(input.Replace(text2, num2.ToString()));
    }
    public void SetQuestID(int questID)
    {
        this.m_questID       = questID;
        base.gameObject.name = "WorldQuest " + this.m_questID;
        MobileWorldQuest mobileWorldQuest = (MobileWorldQuest)WorldQuestData.worldQuestDictionary[this.m_questID];

        if (mobileWorldQuest == null || mobileWorldQuest.Item == null)
        {
            return;
        }
        this.m_quantityArea.gameObject.SetActive(false);
        bool flag = false;

        foreach (MobileWorldQuestReward mobileWorldQuestReward in mobileWorldQuest.Item)
        {
            ItemRec record = StaticDB.itemDB.GetRecord(mobileWorldQuestReward.RecordID);
            if (record == null)
            {
                Debug.LogWarning(string.Concat(new object[]
                {
                    "Invalid Item ID ",
                    mobileWorldQuestReward.RecordID,
                    " from Quest ID ",
                    this.m_questID,
                    ". Ignoring for loot quality check."
                }));
            }
            else
            {
                flag = true;
                if (record.OverallQualityID > (int)this.m_lootQuality)
                {
                    this.m_lootQuality = (ITEM_QUALITY)record.OverallQualityID;
                }
                if (this.m_showLootIconInsteadOfMain)
                {
                    bool isArtifactXP = false;
                    long quantity     = 0L;
                    StaticDB.itemEffectDB.EnumRecordsByParentID(mobileWorldQuestReward.RecordID, delegate(ItemEffectRec itemEffectRec)
                    {
                        StaticDB.spellEffectDB.EnumRecordsByParentID(itemEffectRec.SpellID, delegate(SpellEffectRec spellEffectRec)
                        {
                            if (spellEffectRec.Effect == 240)
                            {
                                isArtifactXP = true;
                                quantity     = GeneralHelpers.ApplyArtifactXPMultiplier((long)spellEffectRec.EffectBasePoints, (double)GarrisonStatus.ArtifactXpMultiplier);
                                return(false);
                            }
                            return(true);
                        });
                        return(!isArtifactXP);
                    });
                    if (isArtifactXP)
                    {
                        this.m_main.sprite = Resources.Load <Sprite>("WorldMap/INV_Artifact_XP02");
                        if (AdventureMapPanel.instance.IsFilterEnabled(MapFilterType.ArtifactPower))
                        {
                            this.m_quantityArea.gameObject.SetActive(true);
                            this.m_quantity.text = quantity.ToString();
                        }
                    }
                    else
                    {
                        this.m_main.sprite = GeneralHelpers.LoadIconAsset(AssetBundleType.Icons, mobileWorldQuestReward.FileDataID);
                        this.m_itemID      = mobileWorldQuestReward.RecordID;
                        this.m_itemContext = mobileWorldQuestReward.ItemContext;
                        this.ShowILVL();
                    }
                }
            }
        }
        if (!flag && this.m_showLootIconInsteadOfMain)
        {
            if (mobileWorldQuest.Currency.GetLength(0) > 0)
            {
                foreach (MobileWorldQuestReward mobileWorldQuestReward2 in mobileWorldQuest.Currency)
                {
                    CurrencyTypesRec record2 = StaticDB.currencyTypesDB.GetRecord(mobileWorldQuestReward2.RecordID);
                    if (record2 != null)
                    {
                        this.m_main.sprite = GeneralHelpers.LoadCurrencyIcon(mobileWorldQuestReward2.RecordID);
                    }
                    if (AdventureMapPanel.instance.IsFilterEnabled(MapFilterType.OrderResources))
                    {
                        this.m_quantityArea.gameObject.SetActive(true);
                        this.m_quantity.text = mobileWorldQuestReward2.Quantity.ToString();
                    }
                }
            }
            else if (mobileWorldQuest.Money > 0)
            {
                this.m_main.sprite = Resources.Load <Sprite>("MiscIcons/INV_Misc_Coin_01");
                if (AdventureMapPanel.instance.IsFilterEnabled(MapFilterType.Gold))
                {
                    this.m_quantityArea.gameObject.SetActive(true);
                    this.m_quantity.text = string.Empty + mobileWorldQuest.Money / 100 / 100;
                }
            }
            else if (mobileWorldQuest.Experience > 0)
            {
                this.m_main.sprite = GeneralHelpers.GetLocalizedFollowerXpIcon();
            }
        }
        this.m_endTime = (long)mobileWorldQuest.EndTime;
        int             areaID  = 0;
        WorldMapAreaRec record3 = StaticDB.worldMapAreaDB.GetRecord(mobileWorldQuest.WorldMapAreaID);

        if (record3 != null)
        {
            areaID = record3.AreaID;
        }
        this.m_areaID = areaID;
        QuestInfoRec record4 = StaticDB.questInfoDB.GetRecord(mobileWorldQuest.QuestInfoID);

        if (record4 == null)
        {
            return;
        }
        bool active = (record4.Modifiers & 2) != 0;

        this.m_dragonFrame.gameObject.SetActive(active);
        bool flag2 = record4.Type == 7;

        this.m_normalGlow.gameObject.SetActive(!flag2);
        this.m_legionAssaultGlow.gameObject.SetActive(flag2);
        bool flag3 = (record4.Modifiers & 1) != 0;

        if (flag3 && record4.Type != 3)
        {
            this.m_background.sprite = Resources.Load <Sprite>("NewWorldQuest/Mobile-RareQuest");
        }
        bool flag4 = (record4.Modifiers & 4) != 0;

        if (flag4 && record4.Type != 3)
        {
            this.m_background.sprite = Resources.Load <Sprite>("NewWorldQuest/Mobile-EpicQuest");
        }
        int    uitextureAtlasMemberID;
        string text;

        switch (record4.Type)
        {
        case 1:
        {
            int profession = record4.Profession;
            switch (profession)
            {
            case 182:
                uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-herbalism");
                text = "Mobile-Herbalism";
                break;

            default:
                if (profession != 164)
                {
                    if (profession != 165)
                    {
                        if (profession != 129)
                        {
                            if (profession != 171)
                            {
                                if (profession != 197)
                                {
                                    if (profession != 202)
                                    {
                                        if (profession != 333)
                                        {
                                            if (profession != 356)
                                            {
                                                if (profession != 393)
                                                {
                                                    if (profession != 755)
                                                    {
                                                        if (profession != 773)
                                                        {
                                                            if (profession != 794)
                                                            {
                                                                uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-questmarker-questbang");
                                                                text = "Mobile-QuestExclamationIcon";
                                                            }
                                                            else
                                                            {
                                                                uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-archaeology");
                                                                text = "Mobile-Archaeology";
                                                            }
                                                        }
                                                        else
                                                        {
                                                            uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-inscription");
                                                            text = "Mobile-Inscription";
                                                        }
                                                    }
                                                    else
                                                    {
                                                        uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-jewelcrafting");
                                                        text = "Mobile-Jewelcrafting";
                                                    }
                                                }
                                                else
                                                {
                                                    uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-skinning");
                                                    text = "Mobile-Skinning";
                                                }
                                            }
                                            else
                                            {
                                                uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-fishing");
                                                text = "Mobile-Fishing";
                                            }
                                        }
                                        else
                                        {
                                            uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-enchanting");
                                            text = "Mobile-Enchanting";
                                        }
                                    }
                                    else
                                    {
                                        uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-engineering");
                                        text = "Mobile-Engineering";
                                    }
                                }
                                else
                                {
                                    uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-tailoring");
                                    text = "Mobile-Tailoring";
                                }
                            }
                            else
                            {
                                uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-alchemy");
                                text = "Mobile-Alchemy";
                            }
                        }
                        else
                        {
                            uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-firstaid");
                            text = "Mobile-FirstAid";
                        }
                    }
                    else
                    {
                        uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-leatherworking");
                        text = "Mobile-Leatherworking";
                    }
                }
                else
                {
                    uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-blacksmithing");
                    text = "Mobile-Blacksmithing";
                }
                break;

            case 185:
                uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-cooking");
                text = "Mobile-Cooking";
                break;

            case 186:
                uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-mining");
                text = "Mobile-Mining";
                break;
            }
            goto IL_70A;
        }

        case 3:
            uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-pvp-ffa");
            text = "Mobile-PVP";
            goto IL_70A;

        case 4:
            uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-icon-petbattle");
            text = "Mobile-Pets";
            goto IL_70A;
        }
        uitextureAtlasMemberID = TextureAtlas.GetUITextureAtlasMemberID("worldquest-questmarker-questbang");
        text = "Mobile-QuestExclamationIcon";
IL_70A:
        if (!this.m_showLootIconInsteadOfMain)
        {
            if (text != null)
            {
                this.m_main.sprite = Resources.Load <Sprite>("NewWorldQuest/" + text);
            }
            else if (uitextureAtlasMemberID > 0)
            {
                this.m_main.sprite = TextureAtlas.instance.GetAtlasSprite(uitextureAtlasMemberID);
                this.m_main.SetNativeSize();
            }
        }
    }