diff --git a/Base/Base/Data_Classes/Character.cs b/Base/Base/Data_Classes/Character.cs index 8fb144a5..ac993809 100644 --- a/Base/Base/Data_Classes/Character.cs +++ b/Base/Base/Data_Classes/Character.cs @@ -621,24 +621,22 @@ int GetFirstAvailableSlotLevel(int iLevel = 0) public int SlotCheck(PowerEntry power) { - int num1; if (power.Power == null || !this.CanPlaceSlot || power.SlotCount > 5) - num1 = -1; + return -1; else if (!DatabaseAPI.Database.Power[power.NIDPower].Slottable) { - num1 = -1; + return -1; } else { int iLevel = power.Level; if (DatabaseAPI.Database.Power[power.NIDPower].AllowFrontLoading) iLevel = 0; - int num2 = this.GetFirstAvailableSlotLevel(iLevel); - if (MidsContext.Config.BuildMode == Enums.dmModes.LevelUp && num2 > this.CurrentBuild.GetMaxLevel() + 1) - num2 = -1; - num1 = num2; + int firstAvailable = this.GetFirstAvailableSlotLevel(iLevel); + if (MidsContext.Config.BuildMode == Enums.dmModes.LevelUp && firstAvailable > this.CurrentBuild.GetMaxLevel() + 1) + firstAvailable = -1; + return firstAvailable; } - return num1; } public int[] GetSlotCounts() diff --git a/Base/ConfigData.cs b/Base/ConfigData.cs index deca2bda..660b03b3 100644 --- a/Base/ConfigData.cs +++ b/Base/ConfigData.cs @@ -6,14 +6,23 @@ using System.Reflection; using System.Runtime.InteropServices; using System.Windows.Forms; + +using Base; + public interface ISerialize { string Serialize(object o); T Deserialize(string x); string Extension { get; } } + public class ConfigData { + public ConfigData.SDamageMath DamageMath; + public ConfigData.IncludeExclude Inc; + public ConfigData.Si9 I9; + public ConfigData.FontSettings RtFont; + public float BaseAcc = 0.75f; public string UpdatePath = null; public bool DoNotUpdateFileAssociation; @@ -73,39 +82,33 @@ public string DefaultSaveFolderOverride 3, 0, 5, 0, 3, 5, 0, 0, 5, 0, 2, 3, 0, 2, 2, 0, 0, 0, 0, 0 }; public Enums.eSpeedMeasure SpeedFormat = Enums.eSpeedMeasure.MilesPerHour; - static ConfigData _current; - - public bool ExportBonusTotals; - public bool ExportBonusList; - public bool NoToolTips; - public bool DataDamageGraphPercentageOnly; - bool _hideOriginEnhancements; - - public bool CheckForUpdates; - public Enums.eVisibleSize DvState; - public Enums.eSuppress Suppression; - public bool UseArcanaTime; - public ConfigData.SDamageMath DamageMath; - public ConfigData.IncludeExclude Inc; + static ConfigData _current { get; set; } + + public bool ExportBonusTotals { get; set; } + public bool ExportBonusList { get; set; } + public bool NoToolTips { get; set; } + public bool DataDamageGraphPercentageOnly { get; set; } + + public bool CheckForUpdates { get; set; } + public Enums.eVisibleSize DvState { get; set; } + public Enums.eSuppress Suppression { get; set; } + public bool UseArcanaTime { get; set; } public readonly ExportConfig Export; - public ConfigData.Si9 I9; - public ConfigData.FontSettings RtFont; - public bool PrintInColour; - int _printScheme; - - public bool PrintHistory; - public bool SaveFolderChecked; - public bool ShowSlotLevels; - public bool ShowEnhRel; - public bool ShowRelSymbols; - public bool EnhanceVisibility; - public Tips Tips; + public bool PrintInColour { get; set; } + + public bool PrintHistory { get; set; } + public bool SaveFolderChecked { get; set; } + public bool ShowSlotLevels { get; set; } + public bool ShowEnhRel { get; set; } + public bool ShowRelSymbols { get; set; } + public bool EnhanceVisibility { get; set; } + public Tips Tips { get; set; } public bool PopupRecipes { get; set; } - public bool ShoppingListIncludesRecipes; - public bool ExportChunkOnly; - public bool LongExport; - public bool MasterMode; - public bool ShrinkFrmSets; + public bool ShoppingListIncludesRecipes { get; set; } + public bool ExportChunkOnly { get; set; } + public bool LongExport { get; set; } + public bool MasterMode { get; set; } + public bool ShrinkFrmSets { get; set; } internal static ConfigData Current { @@ -126,6 +129,7 @@ static void MigrateToSerializer(string mhdFn, ISerialize serializer) File.Move(mhdFn, mhdFn + ".old"); oldMethod.SaveConfig(serializer); } + public static void Initialize(ISerialize serializer) { // migrate @@ -145,7 +149,6 @@ public static void Initialize(ISerialize serializer) catch { MessageBox.Show("Failed to load json config, falling back to mhd"); - } } else @@ -153,9 +156,6 @@ public static void Initialize(ISerialize serializer) ConfigData._current = new ConfigData(deserializing: false, iFilename: Files.GetConfigFilename(forceMhd: true)); } ConfigData._current.IntializeComponent(); - - //configData = ConfigData._current = new ConfigData( - } ConfigData() : this(true, "") { } @@ -185,7 +185,7 @@ public static void Initialize(ISerialize serializer) { try { - this.Load(iFilename); + this.LegacyForMigration(iFilename); } catch (Exception ex) { @@ -194,6 +194,7 @@ public static void Initialize(ISerialize serializer) } this.IntializeComponent(); } + void IntializeComponent() { this.RelocateSaveFolder(false); @@ -208,29 +209,25 @@ void IntializeComponent() } - void Load(string iFilename) + void LegacyForMigration(string iFilename) { - if (iFilename.EndsWith("json")) - { - - } //using (FileStream fileStream = new FileStream(iFilename, FileMode.Open, FileAccess.Read)) { using (BinaryReader reader = new BinaryReader(File.Open(iFilename, FileMode.Open, FileAccess.Read))) { - float num1; + float version; switch (reader.ReadString()) { // legacy string, refers to something specific in files, do not change case "Mids' Hero Designer Config": - num1 = 0.9f; + version = 0.9f; break; // legacy string, refers to something specific in files, do not change // here's something F# doesn't do easily(fallthrough where one branch has a when variable declared) case "Mids' Hero Designer Config V2": case string x when x == header: - num1 = reader.ReadSingle(); + version = reader.ReadSingle(); break; default: MessageBox.Show("Config file was missing a header! Using defaults."); @@ -244,11 +241,11 @@ void Load(string iFilename) this.DChannel = reader.ReadString();*/ this.NoToolTips = reader.ReadBoolean(); this.BaseAcc = reader.ReadSingle(); - double num3 = (double)reader.ReadSingle(); - double num4 = (double)reader.ReadSingle(); - double num5 = (double)reader.ReadSingle(); - double num6 = (double)reader.ReadSingle(); - double num7 = (double)reader.ReadSingle(); + double num3 = reader.ReadSingle(); + double num4 = reader.ReadSingle(); + double num5 = reader.ReadSingle(); + double num6 = reader.ReadSingle(); + double num7 = reader.ReadSingle(); this.CalcEnhLevel = (Enums.eEnhRelative)reader.ReadInt32(); this.CalcEnhOrigin = (Enums.eEnhGrade)reader.ReadInt32(); this.ExempHigh = reader.ReadInt32(); @@ -257,7 +254,7 @@ void Load(string iFilename) reader.ReadBoolean(); this.DamageMath.Calculate = (ConfigData.EDamageMath)reader.ReadInt32(); reader.ReadSingle(); - if ((double)num1 < 1.24000000953674) + if (version < 1.24000000953674) { reader.ReadBoolean(); } @@ -269,12 +266,13 @@ void Load(string iFilename) this.DataGraphType = (Enums.eDDGraph)reader.ReadInt32(); this.ExportScheme = reader.ReadInt32(); this.ExportTarget = reader.ReadInt32(); - if ((double)num1 >= 1.24000000953674) + if (version >= 1.24000000953674) { this.ExportBonusTotals = reader.ReadBoolean(); this.ExportBonusList = reader.ReadBoolean(); } - this._hideOriginEnhancements = reader.ReadBoolean(); + //this._hideOriginEnhancements = + reader.ReadBoolean(); this.ShowVillainColours = reader.ReadBoolean(); this.CheckForUpdates = reader.ReadBoolean(); this.Columns = reader.ReadInt32(); @@ -282,11 +280,11 @@ void Load(string iFilename) this.LastSize.Height = reader.ReadInt32(); this.DvState = (Enums.eVisibleSize)reader.ReadInt32(); this.StatGraphStyle = (Enums.GraphStyle)reader.ReadInt32(); - if ((double)num1 >= 1.0) + if (version >= 1.0) this.FreshInstall = reader.ReadBoolean(); - if ((double)num1 >= 1.10000002384186) + if (version >= 1.10000002384186) this.ForceLevel = reader.ReadInt32(); - if ((double)num1 >= 1.20000004768372) + if (version >= 1.20000004768372) { this.I9.DefaultIOLevel = reader.ReadInt32(); if (this.I9.DefaultIOLevel > 49) @@ -302,42 +300,43 @@ void Load(string iFilename) this.I9.ExportStripSetNames = reader.ReadBoolean(); this.I9.ExportExtraSep = reader.ReadBoolean(); this.PrintInColour = reader.ReadBoolean(); - this._printScheme = reader.ReadInt32(); + //this._printScheme = + reader.ReadInt32(); } - if ((double)num1 >= 1.21000003814697) + if (version >= 1.21000003814697) { this.RtFont.PairedBase = reader.ReadSingle(); this.RtFont.PairedBold = reader.ReadBoolean(); this.RtFont.RTFBase = reader.ReadInt32(); this.RtFont.RTFBold = reader.ReadBoolean(); - this.RtFont.ColorBackgroundHero = ConfigData.ReadRGB(reader); - this.RtFont.ColorBackgroundVillain = ConfigData.ReadRGB(reader); - this.RtFont.ColorEnhancement = ConfigData.ReadRGB(reader); - this.RtFont.ColorFaded = ConfigData.ReadRGB(reader); - this.RtFont.ColorInvention = ConfigData.ReadRGB(reader); - this.RtFont.ColorInventionInv = ConfigData.ReadRGB(reader); - this.RtFont.ColorText = ConfigData.ReadRGB(reader); - this.RtFont.ColorWarning = ConfigData.ReadRGB(reader); - this.RtFont.ColorPlName = ConfigData.ReadRGB(reader); - this.RtFont.ColorPlSpecial = ConfigData.ReadRGB(reader); + this.RtFont.ColorBackgroundHero = reader.ReadRGB(); + this.RtFont.ColorBackgroundVillain = reader.ReadRGB(); + this.RtFont.ColorEnhancement = reader.ReadRGB(); + this.RtFont.ColorFaded = reader.ReadRGB(); + this.RtFont.ColorInvention = reader.ReadRGB(); + this.RtFont.ColorInventionInv = reader.ReadRGB(); + this.RtFont.ColorText = reader.ReadRGB(); + this.RtFont.ColorWarning = reader.ReadRGB(); + this.RtFont.ColorPlName = reader.ReadRGB(); + this.RtFont.ColorPlSpecial = reader.ReadRGB(); } - if ((double)num1 >= 1.22000002861023) + if ((double)version >= 1.22000002861023) { this.ShowSlotLevels = reader.ReadBoolean(); this.LoadLastFileOnStart = reader.ReadBoolean(); this.LastFileName = reader.ReadString(); - this.RtFont.ColorPowerAvailable = ConfigData.ReadRGB(reader); - this.RtFont.ColorPowerTaken = ConfigData.ReadRGB(reader); - this.RtFont.ColorPowerTakenDark = ConfigData.ReadRGB(reader); - this.RtFont.ColorPowerDisabled = ConfigData.ReadRGB(reader); - this.RtFont.ColorPowerHighlight = ConfigData.ReadRGB(reader); + this.RtFont.ColorPowerAvailable = reader.ReadRGB(); + this.RtFont.ColorPowerTaken = reader.ReadRGB(); + this.RtFont.ColorPowerTakenDark = reader.ReadRGB(); + this.RtFont.ColorPowerDisabled = reader.ReadRGB(); + this.RtFont.ColorPowerHighlight = reader.ReadRGB(); } - if ((double)num1 >= 1.23000001907349) + if ((double)version >= 1.23000001907349) { this.Tips = new Tips(reader); this.DefaultSaveFolderOverride = reader.ReadString(); } - if ((double)num1 >= 1.24000000953674) + if ((double)version >= 1.24000000953674) { this.EnhanceVisibility = reader.ReadBoolean(); reader.ReadBoolean(); @@ -347,12 +346,12 @@ void Load(string iFilename) if (string.IsNullOrEmpty(this.UpdatePath)) this.UpdatePath = ""; } - if ((double)num1 >= 1.25) + if ((double)version >= 1.25) { this.ShowEnhRel = reader.ReadBoolean(); this.ShowRelSymbols = reader.ReadBoolean(); this.ShowPopup = reader.ReadBoolean(); - if ((double)num1 >= 1.32000005245209) + if ((double)version >= 1.32000005245209) this.ShowAlphaPopup = reader.ReadBoolean(); this.PopupRecipes = reader.ReadBoolean(); this.ShoppingListIncludesRecipes = reader.ReadBoolean(); @@ -363,21 +362,21 @@ void Load(string iFilename) this.DesaturateInherent = reader.ReadBoolean(); this.ReapeatOnMiddleClick = reader.ReadBoolean(); } - if ((double)num1 >= 1.25999999046326) + if ((double)version >= 1.25999999046326) this.ExportHex = reader.ReadBoolean(); - if ((double)num1 >= 1.26999998092651) + if ((double)version >= 1.26999998092651) this.SpeedFormat = (Enums.eSpeedMeasure)reader.ReadInt32(); - if ((double)num1 >= 1.27999997138977) + if ((double)version >= 1.27999997138977) this.SaveFolderChecked = reader.ReadBoolean(); - if ((double)num1 >= 1.28999996185303) + if ((double)version >= 1.28999996185303) this.UseArcanaTime = reader.ReadBoolean(); //this is correct /*Commented out to expidite release.... Will not load forum Export settings or supression settings - * if ((double)num1 >= 1.29999995231628) + * if ((double)version >= 1.29999995231628) { // numbers seem really off which is screwing up the rest of the read tempNum = reader.ReadInt16(); this.Suppression = (Enums.eSuppress)tempNum; } - if ((double)num1 >= 1.30999994277954) + if ((double)version >= 1.30999994277954) { for (int index = 0; index < 19; ++index) { this.DragDropScenarioAction[index] = reader.ReadInt16(); @@ -392,7 +391,7 @@ void Load(string iFilename) this.Export.ColorSchemes[index].Level = ConfigData.ReadRGB(reader); this.Export.ColorSchemes[index].Slots = ConfigData.ReadRGB(reader); this.Export.ColorSchemes[index].Title = ConfigData.ReadRGB(reader); - if ((double)num1 >= 1.20000004768372) + if ((double)version >= 1.20000004768372) { this.Export.ColorSchemes[index].IOColor = ConfigData.ReadRGB(reader); this.Export.ColorSchemes[index].SetColor = ConfigData.ReadRGB(reader); @@ -436,18 +435,11 @@ public void CreateDefaultSaveFolder() } void SaveRaw(ISerialize serializer, string iFilename) - { - SaveRawMhd(serializer, this, iFilename, null); - } + => SaveRawMhd(serializer, this, iFilename, null); const string header = "Mids' Hero Designer Config V2"; void Save(ISerialize serializer, string iFilename) - { - SaveRaw(serializer, iFilename); - } - - static Color ReadRGB(BinaryReader reader) - => Color.FromArgb((int)reader.ReadByte(), (int)reader.ReadByte(), (int)reader.ReadByte()); + => SaveRaw(serializer, iFilename); void RelocateSaveFolder(bool manual) { diff --git a/Base/Extensions.cs b/Base/Extensions.cs index d78873e0..28cd90f3 100644 --- a/Base/Extensions.cs +++ b/Base/Extensions.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Drawing; using System.IO; using System.Linq; using System.Text; @@ -9,6 +10,9 @@ namespace Base { public static class Extensions { + public static Color ReadRGB(this BinaryReader reader) + => Color.FromArgb(reader.ReadByte(), reader.ReadByte(), reader.ReadByte()); + //public static T[] Append(this T[] source, T item) //{ // var next = new T[source.Length + 1]; diff --git a/Hero Designer/Extensions.cs b/Hero Designer/Extensions.cs index c47d5bf8..f1170b9a 100644 --- a/Hero Designer/Extensions.cs +++ b/Hero Designer/Extensions.cs @@ -17,6 +17,7 @@ public class ListBoxT public ListBoxT(ListBox lb) => this._lb = lb; } + public class ComboBoxT { readonly ComboBox _cb; @@ -67,9 +68,7 @@ public static void ExecuteWithCatchMessage(this Action f, string titlingOpt = nu // this could be chained indefinitely so... be careful with it // defer the execution until later public static Action WithCatchMessage(this Action f, string titling, string captionOpt = null) - { - return () => ExecuteWithCatchMessage(f, titling, captionOpt); - } + => () => ExecuteWithCatchMessage(f, titling, captionOpt); // does not handle the possibility this is a child control, and a parent is in design mode public static bool IsInDesignMode(this Control c) => LicenseManager.UsageMode == LicenseUsageMode.Designtime || c?.Site?.DesignMode == true; diff --git a/Hero Designer/Forms/DataView.cs b/Hero Designer/Forms/DataView.cs index 750a6298..0ad8a33a 100644 --- a/Hero Designer/Forms/DataView.cs +++ b/Hero Designer/Forms/DataView.cs @@ -1030,7 +1030,7 @@ void DisplayFlippedEnhancements() Bounds.Y -= 3f; Bounds.Height = Control.DefaultFont.GetHeight(this.bxFlip.Graphics); Graphics graphics2 = this.bxFlip.Graphics; - clsDrawX.DrawOutlineText(Conversions.ToString(MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].Enhancement.IOLevel + 1), Bounds, Color.Cyan, Color.FromArgb(128, 0, 0, 0), this.pnlEnhActive.Font, 1f, ref graphics2, false, false); + clsDrawX.DrawOutlineText(Conversions.ToString(MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].Enhancement.IOLevel + 1), Bounds, Color.Cyan, Color.FromArgb(128, 0, 0, 0), this.pnlEnhActive.Font, 1f, graphics2, false, false); } else if (MidsContext.Config.ShowEnhRel & (DatabaseAPI.Database.Enhancements[MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].Enhancement.Enh].TypeID == Enums.eType.Normal | DatabaseAPI.Database.Enhancements[MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].Enhancement.Enh].TypeID == Enums.eType.SpecialO)) { @@ -1039,7 +1039,7 @@ void DisplayFlippedEnhancements() Bounds.Height = Control.DefaultFont.GetHeight(this.bxFlip.Graphics); Color Text = MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].Enhancement.RelativeLevel != Enums.eEnhRelative.None ? (MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].Enhancement.RelativeLevel >= Enums.eEnhRelative.Even ? (MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].Enhancement.RelativeLevel <= Enums.eEnhRelative.Even ? Color.White : Color.FromArgb(0, (int)byte.MaxValue, (int)byte.MaxValue)) : Color.Yellow) : Color.Red; Graphics graphics2 = this.bxFlip.Graphics; - clsDrawX.DrawOutlineText(Enums.GetRelativeString(MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].Enhancement.RelativeLevel, MidsContext.Config.ShowRelSymbols), Bounds, Text, Color.FromArgb(128, 0, 0, 0), this.pnlEnhActive.Font, 1f, ref graphics2, false, false); + clsDrawX.DrawOutlineText(Enums.GetRelativeString(MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].Enhancement.RelativeLevel, MidsContext.Config.ShowRelSymbols), Bounds, Text, Color.FromArgb(128, 0, 0, 0), this.pnlEnhActive.Font, 1f, graphics2, false, false); } } } @@ -1060,7 +1060,7 @@ void DisplayFlippedEnhancements() Bounds.Y -= 3f; Bounds.Height = Control.DefaultFont.GetHeight(this.bxFlip.Graphics); Graphics graphics2 = this.bxFlip.Graphics; - clsDrawX.DrawOutlineText(Conversions.ToString(MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].FlippedEnhancement.IOLevel + 1), Bounds, Color.Cyan, Color.FromArgb(128, 0, 0, 0), this.pnlEnhActive.Font, 1f, ref graphics2, false, false); + clsDrawX.DrawOutlineText(Conversions.ToString(MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].FlippedEnhancement.IOLevel + 1), Bounds, Color.Cyan, Color.FromArgb(128, 0, 0, 0), this.pnlEnhActive.Font, 1f, graphics2, false, false); } else if (MidsContext.Config.ShowEnhRel & (DatabaseAPI.Database.Enhancements[MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].FlippedEnhancement.Enh].TypeID == Enums.eType.Normal | DatabaseAPI.Database.Enhancements[MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].FlippedEnhancement.Enh].TypeID == Enums.eType.SpecialO)) { @@ -1069,7 +1069,7 @@ void DisplayFlippedEnhancements() Bounds.Height = Control.DefaultFont.GetHeight(this.bxFlip.Graphics); Color Text = MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].FlippedEnhancement.RelativeLevel != Enums.eEnhRelative.None ? (MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].FlippedEnhancement.RelativeLevel >= Enums.eEnhRelative.Even ? (MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].FlippedEnhancement.RelativeLevel <= Enums.eEnhRelative.Even ? Color.White : Color.FromArgb(0, (int)byte.MaxValue, (int)byte.MaxValue)) : Color.Yellow) : Color.Red; Graphics graphics2 = this.bxFlip.Graphics; - clsDrawX.DrawOutlineText(Enums.GetRelativeString(MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].FlippedEnhancement.RelativeLevel, MidsContext.Config.ShowRelSymbols), Bounds, Text, Color.FromArgb(128, 0, 0, 0), this.pnlEnhActive.Font, 1f, ref graphics2, false, false); + clsDrawX.DrawOutlineText(Enums.GetRelativeString(MidsContext.Character.CurrentBuild.Powers[inToonHistory].Slots[index].FlippedEnhancement.RelativeLevel, MidsContext.Config.ShowRelSymbols), Bounds, Text, Color.FromArgb(128, 0, 0, 0), this.pnlEnhActive.Font, 1f, graphics2, false, false); } } } diff --git a/Hero Designer/Forms/WindowMenuItems/frmTotals.cs b/Hero Designer/Forms/WindowMenuItems/frmTotals.cs index 81afa65c..647eedbb 100644 --- a/Hero Designer/Forms/WindowMenuItems/frmTotals.cs +++ b/Hero Designer/Forms/WindowMenuItems/frmTotals.cs @@ -152,7 +152,7 @@ void PbClosePaint(object sender, PaintEventArgs e) float height2 = bFont.GetHeight(e.Graphics) + 2f; RectangleF Bounds = new RectangleF(0.0f, (float)(((double)this.tab0.Height - (double)height2) / 2.0), (float)this.tab0.Width, height2); Graphics graphics = extendedBitmap.Graphics; - clsDrawX.DrawOutlineText(iStr, Bounds, Color.WhiteSmoke, Color.FromArgb(192, 0, 0, 0), bFont, 1f, ref graphics, false, false); + clsDrawX.DrawOutlineText(iStr, Bounds, Color.WhiteSmoke, Color.FromArgb(192, 0, 0, 0), bFont, 1f, graphics, false, false); e.Graphics.DrawImage((Image)extendedBitmap.Bitmap, 0, 0); } @@ -186,7 +186,7 @@ void PbTopMostPaint(object sender, PaintEventArgs e) float height = bFont.GetHeight(e.Graphics) + 2f; RectangleF Bounds = new RectangleF(0.0f, (float)(((double)this.tab0.Height - (double)height) / 2.0), (float)this.tab0.Width, height); Graphics graphics = extendedBitmap.Graphics; - clsDrawX.DrawOutlineText(iStr, Bounds, Color.WhiteSmoke, Color.FromArgb(192, 0, 0, 0), bFont, 1f, ref graphics, false, false); + clsDrawX.DrawOutlineText(iStr, Bounds, Color.WhiteSmoke, Color.FromArgb(192, 0, 0, 0), bFont, 1f, graphics, false, false); e.Graphics.DrawImage((Image)extendedBitmap.Bitmap, 0, 0); } @@ -406,7 +406,7 @@ void TabPaint(ref PictureBox iTab, PaintEventArgs e, string iString, bool iState float height = bFont.GetHeight(e.Graphics) + 2f; RectangleF Bounds = new RectangleF(0.0f, (float)(((double)this.tab0.Height - (double)height) / 2.0), (float)this.tab0.Width, height); Graphics graphics = extendedBitmap.Graphics; - clsDrawX.DrawOutlineText(iString, Bounds, Color.WhiteSmoke, Color.FromArgb(192, 0, 0, 0), bFont, 1f, ref graphics, false, false); + clsDrawX.DrawOutlineText(iString, Bounds, Color.WhiteSmoke, Color.FromArgb(192, 0, 0, 0), bFont, 1f, graphics, false, false); e.Graphics.DrawImage((Image)extendedBitmap.Bitmap, 0, 0); } diff --git a/Hero Designer/Forms/frmMain.cs b/Hero Designer/Forms/frmMain.cs index 14f46673..0fba4973 100644 --- a/Hero Designer/Forms/frmMain.cs +++ b/Hero Designer/Forms/frmMain.cs @@ -25,7 +25,6 @@ public partial class frmMain : Form { #region "fields" - bool remember; Rectangle ActivePopupBounds; bool DataViewLocked; readonly short[] ddsa; @@ -5238,7 +5237,7 @@ void UpdateDMBuffer() float height2 = bFont.GetHeight(this.dmBuffer.Graphics) + 2f; RectangleF Bounds = new RectangleF(0.0f, (float)(((double)this.pbDynMode.Height - (double)height2) / 2.0), (float)this.pbDynMode.Width, height2); Graphics graphics = this.dmBuffer.Graphics; - clsDrawX.DrawOutlineText(iStr, Bounds, Color.WhiteSmoke, Color.FromArgb(192, 0, 0, 0), bFont, 1f, ref graphics, false, false); + clsDrawX.DrawOutlineText(iStr, Bounds, Color.WhiteSmoke, Color.FromArgb(192, 0, 0, 0), bFont, 1f, graphics, false, false); } void UpdateDynamicModeInfo() diff --git a/Hero Designer/clsToonX.cs b/Hero Designer/clsToonX.cs index b3a7f71b..81cf95e3 100644 --- a/Hero Designer/clsToonX.cs +++ b/Hero Designer/clsToonX.cs @@ -1204,8 +1204,8 @@ public void GenerateBuffedPowerArray() this._selfBuffs.Reset(); this._selfEnhance.Reset(); this.ModifyEffects = new Dictionary(); - this._buffedPower = new IPower[this.CurrentBuild.Powers.Count - 1 + 1]; - this._mathPower = new IPower[this.CurrentBuild.Powers.Count - 1 + 1]; + this._buffedPower = new IPower[this.CurrentBuild.Powers.Count]; + this._mathPower = new IPower[this.CurrentBuild.Powers.Count]; this.GBPA_Pass0_InitializePowerArray(); this.GenerateModifyEffectsArray(); this.GenerateBuffData(ref this._selfEnhance, true); diff --git a/midsControls/ListLabelV2.cs b/midsControls/ListLabelV2.cs index d75b72b0..68fefd64 100644 --- a/midsControls/ListLabelV2.cs +++ b/midsControls/ListLabelV2.cs @@ -57,7 +57,6 @@ public Color TextColor } } - // Token: 0x060001D4 RID: 468 RVA: 0x000113CC File Offset: 0x0000F5CC public void UpdateTextColors(ListLabelV2.LLItemState State, Color color) { if (!(State < LLItemState.Enabled | State > LLItemState.Heading)) @@ -72,13 +71,9 @@ public ListLabelItemV2 Item get { if (this.Item.Index < 0 | this.Item.Index > checked(this.Items.Length - 1)) - { return new ListLabelItemV2(); - } else - { return this.Items[this.Item.Index]; - } } set { @@ -90,9 +85,6 @@ public ListLabelItemV2 Item } } - // Token: 0x17000065 RID: 101 - // (get) Token: 0x060001D7 RID: 471 RVA: 0x000114C4 File Offset: 0x0000F6C4 - // (set) Token: 0x060001D8 RID: 472 RVA: 0x000114DC File Offset: 0x0000F6DC public override Color BackColor { get @@ -119,15 +111,9 @@ public Color HoverColor } } - // Token: 0x17000067 RID: 103 - // (get) Token: 0x060001DB RID: 475 RVA: 0x0001151C File Offset: 0x0000F71C - // (set) Token: 0x060001DC RID: 476 RVA: 0x00011534 File Offset: 0x0000F734 public int PaddingX { - get - { - return this.xPadding; - } + get => this.xPadding; set { if (value >= 0 & checked(value * 2 < base.Width - 5)) @@ -138,15 +124,9 @@ public int PaddingX } } - // Token: 0x17000068 RID: 104 - // (get) Token: 0x060001DD RID: 477 RVA: 0x00011570 File Offset: 0x0000F770 - // (set) Token: 0x060001DE RID: 478 RVA: 0x00011588 File Offset: 0x0000F788 public int PaddingY { - get - { - return this.yPadding; - } + get => this.yPadding; set { if (value >= 0 & (double)value < (double)base.Height / 3.0) @@ -158,15 +138,9 @@ public int PaddingY } } - // Token: 0x17000069 RID: 105 - // (get) Token: 0x060001DF RID: 479 RVA: 0x000115D4 File Offset: 0x0000F7D4 - // (set) Token: 0x060001E0 RID: 480 RVA: 0x000115EC File Offset: 0x0000F7EC public bool HighVis { - get - { - return this.TextOutline; - } + get => this.TextOutline; set { this.TextOutline = value; @@ -174,25 +148,11 @@ public bool HighVis } } - // Token: 0x1700006A RID: 106 - // (get) Token: 0x060001E1 RID: 481 RVA: 0x00011600 File Offset: 0x0000F800 - public int HoverID - { - get - { - return this.HoverIndex; - } - } + public int HoverID => this.HoverIndex; - // Token: 0x1700006B RID: 107 - // (get) Token: 0x060001E2 RID: 482 RVA: 0x00011618 File Offset: 0x0000F818 - // (set) Token: 0x060001E3 RID: 483 RVA: 0x00011630 File Offset: 0x0000F830 public bool SuspendRedraw { - get - { - return this.DisableRedraw; - } + get => this.DisableRedraw; set { this.DisableRedraw = value; @@ -211,9 +171,6 @@ public bool SuspendRedraw } } - // Token: 0x1700006C RID: 108 - // (get) Token: 0x060001E4 RID: 484 RVA: 0x00011680 File Offset: 0x0000F880 - // (set) Token: 0x060001E5 RID: 485 RVA: 0x00011698 File Offset: 0x0000F898 public bool Scrollable { get @@ -227,15 +184,9 @@ public bool Scrollable } } - // Token: 0x1700006D RID: 109 - // (get) Token: 0x060001E6 RID: 486 RVA: 0x000116AC File Offset: 0x0000F8AC - // (set) Token: 0x060001E7 RID: 487 RVA: 0x000116C4 File Offset: 0x0000F8C4 public bool Expandable { - get - { - return this.canExpand; - } + get => this.canExpand; set { this.canExpand = value; @@ -243,15 +194,9 @@ public bool Expandable } } - // Token: 0x1700006E RID: 110 - // (get) Token: 0x060001E8 RID: 488 RVA: 0x000116D8 File Offset: 0x0000F8D8 - // (set) Token: 0x060001E9 RID: 489 RVA: 0x000116F0 File Offset: 0x0000F8F0 public Size SizeNormal { - get - { - return this.szNormal; - } + get => this.szNormal; set { this.szNormal = value; @@ -383,7 +328,7 @@ protected override void Dispose(bool disposing) // Token: 0x060001F6 RID: 502 RVA: 0x000118C8 File Offset: 0x0000FAC8 [DebuggerStepThrough] - private void InitializeComponent() + void InitializeComponent() { base.SuspendLayout(); base.AutoScaleMode = AutoScaleMode.Inherit; @@ -395,14 +340,14 @@ private void InitializeComponent() } // Token: 0x060001F7 RID: 503 RVA: 0x0001191B File Offset: 0x0000FB1B - private void ListLabelV2_FontChanged(object sender, EventArgs e) + void ListLabelV2_FontChanged(object sender, EventArgs e) { this.Recalculate(false); this.Draw(); } // Token: 0x060001F8 RID: 504 RVA: 0x0001192D File Offset: 0x0000FB2D - private void ListLabelV2_Load(object sender, EventArgs e) + void ListLabelV2_Load(object sender, EventArgs e) { this.szNormal = base.Size; this.DisableRedraw = true; @@ -413,7 +358,7 @@ private void ListLabelV2_Load(object sender, EventArgs e) } // Token: 0x060001F9 RID: 505 RVA: 0x00011960 File Offset: 0x0000FB60 - private void FillDefaultItems() + void FillDefaultItems() { this.ClearItems(); this.AddItem(new ListLabelV2.ListLabelItemV2("Header Item", ListLabelV2.LLItemState.Heading, -1, -1, -1, "", ListLabelV2.LLFontFlags.Bold, ListLabelV2.LLTextAlign.Center)); @@ -463,16 +408,14 @@ public void ClearItems() this.HoverIndex = -1; } - // Token: 0x060001FC RID: 508 RVA: 0x00011C88 File Offset: 0x0000FE88 - private void SetLineHeight() + void SetLineHeight() { Font font = new Font(this.Font, this.Font.Style); this.LineHeight = checked((int)Math.Round((double)(unchecked(font.GetHeight() + (float)(checked(this.yPadding * 2)))))); this.VisibleLineCount = this.GetVisibleLineCount(); } - // Token: 0x060001FD RID: 509 RVA: 0x00011CD8 File Offset: 0x0000FED8 - private void Recalculate(bool Expanded = false) + void Recalculate(bool Expanded = false) { checked { @@ -515,8 +458,7 @@ private void Recalculate(bool Expanded = false) } } - // Token: 0x060001FE RID: 510 RVA: 0x00011E68 File Offset: 0x00010068 - private void RecalcLines(Rectangle bRect) + void RecalcLines(Rectangle bRect) { this.TextArea = bRect; this.SetLineHeight(); @@ -533,8 +475,7 @@ private void RecalcLines(Rectangle bRect) } } - // Token: 0x060001FF RID: 511 RVA: 0x00011EC0 File Offset: 0x000100C0 - private void WrapString(int Index) + void WrapString(int Index) { checked { @@ -594,8 +535,7 @@ private void WrapString(int Index) } } - // Token: 0x06000200 RID: 512 RVA: 0x00012138 File Offset: 0x00010338 - private void InitBuffer() + void InitBuffer() { if (!this.DisableRedraw) { @@ -622,8 +562,7 @@ private void InitBuffer() } } - // Token: 0x06000201 RID: 513 RVA: 0x00012264 File Offset: 0x00010464 - private int GetRealTotalHeight() + int GetRealTotalHeight() { int num = 0; int num2 = 0; @@ -638,8 +577,7 @@ private int GetRealTotalHeight() } } - // Token: 0x06000202 RID: 514 RVA: 0x000122B0 File Offset: 0x000104B0 - private void Draw() + void Draw() { checked { @@ -674,7 +612,6 @@ private void Draw() } } - // Token: 0x06000203 RID: 515 RVA: 0x000123AC File Offset: 0x000105AC protected void DrawItem(int Index) { checked @@ -778,8 +715,7 @@ protected void DrawItem(int Index) } } - // Token: 0x06000204 RID: 516 RVA: 0x00012890 File Offset: 0x00010A90 - private int GetVisibleLineCount() + int GetVisibleLineCount() { int result; if (!this.canScroll) @@ -798,8 +734,7 @@ private int GetVisibleLineCount() return result; } - // Token: 0x06000205 RID: 517 RVA: 0x000128F0 File Offset: 0x00010AF0 - private int GetTotalLineCount() + int GetTotalLineCount() { int num = 0; int num2 = 0; @@ -814,48 +749,42 @@ private int GetTotalLineCount() } } - // Token: 0x06000206 RID: 518 RVA: 0x0001293C File Offset: 0x00010B3C - private int GetScrollSteps() + int GetScrollSteps() { checked { - int result; if (!this.canScroll) { this.ScrollSteps = 0; - result = 0; + return 0; } - else + + int num = 0; + int wrapCount = 0; + int num3 = 0; + int num4 = this.Items.Length - 1; + for (int i = num3; i <= num4; i++) { - int num = 0; - int num2 = 0; - int num3 = 0; - int num4 = this.Items.Length - 1; - for (int i = num3; i <= num4; i++) - { - num += this.Items[i].LineCount; - if (num > this.VisibleLineCount) - { - num2++; - } - } - if (num2 > 0) - { - num2++; - } - this.ScrollSteps = num2; - if (this.ScrollSteps <= 1) + num += this.Items[i].LineCount; + if (num > this.VisibleLineCount) { - this.ScrollSteps = 0; + wrapCount++; } - result = this.ScrollSteps; } - return result; + if (wrapCount > 0) + { + wrapCount++; + } + this.ScrollSteps = wrapCount; + if (this.ScrollSteps <= 1) + { + this.ScrollSteps = 0; + } + return this.ScrollSteps; } } - // Token: 0x06000207 RID: 519 RVA: 0x000129FC File Offset: 0x00010BFC - private void DrawScrollBar() + void DrawScrollBar() { if (!(this.ScrollWidth < 1 | !this.canScroll | this.ScrollSteps < 1)) { @@ -899,8 +828,7 @@ private void DrawScrollBar() } } - // Token: 0x06000208 RID: 520 RVA: 0x00012E84 File Offset: 0x00011084 - private void DrawExpandButton() + void DrawExpandButton() { if (!(!this.canExpand | (!this.Expanded & this.ScrollSteps < 1))) { @@ -938,8 +866,7 @@ private void DrawExpandButton() } } - // Token: 0x06000209 RID: 521 RVA: 0x000131CC File Offset: 0x000113CC - private int GetItemAtY(int Y) + int GetItemAtY(int Y) { int num = 0; checked @@ -968,7 +895,7 @@ private int GetItemAtY(int Y) } // Token: 0x0600020A RID: 522 RVA: 0x00013248 File Offset: 0x00011448 - private ListLabelV2.eMouseTarget GetMouseTarget(int X, int Y) + ListLabelV2.eMouseTarget GetMouseTarget(int X, int Y) { checked { @@ -1016,7 +943,7 @@ private ListLabelV2.eMouseTarget GetMouseTarget(int X, int Y) } // Token: 0x0600020B RID: 523 RVA: 0x000133FC File Offset: 0x000115FC - private void ListLabelV2_MouseDown(object sender, MouseEventArgs e) + void ListLabelV2_MouseDown(object sender, MouseEventArgs e) { checked { @@ -1131,7 +1058,7 @@ private void ListLabelV2_MouseDown(object sender, MouseEventArgs e) } // Token: 0x0600020C RID: 524 RVA: 0x000137F0 File Offset: 0x000119F0 - private void Expand(bool State) + void Expand(bool State) { if (State) { @@ -1152,7 +1079,7 @@ private void Expand(bool State) } // Token: 0x0600020D RID: 525 RVA: 0x00013878 File Offset: 0x00011A78 - private void RecomputeExpand() + void RecomputeExpand() { if (this.Expanded) { @@ -1172,7 +1099,7 @@ private void RecomputeExpand() } // Token: 0x0600020E RID: 526 RVA: 0x000138F0 File Offset: 0x00011AF0 - private void ListLabelV2_MouseLeave(object sender, EventArgs e) + void ListLabelV2_MouseLeave(object sender, EventArgs e) { this.Cursor = System.Windows.Forms.Cursors.Default; this.LastMouseMovetarget = ListLabelV2.eMouseTarget.None; @@ -1182,7 +1109,7 @@ private void ListLabelV2_MouseLeave(object sender, EventArgs e) } // Token: 0x0600020F RID: 527 RVA: 0x00013938 File Offset: 0x00011B38 - private void ListLabelV2_MouseMove(object sender, MouseEventArgs e) + void ListLabelV2_MouseMove(object sender, MouseEventArgs e) { Cursor cursor = System.Windows.Forms.Cursors.Default; ListLabelV2.eMouseTarget mouseTarget = this.GetMouseTarget(e.X, e.Y); @@ -1315,7 +1242,7 @@ private void ListLabelV2_MouseMove(object sender, MouseEventArgs e) } // Token: 0x06000210 RID: 528 RVA: 0x00013D54 File Offset: 0x00011F54 - private void ListLabelV2_MouseUp(object sender, MouseEventArgs e) + void ListLabelV2_MouseUp(object sender, MouseEventArgs e) { this.DragMode = false; if (this.Cursor == System.Windows.Forms.Cursors.SizeNS) @@ -1325,7 +1252,7 @@ private void ListLabelV2_MouseUp(object sender, MouseEventArgs e) } // Token: 0x06000211 RID: 529 RVA: 0x00013D90 File Offset: 0x00011F90 - private void ListLabelV2_Paint(object sender, PaintEventArgs e) + void ListLabelV2_Paint(object sender, PaintEventArgs e) { if (this.bxBuffer == null) { @@ -1338,7 +1265,7 @@ private void ListLabelV2_Paint(object sender, PaintEventArgs e) } // Token: 0x06000212 RID: 530 RVA: 0x00013DEE File Offset: 0x00011FEE - private void ListLabelV2_Resize(object sender, EventArgs e) + void ListLabelV2_Resize(object sender, EventArgs e) { this.ScrollOffset = 0; this.Recalculate(false); @@ -1413,10 +1340,10 @@ public ListLabelV2() } // Token: 0x040000D7 RID: 215 - private IContainer components; + IContainer components; // Token: 0x040000D8 RID: 216 - private ExtendedBitmap bxBuffer; + ExtendedBitmap bxBuffer; // Token: 0x040000D9 RID: 217 public ListLabelV2.ListLabelItemV2[] Items; @@ -1494,10 +1421,10 @@ public ListLabelV2() protected bool DragMode; // Token: 0x040000F2 RID: 242 - private ListLabelV2.eMouseTarget LastMouseMovetarget; + ListLabelV2.eMouseTarget LastMouseMovetarget; // Token: 0x040000F3 RID: 243 - private int VisibleLineCount; + int VisibleLineCount; // Token: 0x0200001F RID: 31 public enum LLItemState @@ -1544,7 +1471,7 @@ public enum LLTextAlign } // Token: 0x02000022 RID: 34 - private enum eMouseTarget + enum eMouseTarget { // Token: 0x0400010A RID: 266 None, diff --git a/midsControls/clsDrawX.cs b/midsControls/clsDrawX.cs index f2a3c059..1286b4ca 100644 --- a/midsControls/clsDrawX.cs +++ b/midsControls/clsDrawX.cs @@ -12,7 +12,6 @@ namespace midsControls { - // Token: 0x0200000A RID: 10 public class clsDrawX { // Token: 0x1700000A RID: 10 @@ -35,8 +34,6 @@ public bool Scaling } } - // Token: 0x1700000C RID: 12 - // (set) Token: 0x0600001D RID: 29 RVA: 0x00002334 File Offset: 0x00000534 public int Columns { set @@ -48,8 +45,6 @@ public int Columns } } - // Token: 0x1700000D RID: 13 - // (set) Token: 0x0600001E RID: 30 RVA: 0x00002364 File Offset: 0x00000564 int InitColumns { set @@ -89,7 +84,7 @@ public clsDrawX(Control iTarget) int num2 = this.bxPower.Length - 1; for (int i = 0; i <= num2; i++) { - this.bxPower[i] = new ExtendedBitmap(FileIO.AddSlash(Application.StartupPath) + "images\\pSlot" + Strings.Trim(Conversions.ToString(i)) + ".png"); + this.bxPower[i] = new ExtendedBitmap(FileIO.AddSlash(Application.StartupPath) + GfxPath + GfxPowerFn + Strings.Trim(Conversions.ToString(i)) + GfxFileExt); } this.ColourSwitch(); this.InitColumns = MidsContext.Config.Columns; @@ -100,7 +95,7 @@ public clsDrawX(Control iTarget) this.bxBuffer = new ExtendedBitmap(size); this.bxBuffer.Graphics.TextRenderingHint = TextRenderingHint.AntiAliasGridFit; this.szBuffer = this.GetRequiredDrawingArea(); - this.bxNewSlot = new ExtendedBitmap(FileIO.AddSlash(Application.StartupPath) + "images\\Addslot.png"); + this.bxNewSlot = new ExtendedBitmap(FileIO.AddSlash(Application.StartupPath) + GfxPath + "Addslot.png"); this.gTarget = iTarget.CreateGraphics(); this.cTarget = iTarget; this.gTarget.CompositingMode = CompositingMode.SourceCopy; @@ -118,7 +113,7 @@ public clsDrawX(Control iTarget) void DrawSplit() { - Pen pen = this.VillainColor ? pen = new Pen(Color.Maroon, 2f) : new Pen(Color.Blue, 2f); + Pen pen = this.VillainColor ? new Pen(Color.Maroon, 2f) : new Pen(Color.Blue, 2f); checked { int iValue = 4 + this.vcRowsPowers * (this.SzPower.Height + 17) - 4; @@ -170,6 +165,58 @@ void DrawPowers() static int IndexFromLevel() => MidsContext.Character.CurrentBuild.Powers.FindIndex(pow => pow?.Level == MidsContext.Character.RequestedLevel); + void DrawEnhancement(SlotEntry slot, Font font, Graphics g, ref RectangleF rect) + { + unchecked + { + if (MidsContext.Config.I9.DisplayIOLevels & (DatabaseAPI.Database.Enhancements[slot.Enhancement.Enh].TypeID == Enums.eType.SetO + | DatabaseAPI.Database.Enhancements[slot.Enhancement.Enh].TypeID == Enums.eType.InventO)) + { + RectangleF iValue2 = rect; + iValue2.Y -= 3f; + iValue2.Height = this.DefaultFont.GetHeight(this.bxBuffer.Graphics); + string iStr = Conversions.ToString(checked(slot.Enhancement.IOLevel + 1)); + RectangleF bounds = this.ScaleDown(iValue2); + Color cyan = Color.Cyan; + Color outline = Color.FromArgb(128, 0, 0, 0); + float outlineSpace = 1f; + g = this.bxBuffer.Graphics; + clsDrawX.DrawOutlineText(iStr, bounds, cyan, outline, font, outlineSpace, g, false, false); + } + else if (MidsContext.Config.ShowEnhRel & (DatabaseAPI.Database.Enhancements[slot.Enhancement.Enh].TypeID == Enums.eType.Normal + | DatabaseAPI.Database.Enhancements[slot.Enhancement.Enh].TypeID == Enums.eType.SpecialO)) + { + RectangleF iValue2 = rect; + iValue2.Y -= 3f; + iValue2.Height = this.DefaultFont.GetHeight(this.bxBuffer.Graphics); + Color color; + if (slot.Enhancement.RelativeLevel == 0) + { + color = Color.Red; + } + else if (slot.Enhancement.RelativeLevel < Enums.eEnhRelative.Even) + { + color = Color.Yellow; + } + else if (slot.Enhancement.RelativeLevel > Enums.eEnhRelative.Even) + { + color = Color.FromArgb(0, 255, 255); + } + else + { + color = Color.White; + } + string relativeString = Enums.GetRelativeString(slot.Enhancement.RelativeLevel, MidsContext.Config.ShowRelSymbols); + RectangleF bounds2 = this.ScaleDown(iValue2); + Color text3 = color; + Color outline2 = Color.FromArgb(128, 0, 0, 0); + Font bFont2 = font; + float outlineSpace2 = 1f; + clsDrawX.DrawOutlineText(relativeString, bounds2, text3, outline2, bFont2, outlineSpace2, g, false, false); + } + } + } + public Point DrawPowerSlot(ref PowerEntry iSlot, bool singleDraw = false) { Pen pen = new Pen(Color.FromArgb(128, 0, 0, 0), 1f); @@ -183,7 +230,7 @@ public Point DrawPowerSlot(ref PowerEntry iSlot, bool singleDraw = false) Pen pen2 = new Pen(Color.Black); Rectangle rectangle = default; Font font = new Font(this.DefaultFont.FontFamily, this.FontScale(this.DefaultFont.SizeInPoints), this.DefaultFont.Style, GraphicsUnit.Point); - int num = MidsContext.Character.SlotCheck(iSlot); + int slotChk = MidsContext.Character.SlotCheck(iSlot); bool indicating = false; Enums.ePowerState ePowerState = iSlot.State; bool canPlaceSlot = MidsContext.Character.CanPlaceSlot; @@ -192,7 +239,7 @@ public Point DrawPowerSlot(ref PowerEntry iSlot, bool singleDraw = false) Point point = default; checked { - point.X = (int)Math.Round(unchecked(result.X + (double)(checked(this.SzPower.Width - this.szSlot.Width * 6)) / 2.0)); + point.X = (int)Math.Round(unchecked(result.X + (checked(this.SzPower.Width - (this.szSlot.Width * 6)) / 2.0))); point.Y = result.Y + 18; Graphics graphics = this.bxBuffer.Graphics; Brush brush = new SolidBrush(this.BackColor); @@ -204,7 +251,7 @@ public Point DrawPowerSlot(ref PowerEntry iSlot, bool singleDraw = false) if (iSlot.Power != null) { if (singleDraw - && num > -1 + && slotChk > -1 && canPlaceSlot && this.InterfaceMode != Enums.eInterfaceMode.PowerToggle && iSlot.PowerSet != null @@ -340,59 +387,8 @@ public Point DrawPowerSlot(ref PowerEntry iSlot, bool singleDraw = false) iValue2.Inflate(1f, 1f); this.bxBuffer.Graphics.FillEllipse(solidBrush, this.ScaleDown(iValue2)); } - unchecked - { - if (slot.Enhancement.Enh > -1) - { - if (MidsContext.Config.I9.DisplayIOLevels & (DatabaseAPI.Database.Enhancements[slot.Enhancement.Enh].TypeID == Enums.eType.SetO - | DatabaseAPI.Database.Enhancements[slot.Enhancement.Enh].TypeID == Enums.eType.InventO)) - { - RectangleF iValue2 = rectangleF; - iValue2.Y -= 3f; - iValue2.Height = this.DefaultFont.GetHeight(this.bxBuffer.Graphics); - string iStr = Conversions.ToString(checked(slot.Enhancement.IOLevel + 1)); - RectangleF bounds = this.ScaleDown(iValue2); - Color cyan = Color.Cyan; - Color outline = Color.FromArgb(128, 0, 0, 0); - Font bFont = font; - float outlineSpace = 1f; - graphics5 = this.bxBuffer.Graphics; - clsDrawX.DrawOutlineText(iStr, bounds, cyan, outline, bFont, outlineSpace, ref graphics5, false, false); - } - else if (MidsContext.Config.ShowEnhRel & (DatabaseAPI.Database.Enhancements[slot.Enhancement.Enh].TypeID == Enums.eType.Normal - | DatabaseAPI.Database.Enhancements[slot.Enhancement.Enh].TypeID == Enums.eType.SpecialO)) - { - RectangleF iValue2 = rectangleF; - iValue2.Y -= 3f; - iValue2.Height = this.DefaultFont.GetHeight(this.bxBuffer.Graphics); - Color color; - if (slot.Enhancement.RelativeLevel == 0) - { - color = Color.Red; - } - else if (slot.Enhancement.RelativeLevel < Enums.eEnhRelative.Even) - { - color = Color.Yellow; - } - else if (slot.Enhancement.RelativeLevel > Enums.eEnhRelative.Even) - { - color = Color.FromArgb(0, 255, 255); - } - else - { - color = Color.White; - } - string relativeString = Enums.GetRelativeString(slot.Enhancement.RelativeLevel, MidsContext.Config.ShowRelSymbols); - RectangleF bounds2 = this.ScaleDown(iValue2); - Color text3 = color; - Color outline2 = Color.FromArgb(128, 0, 0, 0); - Font bFont2 = font; - float outlineSpace2 = 1f; - graphics5 = this.bxBuffer.Graphics; - clsDrawX.DrawOutlineText(relativeString, bounds2, text3, outline2, bFont2, outlineSpace2, ref graphics5, false, false); - } - } - } + if (slot.Enhancement.Enh > -1) + DrawEnhancement(slot, font, graphics, ref rectangleF); } if (MidsContext.Config.ShowSlotLevels) { @@ -411,12 +407,12 @@ public Point DrawPowerSlot(ref PowerEntry iSlot, bool singleDraw = false) outlineColor: Color.FromArgb(192, 0, 0, 0), bFont: font, outlineSpace: 1f, - g: ref graphics5); + g: graphics5); } } - if (num > -1 && (ePowerState != Enums.ePowerState.Empty && drawNewSlot)) + if (slotChk > -1 && (ePowerState != Enums.ePowerState.Empty && drawNewSlot)) { Rectangle clipRect2 = new Rectangle(point.X + this.szSlot.Width * (iSlot.Slots.Length), point.Y, this.szSlot.Width, this.szSlot.Height); RectangleF iValue2 = clipRect2; @@ -424,22 +420,16 @@ public Point DrawPowerSlot(ref PowerEntry iSlot, bool singleDraw = false) iValue2.Height = this.DefaultFont.GetHeight(this.bxBuffer.Graphics); unchecked { - iValue2.Y += ((float)this.szSlot.Height - iValue2.Height) / 2f; + iValue2.Y += (szSlot.Height - iValue2.Height) / 2f; } - string iStr3 = Conversions.ToString(num + 1); - RectangleF bounds4 = this.ScaleDown(iValue2); - Color text5 = Color.FromArgb(0, 255, 255); - Color outline4 = Color.FromArgb(192, 0, 0, 0); - Font bFont4 = font; - float outlineSpace4 = 1f; - Graphics graphics5 = this.bxBuffer.Graphics; - clsDrawX.DrawOutlineText(iStr3, bounds4, text5, outline4, bFont4, outlineSpace4, ref graphics5, false, false); + clsDrawX.DrawOutlineText(Conversions.ToString(slotChk + 1), this.ScaleDown(iValue2), + Color.FromArgb(0, 255, 255), Color.FromArgb(192, 0, 0, 0), font, 1f, this.bxBuffer.Graphics, false, false); } solidBrush = new SolidBrush(Color.Black); stringFormat = new StringFormat(); - rectangleF.X = (float)(result.X + 10); - rectangleF.Y = (float)(result.Y + 4); - rectangleF.Width = (float)this.SzPower.Width; + rectangleF.X = result.X + 10; + rectangleF.Y = result.Y + 4; + rectangleF.Width = SzPower.Width; rectangleF.Height = unchecked(this.DefaultFont.GetHeight() * 2f); Enums.ePowerState ePowerState2 = iSlot.State; if (ePowerState2 == Enums.ePowerState.Empty & ePowerState == Enums.ePowerState.Open) @@ -516,7 +506,7 @@ public Point DrawPowerSlot(ref PowerEntry iSlot, bool singleDraw = false) Font bFont5 = font; float outlineSpace5 = 1f; Graphics graphics5 = this.bxBuffer.Graphics; - clsDrawX.DrawOutlineText(iStr4, bounds5, whiteSmoke, outline5, bFont5, outlineSpace5, ref graphics5, false, true); + clsDrawX.DrawOutlineText(iStr4, bounds5, whiteSmoke, outline5, bFont5, outlineSpace5, graphics5, false, true); } else { @@ -624,7 +614,7 @@ int GetVisualIDX(int PowerIndex) } } - public static void DrawOutlineText(string iStr, RectangleF bounds, Color textColor, Color outlineColor, Font bFont, float outlineSpace, ref Graphics g, bool smallMode = false, bool leftAlign = false) + public static void DrawOutlineText(string iStr, RectangleF bounds, Color textColor, Color outlineColor, Font bFont, float outlineSpace, Graphics g, bool smallMode = false, bool leftAlign = false) { StringFormat stringFormat = new StringFormat(StringFormatFlags.NoWrap) { @@ -736,7 +726,7 @@ public int WhichEnh(int iX, int iY) } } - public bool HighlightSlot(int Index, bool Force = false) + public bool HighlightSlot(int idx, bool Force = false) { checked { @@ -747,9 +737,9 @@ public bool HighlightSlot(int Index, bool Force = false) } else { - if (this.Highlight != Index || Force) + if (this.Highlight != idx || Force) { - if (Index != -1) + if (idx != -1) { Build currentBuild; PowerEntry value; @@ -770,11 +760,11 @@ public bool HighlightSlot(int Index, bool Force = false) this.DrawSplit(); this.Output(ref this.bxBuffer, rectangle, rectangle, GraphicsUnit.Pixel); } - this.Highlight = Index; + this.Highlight = idx; currentBuild = MidsContext.Character.CurrentBuild; - value = currentBuild.Powers[Index]; + value = currentBuild.Powers[idx]; Point point3 = this.DrawPowerSlot(ref value, true); - currentBuild.Powers[Index] = value; + currentBuild.Powers[idx] = value; point2 = point3; iValue = new Rectangle(point2.X, point2.Y, this.SzPower.Width, this.SzPower.Height + 17); rectangle = this.ScaleDown(iValue); @@ -794,7 +784,7 @@ public bool HighlightSlot(int Index, bool Force = false) Rectangle rectangle = this.ScaleDown(iValue); this.DrawSplit(); this.Output(ref this.bxBuffer, rectangle, rectangle, GraphicsUnit.Pixel); - this.Highlight = Index; + this.Highlight = idx; } } result = false;