Decompiled source of SC Stimpack Mod v1.0.2

SCStimpackMod.dll

Decompiled 11 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using HarmonyLib;
using SCStimpackMod.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("SC2StimpackMod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("SC2StimpackMod")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("9d5a1fdc-877f-4c09-8788-845f852adc05")]
[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 SCStimpackMod
{
	[BepInPlugin("sunway.SCStimpack", "SC Stimpack Sound for TPZ Inhalant", "1.0.2")]
	public class StimpackModBase : BaseUnityPlugin
	{
		private const string modGuid = "sunway.SCStimpack";

		private const string modName = "SC Stimpack Sound for TPZ Inhalant";

		private const string modVersion = "1.0.2";

		internal static AudioClip inhaleSFX;

		private readonly Harmony harmony = new Harmony("sunway.SCStimpack");

		private void Awake()
		{
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loading the Starcraft Stimpack Mod");
			string path = ((BaseUnityPlugin)this).Info.Location.TrimEnd("SCStimpackMod.dll".ToCharArray());
			path = Path.Combine(path, "scstimpack");
			AssetBundle val = AssetBundle.LoadFromFile(path);
			if ((Object)(object)val == (Object)null)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)"Failed to load audio assets!");
				return;
			}
			inhaleSFX = val.LoadAsset<AudioClip>("Assets/AssetBundles/SC1Stim.mp3");
			harmony.PatchAll(typeof(InhalantPatch));
		}
	}
}
namespace SCStimpackMod.Patches
{
	[HarmonyPatch(typeof(TetraChemicalItem))]
	internal class InhalantPatch
	{
		[HarmonyPatch("ItemActivate")]
		[HarmonyPostfix]
		public static void inhalantAudioPatch(ref AudioClip ___twistCanSFX)
		{
			AudioClip inhaleSFX = StimpackModBase.inhaleSFX;
			___twistCanSFX = inhaleSFX;
		}
	}
}