Esempio n. 1
0
        /// <summary>
        /// this is only triggered for heroes and defenders
        /// draw the minimum and maximum level as well as a bolt icon
        /// </summary>
        /// <param name="myGraphic"></param>
        private static void DrawPower(Graphics myGraphic)
        {
            Image bolt = Resources.LBolt64;

            myGraphic.DrawImage(ImageUtilities.ResizeImage(bolt, 15, 15), new Point(5, 501));

            DrawToLeft(MinToMax, myGraphic);
        }
Esempio n. 2
0
        private static void drawRewards(string type, string quantity)
        {
            Image        rewardIcon   = null;
            GraphicsPath graphicsPath = null;

            switch (type)
            {
            case "athenabattlestar":
            {
                rewardIcon = Resources.T_FNBR_BattlePoints_L;
                BundleDesign.toDrawOn.DrawImage(ImageUtilities.ResizeImage(rewardIcon, 75, 75), new Point(2325, BundleDesign.theY + 22));

                graphicsPath = new GraphicsPath();
                drawPathAndFill(graphicsPath, quantity, Color.FromArgb(255, 143, 74, 32), Color.FromArgb(255, 255, 219, 103));
                break;
            }

            case "AthenaSeasonalXP":
            {
                rewardIcon = Resources.T_FNBR_SeasonalXP_L;
                BundleDesign.toDrawOn.DrawImage(ImageUtilities.ResizeImage(rewardIcon, 75, 75), new Point(2325, BundleDesign.theY + 22));

                graphicsPath = new GraphicsPath();
                drawPathAndFill(graphicsPath, quantity, Color.FromArgb(255, 81, 131, 15), Color.FromArgb(255, 230, 253, 177));
                break;
            }

            case "MtxGiveaway":
            {
                rewardIcon = Resources.T_Items_MTX_L;
                BundleDesign.toDrawOn.DrawImage(ImageUtilities.ResizeImage(rewardIcon, 75, 75), new Point(2325, BundleDesign.theY + 22));

                graphicsPath = new GraphicsPath();
                drawPathAndFill(graphicsPath, quantity, Color.FromArgb(255, 100, 160, 175), Color.FromArgb(255, 220, 230, 255));
                break;
            }

            case "AthenaFortbyte":
            {
                BundleDesign.toDrawOn.DrawString("#" + Int32.Parse(quantity).ToString("D2"), new Font(FontUtilities.pfc.Families[1], 50), new SolidBrush(Color.White), new Point(2325, BundleDesign.theY + 22));
                break;
            }

            default:
                break;
            }

            if (rewardIcon != null)
            {
                rewardIcon = null;
            }

            if (graphicsPath != null)
            {
                graphicsPath.Dispose();
            }
        }
Esempio n. 3
0
        private static void drawImageLogo(Graphics myGraphic, Image logo, int x)
        {
            if (logo != null)
            {
                Point pointCoords = new Point(x, 6);

                myGraphic.DrawImage(ImageUtilities.ResizeImage(logo, 28, 28), pointCoords);
                logo.Dispose();
            }
        }
Esempio n. 4
0
        /// <summary>
        /// This is only triggered if ThePak.CurrentUsedItem is a weapon id, it's to display the bullet type
        /// extract, serialize and parse the ammoFile, search a Large or Small icon, display this icon at the top left of the rarity image
        /// </summary>
        /// <param name="ammoFile"></param>
        /// <param name="toDrawOn"></param>
        public static void GetAmmoData(string ammoFile, Graphics toDrawOn)
        {
            string ammoFilePath;

            if (ThePak.CurrentUsedPakGuid != null && ThePak.CurrentUsedPakGuid != "0-0-0-0")
            {
                ammoFilePath = JohnWick.ExtractAsset(ThePak.CurrentUsedPak, ammoFile.Substring(ammoFile.LastIndexOf('.') + 1));
            }
            else
            {
                ammoFilePath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary[ammoFile.Substring(ammoFile.LastIndexOf('.') + 1)], ammoFile.Substring(ammoFile.LastIndexOf('.') + 1));
            }

            if (ammoFilePath != null)
            {
                if (ammoFilePath.Contains(".uasset") || ammoFilePath.Contains(".uexp") || ammoFilePath.Contains(".ubulk"))
                {
                    JohnWick.MyAsset = new PakAsset(ammoFilePath.Substring(0, ammoFilePath.LastIndexOf('.')));
                    try
                    {
                        if (JohnWick.MyAsset.GetSerialized() != null)
                        {
                            string parsedJson = JToken.Parse(JohnWick.MyAsset.GetSerialized()).ToString();
                            var    ammoId     = ItemsIdParser.FromJson(parsedJson);
                            for (int i = 0; i < ammoId.Length; i++)
                            {
                                SearchLargeSmallIcon(ammoId[i]);

                                if (File.Exists(ItemIconPath))
                                {
                                    Image itemIcon;
                                    using (var bmpTemp = new Bitmap(ItemIconPath))
                                    {
                                        itemIcon = new Bitmap(bmpTemp);
                                    }
                                    toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 64, 64), new Point(6, 6));
                                }
                                else
                                {
                                    Image itemIcon = Resources.unknown512;
                                    toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 64, 64), new Point(6, 6));
                                }
                            }
                        }
                    }
                    catch (JsonSerializationException)
                    {
                        //do not crash when JsonSerialization does weird stuff
                    }
                }
            }
        }
Esempio n. 5
0
        /// <summary>
        /// this is only triggered for wraps, in case the featured (weapon render) image is drawn
        /// also draw the non featured image to make it clear it's a wrap, not a weapon
        /// </summary>
        /// <param name="theItem"></param>
        /// <param name="myGraphic"></param>
        private static void DrawAdditionalImage(ItemsIdParser theItem, Graphics myGraphic)
        {
            string wrapAddImg = theItem.LargePreviewImage.AssetPathName.Substring(theItem.LargePreviewImage.AssetPathName.LastIndexOf(".", StringComparison.Ordinal) + 1);

            ItemIcon.ItemIconPath = JohnWick.AssetToTexture2D(wrapAddImg);

            if (File.Exists(ItemIcon.ItemIconPath))
            {
                Image itemIcon;
                using (var bmpTemp = new Bitmap(ItemIcon.ItemIconPath))
                {
                    itemIcon = new Bitmap(bmpTemp);
                }
                myGraphic.DrawImage(ImageUtilities.ResizeImage(itemIcon, 122, 122), new Point(395, 282));
            }
        }
Esempio n. 6
0
        /// <summary>
        /// take all the selected images and draw them one after the other depending on mergerImagesRow
        /// at the end, save and open the generated image with OpenMerged()
        /// </summary>
        /// <param name="mySelectedImages"></param>
        private static void MergeSelected(List <Image> mySelectedImages)
        {
            if (Settings.Default.mergerImagesRow == 0)
            {
                Settings.Default.mergerImagesRow = 7;
                Settings.Default.Save();
            }

            int numperrow = Settings.Default.mergerImagesRow;
            var w         = 530 * numperrow;

            if (mySelectedImages.Count * 530 < 530 * numperrow)
            {
                w = mySelectedImages.Count * 530;
            }

            int    h   = int.Parse(Math.Ceiling(double.Parse(mySelectedImages.Count.ToString()) / numperrow).ToString(CultureInfo.InvariantCulture)) * 530;
            Bitmap bmp = new Bitmap(w - 8, h - 8);

            var num  = 1;
            var curW = 0;
            var curH = 0;

            for (int i = 0; i < mySelectedImages.Count; i++)
            {
                using (Graphics g = Graphics.FromImage(bmp))
                {
                    g.DrawImage(ImageUtilities.ResizeImage(mySelectedImages[i], 522, 522), new PointF(curW, curH));
                    if (num % numperrow == 0)
                    {
                        curW  = 0;
                        curH += 530;
                        num  += 1;
                    }
                    else
                    {
                        curW += 530;
                        num  += 1;
                    }
                }
            }
            bmp.Save(App.DefaultOutputPath + "\\" + Settings.Default.mergerFileName + ".png", ImageFormat.Png);

            OpenMerged(bmp);
        }
Esempio n. 7
0
        private static void drawIconSeparator(string iconName)
        {
            string texture = JohnWick.AssetToTexture2D(iconName);

            if (File.Exists(texture))
            {
                Image itemIcon;
                using (var bmpTemp = new Bitmap(texture))
                {
                    itemIcon = new Bitmap(bmpTemp);
                }

                toDrawOn.FillRectangle(new SolidBrush(Color.FromArgb(100, headerColor.R, headerColor.G, headerColor.B)), new Rectangle(25, theY, 50, 35));

                toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 32, 32), new Point(50 - 15, theY + 2));

                theY += 40;
            }
        }
Esempio n. 8
0
 private static void drawIngredientIcon(JToken AssetArray, int i)
 {
     ItemIcon.ItemIconPath = string.Empty;
     ItemIcon.SearchAthIteDefIcon(AssetArray);
     if (File.Exists(ItemIcon.ItemIconPath))
     {
         Image itemIcon;
         using (var bmpTemp = new Bitmap(ItemIcon.ItemIconPath))
         {
             itemIcon = new Bitmap(bmpTemp);
         }
         toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 50, 50), new Point(10, 536 + (75 * i)));
     }
     else
     {
         Image itemIcon = Resources.unknown512;
         toDrawOn.DrawImage(itemIcon, new Point(0, 0));
     }
 }
Esempio n. 9
0
        public static void createItemDefinitionIcon(JToken theItem)
        {
            JToken craftedItem = SchematicItemInfos.setSchematicData(theItem);

            toDrawOn = createGraphic(522, 522 + (75 * SchematicItemInfos.schematicInfoList.Count));
            Rarity.DrawRarity(craftedItem, toDrawOn);

            ItemIcon.ItemIconPath = string.Empty;
            ItemIcon.GetItemIcon(craftedItem, Settings.Default.loadFeaturedImage);
            if (File.Exists(ItemIcon.ItemIconPath))
            {
                Image itemIcon;
                using (var bmpTemp = new Bitmap(ItemIcon.ItemIconPath))
                {
                    itemIcon = new Bitmap(bmpTemp);
                }
                toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 512, 512), new Point(5, 5));
            }
            else
            {
                Image itemIcon = Resources.unknown512;
                toDrawOn.DrawImage(itemIcon, new Point(0, 0));
            }

            if (string.Equals(Properties.Settings.Default.rarityDesign, "Flat"))
            {
                GraphicsPath p = new GraphicsPath();
                p.StartFigure();
                p.AddLine(4, 438, 517, 383);
                p.AddLine(517, 383, 517, 383 + 134);
                p.AddLine(4, 383 + 134, 4, 383 + 134);
                p.AddLine(4, 383 + 134, 4, 438);
                p.CloseFigure();
                toDrawOn.FillPath(new SolidBrush(Color.FromArgb(70, 0, 0, 50)), p);
            }
            else
            {
                toDrawOn.FillRectangle(new SolidBrush(Color.FromArgb(70, 0, 0, 50)), new Rectangle(5, 383, 512, 134));
            }

            DrawText.DrawTexts(craftedItem, toDrawOn, "");
        }
Esempio n. 10
0
        /// <summary>
        /// This is only triggered if ThePak.CurrentUsedItem is a weapon id, it's to display the bullet type
        /// extract, serialize and parse the ammoFile, search a Large or Small icon, display this icon at the top left of the rarity image
        /// </summary>
        /// <param name="ammoFile"></param>
        /// <param name="toDrawOn"></param>
        public static void GetAmmoData(string ammoFile, Graphics toDrawOn)
        {
            string ammoFilePath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary[ammoFile.Substring(ammoFile.LastIndexOf('.') + 1)], ammoFile.Substring(ammoFile.LastIndexOf('.') + 1));

            if (ammoFilePath != null)
            {
                if (ammoFilePath.Contains(".uasset") || ammoFilePath.Contains(".uexp") || ammoFilePath.Contains(".ubulk"))
                {
                    JohnWick.MyAsset = new PakAsset(ammoFilePath.Substring(0, ammoFilePath.LastIndexOf('.')));
                    try
                    {
                        if (JohnWick.MyAsset.GetSerialized() != null)
                        {
                            dynamic AssetData  = JsonConvert.DeserializeObject(JohnWick.MyAsset.GetSerialized());
                            JArray  AssetArray = JArray.FromObject(AssetData);

                            SearchLargeSmallIcon(AssetArray[0]);

                            if (File.Exists(ItemIconPath))
                            {
                                Image itemIcon;
                                using (var bmpTemp = new Bitmap(ItemIconPath))
                                {
                                    itemIcon = new Bitmap(bmpTemp);
                                }
                                toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 64, 64), new Point(6, 6));
                            }
                            else
                            {
                                Image itemIcon = Resources.unknown512;
                                toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 64, 64), new Point(6, 6));
                            }
                        }
                    }
                    catch (JsonSerializationException)
                    {
                        //do not crash when JsonSerialization does weird stuff
                    }
                }
            }
        }
Esempio n. 11
0
 private static void DrawSeriesBackground(JToken theItem, Graphics toDrawOn, string theSeries)
 {
     if (theSeries.Equals("MarvelSeries"))
     {
         DrawBackground(toDrawOn, Color.FromArgb(255, 203, 35, 45), Color.FromArgb(255, 127, 14, 29), Color.FromArgb(255, 255, 67, 61));
     }
     else if (theSeries.Equals("CUBESeries"))
     {
         DrawBackground(toDrawOn, Color.FromArgb(255, 157, 0, 108), Color.FromArgb(255, 97, 0, 100), Color.FromArgb(255, 175, 27, 185));
         string cubeBG = JohnWick.AssetToTexture2D("T-Cube-Background");
         if (!string.IsNullOrEmpty(cubeBG))
         {
             Image itemIcon;
             using (var bmpTemp = new Bitmap(cubeBG))
             {
                 itemIcon = new Bitmap(bmpTemp);
             }
             Image opacityImage = ImageUtilities.SetImageOpacity(itemIcon, (float)0.2);
             toDrawOn.DrawImage(ImageUtilities.ResizeImage(opacityImage, 512, 512), new Point(5, 5));
         }
     }
     else if (theSeries.Equals("DCUSeries"))
     {
         DrawBackground(toDrawOn, Color.FromArgb(255, 45, 68, 93), Color.FromArgb(255, 16, 25, 40), Color.FromArgb(255, 62, 94, 122));
         string cubeBG = JohnWick.AssetToTexture2D("T-BlackMonday-Background");
         if (!string.IsNullOrEmpty(cubeBG))
         {
             Image itemIcon;
             using (var bmpTemp = new Bitmap(cubeBG))
             {
                 itemIcon = new Bitmap(bmpTemp);
             }
             Image opacityImage = ImageUtilities.SetImageOpacity(itemIcon, (float)0.6);
             toDrawOn.DrawImage(ImageUtilities.ResizeImage(opacityImage, 512, 512), new Point(5, 5));
         }
     }
     else
     {
         DrawRarityBackground(theItem, toDrawOn);
     }
 }
Esempio n. 12
0
        private static void loopingLol(string weaponName, Graphics myGraphic)
        {
            foreach (JToken token in jo.FindTokens(weaponName))
            {
                Parser.Weapons.WeaponStatParser statParsed = Parser.Weapons.WeaponStatParser.FromJson(token.ToString());

                Image bulletImage = Resources.dmg64;
                myGraphic.DrawImage(ImageUtilities.ResizeImage(bulletImage, 15, 15), new Point(5, 500));
                DrawToLeft("    " + statParsed.DmgPb, myGraphic); //damage per bullet

                Image clipSizeImage = Resources.clipSize64;
                myGraphic.DrawImage(ImageUtilities.ResizeImage(clipSizeImage, 15, 15), new Point(52, 500));
                myGraphic.DrawString("     " + statParsed.ClipSize, new Font(FontUtilities.pfc.Families[0], 13), new SolidBrush(Color.White), new Point(50, 500));

                Image reload = Resources.reload64;
                myGraphic.DrawImage(ImageUtilities.ResizeImage(reload, 15, 15), new Point(50 + (statParsed.ClipSize.ToString().Length * 7) + 47, 500));                                                                                  //50=clipsize text position | for each clipsize letter we add 7 to x | 47=difference between 2 icons
                myGraphic.DrawString(statParsed.ReloadTime + getSecondsWithLanguage(), new Font(FontUtilities.pfc.Families[0], 13), new SolidBrush(Color.White), new Point(64 + (statParsed.ClipSize.ToString().Length * 7) + 47, 500)); //64=50+icon size (-1 because that wasn't perfectly at the position i wanted)

                DrawToRight(weaponName, myGraphic);
            }
        }
Esempio n. 13
0
        private static void drawForbyteReward()
        {
            string textureFile = "T_UI_ChallengeTile_Fortbytes";

            ItemIcon.ItemIconPath = JohnWick.AssetToTexture2D(textureFile);

            if (File.Exists(ItemIcon.ItemIconPath))
            {
                Image itemIcon;
                using (var bmpTemp = new Bitmap(ItemIcon.ItemIconPath))
                {
                    itemIcon = new Bitmap(bmpTemp);
                }
                toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 110, 110), new Point(2300, theY + 6));
            }
            else
            {
                Image itemIcon = Resources.unknown512;
                toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 110, 110), new Point(2300, theY + 6));
            }
        }
Esempio n. 14
0
        private static void drawIcon()
        {
            Image itemIcon = null;

            if (!string.IsNullOrEmpty(ItemIcon.ItemIconPath) && File.Exists(ItemIcon.ItemIconPath))
            {
                using (var bmpTemp = new Bitmap(ItemIcon.ItemIconPath))
                {
                    itemIcon = new Bitmap(bmpTemp);
                }
            }
            else
            {
                itemIcon = Resources.unknown512;
            }

            if (itemIcon != null)
            {
                BundleDesign.toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 64, 64), new Point(902, BundleDesign.theY + 3));
                itemIcon.Dispose();
            }
        }
Esempio n. 15
0
        /// <summary>
        /// Draw a watermark on an Item Icon
        /// Keep in mind the update mode use different settings than the normal mode, hence there's 2 if statement
        /// </summary>
        /// <param name="toDrawOn"></param>
        public static void DrawWatermark(Graphics toDrawOn)
        {
            if (Checking.UmWorking == false && (Settings.Default.isWatermark && !string.IsNullOrEmpty(Settings.Default.wFilename)))
            {
                Image watermark = Image.FromFile(Settings.Default.wFilename);
                if (watermark != null)
                {
                    var opacityImage = ImageUtilities.SetImageOpacity(watermark, (float)Settings.Default.wOpacity / 100);
                    toDrawOn.DrawImage(ImageUtilities.ResizeImage(opacityImage, Settings.Default.wSize, Settings.Default.wSize), (522 - Settings.Default.wSize) / 2, (522 - Settings.Default.wSize) / 2, Settings.Default.wSize, Settings.Default.wSize);
                }
            }

            if (Checking.UmWorking && (Settings.Default.UMWatermark && !string.IsNullOrEmpty(Settings.Default.UMFilename)))
            {
                Image watermark = Image.FromFile(Settings.Default.UMFilename);
                if (watermark != null)
                {
                    var opacityImage = ImageUtilities.SetImageOpacity(watermark, (float)Settings.Default.UMOpacity / 100);
                    toDrawOn.DrawImage(ImageUtilities.ResizeImage(opacityImage, Settings.Default.UMSize, Settings.Default.UMSize), (522 - Settings.Default.UMSize) / 2, (522 - Settings.Default.UMSize) / 2, Settings.Default.UMSize, Settings.Default.UMSize);
                }
            }
        }
Esempio n. 16
0
        private static void drawIcon(string itemId)
        {
            if (File.Exists(ItemIcon.ItemIconPath))
            {
                if (Settings.Default.challengesDebug)
                {
                    //draw quest reward id
                    BundleDesign.toDrawOn.DrawString(itemId, new Font("Courier New", 12), new SolidBrush(Color.White), new RectangleF(2110, BundleDesign.theY + 30, 190, 60), FontUtilities.centeredStringLine);
                }

                Image itemIcon;
                using (var bmpTemp = new Bitmap(ItemIcon.ItemIconPath))
                {
                    itemIcon = new Bitmap(bmpTemp);
                }
                BundleDesign.toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 110, 110), new Point(2300, BundleDesign.theY + 6));
            }
            else
            {
                Image itemIcon = Resources.unknown512;
                BundleDesign.toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 110, 110), new Point(2300, BundleDesign.theY + 6));
            }
        }
Esempio n. 17
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);
            }
        }
Esempio n. 18
0
 /// <summary>
 /// search for a known Cosmetics.UserFacingFlags, if found draw the uff icon
 /// Cosmetics.UserFacingFlags icons are basically the style icon or the animated/reactive/traversal icon
 /// </summary>
 /// <param name="theItem"></param>
 /// <param name="myGraphic"></param>
 private static void DrawCosmeticUff(ItemsIdParser theItem, Graphics myGraphic)
 {
     if (CosmeticUff != null)
     {
         if (CosmeticUff.Contains("Animated"))
         {
             Image animatedLogo = Resources.T_Icon_Animated_64;
             myGraphic.DrawImage(ImageUtilities.ResizeImage(animatedLogo, 32, 32), new Point(6, -2));
         }
         else if (CosmeticUff.Contains("HasUpgradeQuests") && theItem.ExportType != "AthenaPetCarrierItemDefinition")
         {
             Image questLogo = Resources.T_Icon_Quests_64;
             myGraphic.DrawImage(ImageUtilities.ResizeImage(questLogo, 32, 32), new Point(6, 6));
         }
         else if (CosmeticUff.Contains("HasUpgradeQuests") && theItem.ExportType == "AthenaPetCarrierItemDefinition")
         {
             Image petLogo = Resources.T_Icon_Pets_64;
             myGraphic.DrawImage(ImageUtilities.ResizeImage(petLogo, 32, 32), new Point(6, 6));
         }
         else if (CosmeticUff.Contains("HasVariants"))
         {
             Image variantsLogo = Resources.T_Icon_Variant_64;
             myGraphic.DrawImage(ImageUtilities.ResizeImage(variantsLogo, 32, 32), new Point(6, 6));
         }
         else if (CosmeticUff.Contains("Reactive"))
         {
             Image reactiveLogo = Resources.T_Icon_Adaptive_64;
             myGraphic.DrawImage(ImageUtilities.ResizeImage(reactiveLogo, 32, 32), new Point(7, 7));
         }
         else if (CosmeticUff.Contains("Traversal"))
         {
             Image traversalLogo = Resources.T_Icon_Traversal_64;
             myGraphic.DrawImage(ImageUtilities.ResizeImage(traversalLogo, 32, 32), new Point(6, 3));
         }
     }
 }
Esempio n. 19
0
        /// <summary>
        /// this is only triggered for wraps, in case the featured (weapon render) image is drawn
        /// also draw the non featured image to make it clear it's a wrap, not a weapon
        /// </summary>
        /// <param name="theItem"></param>
        /// <param name="myGraphic"></param>
        private static void DrawAdditionalImage(JToken theItem, Graphics myGraphic)
        {
            JToken largePreviewImage = theItem["LargePreviewImage"];

            if (largePreviewImage != null)
            {
                JToken assetPathName = largePreviewImage["asset_path_name"];
                if (assetPathName != null)
                {
                    string textureFile = Path.GetFileName(assetPathName.Value <string>()).Substring(0, Path.GetFileName(assetPathName.Value <string>()).LastIndexOf('.'));

                    ItemIcon.ItemIconPath = JohnWick.AssetToTexture2D(textureFile);
                    if (File.Exists(ItemIcon.ItemIconPath))
                    {
                        Image itemIcon;
                        using (var bmpTemp = new Bitmap(ItemIcon.ItemIconPath))
                        {
                            itemIcon = new Bitmap(bmpTemp);
                        }
                        myGraphic.DrawImage(ImageUtilities.ResizeImage(itemIcon, 122, 122), new Point(275, 272));
                    }
                }
            }
        }
Esempio n. 20
0
        private static void drawUnknownReward()
        {
            Image itemIcon = Resources.unknown512;

            toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 110, 110), new Point(2300, theY + 6));
        }
Esempio n. 21
0
        /// <summary>
        /// draw the pretty header if DisplayStyle exist, else the pretty header but with random colors
        /// </summary>
        /// <param name="myBitmap"></param>
        /// <param name="myBundle"></param>
        public static void drawBackground(Bitmap myBitmap, ChallengeBundleIdParser myBundle)
        {
            if (Settings.Default.createIconForChallenges && myBundle.DisplayStyle != null)
            {
                //main header
                toDrawOn.FillRectangle(new SolidBrush(BundleInfos.getSecondaryColor(myBundle)), new Rectangle(0, 0, myBitmap.Width, 281));

                //gradient at left and right main header
                LinearGradientBrush linGrBrush_left = new LinearGradientBrush(new Point(0, 282 / 2), new Point(282, 282 / 2),
                                                                              ControlPaint.Light(BundleInfos.getSecondaryColor(myBundle), (float)0.3), BundleInfos.getSecondaryColor(myBundle));
                toDrawOn.FillRectangle(linGrBrush_left, new Rectangle(0, 0, 282, 282));
                LinearGradientBrush linGrBrush_right = new LinearGradientBrush(new Point(2500, 282 / 2), new Point(1500, 282 / 2),
                                                                               ControlPaint.Light(BundleInfos.getSecondaryColor(myBundle), (float)0.3), BundleInfos.getSecondaryColor(myBundle));
                toDrawOn.FillRectangle(linGrBrush_right, new Rectangle(1500, 0, 1000, 282));

                //last folder with border
                GraphicsPath p     = new GraphicsPath();
                Pen          myPen = new Pen(ControlPaint.Light(BundleInfos.getSecondaryColor(myBundle), (float)0.2), 3);
                myPen.LineJoin = LineJoin.Round; //needed to avoid spikes
                p.AddString(BundleInfos.getLastFolder(BundlePath), FontUtilities.pfc.Families[1], (int)FontStyle.Regular, 55, new Point(342, 40), FontUtilities.leftString);
                toDrawOn.DrawPath(myPen, p);
                toDrawOn.FillPath(new SolidBrush(ControlPaint.Dark(BundleInfos.getSecondaryColor(myBundle), (float)0.05)), p);

                //name
                toDrawOn.DrawString(BundleInfos.getBundleDisplayName(myItem), new Font(FontUtilities.pfc.Families[1], 115), new SolidBrush(Color.White), new Point(325, 70));

                //image
                string textureFile = Path.GetFileName(myBundle.DisplayStyle.DisplayImage.AssetPathName).Substring(0, Path.GetFileName(myBundle.DisplayStyle.DisplayImage.AssetPathName).LastIndexOf('.'));
                Image  challengeIcon;
                using (var bmpTemp = new Bitmap(JohnWick.AssetToTexture2D(textureFile)))
                {
                    challengeIcon = new Bitmap(bmpTemp);
                }
                toDrawOn.DrawImage(ImageUtilities.ResizeImage(challengeIcon, 282, 282), new Point(40, 0));

                //fill the rest
                toDrawOn.FillRectangle(new SolidBrush(ControlPaint.Dark(BundleInfos.getSecondaryColor(myBundle), (float)0.1)), new Rectangle(0, 271, myBitmap.Width, myBitmap.Height));
            }
            else
            {
                Color myBaseColor = getRandomColor();

                //main header
                toDrawOn.FillRectangle(new SolidBrush(myBaseColor), new Rectangle(0, 0, myBitmap.Width, 281));

                //gradient at left and right main header
                LinearGradientBrush linGrBrush_left = new LinearGradientBrush(new Point(0, 282 / 2), new Point(282, 282 / 2),
                                                                              ControlPaint.Light(myBaseColor, (float)0.3), myBaseColor);
                toDrawOn.FillRectangle(linGrBrush_left, new Rectangle(0, 0, 282, 282));
                LinearGradientBrush linGrBrush_right = new LinearGradientBrush(new Point(2500, 282 / 2), new Point(1500, 282 / 2),
                                                                               ControlPaint.Light(myBaseColor, (float)0.3), myBaseColor);
                toDrawOn.FillRectangle(linGrBrush_right, new Rectangle(1500, 0, 1000, 282));

                //fill the rest
                toDrawOn.FillRectangle(new SolidBrush(ControlPaint.Dark(myBaseColor, (float)0.1)), new Rectangle(0, 271, myBitmap.Width, myBitmap.Height));

                //last folder
                toDrawOn.DrawString(BundleInfos.getLastFolder(BundlePath), new Font(FontUtilities.pfc.Families[1], 42), new SolidBrush(ControlPaint.Dark(myBaseColor, (float)0.05)), new Point(40, 40));

                //name
                toDrawOn.DrawString(BundleInfos.getBundleDisplayName(myItem), new Font(FontUtilities.pfc.Families[1], 115), new SolidBrush(Color.White), new Point(25, 70));
            }
        }
Esempio n. 22
0
        private static void drawRewards(string itemId, string type, string quantity)
        {
            string value = ThePak.AllpaksDictionary.Where(x => string.Equals(x.Key, itemId, StringComparison.CurrentCultureIgnoreCase)).Select(d => d.Key).FirstOrDefault();

            if (value != null)
            {
                string extractedIconPath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary[value], value);
                if (extractedIconPath != null)
                {
                    if (extractedIconPath.Contains(".uasset") || extractedIconPath.Contains(".uexp") || extractedIconPath.Contains(".ubulk"))
                    {
                        JohnWick.MyAsset = new PakAsset(extractedIconPath.Substring(0, extractedIconPath.LastIndexOf('.')));
                        try
                        {
                            if (JohnWick.MyAsset.GetSerialized() != null)
                            {
                                dynamic AssetData  = JsonConvert.DeserializeObject(JohnWick.MyAsset.GetSerialized());
                                JArray  AssetArray = JArray.FromObject(AssetData);

                                ItemIcon.ItemIconPath = string.Empty;
                                ItemIcon.SearchAthIteDefIcon(AssetArray[0]);
                                if (File.Exists(ItemIcon.ItemIconPath))
                                {
                                    Image itemIcon;
                                    using (var bmpTemp = new Bitmap(ItemIcon.ItemIconPath))
                                    {
                                        itemIcon = new Bitmap(bmpTemp);
                                    }
                                    BundleDesign.toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 48, 48), new Point(947, BundleDesign.theY + 12));
                                }
                            }
                        }
                        catch (JsonSerializationException)
                        {
                            //do not crash when JsonSerialization does weird stuff
                        }
                    }
                }
            }

            GraphicsPath graphicsPath = null;

            switch (type)
            {
            case "athenabattlestar":
            {
                graphicsPath = new GraphicsPath();
                drawPathAndFill(graphicsPath, quantity, Color.FromArgb(255, 143, 74, 32), Color.FromArgb(255, 255, 219, 103));
                break;
            }

            case "AthenaSeasonalXP":
            {
                graphicsPath = new GraphicsPath();
                drawPathAndFill(graphicsPath, quantity, Color.FromArgb(255, 81, 131, 15), Color.FromArgb(255, 230, 253, 177));
                break;
            }

            case "MtxGiveaway":
            {
                graphicsPath = new GraphicsPath();
                drawPathAndFill(graphicsPath, quantity, Color.FromArgb(255, 100, 160, 175), Color.FromArgb(255, 220, 230, 255));
                break;
            }

            case "AthenaFortbyte":
            {
                BundleDesign.toDrawOn.DrawString("#" + Int32.Parse(quantity).ToString("D2"), new Font(FontUtilities.pfc.Families[1], 40), new SolidBrush(Color.White), new Point(975, BundleDesign.theY + 5), FontUtilities.rightString);
                break;
            }

            default:
                break;
            }

            if (graphicsPath != null)
            {
                graphicsPath.Dispose();
            }
        }
Esempio n. 23
0
        private static void drawHeader(Bitmap myBitmap, JToken myBundle)
        {
            bool   isSXBanner        = false;
            string bundleDisplayName = BundleInfos.getBundleDisplayName(myItem);
            string lastFolder        = BundleInfos.getLastFolder(BundlePath);

            JToken displayStyle = myBundle["DisplayStyle"];

            if (displayStyle != null)
            {
                if (Settings.Default.isChallengesTheme)
                {
                    string[] colorParts = Settings.Default.challengesColors.Split(',');
                    headerColor = Color.FromArgb(255, Int32.Parse(colorParts[0]), Int32.Parse(colorParts[1]), Int32.Parse(colorParts[2]));
                }
                else
                {
                    headerColor = BundleInfos.getSecondaryColor(myBundle);
                }

                JToken customBackground = displayStyle["CustomBackground"];
                JToken displayImage     = displayStyle["DisplayImage"];
                if (customBackground != null)
                {
                    JToken assetPathName = customBackground["asset_path_name"];
                    if (assetPathName != null)
                    {
                        if (assetPathName.Value <string>().Contains("/Game/Athena/UI/Challenges/Art/MissionTileImages/") && !ThePak.CurrentUsedItem.Equals("QuestBundle_S10_SeasonX"))
                        {
                            isSXBanner = true;
                            string textureFile   = Path.GetFileName(assetPathName.Value <string>()).Substring(0, Path.GetFileName(assetPathName.Value <string>()).LastIndexOf('.'));
                            Image  challengeIcon = Resources.unknown512;
                            string textureAsset  = JohnWick.AssetToTexture2D(textureFile);;
                            if (!string.IsNullOrEmpty(textureAsset))
                            {
                                using (var bmpTemp = new Bitmap(textureAsset))
                                {
                                    challengeIcon = new Bitmap(bmpTemp);
                                }
                            }

                            toDrawOn.FillRectangle(new SolidBrush(headerColor), new Rectangle(-1, -1, myBitmap.Width + 1, 257));
                            if (Settings.Default.isChallengesTheme && File.Exists(Settings.Default.challengesBannerFileName))
                            {
                                Image banner       = Image.FromFile(Settings.Default.challengesBannerFileName);
                                var   opacityImage = ImageUtilities.SetImageOpacity(banner, (float)Settings.Default.challengesOpacity / 1000);
                                toDrawOn.DrawImage(ImageUtilities.ResizeImage(opacityImage, 1024, 256), 0, 0);
                            }
                            else
                            {
                                var opacityImage = ImageUtilities.SetImageOpacity(challengeIcon, (float)0.3);
                                toDrawOn.DrawImage(opacityImage, new Point(0, 0));
                            }
                        }
                    }
                }
                if (!isSXBanner)
                {
                    if (displayImage != null)
                    {
                        JToken assetPathName = displayImage["asset_path_name"];
                        if (assetPathName != null)
                        {
                            string textureFile   = Path.GetFileName(assetPathName.Value <string>()).Substring(0, Path.GetFileName(assetPathName.Value <string>()).LastIndexOf('.'));
                            Image  challengeIcon = Resources.unknown512;
                            string textureAsset  = JohnWick.AssetToTexture2D(textureFile);
                            if (!string.IsNullOrEmpty(textureAsset))
                            {
                                using (var bmpTemp = new Bitmap(textureAsset))
                                {
                                    challengeIcon = new Bitmap(bmpTemp);
                                }
                            }

                            toDrawOn.FillRectangle(new SolidBrush(headerColor), new Rectangle(-1, -1, myBitmap.Width + 1, 257));
                            if (Settings.Default.isChallengesTheme)
                            {
                                if (File.Exists(Settings.Default.challengesBannerFileName))
                                {
                                    Image banner       = Image.FromFile(Settings.Default.challengesBannerFileName);
                                    var   opacityImage = ImageUtilities.SetImageOpacity(banner, (float)Settings.Default.challengesOpacity / 1000);
                                    toDrawOn.DrawImage(ImageUtilities.ResizeImage(opacityImage, 1024, 256), 0, 0);
                                }
                            }

                            toDrawOn.DrawImage(ImageUtilities.ResizeImage(challengeIcon, 256, 256), new Point(0, 0));
                        }
                    }
                    else
                    {
                        toDrawOn.FillRectangle(new SolidBrush(headerColor), new Rectangle(-1, -1, myBitmap.Width + 1, 257));
                        if (Settings.Default.isChallengesTheme)
                        {
                            if (File.Exists(Settings.Default.challengesBannerFileName))
                            {
                                Image banner       = Image.FromFile(Settings.Default.challengesBannerFileName);
                                var   opacityImage = ImageUtilities.SetImageOpacity(banner, (float)Settings.Default.challengesOpacity / 1000);
                                toDrawOn.DrawImage(ImageUtilities.ResizeImage(opacityImage, 1024, 256), 0, 0);
                            }
                        }
                    }
                }
            }
            else
            {
                if (Settings.Default.isChallengesTheme)
                {
                    string[] colorParts = Settings.Default.challengesColors.Split(',');
                    headerColor = Color.FromArgb(255, Int32.Parse(colorParts[0]), Int32.Parse(colorParts[1]), Int32.Parse(colorParts[2]));
                }
                else
                {
                    headerColor = getRandomColor();
                }

                toDrawOn.FillRectangle(new SolidBrush(headerColor), new Rectangle(-1, -1, myBitmap.Width + 1, 257));
                if (Settings.Default.isChallengesTheme)
                {
                    if (File.Exists(Settings.Default.challengesBannerFileName))
                    {
                        Image banner       = Image.FromFile(Settings.Default.challengesBannerFileName);
                        var   opacityImage = ImageUtilities.SetImageOpacity(banner, (float)Settings.Default.challengesOpacity / 1000);
                        toDrawOn.DrawImage(ImageUtilities.ResizeImage(opacityImage, 1024, 256), 0, 0);
                    }
                }
            }

            GraphicsPath gp = new GraphicsPath();

            gp.StartFigure();
            gp.AddLine(0, 256, myBitmap.Width, 256);
            gp.AddLine(myBitmap.Width, 256, myBitmap.Width, 241);
            gp.AddLine(myBitmap.Width, 241, myBitmap.Width / 2 + 25, 236);
            gp.AddLine(myBitmap.Width / 2 + 25, 236, myBitmap.Width / 2 + 35, 249);
            gp.AddLine(myBitmap.Width / 2 + 35, 249, 0, 241);
            gp.CloseFigure();
            toDrawOn.FillPath(new SolidBrush(ControlPaint.Light(headerColor)), gp);

            GraphicsPath p     = new GraphicsPath();
            Pen          myPen = new Pen(ControlPaint.Light(headerColor, (float)0.2), 3);

            myPen.LineJoin = LineJoin.Round; //needed to avoid spikes
            p.AddString(
                lastFolder,
                Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[1],
                (int)FontStyle.Regular, 30,
                new Point(isSXBanner || displayStyle == null ? 30 : 265, 70),
                FontUtilities.leftString
                );
            toDrawOn.DrawPath(myPen, p);
            toDrawOn.FillPath(new SolidBrush(ControlPaint.Dark(headerColor, (float)0.05)), p);

            toDrawOn.DrawString(bundleDisplayName, new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[1], 40), new SolidBrush(Color.White), new Point(isSXBanner || displayStyle == null ? 25 : 260, 105));

            toDrawOn.FillRectangle(new SolidBrush(ControlPaint.Dark(headerColor, (float)0.1)), new Rectangle(-1, 255, myBitmap.Width + 1, myBitmap.Height));
        }