Skip to content

Commit

Permalink
ReSharper naming fixes
Browse files Browse the repository at this point in the history
Up version number
  • Loading branch information
SFGrenade committed Aug 22, 2021
1 parent ca5cfa7 commit 2c414b4
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 59 deletions.
8 changes: 4 additions & 4 deletions Consts/TextureStrings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ public class TextureStrings
private const string DeepestFocusFile = "MoreHealing.Resources.DeepestFocus.png";
#endregion Misc

private readonly Dictionary<string, Sprite> dict;
private readonly Dictionary<string, Sprite> _dict;

public TextureStrings()
{
Assembly asm = Assembly.GetExecutingAssembly();
dict = new Dictionary<string, Sprite>();
_dict = new Dictionary<string, Sprite>();
Dictionary<string, string> tmpTextures = new Dictionary<string, string>();
tmpTextures.Add(QuickerFocusKey, QuickerFocusFile);
tmpTextures.Add(QuickestFocusKey, QuickestFocusFile);
Expand All @@ -46,14 +46,14 @@ public TextureStrings()

// Create sprite from texture
// Split is to cut off the TestOfTeamwork.Resources. and the .png
dict.Add(t.Key, Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f)));
_dict.Add(t.Key, Sprite.Create(tex, new Rect(0, 0, tex.width, tex.height), new Vector2(0.5f, 0.5f)));
}
}
}

public Sprite Get(string key)
{
return dict[key];
return _dict[key];
}
}
}
12 changes: 5 additions & 7 deletions MhSettings.cs
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
using Modding;

namespace MoreHealing
namespace MoreHealing
{
class MhSettings
{
// insert default values here
public bool[] gotCharms = new bool[] { true, true, true, true };
public bool[] newCharms = new bool[] { false, false, false, false };
public bool[] equippedCharms = new bool[] { false, false, false, false };
public int[] charmCosts = new int[] { 4, 5, 5, 6 };
public bool[] gotCharms = new[] { true, true, true, true };
public bool[] newCharms = new[] { false, false, false, false };
public bool[] equippedCharms = new[] { false, false, false, false };
public int[] charmCosts = new[] { 4, 5, 5, 6 };
}
}
86 changes: 43 additions & 43 deletions MoreHealing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ namespace MoreHealing
class MoreHealing : SaveSettingsMod<MhSettings>
{

public TextureStrings ts { get; private set; }
public List<int> charmIDs { get; private set; }
public TextureStrings Ts { get; private set; }
public List<int> CharmIDs { get; private set; }

// Thx to 56
public override string GetVersion()
Expand All @@ -45,21 +45,21 @@ public override string GetVersion()

public MoreHealing() : base("More Healing")
{
ts = new TextureStrings();
Ts = new TextureStrings();
}

public override void Initialize()
{
Log("Initializing");

charmIDs = CharmHelper.AddSprites(ts.Get(TextureStrings.QuickerFocusKey), ts.Get(TextureStrings.QuickestFocusKey), ts.Get(TextureStrings.DeeperFocusKey), ts.Get(TextureStrings.DeepestFocusKey));
CharmIDs = CharmHelper.AddSprites(Ts.Get(TextureStrings.QuickerFocusKey), Ts.Get(TextureStrings.QuickestFocusKey), Ts.Get(TextureStrings.DeeperFocusKey), Ts.Get(TextureStrings.DeepestFocusKey));

initCallbacks();
InitCallbacks();

Log("Initialized");
}

private void initCallbacks()
private void InitCallbacks()
{
ModHooks.GetPlayerBoolHook += OnGetPlayerBoolHook;
ModHooks.SetPlayerBoolHook += OnSetPlayerBoolHook;
Expand All @@ -81,30 +81,30 @@ private void GameManagerUpdate(On.GameManager.orig_Update orig, GameManager self

#endregion

private bool changed = false;
private bool _changed = false;
private void OnHeroControllerStart(On.HeroController.orig_Start orig, HeroController self)
{
orig(self);
if (changed) return;
changed = true;
if (_changed) return;
_changed = true;

self.StartCoroutine(addCharmStates(self));
self.StartCoroutine(AddCharmStates(self));

changed = true;
_changed = true;
}
private void InitSaveSettings(SaveGameData data)
{
// Found in a project, might help saving, don't know, but who cares
// Charms
_saveSettings.gotCharms = _saveSettings.gotCharms;
_saveSettings.newCharms = _saveSettings.newCharms;
_saveSettings.equippedCharms = _saveSettings.equippedCharms;
_saveSettings.charmCosts = _saveSettings.charmCosts;
SaveSettings.gotCharms = SaveSettings.gotCharms;
SaveSettings.newCharms = SaveSettings.newCharms;
SaveSettings.equippedCharms = SaveSettings.equippedCharms;
SaveSettings.charmCosts = SaveSettings.charmCosts;

changed = false;
_changed = false;
}

private IEnumerator addCharmStates(HeroController self)
private IEnumerator AddCharmStates(HeroController self)
{
var spellFsm = self.gameObject.LocateMyFSM("Spell Control");
var spellFsmVar = spellFsm.FsmVariables;
Expand All @@ -119,15 +119,15 @@ private IEnumerator addCharmStates(HeroController self)
spellFsm.RemoveAction("Set QuickerFocus Speed", 0);
spellFsm.RemoveAction("Set QuickerFocus Speed", 0);
spellFsm.RemoveAction("Set QuickerFocus Speed", 2);
spellFsm.GetAction<PlayerDataBoolTest>("Set QuickerFocus Speed", 0).boolName = $"equippedCharm_{charmIDs[0]}";
spellFsm.GetAction<PlayerDataBoolTest>("Set QuickerFocus Speed", 0).boolName = $"equippedCharm_{CharmIDs[0]}";
spellFsm.AddAction("Set QuickerFocus Speed", fmAction);
spellFsm.GetAction<FloatMultiply>("Set QuickerFocus Speed", 2).multiplyBy = Mathf.Pow(2f/3f, 2);

spellFsm.CopyState("Set Focus Speed", "Set QuickestFocus Speed");
spellFsm.RemoveAction("Set QuickestFocus Speed", 0);
spellFsm.RemoveAction("Set QuickestFocus Speed", 0);
spellFsm.RemoveAction("Set QuickestFocus Speed", 2);
spellFsm.GetAction<PlayerDataBoolTest>("Set QuickestFocus Speed", 0).boolName = $"equippedCharm_{charmIDs[1]}";
spellFsm.GetAction<PlayerDataBoolTest>("Set QuickestFocus Speed", 0).boolName = $"equippedCharm_{CharmIDs[1]}";
spellFsm.AddAction("Set QuickestFocus Speed", fmAction);
spellFsm.GetAction<FloatMultiply>("Set QuickestFocus Speed", 2).multiplyBy = Mathf.Pow(2f/3f, 3);

Expand All @@ -139,11 +139,11 @@ private IEnumerator addCharmStates(HeroController self)
#region Deep Focus Speeds

spellFsm.CopyState("Deep Focus Speed", "Deeper Focus Speed");
spellFsm.GetAction<PlayerDataBoolTest>("Deeper Focus Speed", 0).boolName = $"equippedCharm_{charmIDs[2]}";
spellFsm.GetAction<PlayerDataBoolTest>("Deeper Focus Speed", 0).boolName = $"equippedCharm_{CharmIDs[2]}";
spellFsm.GetAction<FloatMultiply>("Deeper Focus Speed", 1).multiplyBy = Mathf.Pow(1.65f, 2);

spellFsm.CopyState("Deep Focus Speed", "Deepest Focus Speed");
spellFsm.GetAction<PlayerDataBoolTest>("Deepest Focus Speed", 0).boolName = $"equippedCharm_{charmIDs[3]}";
spellFsm.GetAction<PlayerDataBoolTest>("Deepest Focus Speed", 0).boolName = $"equippedCharm_{CharmIDs[3]}";
spellFsm.GetAction<FloatMultiply>("Deepest Focus Speed", 1).multiplyBy = Mathf.Pow(1.65f, 3);

spellFsm.ChangeTransition("Deep Focus Speed", "FINISHED", "Deeper Focus Speed");
Expand All @@ -167,13 +167,13 @@ private IEnumerator addCharmStates(HeroController self)
spellFsm.CopyState("Set HP Amount", "Set HP Amount Deeper");
spellFsm.RemoveAction("Set HP Amount Deeper", 0);
spellFsm.RemoveAction("Set HP Amount Deeper", 1);
spellFsm.GetAction<PlayerDataBoolTest>("Set HP Amount Deeper", 0).boolName = $"equippedCharm_{charmIDs[2]}";
spellFsm.GetAction<PlayerDataBoolTest>("Set HP Amount Deeper", 0).boolName = $"equippedCharm_{CharmIDs[2]}";
spellFsm.AddAction("Set HP Amount Deeper", iaa2);

spellFsm.CopyState("Set HP Amount", "Set HP Amount Deepest");
spellFsm.RemoveAction("Set HP Amount Deepest", 0);
spellFsm.RemoveAction("Set HP Amount Deepest", 1);
spellFsm.GetAction<PlayerDataBoolTest>("Set HP Amount Deepest", 0).boolName = $"equippedCharm_{charmIDs[3]}";
spellFsm.GetAction<PlayerDataBoolTest>("Set HP Amount Deepest", 0).boolName = $"equippedCharm_{CharmIDs[3]}";
spellFsm.AddAction("Set HP Amount Deepest", iaa3);

spellFsm.ChangeTransition("Set HP Amount", FsmEvent.Finished.Name, "Set HP Amount Deeper");
Expand All @@ -186,7 +186,7 @@ private IEnumerator addCharmStates(HeroController self)

#region ModHooks

private string[] charmNames =
private string[] _charmNames =
{
"Quicker Focus",
"Quickest Focus",
Expand All @@ -195,7 +195,7 @@ private IEnumerator addCharmStates(HeroController self)
"Temp",
"Temp"
};
private string[] charmDescriptions =
private string[] _charmDescriptions =
{
"A dense charm containing a crystal lens.<br><br>Increases the speed of focusing SOUL, allowing the bearer to heal damage even faster.",
"A very dense charm containing a crystal lens.<br><br>Increases the speed of focusing SOUL, allowing the bearer to heal damage faster than nothing else.",
Expand All @@ -209,17 +209,17 @@ private string OnLanguageGetHook(string key, string sheet, string orig)
if (key.StartsWith("CHARM_NAME_"))
{
int charmNum = int.Parse(key.Split('_')[2]);
if (charmIDs.Contains(charmNum))
if (CharmIDs.Contains(charmNum))
{
return charmNames[charmIDs.IndexOf(charmNum)];
return _charmNames[CharmIDs.IndexOf(charmNum)];
}
}
else if (key.StartsWith("CHARM_DESC_"))
{
int charmNum = int.Parse(key.Split('_')[2]);
if (charmIDs.Contains(charmNum))
if (CharmIDs.Contains(charmNum))
{
return charmDescriptions[charmIDs.IndexOf(charmNum)];
return _charmDescriptions[CharmIDs.IndexOf(charmNum)];
}
}
return orig;
Expand All @@ -229,25 +229,25 @@ private bool OnGetPlayerBoolHook(string target, bool orig)
if (target.StartsWith("gotCharm_"))
{
int charmNum = int.Parse(target.Split('_')[1]);
if (charmIDs.Contains(charmNum))
if (CharmIDs.Contains(charmNum))
{
return _saveSettings.gotCharms[charmIDs.IndexOf(charmNum)];
return SaveSettings.gotCharms[CharmIDs.IndexOf(charmNum)];
}
}
if (target.StartsWith("newCharm_"))
{
int charmNum = int.Parse(target.Split('_')[1]);
if (charmIDs.Contains(charmNum))
if (CharmIDs.Contains(charmNum))
{
return _saveSettings.newCharms[charmIDs.IndexOf(charmNum)];
return SaveSettings.newCharms[CharmIDs.IndexOf(charmNum)];
}
}
if (target.StartsWith("equippedCharm_"))
{
int charmNum = int.Parse(target.Split('_')[1]);
if (charmIDs.Contains(charmNum))
if (CharmIDs.Contains(charmNum))
{
return _saveSettings.equippedCharms[charmIDs.IndexOf(charmNum)];
return SaveSettings.equippedCharms[CharmIDs.IndexOf(charmNum)];
}
}
return orig;
Expand All @@ -257,27 +257,27 @@ private bool OnSetPlayerBoolHook(string target, bool orig)
if (target.StartsWith("gotCharm_"))
{
int charmNum = int.Parse(target.Split('_')[1]);
if (charmIDs.Contains(charmNum))
if (CharmIDs.Contains(charmNum))
{
_saveSettings.gotCharms[charmIDs.IndexOf(charmNum)] = orig;
SaveSettings.gotCharms[CharmIDs.IndexOf(charmNum)] = orig;
return orig;
}
}
if (target.StartsWith("newCharm_"))
{
int charmNum = int.Parse(target.Split('_')[1]);
if (charmIDs.Contains(charmNum))
if (CharmIDs.Contains(charmNum))
{
_saveSettings.newCharms[charmIDs.IndexOf(charmNum)] = orig;
SaveSettings.newCharms[CharmIDs.IndexOf(charmNum)] = orig;
return orig;
}
}
if (target.StartsWith("equippedCharm_"))
{
int charmNum = int.Parse(target.Split('_')[1]);
if (charmIDs.Contains(charmNum))
if (CharmIDs.Contains(charmNum))
{
_saveSettings.equippedCharms[charmIDs.IndexOf(charmNum)] = orig;
SaveSettings.equippedCharms[CharmIDs.IndexOf(charmNum)] = orig;
return orig;
}
}
Expand All @@ -288,9 +288,9 @@ private int OnGetPlayerIntHook(string target, int orig)
if (target.StartsWith("charmCost_"))
{
int charmNum = int.Parse(target.Split('_')[1]);
if (charmIDs.Contains(charmNum))
if (CharmIDs.Contains(charmNum))
{
return _saveSettings.charmCosts[charmIDs.IndexOf(charmNum)];
return SaveSettings.charmCosts[CharmIDs.IndexOf(charmNum)];
}
}
return orig;
Expand Down
11 changes: 6 additions & 5 deletions MoreHealing.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,21 @@
<AssemblyTitle>MoreHealing</AssemblyTitle>
<Product>MoreHealing</Product>
<Description>A Hollow Knight Mod</Description>
<Copyright>Copyright © SFGrenade 2020</Copyright>
<AssemblyVersion>1.0.0.0</AssemblyVersion>
<FileVersion>1.0.0.0</FileVersion>
<Copyright>Copyright © SFGrenade 2019-2021</Copyright>
<AssemblyVersion>1.5.0.0</AssemblyVersion>
<FileVersion>1.5.0.0</FileVersion>
<OutputPath>bin\$(Configuration)\</OutputPath>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<NoWarn>8002</NoWarn>
<HollowKnightRefs>E:/GOG/Hollow Knight 1.5 Modded/Hollow Knight_Data/Managed/</HollowKnightRefs>
<ExportDir>E:/Github_Projects/__Exports/</ExportDir>
</PropertyGroup>
<Target Name="CopyMod" AfterTargets="PostBuildEvent">
<RemoveDir Directories="$(ExportDir)/$(TargetName)/" />
<MakeDir Directories="$(ExportDir)/$(TargetName)/" />
<MakeDir Directories="$(ExportDir)/$(TargetName)/zip/" />
<Copy SourceFiles="$(TargetPath);$(TargetDir)/$(TargetName).pdb" DestinationFolder="$(HollowKnightRefs)/Mods/" />
<MakeDir Condition="!Exists('$(HollowKnightRefs)/Mods/$(TargetName)/')" Directories="$(HollowKnightRefs)/Mods/$(TargetName)/" />
<Copy SourceFiles="$(TargetPath);$(TargetDir)/$(TargetName).pdb" DestinationFolder="$(HollowKnightRefs)/Mods/$(TargetName)/" />
<Copy SourceFiles="$(TargetPath)" DestinationFolder="$(ExportDir)/$(TargetName)/" />
<Copy SourceFiles="ReadMe.md;$(TargetPath);$(TargetDir)/$(TargetName).pdb" DestinationFolder="$(ExportDir)/$(TargetName)/zip/" />
<ZipDirectory SourceDirectory="$(ExportDir)/$(TargetName)/zip/" DestinationFile="$(ExportDir)/$(TargetName)/$(TargetName).zip" />
Expand Down

0 comments on commit 2c414b4

Please sign in to comment.