-
Notifications
You must be signed in to change notification settings - Fork 0
/
Plugin.cs
160 lines (135 loc) · 8.15 KB
/
Plugin.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
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
using BepInEx;
using UnityEngine;
using HarmonyLib;
using UnityEngine.UI;
using System.Collections.Generic;
using SlimeRanger.Helpers;
using System.Collections;
using SlimeRanger.Hooks;
namespace SlimeRanger
{
[BepInPlugin(PluginInfo.PLUGIN_GUID, PluginInfo.PLUGIN_NAME, PluginInfo.PLUGIN_VERSION)]
[BepInProcess("SlimeRancher.exe")]
public class Plugin : BaseUnityPlugin
{
private void Awake()
{
// Plugin startup logic
Logger.LogInfo("SlimeRanger loaded !");
var harmony = new Harmony("com.example.patch");
harmony.PatchAll();
}
private void Update()
{
if (Input.GetKeyDown(KeyCode.Insert))
{
Settings.Settings.menu_enable = !Settings.Settings.menu_enable;
}
if (Settings.Settings.fly)
{
Settings.Settings.need_to_restore_gravity = true;
Physics.set_gravity_Injected(ref Settings.Settings.zero_gravity);
Hacks.Misc.Fly(Settings.Settings.fly_speed);
}
if (!Settings.Settings.fly && Settings.Settings.need_to_restore_gravity)
{
Settings.Settings.need_to_restore_gravity = false;
Physics.set_gravity_Injected(ref Settings.Settings.original_gravity);
}
Time.timeScale = (float)Settings.Settings.time_multiplier;
}
private void OnGUI()
{
if (Settings.Settings.menu_enable) //Si on appuie sur INSERT
{
GUIStyle StatesLabel;
StatesLabel = new GUIStyle(GUI.skin.label)
{
alignment = TextAnchor.MiddleLeft,
margin = new RectOffset(),
padding = new RectOffset(),
fontSize = 25,
fontStyle = FontStyle.Bold
};
GUIStyle Statestoggle;
Statestoggle = new GUIStyle(GUI.skin.toggle)
{
fontSize = 20,
fontStyle = FontStyle.Bold
};
GUIStyle Statestoggle_smol;
Statestoggle_smol = new GUIStyle(GUI.skin.toggle)
{
fontSize = 10,
fontStyle = FontStyle.Bold
};
GUI.contentColor = Color.cyan;
GUI.Label(new Rect(200, Settings.Settings.y, 200, 50), "SlimeRanger", StatesLabel); //Titre du menu
Settings.Settings.map_reveal = GUI.Toggle(new Rect(200, Settings.Settings.y + 50, 130, 25), Settings.Settings.map_reveal, "Reveal map", Statestoggle);
Settings.Settings.godmode = GUI.Toggle(new Rect(200, Settings.Settings.y + 80, 130, 25), Settings.Settings.godmode, "Godmode", Statestoggle);
if (GUI.Button(new Rect(200, Settings.Settings.y + 110, 110, 20), "Add key"))
{
Hacks.Misc.AddKey();
Logger.LogInfo("Key added");
}
if (GUI.Button(new Rect(200, Settings.Settings.y + 140, 110, 20), "Upgrade All"))
{
Hacks.Unlocks.UnlockAllUpgrades();
Logger.LogInfo("All upgrades unlocked !");
}
if (GUI.Button(new Rect(200, Settings.Settings.y + 170, 110, 20), "Set energy"))
{
Hacks.Misc.SetEnergy((int)Settings.Settings.energy_to_set);
Logger.LogInfo("Energy added !");
}
GUI.Label(new Rect(200, Settings.Settings.y + 190, 200, 30), "Energy Amount : ");
Settings.Settings.energy_to_set = GUI.HorizontalSlider(new Rect(200, Settings.Settings.y + 210, 100, 10), Settings.Settings.energy_to_set, 0f, 1000f);
GUI.Label(new Rect(305, Settings.Settings.y + 205, 100, 30), ((int)Settings.Settings.energy_to_set).ToString());
if (GUI.Button(new Rect(200, Settings.Settings.y + 230, 110, 20), "Set Health"))
{
Hacks.Misc.SetHealth((int)Settings.Settings.health_to_set);
Logger.LogInfo("Health added !");
}
GUI.Label(new Rect(200, Settings.Settings.y + 250, 200, 30), "Health Amount : ");
Settings.Settings.health_to_set = GUI.HorizontalSlider(new Rect(200, Settings.Settings.y + 270, 100, 10), Settings.Settings.health_to_set, 0f, 1000f);
GUI.Label(new Rect(305, Settings.Settings.y + 265, 100, 30), ((int)Settings.Settings.health_to_set).ToString());
if (GUI.Button(new Rect(200, Settings.Settings.y + 290, 110, 20), "Add money"))
{
Hacks.Misc.AddCurrency((int)Settings.Settings.money_to_add);
Logger.LogInfo("Money added !");
}
GUI.Label(new Rect(200, Settings.Settings.y + 310, 200, 30), "Amount : ");
Settings.Settings.money_to_add = GUI.HorizontalSlider(new Rect(200, Settings.Settings.y + 330, 100, 10), Settings.Settings.money_to_add, 0f, 1000f);
GUI.Label(new Rect(305, Settings.Settings.y + 325, 100, 30), ((int)Settings.Settings.money_to_add).ToString());
Settings.Settings.no_rad = GUI.Toggle(new Rect(350, Settings.Settings.y + 50, 130, 25), Settings.Settings.no_rad, "No rad", Statestoggle);
Settings.Settings.infinite_energy = GUI.Toggle(new Rect(350, Settings.Settings.y + 80, 130, 25), Settings.Settings.infinite_energy, "∞ energy", Statestoggle);
Settings.Settings.fly = GUI.Toggle(new Rect(350, Settings.Settings.y + 110, 130, 25), Settings.Settings.fly, "Fly", Statestoggle);
GUI.Label(new Rect(350, Settings.Settings.y + 130, 200, 30), "Speed : ");
Settings.Settings.fly_speed = GUI.HorizontalSlider(new Rect(350, Settings.Settings.y + 150, 100, 10), Settings.Settings.fly_speed, 0f, 100f);
GUI.Label(new Rect(455, Settings.Settings.y + 145, 100, 30), ((int)Settings.Settings.fly_speed).ToString());
if (GUI.Button(new Rect(350, Settings.Settings.y + 175, 110, 20), "Save position"))
{
Settings.Settings.savedposition = StateHelpers.GetPlayerPosition();
Logger.LogInfo("Saved position : " + Settings.Settings.savedposition.ToString());
}
if (GUI.Button(new Rect(350, Settings.Settings.y + 205, 110, 20), "Goto position"))
{
if (Settings.Settings.savedposition != null)
{
Hacks.Misc.SetPlayerPosition(Settings.Settings.savedposition);
Logger.LogInfo("Teleported to position : " + Settings.Settings.savedposition.ToString());
}
}
Settings.Settings.infinite_jetpack = GUI.Toggle(new Rect(350, Settings.Settings.y + 235, 130, 25), Settings.Settings.infinite_jetpack, "∞ jetpack", Statestoggle);
Settings.Settings.max_plot = GUI.Toggle(new Rect(350, Settings.Settings.y + 265, 130, 25), Settings.Settings.max_plot, "Upgrade plot on buy", Statestoggle_smol);
Settings.Settings.max_slot_override = GUI.Toggle(new Rect(350, Settings.Settings.y + 290, 130, 25), Settings.Settings.max_slot_override, "Override max slot", Statestoggle_smol);
GUI.Label(new Rect(350, Settings.Settings.y + 310, 200, 30), "Max : ");
Settings.Settings.max_slot = GUI.HorizontalSlider(new Rect(350, Settings.Settings.y + 330, 100, 10), Settings.Settings.max_slot, 0f, 1000f);
GUI.Label(new Rect(455, Settings.Settings.y + 325, 100, 30), ((int)Settings.Settings.max_slot).ToString());
GUI.Label(new Rect(500, Settings.Settings.y + 50, 200, 30), "Time multiplier :");
Settings.Settings.time_multiplier = GUI.HorizontalSlider(new Rect(500, Settings.Settings.y + 70, 100, 10), Settings.Settings.time_multiplier, 1f, 100f);
GUI.Label(new Rect(605, Settings.Settings.y + 65, 100, 30), ((int)Settings.Settings.time_multiplier).ToString());
}
}
}
}