Decompiled source of GermanAIOMemepack v1.0.0

BepInEx/plugins/AIO Memepack.dll

Decompiled 2 years ago
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LCSoundTool;
using TMPro;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("AIO Memepack")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("AIO Memepack")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("15158709-8f1c-44eb-abf8-90eb79e9d414")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AIO_Memepack;

internal class AudioManager
{
	private static List<AudioClip> loadedClips = new List<AudioClip>();

	public static AudioClip getAudioClip(string filename)
	{
		if (loadedClips.Count == 0 || !isClipLoaded(filename))
		{
			AudioClip audioClip = SoundTool.GetAudioClip("AIO Memepack", filename);
			((Object)audioClip).name = filename;
			loadedClips.Add(audioClip);
			return audioClip;
		}
		return getLoadedClip(filename);
	}

	public static AudioClip getRandomClip(params string[] filenames)
	{
		return getAudioClip(filenames[Random.Range(0, filenames.Length)]);
	}

	public static AudioClip[] getAllClips(params string[] filenames)
	{
		AudioClip[] array = (AudioClip[])(object)new AudioClip[filenames.Length];
		for (int i = 0; i < filenames.Length; i++)
		{
			array[i] = getAudioClip(filenames[i]);
		}
		return array;
	}

	private static AudioClip getLoadedClip(string filename)
	{
		foreach (AudioClip loadedClip in loadedClips)
		{
			if (((Object)loadedClip).name == filename)
			{
				return loadedClip;
			}
		}
		return null;
	}

	private static bool isClipLoaded(string filename)
	{
		foreach (AudioClip loadedClip in loadedClips)
		{
			if (((Object)loadedClip).name == filename)
			{
				return true;
			}
		}
		return false;
	}

	public static AudioSource createAudioSource(Vector3 position, Transform parent, float distance)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0005: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		AudioSource obj = Object.Instantiate<GameObject>(new GameObject(), position, Quaternion.identity, parent).AddComponent<AudioSource>();
		obj.maxDistance = distance;
		obj.spatialBlend = 1f;
		obj.rolloffMode = (AudioRolloffMode)1;
		return obj;
	}
}
[HarmonyPatch(typeof(FlowermanAI))]
internal class BrackenPatch
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	public static void Start(ref FlowermanAI __instance)
	{
		__instance.crackNeckSFX = AudioManager.getRandomClip("bluetooth.mp3");
	}
}
[HarmonyPatch(typeof(HoarderBugAI))]
internal class BugPatch
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	public static void Start(ref HoarderBugAI __instance)
	{
		__instance.chitterSFX = AudioManager.getAllClips("happy.mp3", "yippee.mp3", "ich-bins-farid.mp3");
		__instance.angryScreechSFX = AudioManager.getAllClips("bing-bong.mp3", "pimmelberger.mp3");
	}
}
internal static class ConfigManager
{
	private const string CONFIG_FILE_NAME = "aio_memepakc.cfg";

	private static ConfigFile _config;

	public static ConfigEntry<float> _flashlightStrength;

	public static ConfigEntry<int> _dropshipFirstWait;

	public static ConfigEntry<int> _dropshipNormalWait;

	public static ConfigEntry<bool> _enableBoomboxSpawner;

	public static ConfigEntry<bool> _enableInfiniteSprint;

	public static void Init()
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Expected O, but got Unknown
		_config = new ConfigFile(Path.Combine(Paths.ConfigPath, "aio_memepakc.cfg"), true);
		_flashlightStrength = _config.Bind<float>("Config", "flashlightIntensity", 5f, "Basegame uses 1.0");
		_dropshipFirstWait = _config.Bind<int>("Config", "dropshipFirstWait", 5, "Basegame uses 20");
		_dropshipNormalWait = _config.Bind<int>("Config", "dropshipNormalWait", 5, "Basegame uses 40");
		_enableBoomboxSpawner = _config.Bind<bool>("Config", "enableBoomboxSpawner", true, "Spawns a boombox on the first run of the game");
		_enableInfiniteSprint = _config.Bind<bool>("Config", "enableInfiniteSprint", true, "Allows the player to sprint indefinetly");
	}
}
[HarmonyPatch(typeof(DepositItemsDesk))]
internal class DepositDeskPatch
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	public static void Start(ref DepositItemsDesk __instance)
	{
		shuffleSounds(__instance);
	}

	[HarmonyPatch("OpenShutDoor")]
	[HarmonyPrefix]
	public static void toggleDoor(ref DepositItemsDesk __instance)
	{
		shuffleSounds(__instance);
	}

	private static void shuffleSounds(DepositItemsDesk __instance)
	{
		__instance.rumbleSFX = AudioManager.getRandomClip("traut-euch.mp3", "rehehehe.mp3");
		__instance.doorOpenSFX = AudioManager.getRandomClip("trymacs-hier.mp3", "rehehehe.mp3");
		__instance.rewardGood = AudioManager.getRandomClip("yippee.mp3");
		__instance.microphoneAudios = AudioManager.getAllClips("hier-ist-alles-super.mp3", "chicken-nuggets.mp3", "monte-schonen-abend.mp3", "kaltes-wasser.mp3", "skull-guitar.mp3");
	}
}
[HarmonyPatch(typeof(ItemDropship))]
internal class DropshipPatch
{
	private static int firstWaitTime;

	private static int normalWaitTime;

	public static Terminal terminal;

	private static StartOfRound playerManager;

	private static List<int> itemDelivery;

	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	private static void Start(ref ItemDropship __instance)
	{
		firstWaitTime = ConfigManager._dropshipFirstWait.Value;
		normalWaitTime = ConfigManager._dropshipNormalWait.Value;
		string[] array = new string[2] { "wuhlmaus-apored.mp3", "chinese-rap-song.mp3" };
		string filename = array[Random.Range(0, array.Length)];
		((Component)((Component)__instance).transform.Find("Music")).GetComponent<AudioSource>().clip = AudioManager.getAudioClip(filename);
	}

	[HarmonyPatch("Update")]
	[HarmonyPrefix]
	private static bool Update(ref ItemDropship __instance)
	{
		object value = Traverse.Create((object)__instance).Field("terminalScript").GetValue();
		terminal = (Terminal)((value is Terminal) ? value : null);
		object value2 = Traverse.Create((object)__instance).Field("playersManager").GetValue();
		playerManager = (StartOfRound)((value2 is StartOfRound) ? value2 : null);
		itemDelivery = Traverse.Create((object)__instance).Field("itemsToDeliver").GetValue() as List<int>;
		if (!((NetworkBehaviour)__instance).IsServer)
		{
			return false;
		}
		if (!__instance.deliveringOrder)
		{
			if (terminal.orderedItemsFromTerminal.Count > 0)
			{
				if (playerManager.shipHasLanded)
				{
					ItemDropship obj = __instance;
					obj.shipTimer += Time.deltaTime;
				}
				if (__instance.playersFirstOrder)
				{
					__instance.playersFirstOrder = false;
					__instance.shipTimer = firstWaitTime;
				}
				if (__instance.shipTimer > (float)normalWaitTime)
				{
					LandShipOnServer(ref __instance);
				}
			}
			return false;
		}
		return true;
	}

	[HarmonyPatch("LandShipOnServer")]
	[HarmonyPrefix]
	private static bool LandShipOnServer(ref ItemDropship __instance)
	{
		__instance.shipTimer = 0f;
		itemDelivery.Clear();
		itemDelivery.AddRange(terminal.orderedItemsFromTerminal);
		terminal.orderedItemsFromTerminal.Clear();
		__instance.playersFirstOrder = false;
		__instance.deliveringOrder = true;
		__instance.LandShipClientRpc();
		return false;
	}
}
[HarmonyPatch(typeof(FlashlightItem))]
internal class FlashlightPatch
{
	private static Light lightbulb;

	private static float initialIntensity;

	private static float intensityMultiplier;

	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	public static void Start(ref FlashlightItem __instance)
	{
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		intensityMultiplier = ConfigManager._flashlightStrength.Value;
		lightbulb = __instance.flashlightBulb;
		initialIntensity = lightbulb.intensity * intensityMultiplier;
		Light obj = lightbulb;
		obj.spotAngle *= 1.1f;
		float num = (float)Random.Range(50, 100) / 100f;
		float num2 = (float)Random.Range(50, 100) / 100f;
		float num3 = (float)Random.Range(50, 100) / 100f;
		lightbulb.color = new Color(num, num2, num3);
		Item itemProperties = ((GrabbableObject)__instance).itemProperties;
		itemProperties.batteryUsage *= 3f;
	}

	[HarmonyPatch("Update")]
	[HarmonyPostfix]
	public static void Update(ref int ___flashlightInterferenceLevel, ref int ___globalFlashlightInterferenceLevel)
	{
		int num = ((___flashlightInterferenceLevel <= ___globalFlashlightInterferenceLevel) ? ___globalFlashlightInterferenceLevel : ___flashlightInterferenceLevel);
		if (num >= 2)
		{
			lightbulb.intensity = 0f;
		}
		else if (num == 1)
		{
			lightbulb.intensity = Random.Range(0f, 200f);
		}
		else
		{
			lightbulb.intensity = initialIntensity;
		}
	}
}
internal class GUIManager
{
	public static Canvas myCanvas;

	public static TextMeshPro CreateText(Vector2 position, string text)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: Unknown result type (might be due to invalid IL or missing references)
		//IL_003b: Unknown result type (might be due to invalid IL or missing references)
		//IL_004e: 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_0017: Unknown result type (might be due to invalid IL or missing references)
		GameObject val = new GameObject();
		if ((Object)(object)myCanvas == (Object)null)
		{
			myCanvas = new GameObject("aio_memeCanvas").AddComponent<Canvas>();
		}
		val.transform.SetParent(((Component)myCanvas).transform);
		TextMeshPro val2 = val.AddComponent<TextMeshPro>();
		((TMP_Text)val2).text = text;
		val.transform.position = Vector2.op_Implicit(position);
		return val2;
	}
}
[HarmonyPatch(typeof(HUDManager))]
internal class HudManagerPatch
{
	private static TextMeshPro shipScrapText;

	[HarmonyPatch("Start")]
	[HarmonyPrefix]
	public static void Start(ref HUDManager __instance)
	{
	}

	[HarmonyPatch("Update")]
	[HarmonyPostfix]
	public static void Update(ref HUDManager __instance)
	{
		int num = calculateShiploot();
		int value = Traverse.Create((object)__instance).Field("totalScrapScannedDisplayNum").GetValue<int>();
		((TMP_Text)__instance.totalValueText).text = $"<size=10>Scan: {value}\nIn ship: {num}</size>";
	}

	private static int calculateShiploot()
	{
		GrabbableObject[] componentsInChildren = GameObject.Find("/Environment/HangarShip").GetComponentsInChildren<GrabbableObject>();
		int num = 0;
		GrabbableObject[] array = componentsInChildren;
		foreach (GrabbableObject val in array)
		{
			if (val.itemProperties.isScrap)
			{
				num += val.scrapValue;
			}
		}
		return num;
	}
}
internal class ItemManager
{
	public static List<Item> allItems = StartOfRound.Instance.allItemsList.itemsList;

	public static Item getItemNew(int id)
	{
		return Object.Instantiate<Item>(allItems[id]);
	}

	public static Item getItem(int id)
	{
		return allItems[id];
	}

	public static GameObject spawnItemID(int id, Vector3 pos)
	{
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		GameObject obj = Object.Instantiate<GameObject>(allItems[id].spawnPrefab, pos, Quaternion.identity, StartOfRound.Instance.propsContainer);
		obj.GetComponent<GrabbableObject>().fallTime = 0f;
		obj.GetComponent<NetworkObject>().Spawn(false);
		return obj;
	}

	public static GameObject spawnItem(Item item, Vector3 pos)
	{
		//IL_0006: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		GameObject obj = Object.Instantiate<GameObject>(item.spawnPrefab, pos, Quaternion.identity, StartOfRound.Instance.propsContainer);
		obj.GetComponent<GrabbableObject>().itemProperties = item;
		obj.GetComponent<NetworkObject>().Spawn(false);
		return obj;
	}
}
internal class JesterPatch
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	public static void Start(ref JesterAI __instance)
	{
		__instance.popGoesTheWeaselTheme = AudioManager.getAudioClip("freebird-0.mp3");
		__instance.popUpSFX = AudioManager.getAudioClip("freebird-1.mp3");
	}
}
[HarmonyPatch(typeof(StartMatchLever))]
internal class LeverPatch
{
	private static bool enableBoomboxSpawner;

	private static bool hasSpawnedBoombox;

	[HarmonyPatch("PullLever")]
	[HarmonyPrefix]
	public static bool PullLever(ref StartMatchLever __instance)
	{
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		int num = Random.Range(1, 19);
		__instance.playersManager.openingHangarDoorAudio = AudioManager.getAudioClip($"weis ({num}).mp3");
		AudioSource shipDoorAudioSource = __instance.playersManager.shipDoorAudioSource;
		shipDoorAudioSource.maxDistance *= 3f;
		AudioSource shipDoorAudioSource2 = __instance.playersManager.shipDoorAudioSource;
		shipDoorAudioSource2.volume *= 1.5f;
		if (__instance.leverHasBeenPulled)
		{
			__instance.StartGame();
			enableBoomboxSpawner = ConfigManager._enableBoomboxSpawner.Value;
			if (enableBoomboxSpawner && !hasSpawnedBoombox)
			{
				GameObject obj = Object.Instantiate<GameObject>(ItemManager.allItems[1].spawnPrefab, ((Component)__instance).transform.position + Vector3.up * 2f, Quaternion.identity, StartOfRound.Instance.propsContainer);
				obj.GetComponent<GrabbableObject>().fallTime = 0f;
				obj.GetComponent<NetworkObject>().Spawn(false);
				hasSpawnedBoombox = true;
			}
		}
		else
		{
			__instance.EndGame();
		}
		return false;
	}

	private static IEnumerator stopPlayerAfter(AudioSource source, float waitFor)
	{
		yield return (object)new WaitForSeconds(waitFor);
		while (source.volume > 0f)
		{
			source.volume -= Time.deltaTime * 0.25f;
		}
		source.Stop();
	}
}
[HarmonyPatch(typeof(Landmine))]
internal class MinePatch
{
	[HarmonyPatch("Start")]
	[HarmonyPrefix]
	public static void Start(ref Landmine __instance)
	{
		__instance.mineDetonate = AudioManager.getRandomClip("discord-notification.mp3", "vine-boom.mp3", "bonk.mp3");
		__instance.mineDetonateFar = __instance.mineDetonate;
		__instance.minePress = AudioManager.getRandomClip("was-zitterstn-so.mp3", "bomb-planted.mp3");
	}
}
[HarmonyPatch(typeof(PlayerControllerB))]
internal class PlayerControllerPatch
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	private static void Start(PlayerControllerB __instance)
	{
		if (ConfigManager._enableInfiniteSprint.Value)
		{
			((Component)__instance.sprintMeterUI).gameObject.SetActive(false);
			__instance.sprintTime = 100f;
		}
	}

	[HarmonyPatch("LateUpdate")]
	[HarmonyPostfix]
	private static void LateUpdate(PlayerControllerB __instance)
	{
		if (ConfigManager._enableInfiniteSprint.Value && __instance.sprintMeter <= 0.5f)
		{
			__instance.sprintMeter = 1f;
		}
	}

	[HarmonyPatch(typeof(PlayerControllerB), "CalculateNormalLookingInput")]
	[HarmonyTranspiler]
	private static IEnumerable<CodeInstruction> CalculateNormalInput(IEnumerable<CodeInstruction> instructions)
	{
		foreach (CodeInstruction instruction in instructions)
		{
			if (instruction.opcode == OpCodes.Ldc_R4 && (float)instruction.operand == 60f)
			{
				instruction.operand = 80f;
				break;
			}
		}
		return instructions;
	}

	[HarmonyPatch(typeof(PlayerControllerB), "CalculateSmoothLookingInput")]
	[HarmonyTranspiler]
	private static IEnumerable<CodeInstruction> CalculateSmoothInput(IEnumerable<CodeInstruction> instructions)
	{
		foreach (CodeInstruction instruction in instructions)
		{
			if (instruction.opcode == OpCodes.Ldc_R4 && (float)instruction.operand == 60f)
			{
				instruction.operand = 80f;
				break;
			}
		}
		return instructions;
	}

	[HarmonyPatch("KillPlayer")]
	[HarmonyPrefix]
	public static void KillPlayer(ref PlayerControllerB __instance)
	{
		//IL_007a: Unknown result type (might be due to invalid IL or missing references)
		string[] array = new string[11]
		{
			"auto-machen-so.mp3", "bigmac.mp3", "das-gibt-ne-6.mp3", "ekg.mp3", "fart.mp3", "harry-potter.mp3", "roblox-death.mp3", "skill-issue.mp3", "snore-mimimi.mp3", "vine-boom.mp3",
			"fortnite-knock.mp3"
		};
		AudioClip audioClip = AudioManager.getAudioClip(array[Random.Range(0, array.Length)]);
		AudioManager.createAudioSource(((Component)__instance).transform.position, null, 50f).PlayOneShot(audioClip);
	}
}
[BepInPlugin("dom3005.aio_memepack", "AIO Memepack", "0.0.5")]
public class MemepackBase : BaseUnityPlugin
{
	private const string mod_id = "dom3005.aio_memepack";

	private const string mod_name = "AIO Memepack";

	private const string mod_version = "0.0.5";

	private readonly Harmony harmony = new Harmony("dom3005.aio_memepack");

	public static MemepackBase instance;

	internal ManualLogSource logger;

	private void Awake()
	{
		instance = this;
		logger = Logger.CreateLogSource("dom3005.aio_memepack");
		logger.LogMessage((object)"Loaded AIO Memepack version 0.0.5!");
		ConfigManager.Init();
		harmony.PatchAll();
	}
}
[HarmonyPatch(typeof(RoundManager))]
internal class RoundManagerPatch
{
}
[HarmonyPatch(typeof(Shovel))]
internal class ShovelPatch
{
	[HarmonyPatch("HitShovel")]
	[HarmonyPostfix]
	private static void HitShovel(ref Shovel __instance)
	{
		AudioClip[] allClips = AudioManager.getAllClips("bonk.mp3", "tf2-bonk.mp3", "discord-notification.mp3");
		RoundManager.PlayRandomClip(__instance.shovelAudio, allClips, true, 1f, 0);
	}
}
[HarmonyPatch(typeof(SandSpiderAI))]
internal class SpiderPatch
{
	[HarmonyPatch("TriggerChaseWithPlayer")]
	[HarmonyPostfix]
	public static void TriggerChase(ref SandSpiderAI __instance)
	{
		((EnemyAI)__instance).creatureSFX.PlayOneShot(AudioManager.getAudioClip("ich-bin-eine-spinne.mp3"));
	}
}
[HarmonyPatch(typeof(StartOfRound))]
internal class StartOfRoundPatch
{
	[HarmonyPatch("playersFiredGameOver")]
	[HarmonyPrefix]
	private static void playersFiredGameOver(ref StartOfRound __instance)
	{
		string[] array = new string[3] { "outro-song.mp3", "subway-surfer-bass-boosted.mp3", "in-hamburg-sagt-man-tschuss.mp3" };
		AudioClip audioClip = AudioManager.getAudioClip(array[Random.Range(0, array.Length)]);
		__instance.alarmSFX = audioClip;
		__instance.firedVoiceSFX = AudioManager.getRandomClip("monte_maybe_next_time.mp3", "traut-euch.mp3", "was-zitterstn-so.mp3");
	}

	[HarmonyPatch("Start")]
	[HarmonyPrefix]
	private static void RegisterScrap()
	{
		Item itemNew = ItemManager.getItemNew(50);
		itemNew.itemName = "Jägermeister";
		itemNew.creditsWorth = 56;
		itemNew.minValue = 100;
		itemNew.maxValue = 100;
		itemNew.grabSFX = AudioManager.getAudioClip("jaegermeister.mp3");
		itemNew.itemId = StartOfRound.Instance.allItemsList.itemsList.Count;
		GameObject val = Utils.loadGameObject("Jaeger.prefab", Utils.loadBundle("jaegermeister"));
		itemNew.spawnPrefab.GetComponent<MeshFilter>().mesh = val.GetComponentInChildren<MeshFilter>().mesh;
		((Renderer)itemNew.spawnPrefab.GetComponent<MeshRenderer>()).materials = ((Renderer)val.GetComponentInChildren<MeshRenderer>()).materials;
		itemNew.spawnPrefab.GetComponent<GrabbableObject>().itemProperties = itemNew;
		((Component)itemNew.spawnPrefab.transform.GetChild(0)).GetComponent<ScanNodeProperties>().headerText = itemNew.itemName;
		Shovel component = ItemManager.getItem(10).spawnPrefab.GetComponent<Shovel>();
		component.shovelHitForce *= 2;
		ItemManager.getItem(20).grabSFX = AudioManager.getAudioClip("michi.mp3");
		ItemManager.getItem(25).spawnPrefab.GetComponent<NoisemakerProp>().noiseSFX = (AudioClip[])(object)new AudioClip[1] { AudioManager.getAudioClip("goofy-ahh.mp3") };
		ItemManager.getItem(25).spawnPrefab.GetComponent<NoisemakerProp>().noiseSFXFar = (AudioClip[])(object)new AudioClip[1] { AudioManager.getAudioClip("goofy-ahh.mp3") };
		ItemManager.getItem(44).grabSFX = AudioManager.getAudioClip("pickle-rick.mp3");
		StartOfRound.Instance.allItemsList.itemsList.Add(itemNew);
		Utils.addItemToAllLevels(itemNew, 100);
	}
}
[HarmonyPatch(typeof(CrawlerAI))]
internal class ThumperPatch
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	public static void Start(ref CrawlerAI __instance)
	{
		__instance.hitWallSFX = AudioManager.getAllClips("pimmelberger.mp3");
		((EnemyAI)__instance).dieSFX = AudioManager.getAudioClip("snore-mimimi.mp3");
		__instance.longRoarSFX = AudioManager.getAllClips("was-zitterstn-so.mp3", "chinese-rap-song.mp3", "bing-bong.mp3");
		__instance.eatPlayerSFX = AudioManager.getAudioClip("number-one-victory-royale.mp3");
		__instance.shortRoar = AudioManager.getAudioClip("skull-guitar.mp3");
		__instance.bitePlayerSFX = AudioManager.getAudioClip("heheheha.mp3");
	}
}
internal class Utils
{
	private static Dictionary<string, AssetBundle> loadedBundles = new Dictionary<string, AssetBundle>();

	public static AssetBundle loadBundle(string bundlename)
	{
		if (loadedBundles.ContainsKey(bundlename))
		{
			return loadedBundles[bundlename];
		}
		string text = Path.Combine(Paths.PluginPath, "AIO Memepack", bundlename);
		if (!File.Exists(text))
		{
			MemepackBase.instance.logger.LogError((object)("Could not find bundle \"" + bundlename + "\""));
			return null;
		}
		MemepackBase.instance.logger.LogInfo((object)text);
		AssetBundle val = AssetBundle.LoadFromFile(text);
		loadedBundles.Add(bundlename, val);
		return val;
	}

	public static GameObject loadGameObject(string filename, AssetBundle bundle)
	{
		return bundle.LoadAsset<GameObject>(filename);
	}

	public static Material loadMaterial(string filename, AssetBundle bundle)
	{
		return bundle.LoadAsset<Material>(filename);
	}

	public static void addItemToAllLevels(Item item, int rarity)
	{
		//IL_0000: Unknown result type (might be due to invalid IL or missing references)
		//IL_0006: Expected O, but got Unknown
		SpawnableItemWithRarity val = new SpawnableItemWithRarity();
		val.rarity = rarity;
		val.spawnableItem = item;
		SelectableLevel[] levels = StartOfRound.Instance.levels;
		for (int i = 0; i < levels.Length; i++)
		{
			levels[i].spawnableScrap.Add(val);
		}
	}

	public static void logComponents(GameObject go)
	{
		Component[] components = go.GetComponents<Component>();
		foreach (Component val in components)
		{
			MemepackBase.instance.logger.LogInfo((object)((object)val).ToString());
		}
	}

	public static void logComponentsRecursively(GameObject go)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		foreach (Transform item in go.transform)
		{
			logComponents(((Component)item).gameObject);
		}
	}

	public static void logChildren(GameObject go)
	{
		//IL_0014: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Expected O, but got Unknown
		foreach (Transform item in go.transform)
		{
			Transform val = item;
			MemepackBase.instance.logger.LogInfo((object)((object)val).ToString());
		}
	}
}
[HarmonyPatch(typeof(EnemyVent))]
internal class VentPatch
{
	[HarmonyPatch("Update")]
	[HarmonyPrefix]
	public static void Update(ref EnemyVent __instance)
	{
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		if (!__instance.occupied && __instance.ventAudio.isPlaying)
		{
			AudioSource obj = AudioManager.createAudioSource(((Component)__instance).transform.position, ((Component)__instance).transform, 10f);
			obj.clip = AudioManager.getAudioClip("trymacs-hier.mp3");
			obj.loop = false;
			obj.Play();
		}
	}
}
[HarmonyPatch(typeof(WalkieTalkie))]
internal class WalkietalkiePatch
{
	[HarmonyPatch("Start")]
	[HarmonyPostfix]
	public static void Start(ref FlashlightItem __instance)
	{
		Item itemProperties = ((GrabbableObject)__instance).itemProperties;
		itemProperties.batteryUsage *= 3f;
	}
}