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 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("1.1.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: AssemblyVersion("1.1.0.0")]
namespace ModMenu
{
public class AleMain : MonoBehaviour
{
private int onStart;
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))
{
if (!PlayerManager.Instance.isLocalPlayerSpawned)
{
ModMenu.Cheats.Player.Cheats.GodModeEnabled = false;
ModMenu.Cheats.Player.Cheats.NoClipEnabled = false;
}
if (onStart == 0)
{
Master.Instance.isDebug = Settings.EnableDebug.Value;
Master.Instance.fCheats = Settings.EnableCheats.Value;
onStart++;
}
ModMenu.Cheats.Player.Cheats.GodModeEnabled = Game.Instance.god.Value;
}
}
private void Update()
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Invalid comparison between Unknown and I4
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Invalid comparison between Unknown and I4
//IL_0039: 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_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Invalid comparison between Unknown and I4
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Invalid comparison between Unknown and I4
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Invalid comparison between Unknown and I4
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Invalid comparison between Unknown and I4
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Invalid comparison between Unknown and I4
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Invalid comparison between Unknown and I4
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Invalid comparison between Unknown and I4
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Invalid comparison between Unknown and I4
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Invalid comparison between Unknown and I4
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Invalid comparison between Unknown and I4
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Invalid comparison between Unknown and I4
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Invalid comparison between Unknown and I4
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Invalid comparison between Unknown and I4
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Invalid comparison between Unknown and I4
if (Input.anyKeyDown && Input.anyKeyDown && Input.GetKeyDown(Settings.ModKey.Value))
{
if ((Object)(object)PlayerInventory.Instance == (Object)null)
{
return;
}
Scene activeScene = SceneManager.GetActiveScene();
if ((((Scene)(ref activeScene)).name != "MainMenu" && (int)PlayerInventory.Instance.state == 20) || (int)PlayerInventory.Instance.state == 21 || (int)PlayerInventory.Instance.state == 15 || (int)PlayerInventory.Instance.state == 10 || (int)PlayerInventory.Instance.state == 5 || (int)PlayerInventory.Instance.state == 4 || (int)PlayerInventory.Instance.state == 2 || (int)PlayerInventory.Instance.state == 3)
{
UIManager.MenuVisible = !UIManager.MenuVisible;
}
else
{
UIManager.MenuVisible = false;
}
}
if (!((Object)(object)PlayerInventory.Instance == (Object)null) && (int)PlayerInventory.Instance.state != 20 && (int)PlayerInventory.Instance.state != 21 && (int)PlayerInventory.Instance.state != 15 && (int)PlayerInventory.Instance.state != 10 && (int)PlayerInventory.Instance.state != 5 && (int)PlayerInventory.Instance.state != 4 && (int)PlayerInventory.Instance.state != 2 && ((int)PlayerInventory.Instance.state != 3 || !UIManager.MenuVisible))
{
UIManager.MenuVisible = false;
}
}
}
[BepInPlugin("RealSkye.ModMenu", "ModMenu", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
public const string PLUGIN_GUID = "RealSkye.ModMenu";
public const string PLUGIN_NAME = "ModMenu";
public const string PLUGIN_VERSION = "1.1.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 (v1.1.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)96, "Toggles menu visibility");
EnableDebug = config.Bind<bool>("General", "EnableDebug", false, "Enables Master.Instance.isDebug which allows the teleport menu (backQuote) and UI toggling (slash) and no clip speed changes by using comma to go slower and period to go faster.");
EnableCheats = config.Bind<bool>("General", "EnableCheats", false, "Enables the built in cheat hotkeys in the game: F9 = God, F10 = GivesAllTools, 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)
{
function();
}
}
public static bool Button(string text)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
return GUI.Button(NextControlRect(), text, ButtonStyle);
}
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 _timeInput = "0";
private static string _questTypeInput = "Undefined";
private static bool _isWednesdayInput;
private static string _creatureTypeInput = "None";
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_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Invalid comparison between Unknown and I4
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
if (MenuVisible)
{
if ((int)Event.current.keyCode == 13)
{
GUI.FocusControl((string)null);
}
GUI.color = Color.white;
UIHelper.Begin("Player", 10f, 10f, 150f, 272f, 0f, 22f, 1f);
bool godModeEnabled = ModMenu.Cheats.Player.Cheats.GodModeEnabled;
Action function = ModMenu.Cheats.Player.Cheats.ToggleGodMode;
UIHelper.Button("God Mode", godModeEnabled, function);
UIHelper.Label("1 WalkSpeed 10");
PlayerMovement.Instance.speedEffectModifier = UIHelper.Slider(ref PlayerMovement.Instance.speedEffectModifier, 1f, 10f);
UIHelper.Label("1.5 RunningSpeed 10");
PlayerMovement.Instance.sprintSpeedModifier = UIHelper.Slider(ref PlayerMovement.Instance.sprintSpeedModifier, 1.5f, 10f);
UIHelper.Label("0 PercentToClean 10");
PercentToClean = UIHelper.Slider(ref PercentToClean, 0f, 10f);
bool noClipEnabled = ModMenu.Cheats.Player.Cheats.NoClipEnabled;
Action function2 = ModMenu.Cheats.Player.Cheats.ToggleNoClip;
UIHelper.Button("NoClip", noClipEnabled, function2);
bool state = QuestManager.Instance.activeQuests.Count > 0;
Action function3 = QuestManager.Instance.CompleteCurrentQuest;
UIHelper.Button("Complete Current Quest", state, function3);
Action function4 = delegate
{
CustomersManager.Instance.SpawnSingleCustomer(false);
};
UIHelper.Button("Spawn Customer", state: false, function4);
UIHelper.MakeEnable("", state: true);
ItemSpawnerWindow();
AddEffectWindow();
AddOthersWindow();
GenerateGenericQuestWindow();
SpawnWindow();
if (IdsMenuVisible)
{
AllIdsWindow();
}
if (EffectsMenuVisible)
{
AllEffectsWindow();
}
if (QuestTypeMenuVisible)
{
AllQuestTypesWindow();
}
if (CreatureTypeMenuVisible)
{
AllSpawnTypesWindow();
}
GUI.color = Color.gray;
}
}
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_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: 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;
}
ushort result = 1;
if (ushort.TryParse(_itemIdInput, out var result2) && ushort.TryParse(_itemAmountInput, out result))
{
SpawnItems(result2, result);
}
else
{
Plugin.Log.LogError((object)("Failed to spawn item(s) with id " + result2));
}
}
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_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: 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_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: 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;
}
EffectType result = (EffectType)7;
int result2 = 0;
if (float.TryParse(_effectDurationInput, out var result3) && int.TryParse(_effectStrengthInput, out result2) && Enum.TryParse<EffectType>(_effectTypeInput, out result))
{
EffectsController.Instance.AddEffectServerRpc(result, result3, 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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: Unknown result type (might be due to invalid IL or missing references)
UIHelper.Begin("Misc Add", 638f, 10f, 165f, 145f, 2f, 20f, 2f);
UIHelper.Label("Enter <b>money</b> to add");
if (!PlayerManager.Instance.isLocalPlayerSpawned)
{
return;
}
_moneyInput = GUI.TextField(new Rect(640f, 49f, 40f, 20f), _moneyInput, UIHelper.TextFieldStyle);
if (GUI.Button(new Rect(682f, 49f, 119f, 20f), "Add money", UIHelper.ButtonStyle))
{
if (ushort.TryParse(_moneyInput, out var result))
{
GameStatus.Instance.AddMoney((ulong)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(640f, 91f, 40f, 20f), _expInput, UIHelper.TextFieldStyle);
if (GUI.Button(new Rect(682f, 91f, 119f, 20f), "Add exp", UIHelper.ButtonStyle))
{
if (ushort.TryParse(_expInput, out var result2))
{
GameStatus.Instance.AddExp((uint)result2);
}
else
{
Plugin.Log.LogError((object)("Failed to add exp with value " + _expInput));
}
}
UIHelper.Label("Enter <b>time</b> to add", spacing: false);
_timeInput = GUI.TextField(new Rect(640f, 133f, 40f, 20f), _timeInput, UIHelper.TextFieldStyle);
if (GUI.Button(new Rect(682f, 133f, 119f, 20f), "Add time", UIHelper.ButtonStyle))
{
if (float.TryParse(_moneyInput, out var result3))
{
DayNight.Instance.AddTime(result3);
}
else
{
Plugin.Log.LogError((object)("Failed to add time with value " + _timeInput));
}
}
GUI.Label(new Rect(796f, 52f, 3f, 14f), GUIContent.none, UIHelper.PanelStyle);
GUI.Label(new Rect(796f, 94f, 3f, 14f), GUIContent.none, UIHelper.PanelStyle);
GUI.Label(new Rect(796f, 136f, 3f, 14f), GUIContent.none, UIHelper.PanelStyle);
}
private static void GenerateGenericQuestWindow()
{
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
UIHelper.Begin("Generate generic quest", 807f, 10f, 165f, 83f, 2f, 20f, 2f);
UIHelper.Label("Enter <b>quest type</b>");
if (!PlayerManager.Instance.isLocalPlayerSpawned)
{
return;
}
_questTypeInput = GUI.TextField(new Rect(809f, 49f, 56f, 20f), _questTypeInput, UIHelper.TextFieldStyle);
if (GUI.Button(new Rect(867f, 49f, 103f, 20f), "Generate quest", UIHelper.ButtonStyle))
{
if (Enum.TryParse<GenericQuestType>(_questTypeInput, out GenericQuestType result))
{
QuestManager.Instance.CreateGenericQuest(result);
}
else
{
Plugin.Log.LogError((object)("Failed to generate quest with type " + _questTypeInput));
}
}
GUI.Label(new Rect(966f, 52f, 3f, 14f), GUIContent.none, UIHelper.PanelStyle);
if (GUI.Button(new Rect(809f, 71f, 161f, 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_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: 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_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Unknown result type (might be due to invalid IL or missing references)
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_017a: Unknown result type (might be due to invalid IL or missing references)
//IL_0184: Unknown result type (might be due to invalid IL or missing references)
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
//IL_018e: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
UIHelper.Begin("Spawn entities", 976f, 10f, 180f, 167f, 2f, 20f, 2f);
UIHelper.Label("Can spawn toads if <b>checked</b>");
_isWednesdayInput = GUI.Toggle(new Rect(978f, 49f, 84f, 20f), _isWednesdayInput, "Wednesday?");
if (!PlayerManager.Instance.isLocalPlayerSpawned)
{
return;
}
if (GUI.Button(new Rect(1064f, 49f, 90f, 20f), "Spawn Raid", UIHelper.ButtonStyle))
{
TavernEnemyRaidEvent.Instance.DebugRaidEvent(_isWednesdayInput);
}
UIHelper.Label("Spawn animal raid", spacing: true);
if (GUI.Button(new Rect(978f, 91f, 176f, 20f), "Spawn Raid animal", UIHelper.ButtonStyle))
{
TavernAnimalsRaidEvent.Instance.DebugRaidEvent();
}
UIHelper.Label("Spawn Creature", spacing: false);
_creatureTypeInput = GUI.TextField(new Rect(978f, 133f, 119f, 20f), _creatureTypeInput, UIHelper.TextFieldStyle);
if (GUI.Button(new Rect(1099f, 133f, 55f, 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 " + ((object)(Type)(ref result)).ToString()));
}
}
GUI.Label(new Rect(1149f, 52f, 3f, 14f), GUIContent.none, UIHelper.PanelStyle);
GUI.Label(new Rect(1149f, 94f, 3f, 14f), GUIContent.none, UIHelper.PanelStyle);
GUI.Label(new Rect(1149f, 136f, 3f, 14f), GUIContent.none, UIHelper.PanelStyle);
if (GUI.Button(new Rect(978f, 155f, 176f, 20f), "Show creature types", UIHelper.SpawnerButtonStyle))
{
CreatureTypeMenuVisible = !CreatureTypeMenuVisible;
}
}
private static void AllIdsWindow()
{
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: 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_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: 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_01b0: Expected O, but got Unknown
//IL_01ba: 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()))
{
stringWriter.Write(item.name);
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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Expected I4, but got Unknown
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Expected O, but got Unknown
//IL_01cc: 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), "Item list is empty load a save to populate the list");
}
else
{
StringWriter stringWriter = new StringWriter();
foreach (EffectType effect in _effectList)
{
EffectType current = effect;
if (((object)(EffectType)(ref current)).ToString().ToLower().Contains(_searchQuery1.ToLower()))
{
int value = (int)current;
stringWriter.Write(((object)(EffectType)(ref current)).ToString());
stringWriter.Write(" : ");
stringWriter.WriteLine(value);
}
}
_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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Expected I4, but got Unknown
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Expected O, but got Unknown
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
UIHelper.Begin("All Quests", 807f, 97f, 165f, 70f, 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(808f, 98f, 160f, 65f));
_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), "Item list is empty load a save to populate the list");
}
else
{
StringWriter stringWriter = new StringWriter();
foreach (GenericQuestType questTypes in _questTypesList)
{
GenericQuestType current = questTypes;
if (((object)(GenericQuestType)(ref current)).ToString().ToLower().Contains(_searchQuery2.ToLower()))
{
int value = (int)current;
stringWriter.Write(((object)(GenericQuestType)(ref current)).ToString());
stringWriter.Write(" : ");
stringWriter.WriteLine(value);
}
}
_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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0134: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0160: Expected I4, but got Unknown
//IL_019f: Unknown result type (might be due to invalid IL or missing references)
//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ae: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Expected O, but got Unknown
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
UIHelper.Begin("All entity types", 976f, 181f, 300f, 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(977f, 182f, 295f, 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), "Item list is empty load a save to populate the list");
}
else
{
StringWriter stringWriter = new StringWriter();
foreach (Type entity in _EntityList)
{
Type current = entity;
if (((object)(Type)(ref current)).ToString().ToLower().Contains(_searchQuery3.ToLower()))
{
int value = (int)current;
stringWriter.Write(((object)(Type)(ref current)).ToString());
stringWriter.Write(" : ");
stringWriter.WriteLine(value);
}
}
_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)
{
FieldInfo field = typeof(DirtClean).GetField("percentToClean", BindingFlags.Instance | BindingFlags.NonPublic);
if (field != null)
{
field.SetValue(__instance, UIManager.PercentToClean);
}
else
{
Plugin.Log.LogError((object)"Failed to find field percentToClean in DirtClean");
}
}
}
[HarmonyPatch(typeof(PlayerMovement), "Update")]
public class PlayerMovement_UpdatePatch
{
private static void Postfix(PlayerMovement __instance)
{
MethodInfo method = typeof(PlayerMovement).GetMethod("UpdateNoclipSpeedByHotkey", BindingFlags.Instance | BindingFlags.NonPublic);
if (method != null)
{
method.Invoke(__instance, null);
}
else
{
Plugin.Log.LogError((object)"Failed to find method UpdateNoclipSpeedByHotkey in PlayerMovement");
}
}
}
}
namespace ModMenu.Cheats.Player
{
public class Cheats
{
public static bool GodModeEnabled;
public static bool NoClipEnabled;
public static void ToggleGodMode()
{
if (!PlayerManager.Instance.isLocalPlayerSpawned)
{
Plugin.Log.LogError((object)"Failed to toggle GodMode, not in a world");
return;
}
GodModeEnabled = !GodModeEnabled;
Game.Instance.God();
}
public static void ToggleNoClip()
{
if (!PlayerManager.Instance.isLocalPlayerSpawned)
{
Plugin.Log.LogError((object)"Failed to toggle NoClip, not in a world");
return;
}
NoClipEnabled = !NoClipEnabled;
Game.Instance.Noclip();
}
}
}