Decompiled source of WarpStaffTeleporters v1.1.0

WarpStaff/WarpStaff.dll

Decompiled 11 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
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("WarpStaff")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("WarpStaff")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("61e19d56-6cac-4f4e-83ea-ad05ef37cc3b")]
[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 WarpStaff
{
	[BepInPlugin("Iatroph.WarpStaffTeleporters", "Warp Staff Teleporters", "1.1.0.0")]
	public class ModBase : BaseUnityPlugin
	{
		private const string modGUID = "Iatroph.WarpStaffTeleporters";

		private const string modName = "Warp Staff Teleporters";

		private const string modVersion = "1.1.0.0";

		private readonly Harmony harmony = new Harmony("Iatroph.WarpStaffTeleporters");

		private static ModBase Instance;

		internal ManualLogSource mls;

		internal static List<AudioClip> soundFX;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Iatroph.WarpStaffTeleporters");
			mls.LogInfo((object)"Loading WarpStaff.wav");
			mls = ((BaseUnityPlugin)this).Logger;
			soundFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("WarpStaff.dll".ToCharArray());
			Bundle = AssetBundle.LoadFromFile(location + "teleporters");
			if ((Object)(object)Bundle != (Object)null)
			{
				mls.LogInfo((object)"Successfully loaded asset bundle");
				soundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogError((object)"Failed to load asset bundle");
			}
			harmony.PatchAll();
			mls.LogInfo((object)"WarpStaff loaded, remember to just use it");
			mls.LogInfo((object)((Object)soundFX[0]).name);
			mls.LogInfo((object)((Object)soundFX[1]).name);
			mls.LogInfo((object)((Object)soundFX[2]).name);
		}
	}
}
namespace WarpStaff.Patches
{
	[HarmonyPatch]
	internal class ShipTeleporterPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(ShipTeleporter), "Awake")]
		private static void Awake(ShipTeleporter __instance)
		{
			if (__instance.isInverseTeleporter)
			{
				__instance.teleporterSpinSFX = ModBase.soundFX[1];
			}
			else
			{
				__instance.beamUpPlayerBodySFX = ModBase.soundFX[0];
			}
			__instance.teleporterBeamUpSFX = ModBase.soundFX[2];
		}
	}
}