-
Notifications
You must be signed in to change notification settings - Fork 0
/
HKDamageLimit.cs
78 lines (62 loc) · 1.56 KB
/
HKDamageLimit.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
using UnityEngine;
using Modding;
using System.Reflection;
using System.Collections.Generic;
namespace HKDamageLimitMod
{
public class HKDamageLimit : Mod,
ILocalSettings<DamageSettingData>,
ITogglableMod,
IMenuMod
{
public static HKDamageLimit LoadedInstance { get; set; }
public DamageSettingData LocalSaveData { get; set; } = new();
public bool ToggleButtonInsideMenu => true;
public void OnLoadLocal(DamageSettingData s) => this.LocalSaveData = s;
public DamageSettingData OnSaveLocal() => this.LocalSaveData;
public override string GetVersion() => Assembly.GetExecutingAssembly()
.GetName().Version.ToString();
public override void Initialize()
{
if (HKDamageLimit.LoadedInstance != null)
{
return;
}
HKDamageLimit.LoadedInstance = this;
ModHooks.TakeHealthHook += DamageModifier;
}
public void Unload()
{
ModHooks.TakeHealthHook -= DamageModifier;
HKDamageLimit.LoadedInstance = null;
}
public List<IMenuMod.MenuEntry> GetMenuData(
IMenuMod.MenuEntry? toggleButtonEntry)
{
var entry = new IMenuMod.MenuEntry(
"All damage set to:",
new string[] { "0", "1" },
"Sets all damage received to a given number",
MenuSaver,
MenuLoader
);
return new List<IMenuMod.MenuEntry>()
{
entry,
toggleButtonEntry.Value
};
}
public void MenuSaver(int value)
{
this.LocalSaveData.DamageSetting = value;
}
public int MenuLoader()
{
return this.LocalSaveData.DamageSetting;
}
public int DamageModifier(int orig)
{
return this.LocalSaveData.DamageSetting;
}
}
}