/// <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); } } }
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(); } }
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)); } }
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); } }
/// <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)); } } }
/// <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)); } } } }
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)); }
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(); } }
/// <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)); } }
private static void drawUnknownReward() { Image itemIcon = Resources.unknown512; toDrawOn.DrawImage(ImageUtilities.ResizeImage(itemIcon, 110, 110), new Point(2300, theY + 6)); }