using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text.RegularExpressions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using ModMenu.Cheats.Player;
using ModMenu.UI;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("ModMenu")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ModMenu")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("B6CD993C-9878-4199-9C17-9FFCAFA221F1")]
[assembly: AssemblyFileVersion("2.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("2.0.0.0")]
namespace ModMenu
{
public class AleMain : MonoBehaviour
{
private bool _initialSetupDone;
private bool _stylesInitialized;
private void Start()
{
((MonoBehaviour)this).InvokeRepeating("SlowUpdate", 0f, 0.5f);
}
private void OnGUI()
{
if (!_stylesInitialized)
{
_stylesInitialized = true;
UIHelper.InitializeStyles();
}
UIManager.Display();
}
private void SlowUpdate()
{
if ((Object)(object)PlayerManager.Instance == (Object)null)
{
return;
}
if (!PlayerManager.Instance.isLocalPlayerSpawned)
{
ModMenu.Cheats.Player.Cheats.GodModeEnabled = false;
ModMenu.Cheats.Player.Cheats.NoClipEnabled = false;
ModMenu.Cheats.Player.Cheats.ShopUnlockEnabled = false;
ModMenu.Cheats.Player.Cheats.FreezeTimeEnabled = false;
ModMenu.Cheats.Player.Cheats.NoFallDamageEnabled = false;
ModMenu.Cheats.Player.Cheats.InstantDashEnabled = false;
ModMenu.Cheats.Player.Cheats.AlwaysCleanEnabled = false;
}
else
{
if (!_initialSetupDone)
{
Master.Instance.isDebug = Settings.EnableDebug.Value;
Master.Instance.fCheats = Settings.EnableCheats.Value;
_initialSetupDone = true;
}
ModMenu.Cheats.Player.Cheats.GodModeEnabled = Game.Instance.god.Value;
}
}
private void Update()
{
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Invalid comparison between Unknown and I4
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
ModMenu.Cheats.Player.Cheats.EnforceCheats();
if (Input.GetKeyDown(Settings.ModKey.Value))
{
if ((Object)(object)PlayerInventory.Instance == (Object)null)
{
return;
}
Scene activeScene = SceneManager.GetActiveScene();
if (((Scene)(ref activeScene)).name == "MainMenu")
{
return;
}
if (UIManager.MenuVisible)
{
UIManager.MenuVisible = false;
if ((int)PlayerInventory.Instance.state == 20)
{
PlayerInventory.Instance.SetState((State)0);
}
}
else if (IsInMenuState())
{
UIManager.MenuVisible = true;
if ((int)PlayerInventory.Instance.state == 0)
{
PlayerInventory.Instance.SetState((State)20);
}
}
}
if ((Object)(object)PlayerInventory.Instance != (Object)null && UIManager.MenuVisible && !IsInMenuState())
{
UIManager.MenuVisible = false;
}
}
private static bool IsInMenuState()
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Invalid comparison between Unknown and I4
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Invalid comparison between Unknown and I4
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Invalid comparison between Unknown and I4
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Invalid comparison between Unknown and I4
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Invalid comparison between Unknown and I4
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Invalid comparison between Unknown and I4
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Invalid comparison between Unknown and I4
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Invalid comparison between Unknown and I4
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Invalid comparison between Unknown and I4
if ((Object)(object)PlayerInventory.Instance == (Object)null)
{
return false;
}
State state = PlayerInventory.Instance.state;
if ((int)state != 20 && (int)state != 21 && (int)state != 15 && (int)state != 10 && (int)state != 5 && (int)state != 4 && (int)state != 2 && (int)state != 3)
{
return (int)state == 0;
}
return true;
}
}
[BepInPlugin("RealSkye.ModMenu", "ModMenu", "2.0.0")]
public class Plugin : BaseUnityPlugin
{
public const string PLUGIN_GUID = "RealSkye.ModMenu";
public const string PLUGIN_NAME = "ModMenu";
public const string PLUGIN_VERSION = "2.0.0";
public static ManualLogSource Log { get; private set; }
public void Awake()
{
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
Log = Logger.CreateLogSource("RealSkye.ModMenu");
Settings.Initialize(((BaseUnityPlugin)this).Config);
Log.LogInfo((object)"Plugin ModMenu (v2.0.0) has loaded!");
try
{
GameObject val = new GameObject("AleBehavior");
val.AddComponent<AleMain>();
((Object)val).hideFlags = (HideFlags)61;
Object.DontDestroyOnLoad((Object)val);
}
catch
{
Log.LogError((object)"FAILED to Register Mono Type!");
}
}
}
public static class Settings
{
public static ConfigEntry<KeyCode> ModKey { get; private set; }
public static ConfigEntry<bool> EnableDebug { get; private set; }
public static ConfigEntry<bool> EnableCheats { get; private set; }
internal static void Initialize(ConfigFile config)
{
ModKey = config.Bind<KeyCode>("Hotkeys", "Toggle", (KeyCode)127, "Toggles menu visibility");
EnableDebug = config.Bind<bool>("General", "EnableDebug", true, "Enables debug features: teleport menu (backQuote), UI toggling (slash), and noclip speed changes (comma/period).");
EnableCheats = config.Bind<bool>("General", "EnableCheats", true, "Enables built-in cheat hotkeys: F9 = God, F10 = GiveAllTools, F11 = AddMoney(1000), F12 = AddExp(100), C = ShowEntityStats");
}
}
}
namespace ModMenu.UI
{
public class UIHelper
{
private static float x;
private static float y;
private static float width;
private static float height;
private static float margin;
private static float controlHeight;
private static float controlDist;
private static float nextControlY;
private static Texture2D _panelOff;
private static Texture2D _panelOn;
private static GUIStyle _boxStyle;
private static GUIStyle _titlebarStyle;
public static GUIStyle TextFieldStyle;
private static GUIStyle _centeredLabelStyle;
public static GUIStyle ButtonStyle;
public static GUIStyle SpawnerButtonStyle;
public static GUIStyle PanelStyle;
private static Color onColor = new Color(77f / 85f, 6f / 85f, 0f);
private static Color offColor = Color.white;
public static GUIStyle StringStyle { get; set; } = new GUIStyle(GUI.skin.label);
public static void InitializeStyles()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Expected O, but got Unknown
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Expected O, but got Unknown
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Expected O, but got Unknown
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Expected O, but got Unknown
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0225: Unknown result type (might be due to invalid IL or missing references)
//IL_022f: Expected O, but got Unknown
//IL_0243: Unknown result type (might be due to invalid IL or missing references)
//IL_024d: Expected O, but got Unknown
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_030b: Expected O, but got Unknown
//IL_0326: Unknown result type (might be due to invalid IL or missing references)
//IL_0366: Unknown result type (might be due to invalid IL or missing references)
//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
_panelOff = MakeTex(1, 1, new Color(0.32156864f, 0.32156864f, 0.32156864f));
((Object)_panelOff).hideFlags = (HideFlags)61;
_panelOn = MakeTex(1, 1, new Color(77f / 85f, 6f / 85f, 0f));
((Object)_panelOn).hideFlags = (HideFlags)61;
PanelStyle = new GUIStyle(GUI.skin.label);
PanelStyle.normal.background = _panelOff;
((Object)PanelStyle.normal.background).hideFlags = (HideFlags)61;
_boxStyle = new GUIStyle(GUI.skin.box);
_boxStyle.normal.background = MakeTex(1, 1, new Color(14f / 85f, 14f / 85f, 14f / 85f));
((Object)_boxStyle.normal.background).hideFlags = (HideFlags)61;
_titlebarStyle = new GUIStyle(GUI.skin.box);
_titlebarStyle.normal.background = MakeTex(1, 1, new Color(77f / 85f, 6f / 85f, 0f));
((Object)_titlebarStyle.normal.background).hideFlags = (HideFlags)61;
_centeredLabelStyle = new GUIStyle(GUI.skin.label);
_centeredLabelStyle.alignment = (TextAnchor)4;
SpawnerButtonStyle = new GUIStyle(GUI.skin.button);
SpawnerButtonStyle.normal.background = Texture2D.blackTexture;
((Object)SpawnerButtonStyle.normal.background).hideFlags = (HideFlags)61;
SpawnerButtonStyle.hover.background = MakeTex(1, 1, new Color(6f / 85f, 6f / 85f, 6f / 85f));
((Object)SpawnerButtonStyle.hover.background).hideFlags = (HideFlags)61;
SpawnerButtonStyle.active.background = MakeTex(1, 1, new Color(6f / 85f, 6f / 85f, 6f / 85f));
((Object)SpawnerButtonStyle.active.background).hideFlags = (HideFlags)61;
ButtonStyle = new GUIStyle(GUI.skin.button);
ButtonStyle.alignment = (TextAnchor)3;
ButtonStyle.padding = new RectOffset(4, 0, 0, 0);
ButtonStyle.normal.background = Texture2D.blackTexture;
((Object)ButtonStyle.normal.background).hideFlags = (HideFlags)61;
ButtonStyle.hover.background = MakeTex(1, 1, new Color(6f / 85f, 6f / 85f, 6f / 85f));
((Object)ButtonStyle.hover.background).hideFlags = (HideFlags)61;
ButtonStyle.active.background = MakeTex(1, 1, new Color(6f / 85f, 6f / 85f, 6f / 85f));
((Object)ButtonStyle.active.background).hideFlags = (HideFlags)61;
TextFieldStyle = new GUIStyle(GUI.skin.textField);
TextFieldStyle.normal.background = MakeTex(2, 2, new Color(0.10980392f, 0.10980392f, 0.10980392f));
((Object)TextFieldStyle.normal.background).hideFlags = (HideFlags)61;
TextFieldStyle.hover.background = MakeTex(2, 2, new Color(6f / 85f, 6f / 85f, 6f / 85f));
((Object)TextFieldStyle.hover.background).hideFlags = (HideFlags)61;
TextFieldStyle.focused.background = MakeTex(2, 2, new Color(0.10980392f, 0.10980392f, 0.10980392f));
((Object)TextFieldStyle.focused.background).hideFlags = (HideFlags)61;
}
public static void Begin(string text, float _x, float _y, float _width, float _height, float _margin, float _controlHeight, float _controlDist)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
x = _x;
y = _y;
width = _width;
height = _height;
margin = _margin;
controlHeight = _controlHeight;
controlDist = _controlDist;
nextControlY = 20f;
GUI.Box(new Rect(x, y, width, height), "", _boxStyle);
GUI.Box(new Rect(x, y, width, 20f), "", _titlebarStyle);
GUI.Label(new Rect(x, y, width, 20f), "<b>" + text + "</b>", _centeredLabelStyle);
}
public static void Begin(string text, float _x, float _y, float _width, float _height, float _margin, float _controlHeight, float _controlDist, bool biggerTitleBar)
{
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
x = _x;
y = _y;
width = _width;
height = _height;
margin = _margin;
controlHeight = _controlHeight;
controlDist = _controlDist;
nextControlY = 20f;
GUI.Box(new Rect(x, y, width, height), "", _boxStyle);
GUI.Box(new Rect(x, y, width, 25f), "", _titlebarStyle);
GUI.Label(new Rect(x, y, width, 25f), "<b>" + text + "</b>", _centeredLabelStyle);
}
private static Rect NextControlRect()
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
Rect result = new Rect(x + margin, nextControlY + y, width - margin * 2f, controlHeight);
nextControlY += controlHeight + controlDist;
return result;
}
private static Rect NextControlRectSpaced()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
Rect result = new Rect(x + margin, nextControlY * 1.4f + y, width - margin * 2f, controlHeight);
nextControlY += controlHeight + controlDist;
return result;
}
private static Rect NextControlRectSpaced2()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
Rect result = new Rect(x + margin, nextControlY * 1.6f + y, width - margin * 2f, controlHeight);
nextControlY += controlHeight + controlDist;
return result;
}
public static string MakeEnable(string text, bool state)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
PanelStyle.normal.background = (state ? _panelOn : _panelOff);
Color val = (state ? onColor : offColor);
int num = (int)(val.r * 255f);
int num2 = (int)(val.g * 255f);
int num3 = (int)(val.b * 255f);
string text2 = $"#{num:X2}{num2:X2}{num3:X2}";
return "<color=" + text2 + ">" + text + "</color>";
}
public static void Button(string text, bool state, Action function)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
Rect val = NextControlRect();
bool num = GUI.Button(val, MakeEnable(text, state), ButtonStyle);
GUI.Label(new Rect(((Rect)(ref val)).xMax - 6f, ((Rect)(ref val)).y + 3f, 3f, ((Rect)(ref val)).height - 6f), GUIContent.none, PanelStyle);
if (num)
{
GUI.FocusControl((string)null);
function();
}
}
public static bool Button(string text)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
bool num = GUI.Button(NextControlRect(), text, ButtonStyle);
if (num)
{
GUI.FocusControl((string)null);
}
return num;
}
public static void Label(string text, float value, int decimals = 2)
{
Label($"{text}{Math.Round(value, 2).ToString()}");
}
public static void Label(string text)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
GUI.Label(NextControlRect(), text, _centeredLabelStyle);
}
public static void Label(string text, bool spacing)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
if (spacing)
{
GUI.Label(NextControlRectSpaced(), text, _centeredLabelStyle);
}
else
{
GUI.Label(NextControlRectSpaced2(), text, _centeredLabelStyle);
}
}
public static float Slider(float val, float min, float max)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
return GUI.HorizontalSlider(NextControlRect(), val, min, max);
}
public static float Slider(ref float val, float min, float max)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
return GUI.HorizontalSlider(NextControlRect(), val, min, max);
}
public static bool DrawString(Vector2 position, string label, Color color, int fontSize, bool centered = true)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
GUI.color = color;
StringStyle.fontSize = fontSize;
StringStyle.normal.textColor = color;
GUIContent val = new GUIContent(label);
Vector2 val2 = StringStyle.CalcSize(val);
GUI.Label(new Rect(centered ? (position - val2 / 2f) : position, val2), val, StringStyle);
return true;
}
public static void DrawLine(Vector2 start, Vector2 end, Color color, float width)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
GUI.depth = 0;
Vector2 val = end - start;
float num = 57.29578f * Mathf.Atan(val.y / val.x);
if (val.x < 0f)
{
num += 180f;
}
int num2 = (int)Mathf.Ceil(width / 2f);
GUIUtility.RotateAroundPivot(num, start);
GUI.color = color;
GUI.DrawTexture(new Rect(start.x, start.y - (float)num2, ((Vector2)(ref val)).magnitude, width), (Texture)(object)Texture2D.whiteTexture, (ScaleMode)0);
GUIUtility.RotateAroundPivot(0f - num, start);
}
public static void DrawBox(Vector2 position, Vector2 size, Color color, bool centered = true)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
if (centered)
{
position -= size / 2f;
}
GUI.color = color;
GUI.DrawTexture(new Rect(position, size), (Texture)(object)Texture2D.whiteTexture, (ScaleMode)0);
}
public static void DrawBoxOutline(Vector2 Point, float width, float height, Color color)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
DrawLine(Point, new Vector2(Point.x + width, Point.y), color, 2f);
DrawLine(Point, new Vector2(Point.x, Point.y + height), color, 2f);
DrawLine(new Vector2(Point.x + width, Point.y + height), new Vector2(Point.x + width, Point.y), color, 2f);
DrawLine(new Vector2(Point.x + width, Point.y + height), new Vector2(Point.x, Point.y + height), color, 2f);
}
private static Texture2D MakeTex(int width, int height, Color col)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
Color[] array = (Color[])(object)new Color[width * height];
for (int i = 0; i < array.Length; i++)
{
array[i] = col;
}
Texture2D val = new Texture2D(width, height);
val.SetPixels(array);
val.Apply();
return val;
}
}
public class UIManager
{
private static GUIStyle whiteText = new GUIStyle();
public static bool MenuVisible;
public static bool IdsMenuVisible;
public static bool EffectsMenuVisible;
public static bool QuestTypeMenuVisible;
public static bool CreatureTypeMenuVisible;
public static float PercentToClean = 10f;
private static string _itemIdInput = "0";
private static string _itemAmountInput = "1";
private static string _effectTypeInput = "type";
private static string _effectDurationInput = "60";
private static string _effectStrengthInput = "0";
private static string _moneyInput = "0";
private static string _expInput = "0";
private static string _questTypeInput = "Undefined";
private static bool _isWednesdayInput;
private static string _creatureTypeInput = "None";
private static string _levelInput = "1";
private static float _timeSlider = 12f;
private static Vector2 _scrollPosition = Vector2.zero;
private static Vector2 _scrollPosition1 = Vector2.zero;
private static Vector2 _scrollPosition2 = Vector2.zero;
private static Vector2 _scrollPosition3 = Vector2.zero;
private static List<ItemData> _itemList;
private static List<EffectType> _effectList;
private static List<GenericQuestType> _questTypesList;
private static List<Type> _EntityList;
private static string _searchQuery = "";
private static string _searchQuery1 = "";
private static string _searchQuery2 = "";
private static string _searchQuery3 = "";
private static bool _initialized;
private static bool _initializedEffects;
private static bool _initializedQuests;
private static bool _initializedEntityTypes;
public static void Display()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Invalid comparison between Unknown and I4
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Invalid comparison between Unknown and I4
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Invalid comparison between Unknown and I4
//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
if (MenuVisible)
{
if ((int)Event.current.type == 4 && ((int)Event.current.keyCode == 13 || (int)Event.current.keyCode == 27))
{
GUI.FocusControl((string)null);
}
if ((int)Event.current.type == 0)
{
GUI.FocusControl((string)null);
}
GUI.color = Color.white;
UIHelper.Begin("Player", 10f, 10f, 150f, 380f, 0f, 22f, 1f);
UIHelper.Button("God Mode", ModMenu.Cheats.Player.Cheats.GodModeEnabled, ModMenu.Cheats.Player.Cheats.ToggleGodMode);
UIHelper.Label("1 WalkSpeed 10");
PlayerMovement.Instance.speedEffectModifier = UIHelper.Slider(ref PlayerMovement.Instance.speedEffectModifier, 1f, 10f);
UIHelper.Label("1.5 RunSpeed 10");
PlayerMovement.Instance.sprintSpeedModifier = UIHelper.Slider(ref PlayerMovement.Instance.sprintSpeedModifier, 1.5f, 10f);
UIHelper.Label("0 CleanSpeed 10");
PercentToClean = UIHelper.Slider(ref PercentToClean, 0f, 10f);
UIHelper.Button("NoClip", ModMenu.Cheats.Player.Cheats.NoClipEnabled, ModMenu.Cheats.Player.Cheats.ToggleNoClip);
UIHelper.Button("No Fall Damage", ModMenu.Cheats.Player.Cheats.NoFallDamageEnabled, ModMenu.Cheats.Player.Cheats.ToggleNoFallDamage);
UIHelper.Button("Instant Dash", ModMenu.Cheats.Player.Cheats.InstantDashEnabled, ModMenu.Cheats.Player.Cheats.ToggleInstantDash);
UIHelper.Button("Teleport Home", state: false, ModMenu.Cheats.Player.Cheats.TeleportHome);
UIHelper.Button("Give All Tools", state: false, ModMenu.Cheats.Player.Cheats.GiveAllTools);
UIHelper.MakeEnable("", state: true);
TavernWindow();
TimeWindow();
WorldWindow();
ItemSpawnerWindow();
AddEffectWindow();
AddOthersWindow();
GenerateGenericQuestWindow();
SpawnWindow();
if (IdsMenuVisible)
{
AllIdsWindow();
}
if (EffectsMenuVisible)
{
AllEffectsWindow();
}
if (QuestTypeMenuVisible)
{
AllQuestTypesWindow();
}
if (CreatureTypeMenuVisible)
{
AllSpawnTypesWindow();
}
GUI.color = Color.gray;
}
}
private static void TavernWindow()
{
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
UIHelper.Begin("Tavern", 10f, 400f, 150f, 160f, 0f, 22f, 1f);
UIHelper.Button("Shop Unlock", ModMenu.Cheats.Player.Cheats.ShopUnlockEnabled, ModMenu.Cheats.Player.Cheats.ToggleShopUnlock);
UIHelper.Button("Always Clean", ModMenu.Cheats.Player.Cheats.AlwaysCleanEnabled, ModMenu.Cheats.Player.Cheats.ToggleAlwaysClean);
UIHelper.Button("Complete Quest", state: false, ModMenu.Cheats.Player.Cheats.CompleteCurrentQuest);
UIHelper.Button("Spawn Customer", state: false, ModMenu.Cheats.Player.Cheats.SpawnCustomer);
UIHelper.Label("Level (1-99)");
_levelInput = GUI.TextField(new Rect(15f, 535f, 45f, 20f), _levelInput, UIHelper.TextFieldStyle);
if (GUI.Button(new Rect(65f, 535f, 90f, 20f), "Set Level", UIHelper.ButtonStyle) && int.TryParse(_levelInput, out var result))
{
ModMenu.Cheats.Player.Cheats.SetLevel(result);
}
}
private static void TimeWindow()
{
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Expected O, but got Unknown
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
UIHelper.Begin("Time Control", 10f, 565f, 150f, 100f, 0f, 22f, 1f);
UIHelper.Button("Freeze Time", ModMenu.Cheats.Player.Cheats.FreezeTimeEnabled, ModMenu.Cheats.Player.Cheats.ToggleFreezeTime);
UIHelper.Label("Set Time (0-24h)");
float num = GUI.HorizontalSlider(new Rect(15f, 631f, 140f, 15f), _timeSlider, 0f, 23.99f);
if (Math.Abs(num - _timeSlider) > 0.01f)
{
_timeSlider = num;
ModMenu.Cheats.Player.Cheats.SetTimeOfDay(_timeSlider);
}
GUIStyle val = new GUIStyle(GUI.skin.label);
val.normal.textColor = Color.white;
GUIStyle val2 = val;
GUI.Label(new Rect(15f, 645f, 140f, 20f), $"Time: {Mathf.FloorToInt(_timeSlider)}:{Mathf.FloorToInt(_timeSlider % 1f * 60f):00}", val2);
}
private static void WorldWindow()
{
UIHelper.Begin("World", 10f, 670f, 150f, 115f, 0f, 22f, 1f);
UIHelper.Button("Kill All Enemies", state: false, ModMenu.Cheats.Player.Cheats.KillAllEnemies);
UIHelper.Button("Spawn Zeppelin", state: false, delegate
{
if ((Object)(object)DevelopmentExtension.Instance != (Object)null)
{
DevelopmentExtension.Instance.SpawnZeppelin(true);
}
});
UIHelper.Button("Spawn Zep Items", state: false, delegate
{
if ((Object)(object)DevelopmentExtension.Instance != (Object)null)
{
DevelopmentExtension.Instance.SpawnZeppelinItems();
}
});
UIHelper.Button("Unlock Jukebox", state: false, delegate
{
for (byte b = 0; b < 20; b++)
{
ModMenu.Cheats.Player.Cheats.UnlockJukeboxTrack(b);
}
});
}
private static void ItemSpawnerWindow()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
UIHelper.Begin("Item Spawner", 165f, 10f, 165f, 83f, 2f, 20f, 2f);
UIHelper.Label("Enter item <b>id</b> and <b>amount</b>");
_itemIdInput = GUI.TextField(new Rect(167f, 49f, 40f, 20f), _itemIdInput, UIHelper.TextFieldStyle);
_itemAmountInput = GUI.TextField(new Rect(209f, 49f, 40f, 20f), _itemAmountInput, UIHelper.TextFieldStyle);
if (GUI.Button(new Rect(251f, 49f, 77f, 20f), "Spawn", UIHelper.ButtonStyle))
{
if (!PlayerManager.Instance.isLocalPlayerSpawned)
{
return;
}
if (ushort.TryParse(_itemIdInput, out var result) && ushort.TryParse(_itemAmountInput, out var result2))
{
SpawnItems(result, result2);
}
else
{
Plugin.Log.LogError((object)("Failed to spawn item(s) with id " + _itemIdInput));
}
}
GUI.Label(new Rect(324f, 52f, 3f, 14f), GUIContent.none, UIHelper.PanelStyle);
if (GUI.Button(new Rect(167f, 71f, 161f, 20f), "Show all ID's", UIHelper.SpawnerButtonStyle))
{
EffectsMenuVisible = false;
IdsMenuVisible = !IdsMenuVisible;
}
}
private static void AddEffectWindow()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
UIHelper.Begin("Effect adder", 334f, 10f, 300f, 83f, 2f, 20f, 2f);
UIHelper.Label("Enter effect <b>type</b>, <b>duration</b> and <b>strength</b>");
_effectTypeInput = GUI.TextField(new Rect(338f, 49f, 70f, 20f), _effectTypeInput, UIHelper.TextFieldStyle);
_effectDurationInput = GUI.TextField(new Rect(412f, 49f, 70f, 20f), _effectDurationInput, UIHelper.TextFieldStyle);
_effectStrengthInput = GUI.TextField(new Rect(486f, 49f, 70f, 20f), _effectStrengthInput, UIHelper.TextFieldStyle);
if (GUI.Button(new Rect(560f, 49f, 70f, 20f), "Add effect", UIHelper.ButtonStyle))
{
if (!PlayerManager.Instance.isLocalPlayerSpawned)
{
return;
}
if (float.TryParse(_effectDurationInput, out var result) && int.TryParse(_effectStrengthInput, out var result2) && Enum.TryParse<EffectType>(_effectTypeInput, out EffectType result3))
{
EffectsController.Instance.AddEffectServerRpc(result3, result, result2, default(ServerRpcParams));
}
else
{
Plugin.Log.LogError((object)("Failed to add effect with type " + _effectTypeInput));
}
}
GUI.Label(new Rect(625f, 52f, 3f, 14f), GUIContent.none, UIHelper.PanelStyle);
if (GUI.Button(new Rect(338f, 71f, 292f, 20f), "Show all effects", UIHelper.SpawnerButtonStyle))
{
IdsMenuVisible = false;
EffectsMenuVisible = !EffectsMenuVisible;
}
}
private static void AddOthersWindow()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
UIHelper.Begin("Misc Add", 745f, 10f, 218f, 115f, 2f, 20f, 2f);
UIHelper.Label("Enter <b>money</b> to add");
if (!PlayerManager.Instance.isLocalPlayerSpawned)
{
return;
}
_moneyInput = GUI.TextField(new Rect(747f, 49f, 60f, 20f), _moneyInput, UIHelper.TextFieldStyle);
if (GUI.Button(new Rect(810f, 49f, 150f, 20f), "Add money", UIHelper.ButtonStyle))
{
if (ulong.TryParse(_moneyInput, out var result))
{
GameStatus.Instance.AddMoney(result);
}
else
{
Plugin.Log.LogError((object)("Failed to add money with value " + _moneyInput));
}
}
UIHelper.Label("Enter <b>exp</b> to add", spacing: true);
_expInput = GUI.TextField(new Rect(747f, 91f, 60f, 20f), _expInput, UIHelper.TextFieldStyle);
if (GUI.Button(new Rect(810f, 91f, 150f, 20f), "Add exp", UIHelper.ButtonStyle))
{
if (uint.TryParse(_expInput, out var result2))
{
GameStatus.Instance.AddExp(result2);
}
else
{
Plugin.Log.LogError((object)("Failed to add exp with value " + _expInput));
}
}
GUI.Label(new Rect(957f, 52f, 3f, 14f), GUIContent.none, UIHelper.PanelStyle);
GUI.Label(new Rect(957f, 94f, 3f, 14f), GUIContent.none, UIHelper.PanelStyle);
}
private static void GenerateGenericQuestWindow()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
UIHelper.Begin("Generate generic quest", 968f, 10f, 200f, 83f, 2f, 20f, 2f);
UIHelper.Label("Enter <b>quest type</b>");
if (!PlayerManager.Instance.isLocalPlayerSpawned)
{
return;
}
_questTypeInput = GUI.TextField(new Rect(970f, 49f, 70f, 20f), _questTypeInput, UIHelper.TextFieldStyle);
if (GUI.Button(new Rect(1045f, 49f, 120f, 20f), "Generate quest", UIHelper.ButtonStyle))
{
if (Enum.TryParse<GenericQuestType>(_questTypeInput, out GenericQuestType result))
{
if (!QuestManager.Instance.CreateGenericQuest(result))
{
Plugin.Log.LogWarning((object)("CreateGenericQuest returned false for type " + ((object)(GenericQuestType)(ref result)).ToString()));
}
}
else
{
Plugin.Log.LogError((object)("Failed to generate quest with type " + _questTypeInput));
}
}
GUI.Label(new Rect(1160f, 52f, 3f, 14f), GUIContent.none, UIHelper.PanelStyle);
if (GUI.Button(new Rect(970f, 71f, 195f, 20f), "Show all quest types", UIHelper.SpawnerButtonStyle))
{
QuestTypeMenuVisible = !QuestTypeMenuVisible;
}
}
private static void SpawnWindow()
{
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0135: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0248: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
UIHelper.Begin("Spawn entities", 1173f, 10f, 200f, 167f, 2f, 20f, 2f);
UIHelper.Label("Can spawn toads if <b>checked</b>");
_isWednesdayInput = GUI.Toggle(new Rect(1175f, 49f, 90f, 20f), _isWednesdayInput, "Wednesday?");
if (!PlayerManager.Instance.isLocalPlayerSpawned)
{
return;
}
if (GUI.Button(new Rect(1270f, 49f, 95f, 20f), "Spawn Raid", UIHelper.ButtonStyle))
{
TavernEnemyRaidEvent.Instance.DebugRaidEvent(_isWednesdayInput);
}
UIHelper.Label("Spawn animal raid", spacing: true);
if (GUI.Button(new Rect(1175f, 91f, 190f, 20f), "Spawn Raid animal", UIHelper.ButtonStyle))
{
TavernAnimalsRaidEvent.Instance.DebugRaidEvent();
}
UIHelper.Label("Spawn Creature", spacing: false);
_creatureTypeInput = GUI.TextField(new Rect(1175f, 133f, 125f, 20f), _creatureTypeInput, UIHelper.TextFieldStyle);
if (GUI.Button(new Rect(1305f, 133f, 60f, 20f), "Spawn", UIHelper.ButtonStyle))
{
if (Enum.TryParse<Type>(_creatureTypeInput, out Type result))
{
Transform transform = ((Component)PlayerManager.Instance.players[0uL]).transform;
Vector3 val = transform.position + transform.forward * 5f;
Spawnable val2 = default(Spawnable);
SpawnManager.Instance.ManualSpawn(result, val, Quaternion.identity, ref val2, false);
}
else
{
Plugin.Log.LogError((object)("Failed to spawn creature of type " + _creatureTypeInput));
}
}
GUI.Label(new Rect(1360f, 52f, 3f, 14f), GUIContent.none, UIHelper.PanelStyle);
GUI.Label(new Rect(1360f, 94f, 3f, 14f), GUIContent.none, UIHelper.PanelStyle);
GUI.Label(new Rect(1360f, 136f, 3f, 14f), GUIContent.none, UIHelper.PanelStyle);
if (GUI.Button(new Rect(1175f, 155f, 190f, 20f), "Show creature types", UIHelper.SpawnerButtonStyle))
{
CreatureTypeMenuVisible = !CreatureTypeMenuVisible;
}
}
private static void AllIdsWindow()
{
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0203: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Expected O, but got Unknown
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
UIHelper.Begin("All Ids", 165f, 97f, 300f, 475f, 0f, 22f, 2f, biggerTitleBar: true);
if (PlayerManager.Instance.isLocalPlayerSpawned && !_initialized)
{
_initialized = true;
if (_itemList == null)
{
_itemList = ItemManager.Instance.itemDataHub.itemData.ToList();
}
}
string text = ((_searchQuery.Length == 0) ? "Search" : "");
GUILayout.BeginArea(new Rect(166f, 98f, 295f, 470f));
_searchQuery = GUILayout.TextField(_searchQuery, UIHelper.TextFieldStyle, Array.Empty<GUILayoutOption>());
GUI.Label(new Rect(9f, 1f, 60f, 30f), text);
if (_itemList == null || _itemList.Count == 0)
{
GUI.Label(new Rect(0f, 31f, 300f, 469f), "Item list is empty load a save to populate the list");
}
else
{
StringWriter stringWriter = new StringWriter();
foreach (ItemData item in _itemList)
{
if (item.name.ToLower().Contains(_searchQuery.ToLower()))
{
string input = item.name.Replace("ItemDataName", "").Replace("Item_", "").Replace("Banner_", "")
.Replace("_Title", "")
.Replace("_title", "")
.Replace("_", " ");
input = Regex.Replace(input, "([a-z])([A-Z])", "$1 $2").Trim();
stringWriter.Write(input);
stringWriter.Write(" : ");
stringWriter.WriteLine(item.id);
}
}
_scrollPosition = GUILayout.BeginScrollView(_scrollPosition, Array.Empty<GUILayoutOption>());
GUILayout.BeginVertical(new GUIStyle(), Array.Empty<GUILayoutOption>());
whiteText.normal.textColor = Color.white;
GUILayout.Label(stringWriter.ToString(), whiteText, Array.Empty<GUILayoutOption>());
GUILayout.EndVertical();
GUILayout.EndScrollView();
}
GUILayout.EndArea();
}
private static void AllEffectsWindow()
{
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Expected I4, but got Unknown
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Expected O, but got Unknown
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
UIHelper.Begin("All Effects", 335f, 97f, 300f, 380f, 0f, 22f, 2f, biggerTitleBar: true);
if (PlayerManager.Instance.isLocalPlayerSpawned && !_initializedEffects)
{
_initializedEffects = true;
if (_effectList == null)
{
_effectList = Enum.GetValues(typeof(EffectType)).OfType<EffectType>().ToList();
}
}
string text = ((_searchQuery1.Length == 0) ? "Search" : "");
GUILayout.BeginArea(new Rect(336f, 98f, 295f, 375f));
_searchQuery1 = GUILayout.TextField(_searchQuery1, UIHelper.TextFieldStyle, Array.Empty<GUILayoutOption>());
GUI.Label(new Rect(9f, 1f, 60f, 30f), text);
if (_effectList == null || _effectList.Count == 0)
{
GUI.Label(new Rect(0f, 31f, 300f, 379f), "Effect list is empty — load a save first");
}
else
{
StringWriter stringWriter = new StringWriter();
foreach (EffectType effect in _effectList)
{
EffectType current = effect;
if (((object)(EffectType)(ref current)).ToString().ToLower().Contains(_searchQuery1.ToLower()))
{
stringWriter.Write(((object)(EffectType)(ref current)).ToString());
stringWriter.Write(" : ");
stringWriter.WriteLine((int)current);
}
}
_scrollPosition1 = GUILayout.BeginScrollView(_scrollPosition1, Array.Empty<GUILayoutOption>());
GUILayout.BeginVertical(new GUIStyle(), Array.Empty<GUILayoutOption>());
whiteText.normal.textColor = Color.white;
GUILayout.Label(stringWriter.ToString(), whiteText, Array.Empty<GUILayoutOption>());
GUILayout.EndVertical();
GUILayout.EndScrollView();
}
GUILayout.EndArea();
}
private static void AllQuestTypesWindow()
{
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Expected I4, but got Unknown
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Expected O, but got Unknown
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
UIHelper.Begin("All Quests", 968f, 97f, 200f, 380f, 0f, 22f, 2f, biggerTitleBar: true);
if (PlayerManager.Instance.isLocalPlayerSpawned && !_initializedQuests)
{
_initializedQuests = true;
if (_questTypesList == null)
{
_questTypesList = Enum.GetValues(typeof(GenericQuestType)).OfType<GenericQuestType>().ToList();
}
}
string text = ((_searchQuery2.Length == 0) ? "Search" : "");
GUILayout.BeginArea(new Rect(969f, 98f, 195f, 375f));
_searchQuery2 = GUILayout.TextField(_searchQuery2, UIHelper.TextFieldStyle, Array.Empty<GUILayoutOption>());
GUI.Label(new Rect(9f, 1f, 60f, 30f), text);
if (_questTypesList == null || _questTypesList.Count == 0)
{
GUI.Label(new Rect(0f, 31f, 300f, 379f), "Quest list is empty — load a save first");
}
else
{
StringWriter stringWriter = new StringWriter();
foreach (GenericQuestType questTypes in _questTypesList)
{
GenericQuestType current = questTypes;
if (((object)(GenericQuestType)(ref current)).ToString().ToLower().Contains(_searchQuery2.ToLower()))
{
stringWriter.Write(((object)(GenericQuestType)(ref current)).ToString());
stringWriter.Write(" : ");
stringWriter.WriteLine((int)current);
}
}
_scrollPosition2 = GUILayout.BeginScrollView(_scrollPosition2, Array.Empty<GUILayoutOption>());
GUILayout.BeginVertical(new GUIStyle(), Array.Empty<GUILayoutOption>());
whiteText.normal.textColor = Color.white;
GUILayout.Label(stringWriter.ToString(), whiteText, Array.Empty<GUILayoutOption>());
GUILayout.EndVertical();
GUILayout.EndScrollView();
}
GUILayout.EndArea();
}
private static void AllSpawnTypesWindow()
{
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Expected I4, but got Unknown
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Expected O, but got Unknown
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
UIHelper.Begin("All entity types", 1173f, 181f, 200f, 380f, 0f, 22f, 2f, biggerTitleBar: true);
if (PlayerManager.Instance.isLocalPlayerSpawned && !_initializedEntityTypes)
{
_initializedEntityTypes = true;
if (_EntityList == null)
{
_EntityList = Enum.GetValues(typeof(Type)).OfType<Type>().ToList();
}
}
string text = ((_searchQuery3.Length == 0) ? "Search" : "");
GUILayout.BeginArea(new Rect(1174f, 182f, 195f, 375f));
_searchQuery3 = GUILayout.TextField(_searchQuery3, UIHelper.TextFieldStyle, Array.Empty<GUILayoutOption>());
GUI.Label(new Rect(9f, 1f, 60f, 30f), text);
if (_EntityList == null || _EntityList.Count == 0)
{
GUI.Label(new Rect(0f, 31f, 300f, 379f), "Entity list is empty — load a save first");
}
else
{
StringWriter stringWriter = new StringWriter();
foreach (Type entity in _EntityList)
{
Type current = entity;
if (((object)(Type)(ref current)).ToString().ToLower().Contains(_searchQuery3.ToLower()))
{
stringWriter.Write(((object)(Type)(ref current)).ToString());
stringWriter.Write(" : ");
stringWriter.WriteLine((int)current);
}
}
_scrollPosition3 = GUILayout.BeginScrollView(_scrollPosition3, Array.Empty<GUILayoutOption>());
GUILayout.BeginVertical(new GUIStyle(), Array.Empty<GUILayoutOption>());
whiteText.normal.textColor = Color.white;
GUILayout.Label(stringWriter.ToString(), whiteText, Array.Empty<GUILayoutOption>());
GUILayout.EndVertical();
GUILayout.EndScrollView();
}
GUILayout.EndArea();
}
private static void SpawnItems(ushort itemDataId, ushort amount)
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
ItemData val = default(ItemData);
if (ItemManager.Instance.GetItemData((uint)itemDataId, ref val))
{
Item val2 = default(Item);
((Item)(ref val2))..ctor(val);
Transform transform = ((Component)PlayerManager.Instance.players[0uL]).transform;
for (int i = 0; i < amount; i++)
{
CollectibleManager.Instance.Spawn(val2, transform.position + Vector3.up + transform.forward, transform.rotation, 0u);
}
}
}
}
}
namespace ModMenu.Patches
{
[HarmonyPatch(typeof(DirtClean), "Update")]
public class DirtClean_UpdatePatch
{
private static void Postfix(DirtClean __instance)
{
Traverse.Create((object)__instance).Field("percentToClean").SetValue((object)UIManager.PercentToClean);
}
}
[HarmonyPatch(typeof(PlayerMovement), "Update")]
public class PlayerMovement_UpdatePatch
{
private static void Postfix(PlayerMovement __instance)
{
Traverse.Create((object)__instance).Method("UpdateNoclipSpeedByHotkey", Array.Empty<object>()).GetValue();
}
}
}
namespace ModMenu.Cheats.Player
{
public class Cheats
{
public static bool GodModeEnabled;
public static bool NoClipEnabled;
public static bool ShopUnlockEnabled;
public static bool FreezeTimeEnabled;
public static bool NoFallDamageEnabled;
public static bool InfiniteJumpEnabled;
public static bool InstantDashEnabled;
public static bool AlwaysCleanEnabled;
private static bool IsInWorld()
{
if ((Object)(object)PlayerManager.Instance != (Object)null)
{
return PlayerManager.Instance.isLocalPlayerSpawned;
}
return false;
}
public static void ToggleGodMode()
{
if (!IsInWorld())
{
Plugin.Log.LogError((object)"Failed to toggle GodMode, not in a world");
return;
}
GodModeEnabled = !GodModeEnabled;
Game.Instance.God();
}
public static void ToggleNoClip()
{
if (!IsInWorld())
{
Plugin.Log.LogError((object)"Failed to toggle NoClip, not in a world");
return;
}
NoClipEnabled = !NoClipEnabled;
Game.Instance.Noclip();
}
public static void ToggleShopUnlock()
{
if (IsInWorld())
{
ShopUnlockEnabled = !ShopUnlockEnabled;
Game.Instance.ShopUnlockToggle();
}
}
public static void ToggleFreezeTime()
{
if (IsInWorld())
{
FreezeTimeEnabled = !FreezeTimeEnabled;
DayNight.Instance.autoUpdTime = !FreezeTimeEnabled;
}
}
public static void ToggleNoFallDamage()
{
NoFallDamageEnabled = !NoFallDamageEnabled;
if (IsInWorld())
{
ApplyNoFallDamage();
}
}
public static void ToggleInstantDash()
{
InstantDashEnabled = !InstantDashEnabled;
}
public static void ToggleAlwaysClean()
{
AlwaysCleanEnabled = !AlwaysCleanEnabled;
}
public static void SetTimeOfDay(float hour)
{
if (IsInWorld())
{
DayNight.Instance.dayTime = Mathf.Clamp(hour, 0f, 23.99f);
}
}
public static void AddTime(float hours)
{
if (IsInWorld())
{
DayNight.Instance.AddTime(hours);
}
}
public static void TeleportHome()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
if (IsInWorld())
{
PlayerMovement instance = PlayerMovement.Instance;
if ((Object)(object)instance != (Object)null)
{
((Component)instance).transform.position = Game.tavernCenter + Vector3.up;
}
}
}
public static void KillAllEnemies()
{
if (!IsInWorld())
{
return;
}
Vulnerable[] array = Object.FindObjectsOfType<Vulnerable>();
int num = 0;
Vulnerable[] array2 = array;
foreach (Vulnerable val in array2)
{
if ((Object)(object)val != (Object)null && val.hp.Value > 0 && ((NetworkBehaviour)val).IsSpawned)
{
try
{
val.Kill();
num++;
}
catch
{
}
}
}
Plugin.Log.LogInfo((object)$"Killed {num} enemies");
}
public static void GiveAllTools()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
if (IsInWorld())
{
Game.Instance.AddToolsServerRpc(default(ServerRpcParams));
}
}
public static void SetLevel(int level)
{
if (IsInWorld() && (Object)(object)GameStatus.Instance != (Object)null)
{
GameStatus.Instance.level.Value = Mathf.Clamp(level, 1, 99);
}
}
public static void SetMoney(ulong amount)
{
if (IsInWorld() && (Object)(object)GameStatus.Instance != (Object)null)
{
GameStatus.Instance.AddMoney(amount);
}
}
public static void SetExp(uint amount)
{
if (IsInWorld() && (Object)(object)GameStatus.Instance != (Object)null)
{
GameStatus.Instance.AddExp(amount);
}
}
public static void SpawnBoss()
{
if (IsInWorld() && (Object)(object)CaveSpawnManager.Instance != (Object)null)
{
CaveSpawnManager.Instance.SpawnBoss();
}
}
public static void SpawnCustomer()
{
if (IsInWorld() && (Object)(object)CustomersManager.Instance != (Object)null)
{
CustomersManager.Instance.SpawnSingleCustomer(true);
}
}
public static void SpawnCreature(int type)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
if (IsInWorld())
{
Transform transform = ((Component)PlayerMovement.Instance).transform;
Vector3 val = transform.position + transform.forward * 20f;
Spawnable val2 = default(Spawnable);
SpawnManager.Instance.ManualSpawn((Type)type, val, Quaternion.identity, ref val2, false);
}
}
public static void CompleteCurrentQuest()
{
if (IsInWorld() && (Object)(object)QuestManager.Instance != (Object)null)
{
QuestManager.Instance.CompleteCurrentQuest();
}
}
public static void UnlockJukeboxTrack(byte id)
{
if (IsInWorld() && (Object)(object)JukeboxManager.Instance != (Object)null)
{
JukeboxManager.Instance.UnlockMusicTrack(id);
}
}
public static void EnforceCheats()
{
if (IsInWorld())
{
if (NoFallDamageEnabled)
{
ApplyNoFallDamage();
}
if (InstantDashEnabled && (Object)(object)PlayerMovement.Instance != (Object)null)
{
Traverse.Create((object)PlayerMovement.Instance).Field("_dashCoolDownTime").SetValue((object)0f);
}
if (AlwaysCleanEnabled && (Object)(object)GameStatus.Instance != (Object)null)
{
GameStatus.Instance.cleanliness.Value = 100;
}
}
}
private static void ApplyNoFallDamage()
{
if ((Object)(object)PlayerMovement.Instance != (Object)null)
{
PlayerMovement.Instance.recievesFallDamage = !NoFallDamageEnabled;
}
}
}
}