Decompiled source of UnlimitedShotgunAmmo v1.0.0

ShotgunRevamp.dll

Decompiled a month 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 ShotgunRevamp.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("ShotgunRevamp")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ShotgunRevamp")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("1e0eb909-4665-42d6-9989-768c21a53d9e")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace ShotgunRevamp
{
	[BepInPlugin("Plantain.Revamp", "Plantain Shotgun Revamp", "1.0.0.0")]
	public class ShotgunRevampBase : BaseUnityPlugin
	{
		private const string modGUID = "Plantain.Revamp";

		private const string modName = "Plantain Shotgun Revamp";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("Plantain.Revamp");

		private static ShotgunRevampBase Instance;

		internal ManualLogSource mls;

		internal static List<AudioClip> ShotgunShootSFX;

		internal static AssetBundle BundleSS;

		internal static List<AudioClip> ShotgunShellSFX;

		internal static AssetBundle BundleSH;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Plantain.Revamp");
			mls.LogInfo((object)"fortnite battle pass i just shit out my ass ==\ud83d\udc0a✈\ufe0f==\r\n      ||   \ud83d\udca3");
			harmony.PatchAll(typeof(ShotgunRevampBase));
			harmony.PatchAll(typeof(ShotgunSoundPatch));
			harmony.PatchAll(typeof(ShotgunMisfirePatch));
			harmony.PatchAll(typeof(ShotgunAmmoPatch));
			mls = ((BaseUnityPlugin)this).Logger;
			ShotgunShootSFX = new List<AudioClip>();
			string location = ((BaseUnityPlugin)Instance).Info.Location;
			location = location.TrimEnd("ShotgunRevamp.dll".ToCharArray());
			BundleSS = AssetBundle.LoadFromFile(location + "boom");
			if ((Object)(object)BundleSS != (Object)null)
			{
				mls.LogInfo((object)"Successfully loaded asset bundle");
				ShotgunShootSFX = BundleSS.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogInfo((object)"Failed to load asset bundle :C");
			}
			ShotgunShellSFX = new List<AudioClip>();
			BundleSH = AssetBundle.LoadFromFile(location + "shells");
			if ((Object)(object)BundleSH != (Object)null)
			{
				mls.LogInfo((object)"Successfully loaded asset bundle 2");
				ShotgunShellSFX = BundleSH.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				mls.LogInfo((object)"Failed to load asset bundle 2 :C");
			}
		}
	}
}
namespace ShotgunRevamp.Patches
{
	[HarmonyPatch(typeof(ShotgunItem))]
	internal class ShotgunSoundPatch
	{
		[HarmonyPatch("ShootGun")]
		[HarmonyPrefix]
		private static void ShotgunAudioOveride(ShotgunItem __instance)
		{
			__instance.gunShootSFX[0] = ShotgunRevampBase.ShotgunShootSFX[0];
			__instance.gunShootSFX[1] = ShotgunRevampBase.ShotgunShootSFX[0];
			__instance.gunBulletsRicochetAudio.clip = ShotgunRevampBase.ShotgunShellSFX[0];
		}
	}
	[HarmonyPatch(typeof(ShotgunItem))]
	internal class ShotgunMisfirePatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void ShotgunAudioOveride(ref float ___misfireTimer)
		{
			___misfireTimer = 30f;
		}
	}
	[HarmonyPatch(typeof(ShotgunItem))]
	internal class ShotgunAmmoPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void ShotgunAudioOveride(ref float ___shellsLoaded, ref bool ___isReloading)
		{
			___shellsLoaded = 2f;
			if (___shellsLoaded == 1f)
			{
				___isReloading = true;
			}
			else
			{
				___isReloading = false;
			}
		}
	}
}