Decompiled source of SolarCheatTwo v1.0.10

SolarCheat.dll

Decompiled 9 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using SolarCheat.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("SolarCheat")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SolarCheat")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("c20b17d5-523d-460d-b66a-9ae58cf9a071")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace SolarCheat
{
	[BepInPlugin("Poseidon.SolarCheatBase", "SolarCheat", "1.0.0.0")]
	public class SolarCheatBase : BaseUnityPlugin
	{
		public class ActiveMods
		{
			public static bool InfHealth;

			public static bool InfSprint;

			public static bool InfUndead;

			public static bool Reach;

			public static bool Speed;

			public static bool NightVision;

			public static bool Weight;

			public static bool ResetAll;

			public static bool InfBat;

			public static bool OneHand;

			public static bool GethHealth()
			{
				return InfHealth;
			}

			public static bool GethSprint()
			{
				return InfSprint;
			}

			public static bool GetUndead()
			{
				return InfUndead;
			}

			public static bool GetOneHand()
			{
				return OneHand;
			}

			public static bool GetReach()
			{
				return Reach;
			}

			public static bool GetWeight()
			{
				return Weight;
			}

			public static bool GetInfBat()
			{
				return InfBat;
			}

			public static bool GetSpeed()
			{
				return Speed;
			}

			public static bool GetNightVision()
			{
				return NightVision;
			}

			public static bool GetResetAll()
			{
				return ResetAll;
			}

			public static bool SetHealth(bool On)
			{
				InfHealth = On;
				return true;
			}

			public static bool SetOneHand(bool On)
			{
				OneHand = On;
				return true;
			}

			public static bool SetSprint(bool On)
			{
				InfSprint = On;
				return true;
			}

			public static bool SetReach(bool On)
			{
				Reach = On;
				return true;
			}

			public static bool SetSpeed(bool On)
			{
				Speed = On;
				return true;
			}

			public static bool SetInfBat(bool On)
			{
				InfBat = On;
				return true;
			}

			public static bool SetNightVision(bool On)
			{
				NightVision = On;
				return true;
			}

			public static bool SetWeight(bool On)
			{
				Weight = On;
				return true;
			}

			public static bool SetResetAll(bool On)
			{
				ResetAll = On;
				return true;
			}
		}

		private const string modGUID = "Poseidon.SolarCheatBase";

		private const string modName = "SolarCheat";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("Poseidon.SolarCheatBase");

		private static SolarCheatBase Instance;

		internal ManualLogSource mls;

		private Rect windowRect = new Rect(20f, 20f, 300f, 400f);

		private Vector2 offset;

		private int clickCount = 0;

		private Color guiColor = Color.white;

		private float colorChangeSpeed = 1f;

		private bool toggleState = false;

		private bool toggleState2 = false;

		private bool toggleState3 = false;

		private bool toggleState4 = false;

		private bool toggleState5 = false;

		private bool toggleState6 = false;

		private bool toggleState7 = false;

		private bool toggleState8 = false;

		private bool toggleState9 = false;

		private bool toggleState10 = false;

		private bool toggleState11 = false;

		private bool toggleState12 = false;

		private bool toggleState13 = false;

		private bool toggleState14 = false;

		private bool toggleState15 = false;

		private bool toggleState16 = false;

		private bool toggleState17 = false;

		private bool toggleState18 = false;

		private Vector2 scrollPosition = Vector2.zero;

		private static bool OnGUIEnabled = true;

		private bool isGUIVisible = false;

		private static void TeleportPlayer(Vector3 position)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
			if (!((Object)(object)localPlayerController == (Object)null))
			{
				localPlayerController.TeleportPlayer(position, false, 0f, false, true);
			}
		}

		private void Awake()
		{
			mls = Logger.CreateLogSource("Poseidon.SolarCheatBase");
			mls.LogInfo((object)"Batteries is now Operational");
			harmony.PatchAll(typeof(SolarCheatBase));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
		}

		private void OnGUI()
		{
			//IL_0001: 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_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_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: 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_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: 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)
			//IL_041b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0426: Unknown result type (might be due to invalid IL or missing references)
			//IL_0431: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			GUI.color = (GUI.contentColor = (GUI.backgroundColor = Color.Lerp(Color.white, Color.black, Mathf.PingPong(Time.time * colorChangeSpeed, 1f))));
			windowRect = GUI.Window(0, windowRect, new WindowFunction(WindowFunction), "<color=red>SolarCheat</color>");
			float num = ((Rect)(ref windowRect)).y + 20f;
			float num2 = ((Rect)(ref windowRect)).height - 10f;
			GUILayout.BeginArea(new Rect(((Rect)(ref windowRect)).x + 20f, num, ((Rect)(ref windowRect)).width - 40f, num2));
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.Label("<b>SolarCheat Menu By SDPowerStroke And Menu GUI By Solar32</b>", Array.Empty<GUILayoutOption>());
			scrollPosition = GUILayout.BeginScrollView(scrollPosition, Array.Empty<GUILayoutOption>());
			toggleState13 = GUILayout.Toggle(toggleState13, "Activate Me", Array.Empty<GUILayoutOption>());
			if (toggleState13)
			{
				ActiveMods.SetSprint(On: false);
				ActiveMods.SetHealth(On: false);
				ActiveMods.SetReach(On: false);
				ActiveMods.SetSpeed(On: false);
				ActiveMods.SetNightVision(On: false);
				ActiveMods.SetWeight(On: false);
				ActiveMods.SetInfBat(On: false);
				ActiveMods.SetResetAll(On: true);
			}
			toggleState = GUILayout.Toggle(toggleState, "Kill Self", Array.Empty<GUILayoutOption>());
			if (toggleState)
			{
				GameNetworkManager.Instance.localPlayerController.health = 0;
			}
			toggleState3 = GUILayout.Toggle(toggleState3, "Kill Other Players", Array.Empty<GUILayoutOption>());
			if (toggleState3)
			{
				EnemyAI[] array = Object.FindObjectsOfType(typeof(EnemyAI)) as EnemyAI[];
				foreach (EnemyAI val3 in array)
				{
					val3.KillEnemy(true);
				}
			}
			toggleState4 = GUILayout.Toggle(toggleState4, "Godmode", Array.Empty<GUILayoutOption>());
			if (toggleState4)
			{
				ActiveMods.SetHealth(On: true);
			}
			toggleState5 = GUILayout.Toggle(toggleState5, "InfSprint", Array.Empty<GUILayoutOption>());
			if (toggleState5)
			{
				ActiveMods.SetSprint(On: true);
			}
			toggleState7 = GUILayout.Toggle(toggleState7, "NightVision", Array.Empty<GUILayoutOption>());
			if (toggleState7)
			{
				ActiveMods.SetNightVision(On: true);
			}
			toggleState8 = GUILayout.Toggle(toggleState8, "Speed", Array.Empty<GUILayoutOption>());
			if (toggleState8)
			{
				ActiveMods.SetSpeed(On: true);
			}
			toggleState9 = GUILayout.Toggle(toggleState9, "Reach", Array.Empty<GUILayoutOption>());
			if (toggleState9)
			{
				ActiveMods.SetReach(On: true);
			}
			toggleState10 = GUILayout.Toggle(toggleState10, "What is Weight", Array.Empty<GUILayoutOption>());
			if (toggleState10)
			{
				ActiveMods.SetWeight(On: true);
			}
			toggleState11 = GUILayout.Toggle(toggleState11, "InfBattery", Array.Empty<GUILayoutOption>());
			if (toggleState11)
			{
				ActiveMods.SetInfBat(On: true);
			}
			toggleState12 = GUILayout.Toggle(toggleState12, "OneHanded", Array.Empty<GUILayoutOption>());
			if (toggleState12)
			{
				ActiveMods.SetOneHand(On: true);
			}
			toggleState6 = GUILayout.Toggle(toggleState6, "Teleport Ship", Array.Empty<GUILayoutOption>());
			if (toggleState6)
			{
				StartOfRound.Instance.ForcePlayerIntoShip();
			}
			toggleState2 = GUILayout.Toggle(toggleState2, "Teleport Entrance", Array.Empty<GUILayoutOption>());
			if (toggleState2)
			{
				RoundManager.FindMainEntrancePosition(false, false);
				if (true)
				{
					((Component)StartOfRound.Instance.localPlayerController).transform.position = RoundManager.FindMainEntrancePosition(false, false);
				}
			}
			GUILayout.Label("Drag This Slider To Change GUI Colour Speed", Array.Empty<GUILayoutOption>());
			colorChangeSpeed = GUILayout.HorizontalSlider(colorChangeSpeed, 0f, 4f, Array.Empty<GUILayoutOption>());
			GUI.backgroundColor = Color.white;
			GUI.contentColor = Color.white;
			GUI.color = Color.white;
			GUILayout.EndVertical();
			GUILayout.EndArea();
			GUILayout.EndScrollView();
		}

		private void DragWindow(int windowID)
		{
			GUI.DragWindow();
		}

		private void WindowFunction(int windowID)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 20f));
		}
	}
}
namespace SolarCheat.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void pathUpdate(ref float ___sprintMeter, ref int ___health, ref bool ___isPlayerDead, ref float ___carryWeight, ref float ___movementSpeed, ref Light ___nightVision, ref float ___grabDistance)
		{
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			if (SolarCheatBase.ActiveMods.GetResetAll())
			{
				___grabDistance = 5f;
				((Behaviour)StartOfRound.Instance.localPlayerController.nightVision).enabled = false;
				___movementSpeed = 4f;
				StartOfRound.Instance.allowLocalPlayerDeath = true;
				GameNetworkManager.Instance.localPlayerController.jumpForce = 15f;
				if (GameNetworkManager.Instance.localPlayerController.health >= 100)
				{
					GameNetworkManager.Instance.localPlayerController.health = 100;
				}
			}
			if (SolarCheatBase.ActiveMods.GethHealth())
			{
				StartOfRound.Instance.allowLocalPlayerDeath = false;
			}
			if (SolarCheatBase.ActiveMods.GetUndead())
			{
				___isPlayerDead = false;
			}
			if (SolarCheatBase.ActiveMods.GethSprint())
			{
				___sprintMeter = 1f;
			}
			if (SolarCheatBase.ActiveMods.GetSpeed())
			{
				___movementSpeed = 8f;
			}
			if (SolarCheatBase.ActiveMods.GetWeight())
			{
				___carryWeight = 1f;
			}
			if (SolarCheatBase.ActiveMods.GetNightVision())
			{
				StartOfRound.Instance.localPlayerController.nightVision.range = 1000f;
				StartOfRound.Instance.localPlayerController.nightVision.intensity = 1000f;
				((Behaviour)StartOfRound.Instance.localPlayerController.nightVision).enabled = true;
				StartOfRound.Instance.localPlayerController.nightVision.color = Color.white;
			}
			if (SolarCheatBase.ActiveMods.GetReach())
			{
				___grabDistance = 1000f;
			}
			if (SolarCheatBase.ActiveMods.GetInfBat() && (GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.requiresBattery & ((Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer != (Object)null)))
			{
				GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.insertedBattery.charge = 1f;
			}
			if (SolarCheatBase.ActiveMods.GetOneHand() && (Object)(object)GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer != (Object)null)
			{
				GameNetworkManager.Instance.localPlayerController.currentlyHeldObjectServer.itemProperties.twoHanded = false;
			}
		}
	}
}