Skip to content

Commit 97d7d96

Browse files
author
Unknown
committed
cleaning
1 parent 8caac42 commit 97d7d96

File tree

10 files changed

+242
-333
lines changed

10 files changed

+242
-333
lines changed

Base/Base/Data_Classes/Character.cs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -621,24 +621,22 @@ int GetFirstAvailableSlotLevel(int iLevel = 0)
621621

622622
public int SlotCheck(PowerEntry power)
623623
{
624-
int num1;
625624
if (power.Power == null || !this.CanPlaceSlot || power.SlotCount > 5)
626-
num1 = -1;
625+
return -1;
627626
else if (!DatabaseAPI.Database.Power[power.NIDPower].Slottable)
628627
{
629-
num1 = -1;
628+
return -1;
630629
}
631630
else
632631
{
633632
int iLevel = power.Level;
634633
if (DatabaseAPI.Database.Power[power.NIDPower].AllowFrontLoading)
635634
iLevel = 0;
636-
int num2 = this.GetFirstAvailableSlotLevel(iLevel);
637-
if (MidsContext.Config.BuildMode == Enums.dmModes.LevelUp && num2 > this.CurrentBuild.GetMaxLevel() + 1)
638-
num2 = -1;
639-
num1 = num2;
635+
int firstAvailable = this.GetFirstAvailableSlotLevel(iLevel);
636+
if (MidsContext.Config.BuildMode == Enums.dmModes.LevelUp && firstAvailable > this.CurrentBuild.GetMaxLevel() + 1)
637+
firstAvailable = -1;
638+
return firstAvailable;
640639
}
641-
return num1;
642640
}
643641

644642
public int[] GetSlotCounts()

Base/ConfigData.cs

Lines changed: 85 additions & 93 deletions
Large diffs are not rendered by default.

Base/Extensions.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
using System;
22
using System.Collections.Generic;
3+
using System.Drawing;
34
using System.IO;
45
using System.Linq;
56
using System.Text;
@@ -9,6 +10,9 @@ namespace Base
910
{
1011
public static class Extensions
1112
{
13+
public static Color ReadRGB(this BinaryReader reader)
14+
=> Color.FromArgb(reader.ReadByte(), reader.ReadByte(), reader.ReadByte());
15+
1216
//public static T[] Append<T>(this T[] source, T item)
1317
//{
1418
// var next = new T[source.Length + 1];

Hero Designer/Extensions.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ public class ListBoxT<T>
1717
public ListBoxT(ListBox lb) => this._lb = lb;
1818

1919
}
20+
2021
public class ComboBoxT<T>
2122
{
2223
readonly ComboBox _cb;
@@ -67,9 +68,7 @@ public static void ExecuteWithCatchMessage(this Action f, string titlingOpt = nu
6768
// this could be chained indefinitely so... be careful with it
6869
// defer the execution until later
6970
public static Action WithCatchMessage(this Action f, string titling, string captionOpt = null)
70-
{
71-
return () => ExecuteWithCatchMessage(f, titling, captionOpt);
72-
}
71+
=> () => ExecuteWithCatchMessage(f, titling, captionOpt);
7372

7473
// does not handle the possibility this is a child control, and a parent is in design mode
7574
public static bool IsInDesignMode(this Control c) => LicenseManager.UsageMode == LicenseUsageMode.Designtime || c?.Site?.DesignMode == true;

Hero Designer/Forms/DataView.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ void DisplayFlippedEnhancements()
10301030
Bounds.Y -= 3f;
10311031
Bounds.Height = Control.DefaultFont.GetHeight(this.bxFlip.Graphics);
10321032
Graphics graphics2 = this.bxFlip.Graphics;
1033-
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);
1033+
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);
10341034
}
10351035
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))
10361036
{
@@ -1039,7 +1039,7 @@ void DisplayFlippedEnhancements()
10391039
Bounds.Height = Control.DefaultFont.GetHeight(this.bxFlip.Graphics);
10401040
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;
10411041
Graphics graphics2 = this.bxFlip.Graphics;
1042-
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);
1042+
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);
10431043
}
10441044
}
10451045
}
@@ -1060,7 +1060,7 @@ void DisplayFlippedEnhancements()
10601060
Bounds.Y -= 3f;
10611061
Bounds.Height = Control.DefaultFont.GetHeight(this.bxFlip.Graphics);
10621062
Graphics graphics2 = this.bxFlip.Graphics;
1063-
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);
1063+
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);
10641064
}
10651065
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))
10661066
{
@@ -1069,7 +1069,7 @@ void DisplayFlippedEnhancements()
10691069
Bounds.Height = Control.DefaultFont.GetHeight(this.bxFlip.Graphics);
10701070
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;
10711071
Graphics graphics2 = this.bxFlip.Graphics;
1072-
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);
1072+
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);
10731073
}
10741074
}
10751075
}

Hero Designer/Forms/WindowMenuItems/frmTotals.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ void PbClosePaint(object sender, PaintEventArgs e)
152152
float height2 = bFont.GetHeight(e.Graphics) + 2f;
153153
RectangleF Bounds = new RectangleF(0.0f, (float)(((double)this.tab0.Height - (double)height2) / 2.0), (float)this.tab0.Width, height2);
154154
Graphics graphics = extendedBitmap.Graphics;
155-
clsDrawX.DrawOutlineText(iStr, Bounds, Color.WhiteSmoke, Color.FromArgb(192, 0, 0, 0), bFont, 1f, ref graphics, false, false);
155+
clsDrawX.DrawOutlineText(iStr, Bounds, Color.WhiteSmoke, Color.FromArgb(192, 0, 0, 0), bFont, 1f, graphics, false, false);
156156
e.Graphics.DrawImage((Image)extendedBitmap.Bitmap, 0, 0);
157157
}
158158

@@ -186,7 +186,7 @@ void PbTopMostPaint(object sender, PaintEventArgs e)
186186
float height = bFont.GetHeight(e.Graphics) + 2f;
187187
RectangleF Bounds = new RectangleF(0.0f, (float)(((double)this.tab0.Height - (double)height) / 2.0), (float)this.tab0.Width, height);
188188
Graphics graphics = extendedBitmap.Graphics;
189-
clsDrawX.DrawOutlineText(iStr, Bounds, Color.WhiteSmoke, Color.FromArgb(192, 0, 0, 0), bFont, 1f, ref graphics, false, false);
189+
clsDrawX.DrawOutlineText(iStr, Bounds, Color.WhiteSmoke, Color.FromArgb(192, 0, 0, 0), bFont, 1f, graphics, false, false);
190190
e.Graphics.DrawImage((Image)extendedBitmap.Bitmap, 0, 0);
191191
}
192192

@@ -406,7 +406,7 @@ void TabPaint(ref PictureBox iTab, PaintEventArgs e, string iString, bool iState
406406
float height = bFont.GetHeight(e.Graphics) + 2f;
407407
RectangleF Bounds = new RectangleF(0.0f, (float)(((double)this.tab0.Height - (double)height) / 2.0), (float)this.tab0.Width, height);
408408
Graphics graphics = extendedBitmap.Graphics;
409-
clsDrawX.DrawOutlineText(iString, Bounds, Color.WhiteSmoke, Color.FromArgb(192, 0, 0, 0), bFont, 1f, ref graphics, false, false);
409+
clsDrawX.DrawOutlineText(iString, Bounds, Color.WhiteSmoke, Color.FromArgb(192, 0, 0, 0), bFont, 1f, graphics, false, false);
410410
e.Graphics.DrawImage((Image)extendedBitmap.Bitmap, 0, 0);
411411
}
412412

Hero Designer/Forms/frmMain.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ public partial class frmMain : Form
2525
{
2626
#region "fields"
2727

28-
bool remember;
2928
Rectangle ActivePopupBounds;
3029
bool DataViewLocked;
3130
readonly short[] ddsa;
@@ -5238,7 +5237,7 @@ void UpdateDMBuffer()
52385237
float height2 = bFont.GetHeight(this.dmBuffer.Graphics) + 2f;
52395238
RectangleF Bounds = new RectangleF(0.0f, (float)(((double)this.pbDynMode.Height - (double)height2) / 2.0), (float)this.pbDynMode.Width, height2);
52405239
Graphics graphics = this.dmBuffer.Graphics;
5241-
clsDrawX.DrawOutlineText(iStr, Bounds, Color.WhiteSmoke, Color.FromArgb(192, 0, 0, 0), bFont, 1f, ref graphics, false, false);
5240+
clsDrawX.DrawOutlineText(iStr, Bounds, Color.WhiteSmoke, Color.FromArgb(192, 0, 0, 0), bFont, 1f, graphics, false, false);
52425241
}
52435242

52445243
void UpdateDynamicModeInfo()

Hero Designer/clsToonX.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1204,8 +1204,8 @@ public void GenerateBuffedPowerArray()
12041204
this._selfBuffs.Reset();
12051205
this._selfEnhance.Reset();
12061206
this.ModifyEffects = new Dictionary<string, float>();
1207-
this._buffedPower = new IPower[this.CurrentBuild.Powers.Count - 1 + 1];
1208-
this._mathPower = new IPower[this.CurrentBuild.Powers.Count - 1 + 1];
1207+
this._buffedPower = new IPower[this.CurrentBuild.Powers.Count];
1208+
this._mathPower = new IPower[this.CurrentBuild.Powers.Count];
12091209
this.GBPA_Pass0_InitializePowerArray();
12101210
this.GenerateModifyEffectsArray();
12111211
this.GenerateBuffData(ref this._selfEnhance, true);

0 commit comments

Comments
 (0)