Beispiel #1
0
        /// <summary>
        /// get and draw completion text and its reward
        /// if AssetPathName is "None" we take the TemplateId (it's most likely a banner)
        /// else we take AssetPathName and we ignore "AthenaBattlePass_WeeklyChallenge_Token" and "AthenaBattlePass_WeeklyBundle_Token" because these are useless
        /// ignoring these 2 should give us an item id, we draw this item
        /// </summary>
        /// <param name="myBundle"></param>
        public static void drawCompletionReward(ChallengeBundleIdParser myBundle)
        {
            if (myBundle.BundleCompletionRewards != null)
            {
                theY += 100;
                for (int x = 0; x < myBundle.BundleCompletionRewards.Length; x++)
                {
                    for (int i = 0; i < myBundle.BundleCompletionRewards[x].Rewards.Length; i++)
                    {
                        string compCount    = myBundle.BundleCompletionRewards[x].CompletionCount.ToString();
                        string itemQuantity = myBundle.BundleCompletionRewards[x].Rewards[i].Quantity.ToString();

                        if (myBundle.BundleCompletionRewards[x].Rewards[i].ItemDefinition.AssetPathName == "None")
                        {
                            theY += 140;

                            DrawingRewards.getRewards(myBundle.BundleCompletionRewards[x].Rewards[i].TemplateId, itemQuantity);

                            drawCompletionText(compCount);
                        }
                        else
                        {
                            string rewardId = Path.GetFileName(myBundle.BundleCompletionRewards[x].Rewards[i].ItemDefinition.AssetPathName.Substring(0, myBundle.BundleCompletionRewards[x].Rewards[i].ItemDefinition.AssetPathName.LastIndexOf(".", StringComparison.Ordinal)));

                            if (rewardId != "AthenaBattlePass_WeeklyChallenge_Token" && rewardId != "AthenaBattlePass_WeeklyBundle_Token")
                            {
                                theY += 140;

                                try //needed for rare cases where the icon is in /Content/icon.uasset and atm idk why but i can't extract
                                {
                                    if (rewardId.Contains("Fortbyte_WeeklyChallengesComplete_"))
                                    {
                                        drawForbyteReward();
                                    }
                                    else
                                    {
                                        DrawingRewards.getRewards(rewardId, itemQuantity);
                                    }
                                }
                                catch (Exception)
                                {
                                    drawUnknownReward();
                                }

                                drawCompletionText(compCount);
                            }
                        }
                    }
                }
            }
        }
Beispiel #2
0
        /// <summary>
        /// get and draw completion text and its reward
        /// if AssetPathName is "None" we take the TemplateId (it's most likely a banner)
        /// else we take AssetPathName and we ignore "AthenaBattlePass_WeeklyChallenge_Token" and "AthenaBattlePass_WeeklyBundle_Token" because these are useless
        /// ignoring these 2 should give us an item id, we draw this item
        /// </summary>
        /// <param name="myBundle"></param>
        public static void drawCompletionReward(Bitmap myBitmap, JToken myBundle)
        {
            JToken bundleCompletionRewards = myBundle["BundleCompletionRewards"];

            if (bundleCompletionRewards != null)
            {
                new UpdateMyState("Drawing Completion Rewards...", "Waiting").ChangeProcessState();
                theY += 35;

                JArray bundleCompletionRewardsArray = bundleCompletionRewards.Value <JArray>();
                foreach (JToken token in bundleCompletionRewardsArray)
                {
                    string compCount       = string.Empty;
                    JToken completionCount = token["CompletionCount"];
                    if (completionCount != null)
                    {
                        compCount = completionCount.Value <string>();
                    }

                    JToken rewards = token["Rewards"];
                    if (rewards != null)
                    {
                        JArray rewardsArray = rewards.Value <JArray>();
                        for (int i = 0; i < rewardsArray.Count; i++)
                        {
                            string itemQuantity = string.Empty;
                            JToken quantity     = rewardsArray[i]["Quantity"];
                            if (quantity != null)
                            {
                                itemQuantity = quantity.Value <string>();
                            }

                            JToken itemDefinition = rewardsArray[i]["ItemDefinition"];
                            if (itemDefinition != null)
                            {
                                JToken assetPathName = itemDefinition["asset_path_name"];
                                if (assetPathName != null)
                                {
                                    if (assetPathName.Value <string>().Equals("None"))
                                    {
                                        theY += 140;
                                        drawCompletionText(myBitmap, compCount);
                                        DrawingRewards.getRewards(rewardsArray[i]["TemplateId"].Value <string>(), itemQuantity);
                                    }
                                    else
                                    {
                                        string rewardId = Path.GetFileName(assetPathName.Value <string>().Substring(0, assetPathName.Value <string>().LastIndexOf(".", StringComparison.Ordinal)));

                                        if (!assetPathName.Value <string>().Contains("/Game/Items/Tokens/") && !rewardId.Contains("Quest_BR_")) //no more fortbyte for weekly challenges
                                        {
                                            theY += 90;
                                            drawCompletionText(myBitmap, compCount);
                                            DrawingRewards.getRewards(rewardId, itemQuantity);
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }