Decompiled source of Sante au Colonel v1.0.0

BepInEx/plugins/Santé_au_Colonel/SanteAuColonelMod.dll

Decompiled 9 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("SanteAuColonelMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Parce que ramener de la feraille c'est pas de tout repos, poses-toi, prends une bouteille, et santé !")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SanteAuColonelMod")]
[assembly: AssemblyTitle("SanteAuColonelMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace SanteAuColonelMod
{
	[BepInPlugin("SanteAuColonelMod", "SanteAuColonelMod", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony harmony = new Harmony("SanteAuColonelMod");

		internal static Plugin Instance;

		internal static ManualLogSource logger;

		internal static List<AudioClip> SoundFX;

		internal static AssetBundle Bundle;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger = Logger.CreateLogSource("SanteAuColonelMod");
			harmony.PatchAll();
			logger.LogInfo((object)"Plugin v1.0.0 is loaded!");
			SoundFX = new List<AudioClip>();
			Bundle = AssetBundle.LoadFromFile(((BaseUnityPlugin)Instance).Info.Location.TrimEnd("SanteAuColonelMod.dll".ToCharArray()) + "sante_colonel");
			if ((Object)(object)Bundle != (Object)null)
			{
				logger.LogInfo((object)"Successfully loaded AssetBundle!");
				SoundFX = Bundle.LoadAllAssets<AudioClip>().ToList();
			}
			else
			{
				logger.LogError((object)"Failed to load AssetBundle!");
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "SanteAuColonelMod";

		public const string PLUGIN_NAME = "SanteAuColonelMod";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace SanteAuColonelMod.Patches
{
	[HarmonyPatch(typeof(GrabbableObject))]
	internal class ColonelDropBottlesPatch
	{
		internal static ManualLogSource logger;

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void ReplaceBottlesDropSFX(GrabbableObject __instance)
		{
			logger = Logger.CreateLogSource("SanteAuColonelMod");
			Item itemProperties = __instance.itemProperties;
			if (itemProperties.itemName == "Bottles")
			{
				itemProperties.dropSFX = Plugin.SoundFX[0];
			}
		}
	}
}