-
Notifications
You must be signed in to change notification settings - Fork 0
/
Bootstrap.cs
71 lines (66 loc) · 2.98 KB
/
Bootstrap.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
using CommunityCoreLibrary_StepAway;
using System;
using System.Reflection;
using UnityEngine;
using Verse;
namespace StepAway
{
class Bootstrap : Def
{
static Bootstrap()
{
try
{
{
MethodInfo method1 = typeof(RimWorld.MedicalCareUtility).GetMethod("MedicalCareSetter", BindingFlags.Static | BindingFlags.Public);
MethodInfo method2 = typeof(MedicalCareUtility_Detour).GetMethod("MedicalCareSetter", BindingFlags.Static | BindingFlags.Public);
if (!Detours.TryDetourFromTo(method1, method2))
{
Log.Error("EVERYTHING IS BROKEN 1");
return;
}
}
{
ConstructorInfo method1 = typeof(RimWorld.Pawn_PlayerSettings).GetConstructor(new Type[] { typeof(Pawn) });
MethodInfo method2 = typeof(Pawn_PlayerSettings_Detour).GetMethod("Pawn_PlayerSettings", BindingFlags.Static | BindingFlags.Public);
if (!Detours.TryDetourFromTo(method1, method2))
{
Log.Error("EVERYTHING IS BROKEN 2");
return;
}
}
{
MethodInfo method1 = typeof(RimWorld.Pawn_PlayerSettings).GetMethod("Notify_MadePrisoner", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method2 = typeof(Pawn_PlayerSettings_Detour).GetMethod("Notify_MadePrisoner", BindingFlags.Static | BindingFlags.Public);
if (!Detours.TryDetourFromTo(method1, method2))
{
Log.Error("EVERYTHING IS BROKEN 3");
return;
}
}
{
MethodInfo method1 = typeof(RimWorld.Pawn_PlayerSettings).GetMethod("Notify_FactionChanged", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method2 = typeof(Pawn_PlayerSettings_Detour).GetMethod("Notify_FactionChanged", BindingFlags.Static | BindingFlags.Public);
if (!Detours.TryDetourFromTo(method1, method2))
{
Log.Error("EVERYTHING IS BROKEN 4");
return;
}
}
{
MethodInfo method1 = typeof(Verse.Pawn).GetMethod("SetFaction", BindingFlags.Instance | BindingFlags.Public);
MethodInfo method2 = typeof(Pawn_Detour).GetMethod("SetFaction", BindingFlags.Static | BindingFlags.Public);
if (!Detours.TryDetourFromTo(method1, method2))
{
Log.Error("EVERYTHING IS BROKEN 5");
return;
}
}
}
catch (Exception)
{
Log.Error("something is seriously wrong");
}
}
}
}