Decompiled source of TZPBuff v1.0.0

TZPBuff.dll

Decompiled 8 months ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using GameNetcodeStuff;
using HarmonyLib;
using Unity.Netcode;
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: AssemblyTitle("PlayerGetsShotgunOnSpawn")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("PlayerGetsShotgunOnSpawn")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("93ce57b6-a2b9-4fdc-8c39-de8c88ae69ab")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace PlayerGetsShotgunOnSpawn;

[BepInPlugin("plonk.noweedeffect", "TZP Buff", "1.0.0")]
public class maincode : BaseUnityPlugin
{
	[HarmonyPatch]
	private class Patches
	{
		[HarmonyPostfix]
		[HarmonyPatch(typeof(TetraChemicalItem), "Update")]
		public static void RunOutOfFuelRemove(TetraChemicalItem __instance)
		{
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			if (__instance.fuel != float.PositiveInfinity)
			{
				__instance.fuel = float.PositiveInfinity;
			}
			if (__instance.emittingGas && ((NetworkBehaviour)((GrabbableObject)__instance).playerHeldBy).IsOwner)
			{
				SoundManager.Instance.playerVoicePitchTargets[(uint)((GrabbableObject)__instance).playerHeldBy.playerClientId] = 1f;
				if (((GrabbableObject)__instance).playerHeldBy.drunkness >= 0.98f)
				{
					PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy;
					playerHeldBy.drunkness -= 0.2f;
					((GrabbableObject)__instance).playerHeldBy.DamagePlayer(1, true, true, (CauseOfDeath)5, 0, false, default(Vector3));
				}
			}
		}
	}

	private GameObject lightobj;

	public static float gasRegenTimer;

	private bool candoshit;

	private void Awake()
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_000c: Expected O, but got Unknown
		Harmony val = new Harmony("plonk.noweedeffect");
		val.PatchAll();
		SceneManager.sceneLoaded += SceneManager_OnSceneLoaded;
	}

	private void SceneManager_OnSceneLoaded(Scene scene, LoadSceneMode mode)
	{
		//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)
		if (SceneManager.GetActiveScene() == scene)
		{
			Debug.Log((object)GameObject.Find("Systems/UI/Canvas/HelmetStatusEffects/GasInHelmet"));
		}
	}

	private void Update()
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: 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_003d: Unknown result type (might be due to invalid IL or missing references)
		Scene activeScene;
		if (!candoshit)
		{
			activeScene = SceneManager.GetActiveScene();
			if (((Scene)(ref activeScene)).name == "MainMenu")
			{
				candoshit = true;
			}
		}
		if (!candoshit)
		{
			return;
		}
		activeScene = SceneManager.GetActiveScene();
		if (((Scene)(ref activeScene)).name != "MainMenu")
		{
			GameObject val = GameObject.Find("Systems/UI/Canvas/HelmetStatusEffects/GasInHelmet");
			if ((Object)(object)val != (Object)null && val.activeSelf)
			{
				val.SetActive(false);
			}
		}
	}
}