Decompiled source of TZPVapeReplacer v1.3.5

TZPVape.dll

Decompiled 6 hours ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using TZPVape.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("TZPVape")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TZPVape")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("388b9c6c-acc8-4ebc-8693-190177732fa5")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TZPVape
{
	[BepInPlugin("Ex.VapeMod", "Ex TZP to Vape Mod", "0.1.0")]
	public class VapemodBase : BaseUnityPlugin
	{
		private const string modGUID = "Ex.VapeMod";

		private const string modName = "Ex TZP to Vape Mod";

		private const string modVersion = "0.1.0";

		private readonly Harmony harmony = new Harmony("Ex.VapeMod");

		private static VapemodBase Instance;

		internal ManualLogSource mls;

		public static GameObject newVapeModel;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Ex.VapeMod");
			mls.LogInfo((object)"Vape mod has initiated");
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			string text = "WTZPVape.dll";
			string text2 = location.TrimEnd(text.ToCharArray());
			string text3 = text2 + "vapepen";
			AssetBundle val = AssetBundle.LoadFromFile(text3);
			if ((Object)(object)val == (Object)null)
			{
				mls.LogError((object)"Failed to load assets!");
				return;
			}
			newVapeModel = val.LoadAsset<GameObject>("Assets/Vape1.prefab");
			harmony.PatchAll(typeof(VapemodBase));
			harmony.PatchAll(typeof(TZPVPatch));
			mls.LogInfo((object)"TZP vape replacer mod has loaded.");
		}
	}
}
namespace TZPVape.Patches
{
	[HarmonyPatch(typeof(GrabbableObject))]
	internal class TZPVPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		public static void TZPInhaleMPatch(GrabbableObject __instance)
		{
			//IL_0013: 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_0060: 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_007d: 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)
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			if (__instance is TetraChemicalItem)
			{
				Transform child = ((Component)__instance).transform.GetChild(0);
				((Renderer)((Component)__instance).GetComponent<MeshRenderer>()).enabled = false;
				GameObject val = Object.Instantiate<GameObject>(VapemodBase.newVapeModel);
				val.transform.SetParent(child);
				val.transform.localPosition = Vector3.zero;
				val.transform.localRotation = Quaternion.identity;
				val.transform.localScale = Vector3.one;
				Quaternion localRotation = child.localRotation;
				((Quaternion)(ref localRotation)).Set(0f, 0f, 0f, 0f);
				child.localRotation = localRotation;
				Vector3 localScale = child.localScale;
				((Vector3)(ref localScale)).Set(1f, 1f, 1f);
				child.localScale = localScale;
			}
		}
	}
}