Exemplo n.º 1
0
        private static string searchSetName(string setName)
        {
            JToken setToken = cosmeticsSetsArray[0][setName];

            if (setToken != null)
            {
                if (!Settings.Default.IconLanguage.Equals("English"))
                {
                    string translatedName = SearchResource.getTextByKey(setToken["DisplayName"]["key"].Value <string>(), setToken["DisplayName"]["source_string"].Value <string>(), setToken["DisplayName"]["namespace"].Value <string>());

                    return(string.Format(SearchResource.getTextByKey("CosmeticItemDescription_SetMembership_NotRich", setToken["DisplayName"]["source_string"].Value <string>(), "Fort.Cosmetics"), translatedName));
                }
                else if (HotfixedStrings.HotfixedStringsDict != null && HotfixedStrings.HotfixedStringsDict.ContainsKey(setName + "_DisplayName"))
                {
                    return(string.Format("\nPart of the {0} set.", HotfixedStrings.HotfixedStringsDict[setName + "_DisplayName"]["en"]));
                }
                else
                {
                    return(string.Format("\nPart of the {0} set.", setToken["DisplayName"]["source_string"].Value <string>()));
                }
            }
            else
            {
                return("");
            }
        }
Exemplo n.º 2
0
        private static void drawDisplayNameAndQuantity(JToken AssetArray, string quantity, int i)
        {
            JToken displayName = AssetArray["DisplayName"];

            if (displayName != null)
            {
                JToken key          = displayName["key"];
                JToken sourceString = displayName["source_string"];
                if (key != null && sourceString != null)
                {
                    string text = SearchResource.getTextByKey(key.Value <string>(), sourceString.Value <string>());

                    toDrawOn.DrawString(
                        text,
                        new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[0], 25),
                        new SolidBrush(Color.White),
                        new Point(70, 545 + (75 * i)),
                        FontUtilities.leftString
                        );
                }
            }

            toDrawOn.DrawString(
                quantity,
                new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[0], 25),
                new SolidBrush(Color.White),
                new Point(502, 545 + (75 * i)),
                FontUtilities.rightString
                );
        }
Exemplo n.º 3
0
 /// <summary>
 /// draw item description if exist
 /// </summary>
 /// <param name="theItem"></param>
 /// <param name="myGraphic"></param>
 private static void DrawDescription(ItemsIdParser theItem, Graphics myGraphic)
 {
     if (theItem.Description != null)
     {
         string text = SearchResource.getTextByKey(theItem.Description.Key, theItem.Description.SourceString);
         myGraphic.DrawString(text, new Font("Arial", 10), new SolidBrush(Color.White), new RectangleF(5, 441, 512, 49), FontUtilities.centeredStringLine);
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// draw item name if exist
 /// </summary>
 /// <param name="theItem"></param>
 /// <param name="myGraphic"></param>
 private static void DrawDisplayName(ItemsIdParser theItem, Graphics myGraphic)
 {
     if (theItem.DisplayName != null)
     {
         string text = SearchResource.getTextByKey(theItem.DisplayName.Key, theItem.DisplayName.SourceString);
         myGraphic.DrawString(text, new Font(FontUtilities.pfc.Families[0], 35), new SolidBrush(Color.White), new Point(522 / 2, 395), FontUtilities.centeredString);
     }
 }
Exemplo n.º 5
0
        /// <summary>
        /// draw item description if exist
        /// </summary>
        /// <param name="theItem"></param>
        /// <param name="myGraphic"></param>
        private static void DrawDescription(JToken theItem, Graphics myGraphic)
        {
            JToken description = theItem["Description"];

            if (description != null)
            {
                string descriptionText = string.Empty;

                if (theItem["export_type"].Value <string>().Equals("FortAbilityKit"))
                {
                    JArray descriptionArray = theItem["Description"].Value <JArray>();
                    foreach (JToken token in descriptionArray)
                    {
                        JToken key          = token["key"];
                        JToken sourceString = token["source_string"];
                        if (key != null && sourceString != null)
                        {
                            string text = SearchResource.getTextByKey(key.Value <string>(), sourceString.Value <string>());
                            descriptionText += text;
                        }
                    }
                }
                else
                {
                    JToken key          = description["key"];
                    JToken sourceString = description["source_string"];
                    if (key != null && sourceString != null)
                    {
                        //myGraphic.DrawRectangle(new Pen(new SolidBrush(Color.Pink)), new Rectangle(5, 455, 512, 62));

                        string text = SearchResource.getTextByKey(key.Value <string>(), sourceString.Value <string>());
                        descriptionText = text;

                        if (!string.IsNullOrEmpty(CosmeticSet))
                        {
                            string theSet = DrawCosmeticSet(CosmeticSet);
                            if (!string.IsNullOrEmpty(theSet))
                            {
                                descriptionText += theSet;
                            }
                        }
                    }
                }

                if (!string.IsNullOrEmpty(descriptionText))
                {
                    myGraphic.DrawString(
                        descriptionText,
                        new Font("Arial", string.Equals(Settings.Default.rarityDesign, "Flat") ? 9 : string.Equals(Settings.Default.rarityDesign, "Minimalist") ? 12 : 10),
                        new SolidBrush(Color.White),
                        new RectangleF(5, string.Equals(Settings.Default.rarityDesign, "Flat") || string.Equals(Settings.Default.rarityDesign, "Minimalist") ? 455 : 441, 512, string.Equals(Settings.Default.rarityDesign, "Flat") ? 42 : string.Equals(Settings.Default.rarityDesign, "Minimalist") ? 62 : 49),
                        string.Equals(Settings.Default.rarityDesign, "Flat") ? FontUtilities.rightString : FontUtilities.centeredStringLine
                        );
                }
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// draw item name if exist
        /// </summary>
        /// <param name="theItem"></param>
        /// <param name="myGraphic"></param>
        private static void DrawDisplayName(JToken theItem, Graphics myGraphic)
        {
            JToken displayName = theItem["DisplayName"];

            if (displayName != null)
            {
                JToken key          = displayName["key"];
                JToken sourceString = displayName["source_string"];
                if (key != null && sourceString != null)
                {
                    //myGraphic.DrawRectangle(new Pen(new SolidBrush(Color.Red)), new Rectangle(5, 385, 512, 59));

                    Size  rectSize  = string.Equals(Settings.Default.rarityDesign, "Flat") ? new Rectangle(5, 405, 512, 55).Size : new Rectangle(5, 395, 512, 49).Size;
                    Point textPoint = string.Equals(Settings.Default.rarityDesign, "Flat") ? new Point(522, 405) : new Point(522 / 2, 395);
                    if (string.Equals(Settings.Default.rarityDesign, "Minimalist"))
                    {
                        rectSize  = string.Equals(Settings.Default.rarityDesign, "Flat") ? new Rectangle(5, 395, 512, 55).Size : string.Equals(Settings.Default.IconLanguage, "Russian") ? new Rectangle(5, 385, 512, 69).Size : new Rectangle(5, 385, 512, 59).Size;
                        textPoint = string.Equals(Settings.Default.rarityDesign, "Flat") ? new Point(522, 405) : string.Equals(Settings.Default.IconLanguage, "Russian") ? new Point(522 / 2, 400) : new Point(522 / 2, 408);
                    }
                    else if (Settings.Default.IconLanguage == "Russian")
                    {
                        rectSize  = string.Equals(Settings.Default.rarityDesign, "Flat") ? new Rectangle(5, 395, 512, 55).Size : new Rectangle(5, 385, 512, 59).Size;
                        textPoint = string.Equals(Settings.Default.rarityDesign, "Flat") ? new Point(522, 405) : new Point(522 / 2, 390);
                    }

                    string text = SearchResource.getTextByKey(key.Value <string>(), sourceString.Value <string>());

                    float size = 35;
                    if (string.Equals(Settings.Default.rarityDesign, "Minimalist"))
                    {
                        size = string.Equals(Settings.Default.IconLanguage, "Russian") ? 55 : 45;
                    }
                    else if (string.Equals(Settings.Default.IconLanguage, "Russian"))
                    {
                        size = 45;
                    }

                    Font goodFont = FontUtilities.FindFont(
                        myGraphic,
                        Settings.Default.IconLanguage == "Russian" || string.Equals(Settings.Default.rarityDesign, "Minimalist") ? text.ToUpper() : text,
                        rectSize,
                        new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : Settings.Default.IconLanguage == "Russian" || Settings.Default.IconLanguage == "Chinese (S)" ? FontUtilities.pfc.Families[1] : FontUtilities.pfc.Families[0], size)
                        );

                    myGraphic.DrawString(
                        Settings.Default.IconLanguage == "Russian" || string.Equals(Settings.Default.rarityDesign, "Minimalist") ? text.ToUpper() : text,
                        goodFont,
                        new SolidBrush(Color.White),
                        textPoint,
                        string.Equals(Settings.Default.rarityDesign, "Flat") ? FontUtilities.rightString : FontUtilities.centeredString
                        );
                }
            }
        }
Exemplo n.º 7
0
        public static string getBundleDisplayName(JToken theItem)
        {
            string text = string.Empty;

            JToken displayName = theItem["DisplayName"];

            if (displayName != null)
            {
                JToken key          = displayName["key"];
                JToken sourceString = displayName["source_string"];
                if (key != null && sourceString != null)
                {
                    text = SearchResource.getTextByKey(key.Value <string>(), sourceString.Value <string>());
                }
            }

            return(text.ToUpper());
        }
Exemplo n.º 8
0
        /// <summary>
        /// draw the watermark at the bottom of the bundle of challenges icon
        /// </summary>
        /// <param name="myBitmap"></param>
        public static void drawWatermark(Bitmap myBitmap)
        {
            string text = Settings.Default.challengesWatermark;

            if (string.IsNullOrWhiteSpace(text))
            {
                text = "{Bundle_Name} Generated using FModel & JohnWickParse - {Date}";
            }

            if (text.Contains("{Bundle_Name}"))
            {
                text = text.Replace("{Bundle_Name}", SearchResource.getTextByKey(myItem["DisplayName"]["key"].Value <string>(), myItem["DisplayName"]["source_string"].Value <string>()));
            }
            if (text.Contains("{Date}"))
            {
                text = text.Replace("{Date}", DateTime.Now.ToString("dd/MM/yyyy"));
            }

            toDrawOn.DrawString(text, new Font(FontUtilities.pfc.Families[0], 15), new SolidBrush(Color.FromArgb(150, 255, 255, 255)), new Point(myBitmap.Width - 10, 210), FontUtilities.rightString);
        }
Exemplo n.º 9
0
        /// <summary>
        /// draw the watermark at the bottom of the bundle of challenges icon
        /// </summary>
        /// <param name="myBitmap"></param>
        public static void drawWatermark(Bitmap myBitmap)
        {
            string text = Settings.Default.challengesWatermark;

            if (string.IsNullOrWhiteSpace(text))
            {
                text = "{Bundle_Name} Generated using FModel & JohnWickParse - {Date}";
            }

            if (text.Contains("{Bundle_Name}"))
            {
                text = text.Replace("{Bundle_Name}", SearchResource.getTextByKey(myItem.DisplayName.Key, myItem.DisplayName.SourceString));
            }
            if (text.Contains("{Date}"))
            {
                text = text.Replace("{Date}", DateTime.Now.ToString("dd/MM/yyyy"));
            }

            toDrawOn.FillRectangle(new SolidBrush(Color.FromArgb(100, 0, 0, 0)), new Rectangle(0, theY + 240, myBitmap.Width, 40));
            toDrawOn.DrawString(text, new Font(FontUtilities.pfc.Families[0], 20), new SolidBrush(Color.FromArgb(150, 255, 255, 255)), new Point(myBitmap.Width / 2, theY + 250), FontUtilities.centeredString);
        }
Exemplo n.º 10
0
        private static void loopingLol(string weaponName, Graphics myGraphic)
        {
            JToken weaponToken = weaponsStatsArray[0][weaponName];

            if (weaponToken != null)
            {
                JToken dmgPb = weaponToken["DmgPB"];
                if (dmgPb != null)
                {
                    Image bulletImage = Resources.dmg64;
                    myGraphic.DrawImage(ImageUtilities.ResizeImage(bulletImage, 15, 15), new Point(5, 502));
                    DrawToLeft("     " + dmgPb.Value <string>(), myGraphic); //damage per bullet
                }

                JToken clipSize = weaponToken["ClipSize"];
                if (clipSize != null)
                {
                    Image clipSizeImage = Resources.clipSize64;
                    myGraphic.DrawImage(ImageUtilities.ResizeImage(clipSizeImage, 15, 15), new Point(52, 502));
                    myGraphic.DrawString("      " + clipSize.Value <string>(), new Font(FontUtilities.pfc.Families[0], 11), new SolidBrush(Color.White), new Point(50, 503));
                }
                else
                {
                    clipSize = "";
                }

                JToken reloadTime = weaponToken["ReloadTime"];
                if (reloadTime != null)
                {
                    Image reload = Resources.reload64;
                    myGraphic.DrawImage(ImageUtilities.ResizeImage(reload, 15, 15), new Point(50 + (clipSize.Value <string>().Length * 7) + 47, 502));                                                                                                                                                //50=clipsize text position | for each clipsize letter we add 7 to x | 47=difference between 2 icons
                    myGraphic.DrawString(reloadTime.Value <string>() + " " + SearchResource.getTextByKey("6BA53D764BA5CC13E821D2A807A72365", "seconds"), new Font(FontUtilities.pfc.Families[0], 11), new SolidBrush(Color.White), new Point(64 + (clipSize.Value <string>().Length * 7) + 47, 503)); //64=50+icon size (-1 because that wasn't perfectly at the position i wanted)
                }

                DrawToRight(weaponName, myGraphic);
            }
        }
Exemplo n.º 11
0
        /// <summary>
        /// extract quest and add description, count, reward item, reward quantity to List<BundleInfoEntry> BundleData
        /// loop if stage exist
        /// </summary>
        /// <param name="questFile"></param>
        private static void getQuestData(string questFile, JToken questInfo)
        {
            try
            {
                string questFilePath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary[questFile], questFile);
                if (questFilePath != null)
                {
                    if (questFilePath.Contains(".uasset") || questFilePath.Contains(".uexp") || questFilePath.Contains(".ubulk"))
                    {
                        JohnWick.MyAsset = new PakAsset(questFilePath.Substring(0, questFilePath.LastIndexOf('.')));
                        try
                        {
                            if (JohnWick.MyAsset.GetSerialized() != null)
                            {
                                new UpdateMyState("Parsing " + questFile + "...", "Waiting").ChangeProcessState();

                                //prestige challenge check
                                JToken questUnlockType = questInfo["QuestUnlockType"];
                                string unlockType      = string.Empty;
                                if (questUnlockType != null)
                                {
                                    unlockType = questUnlockType.Value <string>();
                                }

                                dynamic AssetData  = JsonConvert.DeserializeObject(JohnWick.MyAsset.GetSerialized());
                                JArray  AssetArray = JArray.FromObject(AssetData);

                                //fortbyte check
                                JToken rewards        = AssetArray[0]["Rewards"];
                                JToken assetTypeToken = null;
                                bool   isFortbyte     = false;
                                if (rewards != null)
                                {
                                    JArray rewardsArray = rewards.Value <JArray>();
                                    assetTypeToken = rewardsArray.Where(item => item["ItemPrimaryAssetId"]["PrimaryAssetType"]["Name"].Value <string>().Equals("Token")).FirstOrDefault();
                                    if (assetTypeToken != null)
                                    {
                                        isFortbyte = rewardsArray.Any(item => item["ItemPrimaryAssetId"]["PrimaryAssetName"].Value <string>().Equals("AthenaFortbyte"));
                                    }
                                }

                                JToken objectives = AssetArray[0]["Objectives"];
                                if (objectives != null)
                                {
                                    long   questCount        = 0;
                                    string descriptionKey    = string.Empty;
                                    string descriptionSource = string.Empty;

                                    JArray objectivesArray = objectives.Value <JArray>();
                                    foreach (JToken token in objectivesArray)
                                    {
                                        //quest count
                                        JToken count = token["Count"];
                                        if (count != null)
                                        {
                                            questCount = count.Value <long>();
                                            JToken objectiveCompletionCount = AssetArray[0]["ObjectiveCompletionCount"];
                                            if (objectiveCompletionCount != null && objectiveCompletionCount.Value <long>() > 0)
                                            {
                                                questCount = objectiveCompletionCount.Value <long>();
                                            }
                                        }

                                        //quest description
                                        JToken description = token["Description"];
                                        if (description != null)
                                        {
                                            JToken key          = description["key"];
                                            JToken sourceString = description["source_string"];
                                            if (key != null && sourceString != null)
                                            {
                                                descriptionKey    = key.Value <string>();
                                                descriptionSource = sourceString.Value <string>();
                                            }
                                        }
                                        JToken descriptionMain = AssetArray[0]["Description"];
                                        if (descriptionMain != null)
                                        {
                                            JToken key          = descriptionMain["key"];
                                            JToken sourceString = descriptionMain["source_string"];
                                            if (key != null && sourceString != null)
                                            {
                                                descriptionKey    = key.Value <string>();
                                                descriptionSource = sourceString.Value <string>();
                                            }
                                        }
                                    }

                                    string questDescription = SearchResource.getTextByKey(descriptionKey, descriptionSource);
                                    if (string.IsNullOrEmpty(questDescription))
                                    {
                                        questDescription = " ";
                                    }

                                    if (rewards != null && !isFortbyte)
                                    {
                                        //quest rewards
                                        JArray rewardsArray = rewards.Value <JArray>();
                                        try
                                        {
                                            string rewardId       = rewardsArray.Where(item => !item["ItemPrimaryAssetId"]["PrimaryAssetType"]["Name"].Value <string>().Equals("Quest") && !item["ItemPrimaryAssetId"]["PrimaryAssetType"]["Name"].Value <string>().Equals("Token")).FirstOrDefault()["ItemPrimaryAssetId"]["PrimaryAssetName"].Value <string>();
                                            string rewardQuantity = rewardsArray.Where(item => !item["ItemPrimaryAssetId"]["PrimaryAssetType"]["Name"].Value <string>().Equals("Quest") && !item["ItemPrimaryAssetId"]["PrimaryAssetType"]["Name"].Value <string>().Equals("Token")).FirstOrDefault()["Quantity"].Value <string>();

                                            BundleInfoEntry currentData    = new BundleInfoEntry(questDescription, questCount, rewardId, rewardQuantity, unlockType);
                                            bool            isAlreadyAdded = BundleData.Any(item => item.questDescr.Equals(currentData.questDescr, StringComparison.InvariantCultureIgnoreCase) && item.questCount == currentData.questCount);
                                            if (!isAlreadyAdded)
                                            {
                                                BundleData.Add(currentData);
                                            }
                                        }
                                        catch (NullReferenceException)
                                        {
                                            JToken hiddenRewards = AssetArray[0]["HiddenRewards"];
                                            if (hiddenRewards != null)
                                            {
                                                string rewardId       = hiddenRewards[0]["TemplateId"].Value <string>();
                                                string rewardQuantity = hiddenRewards[0]["Quantity"].Value <string>();

                                                BundleInfoEntry currentData    = new BundleInfoEntry(questDescription, questCount, rewardId, rewardQuantity, unlockType);
                                                bool            isAlreadyAdded = BundleData.Any(item => item.questDescr.Equals(currentData.questDescr, StringComparison.InvariantCultureIgnoreCase) && item.questCount == currentData.questCount);
                                                if (!isAlreadyAdded)
                                                {
                                                    BundleData.Add(currentData);
                                                }
                                            }
                                        }

                                        //quest stage
                                        foreach (JToken token in rewardsArray)
                                        {
                                            string qAssetType = token["ItemPrimaryAssetId"]["PrimaryAssetType"]["Name"].Value <string>();
                                            string qAssetName = token["ItemPrimaryAssetId"]["PrimaryAssetName"].Value <string>();

                                            if (qAssetType == "Quest")
                                            {
                                                getQuestData(qAssetName, questInfo);
                                            }
                                        }
                                    }
                                    else if (isFortbyte && assetTypeToken != null)
                                    {
                                        //thank you Quest_BR_S9_Fortbyte_04
                                        JToken weight      = AssetArray[0]["Weight"];
                                        JToken weightToUse = null;
                                        if (weight != null)
                                        {
                                            weightToUse = weight;
                                        }

                                        BundleInfoEntry currentData    = new BundleInfoEntry(questDescription, questCount, assetTypeToken["ItemPrimaryAssetId"]["PrimaryAssetName"].Value <string>(), weightToUse == null ? "01" : weightToUse.Value <string>(), unlockType);
                                        bool            isAlreadyAdded = BundleData.Any(item => item.questDescr.Equals(currentData.questDescr, StringComparison.InvariantCultureIgnoreCase) && item.questCount == currentData.questCount);
                                        if (!isAlreadyAdded)
                                        {
                                            BundleData.Add(currentData);
                                        }
                                    }
                                    else
                                    {
                                        BundleInfoEntry currentData    = new BundleInfoEntry(questDescription, questCount, "", "", unlockType);
                                        bool            isAlreadyAdded = BundleData.Any(item => item.questDescr.Equals(currentData.questDescr, StringComparison.InvariantCultureIgnoreCase) && item.questCount == currentData.questCount);
                                        if (!isAlreadyAdded)
                                        {
                                            BundleData.Add(currentData);
                                        }
                                    }
                                }
                            }
                        }
                        catch (JsonSerializationException)
                        {
                            //do not crash when JsonSerialization does weird stuff
                        }
                    }
                }
            }
            catch (KeyNotFoundException)
            {
                new UpdateMyConsole("Can't extract " + questFile, Color.Crimson, true).AppendToConsole();
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// extract quest and add description, count, reward item, reward quantity to List<BundleInfoEntry> BundleData
        /// loop if stage exist
        /// </summary>
        /// <param name="questFile"></param>
        private static void getQuestData(string questFile)
        {
            try
            {
                string questFilePath;
                if (ThePak.CurrentUsedPakGuid != null && ThePak.CurrentUsedPakGuid != "0-0-0-0")
                {
                    questFilePath = JohnWick.ExtractAsset(ThePak.CurrentUsedPak, questFile);
                }
                else
                {
                    questFilePath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary[questFile], questFile);
                }

                if (questFilePath != null)
                {
                    if (questFilePath.Contains(".uasset") || questFilePath.Contains(".uexp") || questFilePath.Contains(".ubulk"))
                    {
                        JohnWick.MyAsset = new PakAsset(questFilePath.Substring(0, questFilePath.LastIndexOf('.')));
                        try
                        {
                            if (JohnWick.MyAsset.GetSerialized() != null)
                            {
                                QuestParser[] questParser = QuestParser.FromJson(JToken.Parse(JohnWick.MyAsset.GetSerialized()).ToString());
                                for (int x = 0; x < questParser.Length; x++)
                                {
                                    string oldQuest = string.Empty;
                                    long   oldCount = 0;

                                    for (int p = 0; p < questParser[x].Objectives.Length; p++)
                                    {
                                        long newCount = questParser[x].Objectives[p].Count;
                                        if (questParser[x].ObjectiveCompletionCount > 0)
                                        {
                                            newCount = questParser[x].ObjectiveCompletionCount;
                                        }

                                        //fortbyte check
                                        bool isFortbyte = false;
                                        Parser.Quests.Reward assetTypeToken = null;
                                        if (questParser[x].Rewards != null) //this caused a null exception for some challenges (most of them in the Styles folder)
                                        {
                                            assetTypeToken = questParser[x].Rewards.Where(item => item.ItemPrimaryAssetId.PrimaryAssetType.Name == "Token").FirstOrDefault();
                                            if (assetTypeToken != null)
                                            {
                                                isFortbyte = assetTypeToken.ItemPrimaryAssetId.PrimaryAssetName == "AthenaFortbyte";
                                            }
                                        }

                                        string newQuest = SearchResource.getTextByKey(questParser[x].Objectives[p].Description.Key, questParser[x].Objectives[p].Description.SourceString);
                                        if (newQuest != oldQuest && newCount != oldCount)
                                        {
                                            if (questParser[x].Rewards != null && !isFortbyte)
                                            {
                                                try
                                                {
                                                    string rewardId       = questParser[x].Rewards.Where(item => item.ItemPrimaryAssetId.PrimaryAssetType.Name != "Quest").Where(item => item.ItemPrimaryAssetId.PrimaryAssetType.Name != "Token").FirstOrDefault().ItemPrimaryAssetId.PrimaryAssetName;
                                                    string rewardQuantity = questParser[x].Rewards.Where(item => item.ItemPrimaryAssetId.PrimaryAssetType.Name != "Quest").Where(item => item.ItemPrimaryAssetId.PrimaryAssetType.Name != "Token").FirstOrDefault().Quantity.ToString();

                                                    BundleData.Add(new BundleInfoEntry(newQuest, newCount, rewardId, rewardQuantity));
                                                }
                                                catch (NullReferenceException)
                                                {
                                                    if (questParser[x].HiddenRewards != null)
                                                    {
                                                        string rewardId       = questParser[x].HiddenRewards.FirstOrDefault().TemplateId;
                                                        string rewardQuantity = questParser[x].HiddenRewards.FirstOrDefault().Quantity.ToString();

                                                        BundleData.Add(new BundleInfoEntry(newQuest, newCount, rewardId, rewardQuantity));
                                                    }
                                                }

                                                //get stage
                                                for (int k = 0; k < questParser[x].Rewards.Length; k++)
                                                {
                                                    string qAssetType = questParser[x].Rewards[k].ItemPrimaryAssetId.PrimaryAssetType.Name;
                                                    string qAssetName = questParser[x].Rewards[k].ItemPrimaryAssetId.PrimaryAssetName;

                                                    if (qAssetType == "Quest")
                                                    {
                                                        getQuestData(qAssetName);
                                                    }
                                                }
                                            }
                                            else if (isFortbyte && assetTypeToken != null)
                                            {
                                                BundleData.Add(new BundleInfoEntry(newQuest, newCount, assetTypeToken.ItemPrimaryAssetId.PrimaryAssetName, questParser[x].Weight > 0 ? questParser[x].Weight.ToString() : "01"));
                                            }
                                            else
                                            {
                                                BundleData.Add(new BundleInfoEntry(newQuest, newCount, "", ""));
                                            }

                                            oldQuest = newQuest;
                                            oldCount = newCount;
                                        }
                                    }
                                }
                            }
                        }
                        catch (JsonSerializationException)
                        {
                            //do not crash when JsonSerialization does weird stuff
                        }
                    }
                }
            }
            catch (KeyNotFoundException)
            {
                //do not stop when questFile doesn't exist
                //Console.WriteLine("Can't extract " + questFile);
            }
        }
Exemplo n.º 13
0
        public static string getBundleDisplayName(ItemsIdParser theItem)
        {
            string text = SearchResource.getTextByKey(theItem.DisplayName.Key, theItem.DisplayName.SourceString);

            return(text.ToUpper());
        }
Exemplo n.º 14
0
        /// <summary>
        /// todo: find a better way to handle errors
        /// </summary>
        /// <param name="theItem"></param>
        private static void SetTexts(ItemsIdParser theItem)
        {
            CosmeticSource   = "";
            ShortDescription = "";
            CosmeticId       = "";
            MaxStackSize     = "";
            ItemAction       = "";
            WeaponRowName    = "";
            CosmeticUff      = "";
            HeroType         = "";
            DefenderType     = "";
            MinToMax         = "";

            try
            {
                switch (Settings.Default.IconLanguage)
                {
                case "French":
                case "German":
                case "Italian":
                case "Spanish":
                case "Spanish (LA)":
                    ShortDescription = theItem.ShortDescription != null?SearchResource.getTextByKey(theItem.ShortDescription.Key, theItem.ShortDescription.SourceString) : "";

                    break;

                default:
                    ShortDescription = theItem.ShortDescription != null ? theItem.ShortDescription.SourceString : "";
                    break;
                }
            }
            catch (Exception)
            {
                //avoid generator to stop when a string isn't found
            }
            try
            { }
            catch (Exception)
            {
                //avoid generator to stop when a string isn't found
            }
            try
            {
                CosmeticId = theItem.CosmeticItem;
            }
            catch (Exception)
            {
                //avoid generator to stop when a string isn't found
            }
            try
            {
                MaxStackSize = "Max Stack Size: " + theItem.MaxStackSize;
            }
            catch (Exception)
            {
                //avoid generator to stop when a string isn't found
            }
            try
            { }
            catch (Exception)
            {
                //avoid generator to stop when a string isn't found
            }
            try
            {
                if (theItem.WeaponStatHandle != null && theItem.WeaponStatHandle.RowName != "Harvest_Pickaxe_Athena_C_T01" && theItem.WeaponStatHandle.RowName != "Edged_Sword_Athena_C_T01")
                {
                    WeaponRowName = theItem.WeaponStatHandle.RowName;
                }
            }
            catch (Exception)
            {
                //avoid generator to stop when a string isn't found
            }
            try
            { }
            catch (Exception)
            {
                //avoid generator to stop when a string isn't found
            }
            try
            {
                HeroType = theItem.AttributeInitKey != null ? theItem.AttributeInitKey.AttributeInitCategory : "";
            }
            catch (Exception)
            {
                //avoid generator to stop when a string isn't found
            }
            try
            { }
            catch (Exception)
            {
                //avoid generator to stop when a string isn't found
            }
            try
            {
                MinToMax = "   " + theItem.MinLevel + " to " + theItem.MaxLevel;
            }
            catch (Exception)
            {
                //avoid generator to stop when a string isn't found
            }
        }
Exemplo n.º 15
0
        /// <summary>
        /// todo: find a better way to handle errors
        /// </summary>
        /// <param name="theItem"></param>
        private static void SetTexts(JToken theItem)
        {
            CosmeticSource   = "";
            CosmeticSet      = "";
            ShortDescription = "";
            CosmeticId       = "";
            MaxStackSize     = "";
            ItemAction       = "";
            WeaponDataTable  = "";
            WeaponRowName    = "";
            CosmeticUff      = null;
            HeroType         = "";
            DefenderType     = "";
            MinToMax         = "";

            JToken shortDescription = theItem["ShortDescription"];

            if (shortDescription != null)
            {
                JToken key          = shortDescription["key"];
                JToken sourceString = shortDescription["source_string"];
                ShortDescription = SearchResource.getTextByKey(key != null ? key.Value <string>() : "", sourceString != null ? sourceString.Value <string>() : "");
            }

            if (theItem["export_type"] != null && theItem["export_type"].Value <string>().Equals("AthenaItemWrapDefinition"))
            {
                ShortDescription = SearchResource.getTextByKey("ItemWrapShortDescription", "Wrap", "Fort.Cosmetics");
            }

            JToken gameplayTags = theItem["GameplayTags"];

            if (gameplayTags != null)
            {
                JToken gameplayTagsTwo = gameplayTags["gameplay_tags"];
                if (gameplayTagsTwo != null)
                {
                    JArray gameplayTagsArray = gameplayTagsTwo.Value <JArray>();

                    JToken cosmeticSet = gameplayTagsArray.Children <JToken>().FirstOrDefault(x => x.ToString().StartsWith("Cosmetics.Set."));
                    if (cosmeticSet != null)
                    {
                        CosmeticSet = gameplayTagsArray[gameplayTagsArray.IndexOf(cosmeticSet)].Value <string>();
                    }

                    JToken cosmeticSource = gameplayTagsArray.Children <JToken>().FirstOrDefault(x => x.ToString().StartsWith("Cosmetics.Source."));
                    if (cosmeticSource != null)
                    {
                        CosmeticSource = cosmeticSource.Value <string>().Substring(17);
                    }

                    JToken athenaItemAction = gameplayTagsArray.Children <JToken>().FirstOrDefault(x => x.ToString().StartsWith("Athena.ItemAction."));
                    if (athenaItemAction != null)
                    {
                        ItemAction = athenaItemAction.Value <string>().Substring(18);
                    }

                    IEnumerable <JToken> userFacingFlags = gameplayTagsArray.Children <JToken>().Where(x => x.ToString().StartsWith("Cosmetics.UserFacingFlags."));
                    if (userFacingFlags != null)
                    {
                        CosmeticUff = new string[userFacingFlags.Count()];
                        for (int i = 0; i < CosmeticUff.Length; i++)
                        {
                            CosmeticUff[i] = userFacingFlags.ElementAt(i).Value <string>().Substring("Cosmetics.UserFacingFlags.".Length);
                        }
                    }

                    JToken defenderType = gameplayTagsArray.Children <JToken>().FirstOrDefault(x => x.ToString().StartsWith("NPC.CharacterType.Survivor.Defender."));
                    if (defenderType != null)
                    {
                        DefenderType = defenderType.Value <string>().Substring(36);
                    }
                }
            }

            JToken cosmeticId = theItem["cosmetic_item"];

            if (cosmeticId != null)
            {
                CosmeticId = cosmeticId.Value <string>();
            }

            JToken maxStackSize = theItem["MaxStackSize"];

            if (maxStackSize != null)
            {
                MaxStackSize = "Max Stack Size: " + maxStackSize.Value <string>();
            }

            JToken weaponStatHandle = theItem["WeaponStatHandle"];

            if (weaponStatHandle != null)
            {
                JToken dataTable = weaponStatHandle["DataTable"];
                if (dataTable != null)
                {
                    WeaponDataTable = dataTable.Value <string>();
                }

                JToken rowName = weaponStatHandle["RowName"];
                if (rowName != null)
                {
                    WeaponRowName = rowName.Value <string>();
                }
            }

            JToken attributeInitKey = theItem["AttributeInitKey"];

            if (attributeInitKey != null)
            {
                JToken attributeInitCategory = attributeInitKey["AttributeInitCategory"];
                if (attributeInitCategory != null)
                {
                    HeroType = attributeInitCategory.Value <string>();
                }
            }

            JToken minLevel = theItem["MinLevel"];
            JToken maxLevel = theItem["MaxLevel"];

            if (maxLevel != null)
            {
                MinToMax = "    0 to " + maxLevel.Value <string>();
                if (minLevel != null)
                {
                    MinToMax = "    " + minLevel.Value <string>() + " to " + maxLevel.Value <string>();
                }
            }
        }
Exemplo n.º 16
0
        private static void drawCompletionText(Bitmap myBitmap, string count)
        {
            string all = "Complete ALL CHALLENGES to earn the reward item";
            string any = "Complete ANY " + count + " CHALLENGES to earn the reward item";

            if (!Settings.Default.IconLanguage.Equals("English"))
            {
                all = SearchResource.getTextByKey("CompletionRewardFormat_All", "Complete ALL CHALLENGES to earn the reward item", "AthenaChallengeDetailsEntry");
                any = SearchResource.getTextByKey("CompletionRewardFormat", "Complete ANY " + count + " CHALLENGES to earn the reward item", "AthenaChallengeDetailsEntry");

                //because HtmlAgilityPack fail to detect the end of the tag when it's </>
                if (all.Contains("</>"))
                {
                    all = all.Replace("</>", "</text>");
                }
                if (any.Contains("</>"))
                {
                    any = any.Replace("</>", "</text>");
                }

                HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
                doc.LoadHtml(all);
                if (doc.DocumentNode.InnerText.Contains(" {0}")) //avoid white space
                {
                    if (all.Contains("</text>"))
                    {
                        all = doc.DocumentNode.InnerText.Replace(doc.DocumentNode.SelectSingleNode("text").InnerText, doc.DocumentNode.SelectSingleNode("text").InnerText.ToUpper());
                        all = all.Replace(" {0}", string.Empty);
                    }
                    else
                    {
                        all = doc.DocumentNode.InnerText.Replace(" {0}", string.Empty);
                    }
                }
                else
                {
                    if (all.Contains("</text>"))
                    {
                        all = doc.DocumentNode.InnerText.Replace(doc.DocumentNode.SelectSingleNode("text").InnerText, doc.DocumentNode.SelectSingleNode("text").InnerText.ToUpper());
                        all = all.Replace("{0}", string.Empty);
                    }
                    else
                    {
                        all = doc.DocumentNode.InnerText.Replace("{0}", string.Empty);
                    }
                }

                doc = new HtmlAgilityPack.HtmlDocument();
                doc.LoadHtml(any);
                if (doc.DocumentNode.InnerText.Contains("{QuestNumber}")) //russian
                {
                    if (any.Contains("</text>"))
                    {
                        any = doc.DocumentNode.InnerText.Replace(doc.DocumentNode.SelectSingleNode("text").InnerText, doc.DocumentNode.SelectSingleNode("text").InnerText.ToUpper());
                        any = any.Replace("{QuestNumber}", count);
                    }
                    else
                    {
                        any = doc.DocumentNode.InnerText.Replace("{QuestNumber}", count);
                    }
                }
                else
                {
                    if (any.Contains("</text>"))
                    {
                        any = doc.DocumentNode.InnerText.Replace(doc.DocumentNode.SelectSingleNode("text").InnerText, doc.DocumentNode.SelectSingleNode("text").InnerText.ToUpper());
                        any = string.Format(any, count);
                    }
                    else
                    {
                        any = string.Format(doc.DocumentNode.InnerText, count);
                    }
                }

                if (all.Contains("  "))
                {
                    all = all.Replace("  ", " ");
                }                                                         //double space in Spanish (LA)               i.e. with QuestBundle_PirateParty
                if (any.Contains("  "))
                {
                    any = any.Replace("  ", " ");
                }
            }

            drawQuestBackground(myBitmap, false);
            Font goodFont = FontUtilities.FindFont(toDrawOn, count == "-1" ? all : any, new Rectangle(57, theY + 7, myBitmap.Width - 227, 45).Size, new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[1], 30)); //size in "new Font()" is never check

            toDrawOn.DrawString(count == "-1" ? all : any, goodFont, new SolidBrush(Color.White), new Point(55, theY + 15));
        }