Decompiled source of Pelon Con Suelas ModPack 2 v1.0.1

BepinEx/Plugins/AlwaysHearWalkie.dll

Decompiled 8 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LCAlwaysHearWalkieMod.Patches;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AlwaysHearWalkie")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.4.1.0")]
[assembly: AssemblyInformationalVersion("1.4.1+1a2019429725b04bbe03cd11a689bf3cd79f8dc4")]
[assembly: AssemblyProduct("Always Hear Active Walkies")]
[assembly: AssemblyTitle("AlwaysHearWalkie")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.4.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace BepInEx5.PluginTemplate
{
	[BepInPlugin("suskitech.LCAlwaysHearActiveWalkie", "LC Always Hear Active Walkies", "1.4.1")]
	public class LCAlwaysHearWalkieMod : BaseUnityPlugin
	{
		public static ManualLogSource Log;

		private const string modGUID = "suskitech.LCAlwaysHearActiveWalkie";

		private const string modName = "LC Always Hear Active Walkies";

		private const string modVersion = "1.4.1";

		private readonly Harmony harmony = new Harmony("suskitech.LCAlwaysHearActiveWalkie");

		private static LCAlwaysHearWalkieMod Instance;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			Log = Logger.CreateLogSource("suskitech.LCAlwaysHearActiveWalkie");
			Log.LogInfo((object)"\\ /");
			Log.LogInfo((object)"/|\\");
			Log.LogInfo((object)" |----|");
			Log.LogInfo((object)" |[__]| Always Hear Active Walkies");
			Log.LogInfo((object)" |.  .| Version 1.4.1 Loaded");
			Log.LogInfo((object)" |____|");
			harmony.PatchAll(typeof(LCAlwaysHearWalkieMod));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			harmony.PatchAll(typeof(WalkieTalkiePatch));
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "AlwaysHearWalkie";

		public const string PLUGIN_NAME = "Always Hear Active Walkies";

		public const string PLUGIN_VERSION = "1.4.1";
	}
}
namespace LCAlwaysHearWalkieMod.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		private static float AudibleDistance = 20f;

		private static float throttleInterval = 0.4f;

		private static float throttle = 0f;

		private static float AverageDistanceToHeldWalkie = 2f;

		private static float WalkieRecordingRange = 20f;

		private static float PlayerToPlayerSpatialHearingRange = 20f;

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void alwaysHearWalkieTalkiesPatch(ref bool ___holdingWalkieTalkie, ref PlayerControllerB __instance)
		{
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_031c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			throttle += Time.deltaTime;
			if (throttle < throttleInterval)
			{
				return;
			}
			throttle = 0f;
			if ((Object)(object)__instance == (Object)null || (Object)(object)GameNetworkManager.Instance == (Object)null || (Object)(object)__instance != (Object)(object)GameNetworkManager.Instance.localPlayerController || (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null || GameNetworkManager.Instance.localPlayerController.isPlayerDead)
			{
				return;
			}
			List<WalkieTalkie> list = new List<WalkieTalkie>();
			List<WalkieTalkie> list2 = new List<WalkieTalkie>();
			for (int i = 0; i < WalkieTalkie.allWalkieTalkies.Count; i++)
			{
				float num = Vector3.Distance(((Component)WalkieTalkie.allWalkieTalkies[i]).transform.position, ((Component)__instance).transform.position);
				if (num <= AudibleDistance)
				{
					if (((GrabbableObject)WalkieTalkie.allWalkieTalkies[i]).isBeingUsed)
					{
						list.Add(WalkieTalkie.allWalkieTalkies[i]);
					}
				}
				else
				{
					list2.Add(WalkieTalkie.allWalkieTalkies[i]);
				}
			}
			bool flag = list.Count > 0;
			if (flag != __instance.holdingWalkieTalkie)
			{
				___holdingWalkieTalkie = flag;
				for (int j = 0; j < list2.Count; j++)
				{
					if (j < list.Count)
					{
						list2[j].thisAudio.Stop();
					}
				}
			}
			if (!flag)
			{
				return;
			}
			PlayerControllerB val = ((!GameNetworkManager.Instance.localPlayerController.isPlayerDead || !((Object)(object)GameNetworkManager.Instance.localPlayerController.spectatedPlayerScript != (Object)null)) ? GameNetworkManager.Instance.localPlayerController : GameNetworkManager.Instance.localPlayerController.spectatedPlayerScript);
			for (int k = 0; k < StartOfRound.Instance.allPlayerScripts.Length; k++)
			{
				if ((!StartOfRound.Instance.allPlayerScripts[k].isPlayerControlled && !StartOfRound.Instance.allPlayerScripts[k].isPlayerDead) || (Object)(object)StartOfRound.Instance.allPlayerScripts[k] == (Object)(object)GameNetworkManager.Instance.localPlayerController || StartOfRound.Instance.allPlayerScripts[k].isPlayerDead)
				{
					continue;
				}
				PlayerControllerB val2 = StartOfRound.Instance.allPlayerScripts[k];
				if (!val2.holdingWalkieTalkie)
				{
					continue;
				}
				float num2 = Vector3.Distance(((Component)val).transform.position, ((Component)val2).transform.position);
				float num3 = float.MaxValue;
				float num4 = float.MaxValue;
				for (int l = 0; l < WalkieTalkie.allWalkieTalkies.Count; l++)
				{
					if (!((GrabbableObject)WalkieTalkie.allWalkieTalkies[l]).isBeingUsed)
					{
						continue;
					}
					float num5 = Vector3.Distance(((Component)WalkieTalkie.allWalkieTalkies[l].target).transform.position, ((Component)val).transform.position);
					if (num5 < num4)
					{
						num4 = num5;
					}
					if (!WalkieTalkie.allWalkieTalkies[l].speakingIntoWalkieTalkie)
					{
						float num6 = Vector3.Distance(((Component)WalkieTalkie.allWalkieTalkies[l]).transform.position, ((Component)val2).transform.position);
						if (num6 < num3)
						{
							num3 = num6;
						}
					}
				}
				float num7 = Mathf.Min(1f - Mathf.InverseLerp(AverageDistanceToHeldWalkie, WalkieRecordingRange, num3), 1f - Mathf.InverseLerp(AverageDistanceToHeldWalkie, WalkieRecordingRange, num4));
				float num8 = 1f - Mathf.InverseLerp(0f, PlayerToPlayerSpatialHearingRange, num2);
				val2.voicePlayerState.Volume = Mathf.Max(num7, num8);
			}
		}
	}
	[HarmonyPatch(typeof(WalkieTalkie))]
	internal class WalkieTalkiePatch
	{
		[HarmonyPatch("EnableWalkieTalkieListening")]
		[HarmonyPrefix]
		private static bool alwaysHearWalkieTalkiesEnableWalkieTalkieListeningPatch(bool enable)
		{
			if (!enable)
			{
				return false;
			}
			return true;
		}
	}
}

BepinEx/Plugins/FreddyBracken.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("FreddyBracken")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("har har har har")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("FreddyBracken")]
[assembly: AssemblyTitle("FreddyBracken")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FreddyBracken
{
	[BepInPlugin("FreddyBracken", "FreddyBracken", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static GameObject Visuals;

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin FreddyBracken is loaded!");
			Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), (string)null);
			string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "freddy.bundle");
			AssetBundle val = AssetBundle.LoadFromFile(text);
			Visuals = val.LoadAsset<GameObject>("assets/prefabs/freddy.prefab");
			Renderer[] componentsInChildren = Visuals.GetComponentsInChildren<Renderer>(true);
			foreach (Renderer val2 in componentsInChildren)
			{
				((Component)val2).gameObject.layer = LayerMask.NameToLayer("Enemies");
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "FreddyBracken";

		public const string PLUGIN_NAME = "FreddyBracken";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace FreddyBracken.Patches
{
	[HarmonyPatch(typeof(FlowermanAI), "Start")]
	internal class FlowermanPatch
	{
		private static void Postfix(FlowermanAI __instance)
		{
			//IL_00e3: 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_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)Plugin.Visuals == (Object)null)
			{
				return;
			}
			Transform val = ((Component)__instance).transform.Find("FlowermanModel");
			object obj;
			if (val == null)
			{
				obj = null;
			}
			else
			{
				Transform obj2 = val.Find("LOD1");
				obj = ((obj2 != null) ? ((Component)obj2).GetComponent<SkinnedMeshRenderer>() : null);
			}
			SkinnedMeshRenderer val2 = (SkinnedMeshRenderer)obj;
			object obj3;
			if (val == null)
			{
				obj3 = null;
			}
			else
			{
				Transform obj4 = val.Find("AnimContainer");
				obj3 = ((obj4 != null) ? obj4.Find("metarig") : null);
			}
			Transform val3 = (Transform)obj3;
			if (!((Object)(object)val2 == (Object)null) && ((Renderer)val2).enabled)
			{
				((Renderer)val2).enabled = false;
				Renderer[] componentsInChildren = ((Component)val3).gameObject.GetComponentsInChildren<Renderer>();
				foreach (Renderer val4 in componentsInChildren)
				{
					val4.enabled = false;
				}
				GameObject val5 = Object.Instantiate<GameObject>(Plugin.Visuals);
				val5.transform.SetParent(val);
				val5.transform.localPosition = Vector3.zero;
				val5.transform.localRotation = Quaternion.identity;
				val5.transform.localScale = Vector3.one;
				Transform val6 = val5.transform.Find("Container/Body_Geo");
				Transform val7 = val5.transform.Find("Container/metarig");
				val7.SetParent(val3.parent, true);
				((Component)val7).transform.localScale = ((Component)val3).transform.localScale;
				((Component)val7).transform.localRotation = ((Component)val3).transform.localRotation;
				((Component)val7).transform.localPosition = ((Component)val3).transform.localPosition;
				SkinnedMeshRenderer component = ((Component)val6).GetComponent<SkinnedMeshRenderer>();
				component.rootBone = val7;
				((Object)val3).name = "old-metarig";
			}
		}
	}
}

BepinEx/Plugins/LC_API.dll

Decompiled 8 months ago
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using LC_API.BundleAPI;
using LC_API.Comp;
using LC_API.Data;
using LC_API.GameInterfaceAPI;
using LC_API.ManualPatches;
using LC_API.ServerAPI;
using Microsoft.CodeAnalysis;
using Steamworks;
using Steamworks.Data;
using TMPro;
using UnityEngine;
using UnityEngine.InputSystem;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.6", FrameworkDisplayName = ".NET Framework 4.6")]
[assembly: AssemblyCompany("LC_API")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Utilities for plugin devs")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("LC_API")]
[assembly: AssemblyTitle("LC_API")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LC_API
{
	public class CheatDatabase
	{
		private static Dictionary<string, PluginInfo> PluginsLoaded = new Dictionary<string, PluginInfo>();

		public static void RunLocalCheatDetector()
		{
			PluginsLoaded = Chainloader.PluginInfos;
			foreach (PluginInfo value in PluginsLoaded.Values)
			{
				if (value.Metadata.GUID == "mikes.lethalcompany.mikestweaks")
				{
					ModdedServer.SetServerModdedOnly();
				}
				if (value.Metadata.GUID == "mom.llama.enhancer")
				{
					ModdedServer.SetServerModdedOnly();
				}
				if (value.Metadata.GUID == "Posiedon.GameMaster")
				{
					ModdedServer.SetServerModdedOnly();
				}
				if (value.Metadata.GUID == "LethalCompanyScalingMaster")
				{
					ModdedServer.SetServerModdedOnly();
				}
			}
		}

		public static void OtherPlayerCheatDetector()
		{
			Plugin.Log.LogWarning((object)"Asking all other players for their mod list..");
			TextMeshProUGUI chatText = HUDManager.Instance.chatText;
			((TMP_Text)chatText).text = ((TMP_Text)chatText).text + "\n<color=white>Grabbing all connected users mod list\nCheck the log for results!!</color>";
			Networking.Broadcast("LC_API_CD_Broadcast", "LC_API_ReqGUID");
		}

		internal static void RequestModList(string data, string signature)
		{
			if ((data == "LC_API_CD_Broadcast") & (signature == "LC_API_ReqGUID"))
			{
				string text = "";
				foreach (PluginInfo value in PluginsLoaded.Values)
				{
					text = text + "\n" + value.Metadata.GUID;
				}
				Networking.Broadcast(GameNetworkManager.Instance.localPlayerController.playerUsername + " responded with these mods:" + text, "LC_APISendMods");
			}
			if (signature == "LC_APISendMods")
			{
				Plugin.Log.LogWarning((object)data);
			}
		}
	}
	[BepInPlugin("LC_API", "LC_API", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource Log;

		private ConfigEntry<bool> configOverrideModServer;

		private ConfigEntry<bool> configLegacyAssetLoading;

		private void Awake()
		{
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: 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)
			//IL_013d: Expected O, but got Unknown
			//IL_013e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0143: Unknown result type (might be due to invalid IL or missing references)
			//IL_0151: Expected O, but got Unknown
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Expected O, but got Unknown
			configOverrideModServer = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Force modded server browser", false, "Should the API force you into the modded server browser?");
			configLegacyAssetLoading = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Legacy asset bundle loading", false, "Should the BundleLoader use legacy asset loading? Turning this on may help with loading assets from older plugins.");
			Log = ((BaseUnityPlugin)this).Logger;
			((BaseUnityPlugin)this).Logger.LogWarning((object)"\n.____    _________           _____  __________ .___  \r\n|    |   \\_   ___ \\         /  _  \\ \\______   \\|   | \r\n|    |   /    \\  \\/        /  /_\\  \\ |     ___/|   | \r\n|    |___\\     \\____      /    |    \\|    |    |   | \r\n|_______ \\\\______  /______\\____|__  /|____|    |___| \r\n        \\/       \\//_____/        \\/                 \r\n                                                     ");
			((BaseUnityPlugin)this).Logger.LogInfo((object)"LC_API Starting up..");
			if (configOverrideModServer.Value)
			{
				ModdedServer.SetServerModdedOnly();
			}
			Harmony val = new Harmony("ModAPI");
			MethodInfo methodInfo = AccessTools.Method(typeof(GameNetworkManager), "SteamMatchmaking_OnLobbyCreated", (Type[])null, (Type[])null);
			AccessTools.Method(typeof(GameNetworkManager), "LobbyDataIsJoinable", (Type[])null, (Type[])null);
			MethodInfo methodInfo2 = AccessTools.Method(typeof(ServerPatch), "OnLobbyCreate", (Type[])null, (Type[])null);
			MethodInfo methodInfo3 = AccessTools.Method(typeof(MenuManager), "Awake", (Type[])null, (Type[])null);
			MethodInfo methodInfo4 = AccessTools.Method(typeof(ServerPatch), "Vers", (Type[])null, (Type[])null);
			MethodInfo methodInfo5 = AccessTools.Method(typeof(HUDManager), "AddChatMessage", (Type[])null, (Type[])null);
			MethodInfo methodInfo6 = AccessTools.Method(typeof(ServerPatch), "ChatInterpreter", (Type[])null, (Type[])null);
			val.Patch((MethodBase)methodInfo3, new HarmonyMethod(methodInfo4), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)methodInfo5, new HarmonyMethod(methodInfo6), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			val.Patch((MethodBase)methodInfo, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			Networking.GetString = (Networking.GotStringEventDelegate)Delegate.Combine(Networking.GetString, new Networking.GotStringEventDelegate(CheatDatabase.RequestModList));
		}

		private void OnDestroy()
		{
			//IL_0015: 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_0020: Expected O, but got Unknown
			BundleLoader.Load(configLegacyAssetLoading.Value);
			GameObject val = new GameObject("API");
			Object.DontDestroyOnLoad((Object)val);
			val.AddComponent<SVAPI>();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"LC_API Started!");
			CheatDatabase.RunLocalCheatDetector();
		}

		private static void PatchMethodManual(MethodInfo method, MethodInfo patch, Harmony harmony)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			harmony.Patch((MethodBase)method, new HarmonyMethod(patch), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "LC_API";

		public const string PLUGIN_NAME = "LC_API";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace LC_API.ServerAPI
{
	public class ModdedServer
	{
		private static bool moddedOnly;

		public static bool setModdedOnly;

		public static bool ModdedOnly => moddedOnly;

		public static void SetServerModdedOnly()
		{
			moddedOnly = true;
			Plugin.Log.LogMessage((object)"A plugin has set your game to only allow you to play with other people who have mods!");
		}

		public static void OnSceneLoaded()
		{
			if (Object.op_Implicit((Object)(object)GameNetworkManager.Instance) && ModdedOnly)
			{
				GameNetworkManager instance = GameNetworkManager.Instance;
				instance.gameVersionNum += 16440;
				setModdedOnly = true;
			}
		}
	}
	public class Networking
	{
		public delegate void GotStringEventDelegate(string data, string signature);

		public delegate void GotIntEventDelegate(int data, string signature);

		public delegate void GotFloatEventDelegate(float data, string signature);

		public delegate void GotVector3EventDelegate(Vector3 data, string signature);

		public static GotStringEventDelegate GetString = GotString;

		public static GotIntEventDelegate GetInt = GotInt;

		public static GotFloatEventDelegate GetFloat = GotFloat;

		public static GotVector3EventDelegate GetVector3 = GotVector3;

		public static void Broadcast(string data, string signature)
		{
			if (data.Contains("/"))
			{
				Plugin.Log.LogError((object)"Invalid character in broadcasted string event! ( / )");
				return;
			}
			HUDManager.Instance.AddTextToChatOnServer("<size=0>NWE/" + data + "/" + signature + "/" + NetworkBroadcastDataType.BDstring.ToString() + "/" + GameNetworkManager.Instance.localPlayerController.playerClientId + "/</size>", -1);
		}

		public static void Broadcast(int data, string signature)
		{
			HUDManager.Instance.AddTextToChatOnServer("<size=0>NWE/" + data + "/" + signature + "/" + NetworkBroadcastDataType.BDint.ToString() + "/" + GameNetworkManager.Instance.localPlayerController.playerClientId + "/</size>", -1);
		}

		public static void Broadcast(float data, string signature)
		{
			HUDManager.Instance.AddTextToChatOnServer("<size=0>NWE/" + data + "/" + signature + "/" + NetworkBroadcastDataType.BDfloat.ToString() + "/" + GameNetworkManager.Instance.localPlayerController.playerClientId + "/</size>", -1);
		}

		public static void Broadcast(Vector3 data, string signature)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			HUDManager instance = HUDManager.Instance;
			string[] obj = new string[9] { "<size=0>NWE/", null, null, null, null, null, null, null, null };
			Vector3 val = data;
			obj[1] = ((object)(Vector3)(ref val)).ToString();
			obj[2] = "/";
			obj[3] = signature;
			obj[4] = "/";
			obj[5] = NetworkBroadcastDataType.BDvector3.ToString();
			obj[6] = "/";
			obj[7] = GameNetworkManager.Instance.localPlayerController.playerClientId.ToString();
			obj[8] = "/</size>";
			instance.AddTextToChatOnServer(string.Concat(obj), -1);
		}

		private static void GotString(string data, string signature)
		{
		}

		private static void GotInt(int data, string signature)
		{
		}

		private static void GotFloat(float data, string signature)
		{
		}

		private static void GotVector3(Vector3 data, string signature)
		{
		}
	}
}
namespace LC_API.ManualPatches
{
	internal class ServerPatch
	{
		private static bool OnLobbyCreate(GameNetworkManager __instance, Result result, Lobby lobby)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Invalid comparison between Unknown and I4
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			if ((int)result != 1)
			{
				Debug.LogError((object)$"Lobby could not be created! {result}", (Object)(object)__instance);
			}
			__instance.lobbyHostSettings.lobbyName = "[MODDED]" + __instance.lobbyHostSettings.lobbyName.ToString();
			Plugin.Log.LogMessage((object)"server pre-setup success");
			return true;
		}

		private static bool Vers(MenuManager __instance)
		{
			SVAPI.MenuManager = __instance;
			return true;
		}

		private static bool ChatInterpreter(HUDManager __instance, string chatMessage)
		{
			//IL_0119: 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)
			if (chatMessage.Contains("NWE") & chatMessage.Contains("<size=0>"))
			{
				string[] array = chatMessage.Split(new char[1] { '/' });
				if (array.Length >= 3)
				{
					if (!int.TryParse(array[4], out var result))
					{
						Plugin.Log.LogWarning((object)"Failed to parse player ID!!");
						return false;
					}
					if ((result == (int)GameNetworkManager.Instance.localPlayerController.playerClientId) & !SVAPI.netTester)
					{
						return false;
					}
					NetworkBroadcastDataType result2 = NetworkBroadcastDataType.BDint;
					Enum.TryParse<NetworkBroadcastDataType>(array[3], out result2);
					switch (result2)
					{
					case NetworkBroadcastDataType.BDstring:
						Networking.GetString(array[1], array[2]);
						break;
					case NetworkBroadcastDataType.BDint:
						Networking.GetInt(int.Parse(array[1]), array[2]);
						break;
					case NetworkBroadcastDataType.BDfloat:
						Networking.GetFloat(float.Parse(array[1]), array[2]);
						break;
					case NetworkBroadcastDataType.BDvector3:
					{
						string[] array2 = array[1].Replace("(", "").Replace(")", "").Split(new char[1] { ',' });
						Vector3 data = default(Vector3);
						if (array2.Length == 3)
						{
							if (float.TryParse(array2[0], out var result3) && float.TryParse(array2[1], out var result4) && float.TryParse(array2[2], out var result5))
							{
								data.x = result3;
								data.y = result4;
								data.z = result5;
							}
							else
							{
								Plugin.Log.LogError((object)"Vector3 Network receive fail. This is a failure of the API, and it should be reported as a bug.");
							}
						}
						else
						{
							Plugin.Log.LogError((object)"Vector3 Network receive fail. This is a failure of the API, and it should be reported as a bug.");
						}
						Networking.GetVector3(data, array[2]);
						break;
					}
					}
					_ = SVAPI.netTester;
					return false;
				}
				Plugin.Log.LogError((object)"Generic Network receive fail. This is a failure of the API, and it should be reported as a bug.");
			}
			return true;
		}

		private static bool ChatCommands(HUDManager __instance, CallbackContext context)
		{
			if (__instance.chatTextField.text.ToLower().Contains("/modcheck"))
			{
				CheatDatabase.OtherPlayerCheatDetector();
				return false;
			}
			return true;
		}
	}
}
namespace LC_API.GameInterfaceAPI
{
	public class GameState
	{
		public delegate void GenericGameEventDelegate();

		public static int AlivePlayerCount;

		public static ShipStateEnum ShipState;

		public static GenericGameEventDelegate PlayerDied = GSPlayerDied;

		public static GenericGameEventDelegate LandOnMoon = GSLandOnMood;

		public static GenericGameEventDelegate WentIntoOrbit = GSGoIntoOrbit;

		public static GenericGameEventDelegate ShipStartedLeaving = GSStartLeavingMoon;

		public static void GSUpdate()
		{
			if ((Object)(object)StartOfRound.Instance != (Object)null)
			{
				if (StartOfRound.Instance.shipHasLanded && ShipState != ShipStateEnum.OnMoon)
				{
					ShipState = ShipStateEnum.OnMoon;
					LandOnMoon();
				}
				if (StartOfRound.Instance.inShipPhase && ShipState != 0)
				{
					ShipState = ShipStateEnum.InOrbit;
					WentIntoOrbit();
				}
				if (StartOfRound.Instance.shipIsLeaving && ShipState != ShipStateEnum.LeavingMoon)
				{
					ShipState = ShipStateEnum.LeavingMoon;
					ShipStartedLeaving();
				}
				if (AlivePlayerCount < StartOfRound.Instance.livingPlayers)
				{
					PlayerDied();
				}
				AlivePlayerCount = StartOfRound.Instance.livingPlayers;
			}
		}

		private static void GSPlayerDied()
		{
		}

		private static void GSLandOnMood()
		{
		}

		private static void GSGoIntoOrbit()
		{
		}

		private static void GSStartLeavingMoon()
		{
		}
	}
}
namespace LC_API.Data
{
	public enum NetworkBroadcastDataType
	{
		BDint,
		BDfloat,
		BDvector3,
		BDstring
	}
	public enum ShipStateEnum
	{
		InOrbit,
		OnMoon,
		LeavingMoon
	}
}
namespace LC_API.Comp
{
	internal class SVAPI : MonoBehaviour
	{
		public static MenuManager MenuManager;

		public static bool netTester;

		private static int playerCount;

		private static bool wanttoCheckMods;

		private static float lobbychecktimer;

		public void Update()
		{
			GameState.GSUpdate();
			if ((((Object)(object)HUDManager.Instance != (Object)null) & netTester) && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)
			{
				Networking.Broadcast("testerData", "testerSignature");
			}
			if (!ModdedServer.setModdedOnly)
			{
				ModdedServer.OnSceneLoaded();
			}
			else if (ModdedServer.ModdedOnly && (Object)(object)MenuManager != (Object)null && Object.op_Implicit((Object)(object)MenuManager.versionNumberText))
			{
				((TMP_Text)MenuManager.versionNumberText).text = $"v{GameNetworkManager.Instance.gameVersionNum - 16440}\nMOD";
			}
			if ((Object)(object)GameNetworkManager.Instance != (Object)null)
			{
				if (playerCount < GameNetworkManager.Instance.connectedPlayers)
				{
					lobbychecktimer = -8f;
					wanttoCheckMods = true;
				}
				playerCount = GameNetworkManager.Instance.connectedPlayers;
			}
			if (lobbychecktimer < 0f)
			{
				lobbychecktimer += Time.deltaTime;
			}
			else if (wanttoCheckMods)
			{
				wanttoCheckMods = false;
				CD();
			}
		}

		private void CD()
		{
			CheatDatabase.OtherPlayerCheatDetector();
		}
	}
}
namespace LC_API.BundleAPI
{
	public class BundleLoader
	{
		public delegate void OnLoadedAssetsDelegate();

		public static ConcurrentDictionary<string, Object> assets;

		public static bool assetsInLegacyDirectory;

		public static bool legacyLoadingEnabled;

		public static OnLoadedAssetsDelegate OnLoadedAssets;

		public static void Load(bool legacyLoading)
		{
			assetsInLegacyDirectory = true;
			legacyLoadingEnabled = legacyLoading;
			assets = new ConcurrentDictionary<string, Object>();
			Plugin.Log.LogMessage((object)"BundleAPI will now load all asset bundles...");
			string path = Path.Combine(Paths.BepInExRootPath, "Bundles");
			if (!Directory.Exists(path))
			{
				Directory.CreateDirectory(path);
				Plugin.Log.LogMessage((object)"BundleAPI Created legacy bundle directory in BepInEx/Bundles");
			}
			string[] array = (from x in Directory.GetFiles(path, "*", SearchOption.AllDirectories)
				where !x.EndsWith(".manifest", StringComparison.CurrentCultureIgnoreCase)
				select x).ToArray();
			if (array.Length == 0)
			{
				Plugin.Log.LogMessage((object)"BundleAPI got no assets to load from legacy directory");
				assetsInLegacyDirectory = false;
			}
			if (assetsInLegacyDirectory)
			{
				Plugin.Log.LogWarning((object)"The path BepInEx > Bundles is outdated and should not be used anymore! Bundles will be loaded from BepInEx > plugins from now on");
				LoadAllAssetsFromDirectory(array, legacyLoading);
			}
			path = Path.Combine(Paths.BepInExRootPath, "plugins");
			array = (from x in Directory.GetFiles(path, "*", SearchOption.AllDirectories)
				where !x.EndsWith(".dll", StringComparison.CurrentCultureIgnoreCase)
				where !x.EndsWith(".json", StringComparison.CurrentCultureIgnoreCase)
				where !x.EndsWith(".png", StringComparison.CurrentCultureIgnoreCase)
				where !x.EndsWith(".md", StringComparison.CurrentCultureIgnoreCase)
				where !x.EndsWith(".old", StringComparison.CurrentCultureIgnoreCase)
				select x).ToArray();
			if (array.Length == 0)
			{
				Plugin.Log.LogMessage((object)"BundleAPI got no assets to load from plugins folder");
			}
			else
			{
				LoadAllAssetsFromDirectory(array, legacyLoading);
			}
			OnLoadedAssets = (OnLoadedAssetsDelegate)Delegate.Combine(OnLoadedAssets, new OnLoadedAssetsDelegate(LoadAssetsCompleted));
			OnLoadedAssets();
		}

		private static void LoadAllAssetsFromDirectory(string[] array, bool legacyLoading)
		{
			Plugin.Log.LogMessage((object)("BundleAPI got " + array.Length + " AssetBundles to load!"));
			for (int i = 0; i < array.Length; i++)
			{
				try
				{
					SaveAsset(array[i], legacyLoading);
				}
				catch (Exception)
				{
					Plugin.Log.LogError((object)("Failed to load an assetbundle! Path: " + array[i]));
				}
			}
		}

		public static void SaveAsset(string path, bool legacyLoad)
		{
			AssetBundle val = AssetBundle.LoadFromFile(path);
			string[] allAssetNames = val.GetAllAssetNames();
			foreach (string text in allAssetNames)
			{
				Plugin.Log.LogMessage((object)("Got asset for load: " + text));
				Object val2 = val.LoadAsset(text);
				if (val2 != (Object)null)
				{
					string text2 = text.ToLower();
					if (legacyLoad)
					{
						text2 = text2.ToUpper();
					}
					if (assets.ContainsKey(text2))
					{
						Plugin.Log.LogError((object)"BundleAPI got duplicate asset!");
						break;
					}
					assets.TryAdd(text2, val2);
					Plugin.Log.LogMessage((object)("Loaded asset: " + val2.name));
				}
				else
				{
					Plugin.Log.LogWarning((object)"Skipped loading an asset");
				}
			}
		}

		public static AssetType GetLoadedAsset<AssetType>(string itemPath) where AssetType : Object
		{
			Object value;
			if (legacyLoadingEnabled)
			{
				assets.TryGetValue(itemPath.ToUpper(), out value);
			}
			else
			{
				assets.TryGetValue(itemPath.ToLower(), out value);
			}
			return (AssetType)(object)value;
		}

		private static void LoadAssetsCompleted()
		{
			Plugin.Log.LogMessage((object)"BundleAPI finished loading all assets.");
		}

		private void Awake()
		{
		}
	}
}

BepinEx/Plugins/SolosBodycams.dll

Decompiled 8 months ago
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using UnityEngine;
using UnityEngine.SceneManagement;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("SolosBodycams")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Solo's Bodycams")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SolosBodycams")]
[assembly: AssemblyTitle("SolosBodycams")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace SolosBodycams;

[BepInPlugin("SolosBodycams", "Solo's Bodycams", "1.0")]
public class Plugin : BaseUnityPlugin
{
	private GameObject ShipExternalCamera = null;

	private int TransformIndexCopy;

	private bool ActivateCamera1 = false;

	private bool ActivateCamera2 = false;

	private bool SwitchedMonitors = false;

	private RenderTexture NewRT;

	public void Awake()
	{
		((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin SolosBodycams is loaded!");
		SceneManager.sceneLoaded += OnSceneLoaded;
	}

	public void OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		ActivateCamera2 = false;
		if (!(((Scene)(ref scene)).name == "MainMenu") && !(((Scene)(ref scene)).name == "InitScene") && !(((Scene)(ref scene)).name == "InitSceneLaunchOptions"))
		{
			ActivateCamera1 = true;
			((MonoBehaviour)this).StartCoroutine(LoadSceneEnter());
		}
		else
		{
			ActivateCamera1 = false;
			SwitchedMonitors = false;
		}
	}

	private IEnumerator LoadSceneEnter()
	{
		yield return (object)new WaitForSeconds(5f);
		ActivateCamera2 = true;
		if (!((Object)(object)GameObject.Find("Environment/HangarShip/Cameras/ShipCamera") == (Object)null))
		{
			if (!SwitchedMonitors)
			{
				NewRT = new RenderTexture(160, 120, 32, (RenderTextureFormat)0);
				((Renderer)GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube").GetComponent<MeshRenderer>()).materials[2].mainTexture = ((Renderer)GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001").GetComponent<MeshRenderer>()).materials[2].mainTexture;
				((Renderer)GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001").GetComponent<MeshRenderer>()).materials[2].mainTexture = (Texture)(object)NewRT;
				GameObject.Find("Environment/HangarShip/Cameras/ShipCamera").GetComponent<Camera>().targetTexture = NewRT;
				SwitchedMonitors = true;
			}
			ShipExternalCamera = GameObject.Find("Environment/HangarShip/Cameras/ShipCamera");
			Object.Destroy((Object)(object)((Component)ShipExternalCamera.transform.Find("VolumeMain (1)")).GetComponent<BoxCollider>());
			Object.Destroy((Object)(object)ShipExternalCamera.GetComponent<Animator>());
			Object.Destroy((Object)(object)ShipExternalCamera.GetComponent<MeshRenderer>());
		}
	}

	public void Update()
	{
		//IL_0192: 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_01ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: 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)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: 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_0141: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		if (!ActivateCamera1 || !ActivateCamera2)
		{
			return;
		}
		TransformIndexCopy = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001/CameraMonitorScript").GetComponent<ManualCameraRenderer>().targetTransformIndex;
		TransformAndName val = GameObject.Find("Environment/HangarShip/ShipModels2b/MonitorWall/Cube.001/CameraMonitorScript").GetComponent<ManualCameraRenderer>().radarTargets[TransformIndexCopy];
		if (!val.isNonPlayer)
		{
			ShipExternalCamera.transform.SetPositionAndRotation(val.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003").position + new Vector3(0.2f, 0f, 0f), val.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003").rotation * Quaternion.Euler(0f, 0f, 0f));
			DeadBodyInfo[] array = Object.FindObjectsOfType<DeadBodyInfo>();
			for (int i = 0; i < array.Length; i++)
			{
				if (array[i].playerScript.playerUsername == val.name)
				{
					ShipExternalCamera.transform.SetPositionAndRotation(((Component)array[i]).gameObject.transform.Find("spine.001/spine.002/spine.003").position, ((Component)array[i]).gameObject.transform.Find("spine.001/spine.002/spine.003").rotation * Quaternion.Euler(0f, 0f, 0f));
				}
			}
		}
		else
		{
			ShipExternalCamera.transform.SetPositionAndRotation(val.transform.position + new Vector3(0f, 1.6f, 0f), val.transform.rotation * Quaternion.Euler(0f, -90f, 0f));
		}
	}
}
public static class PluginInfo
{
	public const string PLUGIN_GUID = "SolosBodycams";

	public const string PLUGIN_NAME = "SolosBodycams";

	public const string PLUGIN_VERSION = "1.0.0";
}

BepinEx/Plugins/TZPReworked.dll

Decompiled 8 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using TzpLeth.Patches;
using Unity.Netcode;
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("TestLethal")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TestLethal")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("2ba0eb43-680c-46bc-9c38-f755dcb4f038")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TzpLeth
{
	[BepInPlugin("Hotoni.TZPHEAL", "TZP Reworked: Healing", "1.1.0.0")]
	public class TZPHEAL : BaseUnityPlugin
	{
		private const string modGUID = "Hotoni.TZPHEAL";

		private const string modName = "TZP Reworked: Healing";

		private const string modVersion = "1.1.0.0";

		private readonly Harmony harmony = new Harmony("Hotoni.TZPHEAL");

		private ConfigEntry<bool> configInfiniteFuel;

		public static bool InfiniteFuel;

		private ConfigEntry<bool> configShowBatteryIcon;

		public static bool ShowBatteryIcon;

		private static TZPHEAL Instance;

		internal ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Hotoni.TZPHEAL");
			mls.LogInfo((object)"TZP HEAL loaded");
			harmony.PatchAll(typeof(TZPHEAL));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			configInfiniteFuel = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Infinite TZP", false, "Prevent TZP from ever running out.");
			InfiniteFuel = configInfiniteFuel.Value;
			configShowBatteryIcon = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Battery Icon", true, "Show a battery icon with the current TZP Fuel");
			ShowBatteryIcon = configShowBatteryIcon.Value;
		}
	}
}
namespace TzpLeth.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	[HarmonyPatch(typeof(TetraChemicalItem))]
	internal class PlayerControllerBPatch : GrabbableObject
	{
		[HarmonyPatch(typeof(TetraChemicalItem), "Update")]
		[HarmonyPrefix]
		private static void PatchBattery(ref Item ___itemProperties, ref Battery ___insertedBattery, ref float ___fuel)
		{
			___itemProperties.requiresBattery = false;
			___insertedBattery.charge = ___fuel;
			___insertedBattery.empty = false;
		}

		[HarmonyPatch(typeof(TetraChemicalItem), "Update")]
		[HarmonyPostfix]
		public static void healtzp(ref bool ___emittingGas, ref bool ___isHeld, PlayerControllerB __instance, ref float ___fuel, ref Item ___itemProperties, ref Battery ___insertedBattery)
		{
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			if (TZPHEAL.InfiniteFuel && (int)(___fuel * 1000f) % 1000 < 500)
			{
				___fuel = 1f;
			}
			else if (TZPHEAL.ShowBatteryIcon)
			{
				___itemProperties.requiresBattery = true;
				___insertedBattery.charge = ___fuel;
				___insertedBattery.empty = false;
			}
			if (!(___emittingGas & ___isHeld))
			{
				return;
			}
			int num = (int)(___fuel * 1000f) % 1000;
			GameNetworkManager.Instance.localPlayerController.inSpecialInteractAnimation = true;
			if (((NetworkBehaviour)__instance).IsOwner && num % 30 == 0 && GameNetworkManager.Instance.localPlayerController.health < 100)
			{
				HUDManager.Instance.DisplayStatusEffect("Healing ... " + (GameNetworkManager.Instance.localPlayerController.health + 1) + "%");
				GameNetworkManager.Instance.localPlayerController.DamagePlayer(-2, false, true, (CauseOfDeath)0, 0, false, default(Vector3));
				if (GameNetworkManager.Instance.localPlayerController.health >= 10 && GameNetworkManager.Instance.localPlayerController.criticallyInjured)
				{
					GameNetworkManager.Instance.localPlayerController.MakeCriticallyInjured(false);
				}
				HUDManager.Instance.HUDAnimator.ResetTrigger("SmallHit");
			}
			if (GameNetworkManager.Instance.localPlayerController.health >= 99)
			{
				HUDManager.Instance.DisplayStatusEffect("Healthy.\nGet to work!");
				HUDManager.Instance.statusEffectAnimator.SetTrigger("IndicateStatus");
			}
			GameNetworkManager.Instance.localPlayerController.inSpecialInteractAnimation = false;
		}
	}
}