Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.5.4.12 #162

Merged
merged 36 commits into from
May 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
b4f0f2a
DB / HC: Psionic Darts (Blaster) use Targeted AoE instead of Ranged s…
zethriller May 1, 2023
d42bf12
Prevent crash when conditional expressions are null (Stalker Assassin…
zethriller May 1, 2023
4b988c6
DB / HC: Adjusted Damage, use Targeted AoE instead of Ranged sets on …
zethriller May 1, 2023
151e7cc
DB / HC: Mark Bio Armor adaptations and Staff Fighting stances as pow…
zethriller May 1, 2023
abd469e
Rework of powerset mutex selector
zethriller May 1, 2023
f6b0618
DB / HC: reorder powers in Psychic Blast (Corruptor, Defender)
zethriller May 1, 2023
2fe81fd
App: Fixed Powerset Mutex addition/removal.
Metalios May 1, 2023
62a3111
DB / HC: Assign mutex sets for Shield Defense (Tanker, Stalker) // In…
zethriller May 1, 2023
bb34d60
DB editor: realign "Manage Hidden Powers" button text
zethriller May 1, 2023
f0cc59e
Power editor: widen labels for some cut items (ignore when setting gr…
zethriller May 1, 2023
1d8aa48
DB / HC: update Dominate Will Damage, Psionic Darts arc, max targets,…
zethriller May 2, 2023
479a7c7
Create blank Compare.mhd datafile when it is missing, change error me…
zethriller May 2, 2023
7d78277
PairedListEx: Fixed tooltip flicker by removing redundant tooltip in …
Metalios May 3, 2023
9c23f31
Removed unused using directives in the solution
Metalios May 3, 2023
b5a3f9e
Corrected assembly version which translates over to the window title …
Metalios May 3, 2023
323a9b7
DB/ HC: Fix Lightning Aura Mode (Storm Blast inherent) so it displays…
zethriller May 3, 2023
7e37a4b
Fix crash when trying to parse app/db manifests that contains errors …
zethriller May 3, 2023
ddb9eab
Prevent negative Defense/Resistance values in the DataView Totals tab…
zethriller May 3, 2023
8104055
Build recovery: properly parse D-Sync, Hamido, Hydra, Titan enhancements
zethriller May 3, 2023
986d69c
Restore open build from /buildsave text file
zethriller May 3, 2023
6314c70
PairedListEx - Fixed flicking issue when tooltips are displayed.
Metalios May 4, 2023
0fe7ae9
Show ED figures/slotting in the DataView enhance tab even when source…
zethriller May 4, 2023
f130353
Character: Reverted build back to an array.
Metalios May 5, 2023
e666230
CharacterBuildFile: Added re-initialization of InherentPowers list wh…
Metalios May 5, 2023
634ca70
DB: Fixed Jaunt and Translocation not showing in inherent grid when t…
Metalios May 5, 2023
cc59554
App: Added pool powers to cleaning of auto granted powers.
Metalios May 5, 2023
30abd91
Show which database is in use when loading a mxd build and an error o…
zethriller May 5, 2023
4412bcf
App: Removed unneeded references to NetStandard
Metalios May 6, 2023
f8f1c08
Update version to 3.5.4 rev 10
Metalios May 6, 2023
a59538e
Project: Set to not use build acceleration
Metalios May 6, 2023
69b8d46
App: Added check for null data when loading from a schema build.
Metalios May 6, 2023
d61ef81
Rev11
Metalios May 6, 2023
ba383a8
Corrected mistake in revision
Metalios May 6, 2023
33bf8c4
DB / HC: Added Toxic Defense debuff to Weaken (All ATs), fix effect g…
zethriller May 6, 2023
7f5186c
Effect: Modified BuffedMag to use the absolute value of Math_Mag befo…
Metalios May 6, 2023
3e4afce
Adjusted version to rev 12
Metalios May 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion MRBUpdater/Program.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace MRBUpdater
Expand Down
8 changes: 2 additions & 6 deletions MidsReborn/BuildImportTools.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1025,12 +1025,8 @@ private string ShortNamesConversion(string sn)
}
}

if (sn.StartsWith("DSyncO:"))
{
sn = sn[7..];
}

return sn;
// Parse D-Sync, Hamidon, Hydra, Titan enhancements
return Regex.Replace(sn, @"^(DSyncO|HO|HY|TN)\:", "");
}

public List<PowerEntry>? Parse()
Expand Down
9 changes: 0 additions & 9 deletions MidsReborn/Controls/PairedListEx.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

44 changes: 17 additions & 27 deletions MidsReborn/Controls/PairedListEx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ public partial class PairedListEx : UserControl
private int _rows = 5;
private Color _valueColor = Color.WhiteSmoke;
private Color _itemColor = Color.Silver;
private int _hoverIndex = -1;
private bool _setItemsBold;
private int _highlightedItem = -1;
private List<Item>? _items;

public delegate void ItemClickEventHandler(object? sender, Item item, MouseEventArgs e);
public delegate void ItemHoverEventHandler(object? sender, int index, Enums.ShortFX tagId, string tooltip = "");
public delegate void ItemHoverEventHandler(object? sender, int index, Enums.ShortFX tagId, string? tooltip = "");
public delegate void ItemOutEventHandler(object? sender);

public event ItemClickEventHandler? ItemClick;
Expand Down Expand Up @@ -176,22 +176,9 @@ public PairedListEx()

private static void OnItemClick(object? sender, Item item, MouseEventArgs mouseEventArgs) { }

private void OnItemHover(object? sender, int index, Enums.ShortFX tagId, string tooltip = "")
{
if (index != _highlightedItem)
{
if (myTip.GetToolTip(this) == tooltip) return;
myTip.SetToolTip(this, tooltip);
}
private static void OnItemHover(object? sender, int index, Enums.ShortFX tagId, string? tooltip = "") { }

_highlightedItem = index;
}

private void OnItemOut(object? sender)
{
myTip.SetToolTip(this, "");
_highlightedItem = -1;
}
private static void OnItemOut(object? sender) { }

private void OnForeColorChanged(object? sender, EventArgs e)
{
Expand Down Expand Up @@ -223,8 +210,6 @@ private void OnMouseClick(object? sender, MouseEventArgs e)

private void OnMouseLeave(object? sender, EventArgs e)
{
myTip.SetToolTip(this, "");
_highlightedItem = -1;
if (UseHighlighting)
{
Items?.ForEach(i => i.IsHighlightable = false);
Expand All @@ -240,7 +225,7 @@ private void OnMouseMove(object? sender, MouseEventArgs e)
return;
}

var hoveredItem = false;
var hoveredItem = -1;
for (var i = 0; i < Items.Count; i++)
{
var item = Items[i];
Expand All @@ -249,35 +234,40 @@ private void OnMouseMove(object? sender, MouseEventArgs e)
if (UseHighlighting)
{
item.IsHighlightable = true;
Invalidate();
}

if (item.ToolTip == null)
{
continue;
}

ItemHover?.Invoke(this, i, item.TagId, item.ToolTip);
hoveredItem = true;
hoveredItem = i;
}
else
{
item.IsHighlightable = false;
}
}

if (!hoveredItem)
if (_hoverIndex == hoveredItem)
{
ItemOut?.Invoke(this);
return;
}

if (UseHighlighting)
_hoverIndex = hoveredItem;
if (hoveredItem <= -1)
{
Invalidate();
ItemOut?.Invoke(this);
return;
}

if (Items[hoveredItem].ToolTip != null) ItemHover?.Invoke(this, hoveredItem, Items[hoveredItem].TagId, Items[hoveredItem].ToolTip);
}

private void OnLoad(object? sender, EventArgs e)
{
_hoverIndex = -1;
Redraw();
}

Expand Down Expand Up @@ -440,7 +430,7 @@ public class Item
{
public string? Name { get; set; }
public string? Value { get; set; }
public Enums.ShortFX TagId { get; set; }
public Enums.ShortFX TagId { get; }
public string? ToolTip { get; set; }
public bool UseAlternateColor { get; set; }
public bool UseSpecialColor { get; set; }
Expand Down
2 changes: 0 additions & 2 deletions MidsReborn/Controls/clsDrawX.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Drawing.Text;
using System.IO;
using System.Windows.Forms;
using Mids_Reborn.Core;
using Mids_Reborn.Core.Base.Display;
Expand Down
1 change: 0 additions & 1 deletion MidsReborn/Controls/ctlDamageDisplay.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.Windows.Forms;
using Mids_Reborn.Core;
using Mids_Reborn.Core.Base.Display;
using Mids_Reborn.Core.Utils;

namespace Mids_Reborn.Controls
{
Expand Down
1 change: 0 additions & 1 deletion MidsReborn/Controls/ctlTotalsTabStrip.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Windows.Forms;
using Mids_Reborn.Controls.Extensions;
Expand Down
11 changes: 4 additions & 7 deletions MidsReborn/Core/Base/Data_Classes/Character.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@ namespace Mids_Reborn.Core.Base.Data_Classes
{
public class Character
{
public static List<string> gridEntries = new List<string> { "a", "b", "c", "d", "e", "f", "g", "h" };
private Archetype? _archetype;
private bool? _completeCache;
public Dictionary<string, int> SetSlotLoc = new Dictionary<string, int>();
public HashSet<string> setSlotted = new HashSet<string>();
public event EventHandler<Enums.Alignment>? AlignmentChanged;

internal Character()
Expand All @@ -27,7 +24,7 @@ internal Character()
Totals = new TotalStatistics();
TotalsCapped = new TotalStatistics();
DisplayStats = new Statistics(this);
Build = new Build(this, DatabaseAPI.Database.Levels);
Builds = new Build?[] { new Build(this, DatabaseAPI.Database.Levels) };
PEnhancementsList = new List<string>();
Reset();
}
Expand Down Expand Up @@ -73,9 +70,9 @@ public int Level

public int RequestedLevel { get; set; }

private Build Build { get; set; }
private Build?[] Builds { get; }

public Build CurrentBuild => Build;
public Build? CurrentBuild => Builds.Length > 0 ? Builds[0] : null;

public Archetype? Archetype
{
Expand Down Expand Up @@ -426,7 +423,7 @@ public void Reset(Archetype? iArchetype = null, int iOrigin = 0)

protected void NewBuild()
{
Build = new Build(this, DatabaseAPI.Database.Levels);
Builds[0] = new Build(this, DatabaseAPI.Database.Levels);
AcceleratedActive = false;
ActiveComboLevel = 0;
DelayedActive = false;
Expand Down
2 changes: 1 addition & 1 deletion MidsReborn/Core/Base/Data_Classes/Effect.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ public float Mag
}
}

public float BuffedMag => Math_Mag > float.Epsilon ? Math_Mag : Mag;
public float BuffedMag => Math.Abs(Math_Mag) > float.Epsilon ? Math_Mag : Mag;

public float MagPercent => !DisplayPercentage ? BuffedMag : BuffedMag * 100f;

Expand Down
8 changes: 1 addition & 7 deletions MidsReborn/Core/Base/Display/InherentDisplayItem.cs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Mids_Reborn.Core.Base.Display
namespace Mids_Reborn.Core.Base.Display
{
public class InherentDisplayItem
{
Expand Down
8 changes: 4 additions & 4 deletions MidsReborn/Core/Base/Master_Classes/MidsContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ public static class MidsContext
public const string AppName = "Mids' Reborn";
private const int AppMajorVersion = 3;
private const int AppMinorVersion = 5;
private const int AppBuildVersion = 3;
private const int AppRevisionVersion = 6;
private const int AppBuildVersion = 4;
private const int AppRevisionVersion = 12;

public const string AssemblyVersion = "3.5.6";
public const string AssemblyFileVersion = "3.5.3.6";
public const string AssemblyVersion = "3.5.4";
public const string AssemblyFileVersion = "3.5.4.12";
public static Version AppFileVersion { get; set; } = new(AppMajorVersion, AppMinorVersion, AppBuildVersion, AppRevisionVersion);

public const string AppVersionStatus = "";
Expand Down
15 changes: 15 additions & 0 deletions MidsReborn/Core/BooleanExprPreprocessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,11 @@ public static bool Parse(IEffect effect)
mathEngine.AddFunction("AND", (a, b) => a > 0 & b > 0 ? 1 : 0);
mathEngine.AddFunction("OR", (a, b) => a > 0 | b > 0 ? 1 : 0);

if (string.IsNullOrWhiteSpace(prefixExpr))
{
return true;
}

var ret = false;
try
{
Expand Down Expand Up @@ -406,6 +411,11 @@ public static bool Parse(IEffect effect, string cType, string cPowerName)
mathEngine.AddFunction("AND", (a, b) => a > 0 & b > 0 ? 1 : 0);
mathEngine.AddFunction("OR", (a, b) => a > 0 | b > 0 ? 1 : 0);

if (string.IsNullOrWhiteSpace(prefixExpr))
{
return true;
}

var ret = false;
try
{
Expand Down Expand Up @@ -455,6 +465,11 @@ public static bool Parse(IEffect effect, string cPowerName)
mathEngine.AddFunction("AND", (a, b) => a > 0 & b > 0 ? 1 : 0);
mathEngine.AddFunction("OR", (a, b) => a > 0 | b > 0 ? 1 : 0);

if (string.IsNullOrWhiteSpace(prefixExpr))
{
return true;
}

var ret = false;
try
{
Expand Down
5 changes: 1 addition & 4 deletions MidsReborn/Core/Build.cs
Original file line number Diff line number Diff line change
Expand Up @@ -859,10 +859,7 @@ private void ScanAndCleanAutomaticallyGrantedPowers()
continue;
}

if (power.Chosen ||
power.PowerSet.SetType != Enums.ePowerSetType.Inherent &&
power.PowerSet.SetType != Enums.ePowerSetType.Primary &&
power.PowerSet.SetType != Enums.ePowerSetType.Secondary)
if (power.Chosen || power.PowerSet.SetType != Enums.ePowerSetType.Inherent && power.PowerSet.SetType != Enums.ePowerSetType.Primary && power.PowerSet.SetType != Enums.ePowerSetType.Secondary && power.PowerSet.SetType != Enums.ePowerSetType.Pool)
{
continue;
}
Expand Down
19 changes: 10 additions & 9 deletions MidsReborn/Core/BuildFile/CharacterBuildFile.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using Mids_Reborn.Core.Base.Data_Classes;
using Mids_Reborn.Core.Base.Master_Classes;
using Mids_Reborn.Core.BuildFile.DataModels;
using Mids_Reborn.Core.BuildFile.RestModels;
using Mids_Reborn.Core.Utils;
using Mids_Reborn.Forms.Controls;
using Newtonsoft.Json;
using Newtonsoft.Json.Bson;
using RestSharp;

namespace Mids_Reborn.Core.BuildFile
{
Expand All @@ -21,9 +18,11 @@ public class CharacterBuildFile

private static CharacterBuildFile? _instance;
private static readonly object Mutex = new();

private static int DisplayIndex { get; set; } = -1;
private static List<PowerEntry> InherentPowers { get; set; } = new();

private static CharacterBuildFile CreateInstance(Character characterData, bool refreshData = false)
private static CharacterBuildFile GetInstance(Character characterData, bool refreshData = false)
{
if (_instance != null && !refreshData) return _instance;
lock (Mutex)
Expand All @@ -33,18 +32,17 @@ private static CharacterBuildFile CreateInstance(Character characterData, bool r
return _instance;
}

public static CharacterBuildFile GetInstance()
private static CharacterBuildFile CreateInstance()
{
if (_instance != null) return _instance;
throw new NullReferenceException("Instance was not initialized before access.");
return _instance = new CharacterBuildFile();
}

public MetaData? BuiltWith { get; set; }
public string Class { get; set; }
public string Origin { get; set; }
public string Alignment { get; set; }
public string Name { get; set; }
public string? Comment { get; set; }
public string Comment { get; set; }
public List<string> PowerSets { get; set; }
public int LastPower { get; set; }
public List<PowerData?> PowerEntries { get; set; }
Expand Down Expand Up @@ -264,12 +262,14 @@ private static void WriteAltSlotData(ref SlotData slotData, I9Slot slot)
}
}


private static bool LoadBuild()
{
if (_instance == null)
{
return false;
}
InherentPowers = new List<PowerEntry>();

var atNiD = DatabaseAPI.NidFromUidClass(_instance.Class);
var atOrigin = DatabaseAPI.NidFromUidOrigin(_instance.Origin, atNiD);
Expand Down Expand Up @@ -490,14 +490,15 @@ public static bool Generate(string fileName)
return false;
}

var instance = CreateInstance(MidsContext.Character, true);
var instance = GetInstance(MidsContext.Character, true);
File.WriteAllText(fileName, JsonConvert.SerializeObject(instance, Formatting.Indented));
return true;
}

public static bool Load(string fileName)
{
var returnedVal = false;
_instance = CreateInstance();
_instance = JsonConvert.DeserializeObject<CharacterBuildFile>(File.ReadAllText(fileName));
if (_instance == null) throw new NullReferenceException(nameof(_instance));
var metaData = _instance.BuiltWith;
Expand Down
Loading