-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.cs
More file actions
84 lines (71 loc) · 2.47 KB
/
main.cs
File metadata and controls
84 lines (71 loc) · 2.47 KB
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
using BepInEx;
using BepInEx.Logging;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using HarmonyLib;
using static MenuSkipper.MenuSkipper;
using static MenuSkipper.SharedState;
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Text;
using System.Threading.Tasks;
namespace MenuSkipper
{
public static class SharedState
{
}
[BepInPlugin(pluginGuid, pluginName, pluginVersion)]
public class MenuSkipper : BaseUnityPlugin
{
public static ManualLogSource logger;
public const string pluginGuid = "shushu.casualtiesunknown.menuskipper";
public const string pluginName = "Menu Skipper";
public const string pluginVersion = "26.1.2.0";
public static MenuSkipper Instance;
public void Awake()
{
Instance = this;
logger = Logger;
logger.LogInfo("Awake() ran - mod loaded!");
Harmony harmony = new Harmony(pluginGuid);
var TryLore_OG = AccessTools.Method(typeof(PreRunScript), "TryLore");
var TryLore_Patch = typeof(MyPatches).GetMethod("PreRunScript_TryLore_MyPatches");
harmony.Patch(TryLore_OG, prefix: new HarmonyMethod(TryLore_Patch));
Log("Patched TryLore_OG.TryLore");
var Start_OG = AccessTools.Method(typeof(PreRunScript), "Start");
var Store_Patch = typeof(MyPatches).GetMethod("PreRunScript_Start_MyPatches");
harmony.Patch(Start_OG, prefix: new HarmonyMethod(Store_Patch));
Log("Patched Start_OG.TryLore");
}
public static void Log(string message)
{
logger.LogInfo(message);
}
}
public class MyPatches
{
[HarmonyPatch(typeof(PreRunScript))]
[HarmonyPatch("TryLore")]
[HarmonyPrefix]
public static bool PreRunScript_TryLore_MyPatches(PreRunScript __instance)
{
AccessTools.Field(typeof(PreRunScript), "didIntro").SetValue(__instance, true);
return false;
}
[HarmonyPatch(typeof(PreRunScript))]
[HarmonyPatch("Start")]
[HarmonyPrefix]
public static void PreRunScript_Start_MyPatches(PreRunScript __instance)
{
var warningObj = GameObject.Find("Warning");
warningObj?.SetActive(false);
}
}
}