-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathHarmonyPatches.cs
112 lines (104 loc) · 3.22 KB
/
HarmonyPatches.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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
using System.Collections.Generic;
using HarmonyLib;
using UKButt.Commands;
using UnityEngine.UI;
namespace UKButt
{
[HarmonyPatch(typeof(CameraController), nameof(CameraController.CameraShake))]
public class CameraPatch
{
static void Postfix(float shakeAmount)
{
if (!ButtplugManager.ForwardPatchedEvents) return;
ButtplugManager.Vibrate(shakeAmount);
}
}
// patch private OnPointerClick
[HarmonyPatch(typeof(Button), "Press")]
public class ButtonPatch
{
static void Postfix()
{
if (!ButtplugManager.ForwardPatchedEvents) return;
ButtplugManager.Tap(true);
}
}
// patch CheatsManager.Start
[HarmonyPatch(typeof(CheatsManager), "Start")]
public class CheatsPatch
{
static void Postfix()
{
// Register ULTRAKILL cheats
CheatsManager.Instance.RegisterExternalCheat(new UKButtStopCheat());
CheatsManager.Instance.RegisterExternalCheat(new UKButtCycleMode());
CheatBinds.Instance.RestoreBinds(new Dictionary<string, List<ICheat>>
{
{
"EXTERNAL",
new List<ICheat>
{
new UKButtStopCheat(),
new UKButtCycleMode()
}
}
});
CheatsManager.Instance.RebuildMenu();
}
}
[HarmonyPatch(typeof(Revolver), "Shoot")]
public class RevolverPatch
{
static void Postfix(int shotType = 1)
{
if (!ButtplugManager.ForwardPatchedEvents) return;
if (shotType == 1)
{
ButtplugManager.Vibrate(0.5f);
}
else
{
ButtplugManager.Vibrate(1f);
}
}
}
[HarmonyPatch(typeof(NewMovement), "Dodge")]
public class DashPatch
{
static void Postfix()
{
if (!ButtplugManager.ForwardPatchedEvents) return;
ButtplugManager.Tap();
}
}
[HarmonyPatch(typeof(StyleHUD), "AscendRank")]
public class StyleAscendRank
{
static void Postfix()
{
if (!StyleHUD.Instance)
{
ButtplugManager.Instance.currentRank = 0;
return;
}
var styleMeter = Traverse.Create(StyleHUD.Instance).Field("currentMeter").GetValue<float>();
if (styleMeter > 0) ButtplugManager.Instance.currentRank = StyleHUD.Instance.rankIndex + 1;
else ButtplugManager.Instance.currentRank = 0;
}
}
[HarmonyPatch(typeof(StyleHUD), "DescendRank")]
public class StyleDescendRank
{
static void Postfix()
{
if (!StyleHUD.Instance)
{
ButtplugManager.Instance.currentRank = 0;
return;
}
var styleMeter = Traverse.Create(StyleHUD.Instance).Field("currentMeter").GetValue<float>();
if (styleMeter > 0) ButtplugManager.Instance.currentRank = StyleHUD.Instance.rankIndex + 1;
else ButtplugManager.Instance.currentRank = 0;
}
}
}