Skip to content

Commit

Permalink
cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
Unknown committed Jul 21, 2019
1 parent 8caac42 commit 97d7d96
Show file tree
Hide file tree
Showing 10 changed files with 242 additions and 333 deletions.
14 changes: 6 additions & 8 deletions Base/Base/Data_Classes/Character.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
178 changes: 85 additions & 93 deletions Base/ConfigData.cs

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Base/Extensions.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
Expand All @@ -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<T>(this T[] source, T item)
//{
// var next = new T[source.Length + 1];
Expand Down
5 changes: 2 additions & 3 deletions Hero Designer/Extensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ public class ListBoxT<T>
public ListBoxT(ListBox lb) => this._lb = lb;

}

public class ComboBoxT<T>
{
readonly ComboBox _cb;
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 4 additions & 4 deletions Hero Designer/Forms/DataView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
{
Expand All @@ -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);
}
}
}
Expand All @@ -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))
{
Expand All @@ -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);
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions Hero Designer/Forms/WindowMenuItems/frmTotals.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -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);
}

Expand Down
3 changes: 1 addition & 2 deletions Hero Designer/Forms/frmMain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ public partial class frmMain : Form
{
#region "fields"

bool remember;
Rectangle ActivePopupBounds;
bool DataViewLocked;
readonly short[] ddsa;
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 2 additions & 2 deletions Hero Designer/clsToonX.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1204,8 +1204,8 @@ public void GenerateBuffedPowerArray()
this._selfBuffs.Reset();
this._selfEnhance.Reset();
this.ModifyEffects = new Dictionary<string, float>();
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);
Expand Down
Loading

0 comments on commit 97d7d96

Please sign in to comment.