Decompiled source of LCPaperCompanyMod v1.0.8

LCPaperCompanyMod.dll

Decompiled 5 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using HarmonyLib.Tools;
using Microsoft.CodeAnalysis;
using STSharedAudioLib;
using UnityEngine;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("LCPaperCompanyMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Flatten your friends, perform hammer attacks, add a bunch of sounds, and more in this Paper Mario tribute!")]
[assembly: AssemblyFileVersion("1.0.8.0")]
[assembly: AssemblyInformationalVersion("1.0.8")]
[assembly: AssemblyProduct("LCPaperCompanyMod")]
[assembly: AssemblyTitle("LCPaperCompanyMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.8.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 LCPaperCompanyMod
{
	public class ConfigDisplay
	{
		public static void DisplayConfigs()
		{
			Plugin.Logger.LogInfo((object)"DISPLAYING CONFIG OPTIONS SET TO TRUE...");
			Plugin.Logger.LogInfo((object)"Boombox:");
			if (!Plugin.Config.BoomboxMusic64.Value && !Plugin.Config.BoomboxMusicTTYD.Value && !Plugin.Config.BoomboxMusicSuper.Value && !Plugin.Config.BoomboxMusicSticker.Value && !Plugin.Config.BoomboxMusicColor.Value && !Plugin.Config.BoomboxMusicOrigami.Value)
			{
				Plugin.LoadBoomboxSongs = false;
			}
			if (Plugin.Config.BoomboxAddOrOverwrite.Value && Plugin.LoadBoomboxSongs)
			{
				Plugin.Logger.LogInfo((object)"[Add Or Overwrite]");
			}
			if (Plugin.Config.BoomboxMusic64.Value)
			{
				Plugin.Logger.LogInfo((object)"[PM64]");
			}
			if (Plugin.Config.BoomboxMusicTTYD.Value)
			{
				Plugin.Logger.LogInfo((object)"[The Thousand-Year Door]");
			}
			if (Plugin.Config.BoomboxMusicSuper.Value)
			{
				Plugin.Logger.LogInfo((object)"[Super]");
			}
			if (Plugin.Config.BoomboxMusicSticker.Value)
			{
				Plugin.Logger.LogInfo((object)"[Sticker Star]");
			}
			if (Plugin.Config.BoomboxMusicColor.Value)
			{
				Plugin.Logger.LogInfo((object)"[Color Splash]");
			}
			if (Plugin.Config.BoomboxMusicOrigami.Value)
			{
				Plugin.Logger.LogInfo((object)"[The Origami King]\n");
			}
			Plugin.Logger.LogInfo((object)"Hammer:");
			if (Plugin.Config.HammerModel.Value)
			{
				Plugin.Logger.LogInfo((object)"[Shovel As Hammer]");
			}
			if (Plugin.Config.HammerAttack.Value)
			{
				Plugin.Logger.LogInfo((object)"[Hammer Attack]\n");
			}
			Plugin.Logger.LogInfo((object)"Paper Company:");
			if (Plugin.Config.PaperFlatten.Value)
			{
				Plugin.Logger.LogInfo((object)"[Flat Employees]");
			}
			if (Plugin.Config.PaperCorpses.Value)
			{
				Plugin.Logger.LogInfo((object)"[Flat Corpses]");
			}
			if (Plugin.Config.PaperMusic.Value)
			{
				Plugin.Logger.LogInfo((object)"[Title Screen Music]");
			}
			if (Plugin.Config.PaperLogo.Value)
			{
				Plugin.Logger.LogInfo((object)"[Title Screen Logo]\n");
			}
			Plugin.Logger.LogInfo((object)"Ship:");
			if (Plugin.Config.ShipJumpAudio.Value)
			{
				Plugin.Logger.LogInfo((object)"[Jump Sound Effect]");
			}
			if (Plugin.Config.ShipRecordPlayer.Value)
			{
				Plugin.Logger.LogInfo((object)"[Record Player Music]");
			}
			if (Plugin.Config.ShipPlushieMan.Value)
			{
				Plugin.Logger.LogInfo((object)"[Plushie Sound Effect]");
			}
			if (Plugin.Config.ShipQuotaReached.Value)
			{
				Plugin.Logger.LogInfo((object)"[Quota Reached Sound]");
			}
			if (Plugin.Config.ShipFired.Value)
			{
				Plugin.Logger.LogInfo((object)"[Fired Sound Effect]");
			}
			if (Plugin.Config.ShipTeleporter.Value)
			{
				Plugin.Logger.LogInfo((object)"[Teleport Sound Effect]");
			}
			if (Plugin.Config.ShipTeamDead.Value)
			{
				Plugin.Logger.LogInfo((object)"[Team Dead Sound]");
			}
			if (Plugin.Config.ShipLevelUp.Value)
			{
				Plugin.Logger.LogInfo((object)"[Level Up Sound]");
			}
			if (Plugin.Config.ShipDiscoBall.Value)
			{
				Plugin.Logger.LogInfo((object)"[Disco Ball Music]");
			}
			if (Plugin.Config.ShipInverseTeleporter.Value)
			{
				Plugin.Logger.LogInfo((object)"[Inverse Teleporter Sound]");
			}
			if (Plugin.Config.ShipFishPartner.Value)
			{
				Plugin.Logger.LogInfo((object)"[Fishbowl Friend]");
			}
			if (Plugin.Config.ShipCozyLights.Value)
			{
				Plugin.Logger.LogInfo((object)"[Cozy Lights Music]\n\n\n");
			}
		}
	}
	public class Hammer
	{
		[HarmonyPatch(typeof(Shovel), "HitShovel")]
		public class NewShovelHitPrefix
		{
			[HarmonyPrefix]
			public static void Prefix(Shovel __instance)
			{
				if (!(((Object)((Component)__instance).gameObject).name != "ShovelItem(Clone)") && Plugin.Config.HammerAttack.Value && !((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null) && !((GrabbableObject)__instance).playerHeldBy.isPlayerDead)
				{
					Plugin.Logger.LogDebug((object)$"found hitshovel at hammertimer {Plugin.HammerTimer}");
					if (Plugin.HammerTimer >= HammerTimerMin && Plugin.HammerTimer <= HammerTimerMax)
					{
						__instance.hitSFX[0] = Plugin.HammerAssetBundle.LoadAsset<AudioClip>("Assets/Hammer/SFX/Stylish.ogg");
						__instance.hitSFX[1] = Plugin.HammerAssetBundle.LoadAsset<AudioClip>("Assets/Hammer/SFX/Stylish.ogg");
						__instance.shovelHitForce = 2;
						Plugin.Logger.LogInfo((object)"GREAT!!");
					}
					else
					{
						__instance.hitSFX[0] = Plugin.HammerAssetBundle.LoadAsset<AudioClip>("Assets/Hammer/SFX/PaperMarioHit.ogg");
						__instance.hitSFX[1] = Plugin.HammerAssetBundle.LoadAsset<AudioClip>("Assets/Hammer/SFX/PaperMarioHit.ogg");
						__instance.shovelAudio.Stop();
						__instance.shovelHitForce = 1;
						Plugin.Logger.LogInfo((object)"nice");
					}
				}
			}
		}

		[HarmonyPatch(typeof(Shovel), "ReelUpSFXClientRpc")]
		public class NewShovelReelClients
		{
			[HarmonyPrefix]
			public static void SetReelUpSFX(Shovel __instance)
			{
				if (Plugin.Config.HammerAttack.Value && !(((Object)((Component)__instance).gameObject).name != "ShovelItem(Clone)") && !((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null))
				{
					if ((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)
					{
						__instance.shovelAudio.pitch = 1f;
						__instance.reelUp = Plugin.HammerAssetBundle.LoadAsset<AudioClip>("Assets/Hammer/SFX/ReelUpBeeps.ogg");
					}
					else
					{
						__instance.reelUp = Plugin.OriginalShovelReelSFX;
					}
				}
			}
		}

		[HarmonyPatch(typeof(Shovel), "HitShovelClientRpc")]
		public class NewShovelHitClientRpc
		{
			[HarmonyPrefix]
			public static void SetHitSFXOnOtherClients(Shovel __instance)
			{
				if (Plugin.Config.HammerAttack.Value && !(((Object)((Component)__instance).gameObject).name != "ShovelItem(Clone)") && !((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null) && (Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController)
				{
					__instance.shovelAudio.Stop();
					__instance.hitSFX[0] = Plugin.HammerAssetBundle.LoadAsset<AudioClip>("Assets/Hammer/SFX/PaperMarioHit.ogg");
					__instance.hitSFX[1] = Plugin.HammerAssetBundle.LoadAsset<AudioClip>("Assets/Hammer/SFX/PaperMarioHit.ogg");
				}
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "Update")]
		public class NewStartOfRoundUpdate
		{
			[HarmonyPostfix]
			public static void IncreaseHammerBeeps(StartOfRound __instance)
			{
				if (Plugin.Config.HammerAttack.Value && !((Object)(object)__instance.localPlayerController == (Object)null) && !((Object)(object)__instance.localPlayerController.ItemSlots[__instance.localPlayerController.currentItemSlot] == (Object)null) && !(((Object)__instance.localPlayerController.ItemSlots[__instance.localPlayerController.currentItemSlot]).name != "ShovelItem(Clone)"))
				{
					if (((Component)__instance.localPlayerController.ItemSlots[__instance.localPlayerController.currentItemSlot]).GetComponent<Shovel>().reelingUp)
					{
						Plugin.HammerTimer += 1f * Time.deltaTime;
					}
					else
					{
						Plugin.HammerTimer = 0f;
					}
				}
			}
		}

		public static float HammerTimerMin = 2.05f;

		public static float HammerTimerMax = 2.4f;
	}
	public class HarmonyPatches
	{
		[HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")]
		public class NewPlayerConnectClient
		{
			[HarmonyPostfix]
			public static void LoadedPlayers()
			{
				if (Plugin.Config.PaperFlatten.Value)
				{
					Plugin.Flatten();
				}
				if (Plugin.Config.HammerModel.Value)
				{
					Plugin.SetHammerTerminalKeyword();
				}
			}
		}

		[HarmonyPatch(typeof(HUDManager), "Awake")]
		public class NewHUDManagerAwake
		{
			[HarmonyPostfix]
			public static void ApplyHUDSongsAndSFX(HUDManager __instance)
			{
				if (Plugin.Config.ShipQuotaReached.Value)
				{
					__instance.reachedQuotaSFX = Plugin.ShipAssetBundle.LoadAsset<AudioClip>("Assets/ShipSounds/BattleWonTTYD.ogg");
				}
				if (Plugin.Config.ShipLevelUp.Value)
				{
					__instance.levelIncreaseSFX = Plugin.ShipAssetBundle.LoadAsset<AudioClip>("Assets/ShipSounds/LevelUp.ogg");
				}
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		public class NewStartOfRoundAwake
		{
			[HarmonyPostfix]
			public static void ApplyStartOfRoundSongsAndSFX(StartOfRound __instance)
			{
				if (Plugin.Config.ShipJumpAudio.Value)
				{
					__instance.playerJumpSFX = Plugin.ShipAssetBundle.LoadAsset<AudioClip>("Assets/ShipSounds/JumpAudioModern.ogg");
				}
				if (Plugin.Config.ShipTeamDead.Value)
				{
					__instance.allPlayersDeadAudio = Plugin.ShipAssetBundle.LoadAsset<AudioClip>("Assets/ShipSounds/MiniGameOver.ogg");
				}
				if (Plugin.Config.ShipFired.Value)
				{
					__instance.suckedIntoSpaceSFX = Plugin.ShipAssetBundle.LoadAsset<AudioClip>("Assets/ShipSounds/GameOver.ogg");
				}
				if (Plugin.Config.HammerAttack.Value || Plugin.Config.HammerModel.Value)
				{
					foreach (Item items in __instance.allItemsList.itemsList)
					{
						if (((Object)items).name == "Shovel")
						{
							if (Plugin.Config.HammerAttack.Value)
							{
								Shovel component = items.spawnPrefab.GetComponent<Shovel>();
								Plugin.OriginalShovelReelSFX = component.reelUp;
								component.hitSFX[0] = Plugin.HammerAssetBundle.LoadAsset<AudioClip>("Assets/Hammer/SFX/PaperMarioHit.ogg");
								component.hitSFX[1] = Plugin.HammerAssetBundle.LoadAsset<AudioClip>("Assets/Hammer/SFX/PaperMarioHit.ogg");
								component.reelUp = Plugin.HammerAssetBundle.LoadAsset<AudioClip>("Assets/Hammer/SFX/ReelUpBeeps.ogg");
								component.swing = Plugin.HammerAssetBundle.LoadAsset<AudioClip>("Assets/Hammer/SFX/PaperMarioSwing.ogg");
								Plugin.Logger.LogDebug((object)"set shovel sounds on awake");
							}
							if (Plugin.Config.HammerModel.Value)
							{
								((Vector3)(ref items.restingRotation)).Set(-10f, -90f, 0f);
								items.verticalOffset = 0.05f;
								items.itemName = "Hammer";
								items.toolTips[0] = "Swing hammer: [LMB]";
								items.itemIcon = Plugin.HammerAssetBundle.LoadAsset<Sprite>("Assets/Hammer/Model/Hammer_PMTOK_icon.png");
								items.grabSFX = Plugin.HammerAssetBundle.LoadAsset<AudioClip>("Assets/Hammer/Model/HammerGrab.ogg");
								items.dropSFX = Plugin.HammerAssetBundle.LoadAsset<AudioClip>("Assets/Hammer/Model/HammerDrop.ogg");
								items.pocketSFX = Plugin.HammerAssetBundle.LoadAsset<AudioClip>("Assets/Hammer/Model/HammerPocket.ogg");
								Plugin.Logger.LogDebug((object)"set shovel itemdata on awake");
							}
						}
					}
				}
				if (!Plugin.Config.ShipInverseTeleporter.Value && !Plugin.Config.ShipTeleporter.Value && !Plugin.Config.ShipPlushieMan.Value && !Plugin.Config.ShipCozyLights.Value && !Plugin.Config.ShipDiscoBall.Value && !Plugin.Config.ShipRecordPlayer.Value)
				{
					return;
				}
				foreach (UnlockableItem unlockable in __instance.unlockablesList.unlockables)
				{
					if (unlockable.unlockableName == "Inverse Teleporter")
					{
						if (Plugin.Config.ShipInverseTeleporter.Value)
						{
							unlockable.prefabObject.GetComponent<ShipTeleporter>().teleporterSpinSFX = Plugin.ShipAssetBundle.LoadAsset<AudioClip>("Assets/ShipSounds/MagnifyingGlass.ogg");
						}
						if (Plugin.Config.ShipTeleporter.Value)
						{
							unlockable.prefabObject.GetComponent<ShipTeleporter>().teleporterBeamUpSFX = Plugin.ShipAssetBundle.LoadAsset<AudioClip>("Assets/ShipSounds/PipeExit.ogg");
						}
					}
					if (Plugin.Config.ShipTeleporter.Value && unlockable.unlockableName == "Teleporter")
					{
						unlockable.prefabObject.GetComponent<ShipTeleporter>().teleporterBeamUpSFX = Plugin.ShipAssetBundle.LoadAsset<AudioClip>("Assets/ShipSounds/PipeEnter.ogg");
					}
					if (Plugin.Config.ShipPlushieMan.Value && unlockable.unlockableName == "Plushie pajama man")
					{
						if (Plugin.LCSimonTendoPlaylistsModCompatabile)
						{
							Plugin.AddSharedAudio(unlockable.unlockableName, unlockable.prefabObject);
						}
						else
						{
							((Component)unlockable.prefabObject.transform.GetChild(2)).GetComponent<AnimatedObjectTrigger>().boolFalseAudios[0] = Plugin.ShipAssetBundle.LoadAsset<AudioClip>("Assets/ShipSounds/Lucky.ogg");
							((Component)unlockable.prefabObject.transform.GetChild(1)).GetComponent<PlaceableShipObject>().placeObjectSFX = Plugin.ShipAssetBundle.LoadAsset<AudioClip>("Assets/ShipSounds/Lucky.ogg");
						}
					}
					if (unlockable.unlockableName == "Disco Ball")
					{
						if (Plugin.Config.ShipDiscoBall.Value)
						{
							if (Plugin.LCSimonTendoPlaylistsModCompatabile)
							{
								Plugin.AddSharedAudio(unlockable.unlockableName, unlockable.prefabObject);
							}
							else
							{
								((Component)unlockable.prefabObject.transform.GetChild(0)).GetComponent<CozyLights>().turnOnAudio.clip = Plugin.ShipAssetBundle.LoadAsset<AudioClip>("Assets/ShipSounds/BooNightFever.ogg");
							}
						}
						if (Plugin.Config.ShipCozyLights.Value)
						{
							Plugin.DiscoBallUnlockableID = unlockable.shopSelectionNode.shipUnlockableID;
						}
					}
					if (unlockable.unlockableName == "Record player" && Plugin.Config.ShipRecordPlayer.Value)
					{
						if (Plugin.LCSimonTendoPlaylistsModCompatabile)
						{
							Plugin.AddSharedAudio(unlockable.unlockableName, unlockable.prefabObject);
						}
						else
						{
							((Component)unlockable.prefabObject.transform.GetChild(3)).GetComponent<AnimatedObjectTrigger>().playWhileTrue = Plugin.ShipAssetBundle.LoadAsset<AudioClip>("Assets/ShipSounds/BooMansionRecordPlayer.ogg");
						}
					}
				}
			}
		}

		[HarmonyPatch(typeof(BoomboxItem), "Start")]
		public class NewBoomboxStart
		{
			[HarmonyPostfix]
			public static void SetBoomboxMusic(BoomboxItem __instance)
			{
				if (Plugin.LoadBoomboxSongs)
				{
					Plugin.SetBoombox(__instance);
				}
			}
		}

		[HarmonyPatch(typeof(DeadBodyInfo), "Start")]
		public class NewDeadBodyStart
		{
			[HarmonyPostfix]
			public static void FlattenCorpse(DeadBodyInfo __instance)
			{
				//IL_0012: Unknown result type (might be due to invalid IL or missing references)
				//IL_003a: Unknown result type (might be due to invalid IL or missing references)
				if (Plugin.Config.PaperCorpses.Value)
				{
					Vector3 localScale = default(Vector3);
					((Vector3)(ref localScale)).Set(1.1216f, 1.1216f, 0.1f);
					((Component)__instance).gameObject.transform.localScale = localScale;
					Plugin.Logger.LogDebug((object)("flattened " + ((Object)((Component)__instance).gameObject).name + "!"));
				}
			}
		}

		[HarmonyPatch(typeof(StartOfRound), "openingDoorsSequence")]
		public class NewStartOfRoundOpeningDoors
		{
			[HarmonyPostfix]
			public static void Postfix()
			{
				if (Plugin.Config.PaperFlatten.Value)
				{
					Plugin.Flatten();
				}
			}
		}
	}
	[BepInPlugin("LCPaperCompanyMod", "LCPaperCompanyMod", "1.0.8")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		public class Config
		{
			public static ConfigEntry<bool> PaperFlatten;

			public static ConfigEntry<bool> PaperCorpses;

			public static ConfigEntry<bool> PaperMusic;

			public static ConfigEntry<bool> PaperLogo;

			public static ConfigEntry<bool> HammerModel;

			public static ConfigEntry<bool> HammerAttack;

			public static ConfigEntry<bool> BoomboxAddOrOverwrite;

			public static ConfigEntry<bool> BoomboxMusic64;

			public static ConfigEntry<bool> BoomboxMusicTTYD;

			public static ConfigEntry<bool> BoomboxMusicSuper;

			public static ConfigEntry<bool> BoomboxMusicSticker;

			public static ConfigEntry<bool> BoomboxMusicColor;

			public static ConfigEntry<bool> BoomboxMusicOrigami;

			public static ConfigEntry<bool> ShipJumpAudio;

			public static ConfigEntry<bool> ShipRecordPlayer;

			public static ConfigEntry<bool> ShipPlushieMan;

			public static ConfigEntry<bool> ShipQuotaReached;

			public static ConfigEntry<bool> ShipFired;

			public static ConfigEntry<bool> ShipTeamDead;

			public static ConfigEntry<bool> ShipLevelUp;

			public static ConfigEntry<bool> ShipDiscoBall;

			public static ConfigEntry<bool> ShipInverseTeleporter;

			public static ConfigEntry<bool> ShipCozyLights;

			public static ConfigEntry<bool> ShipFishPartner;

			public static ConfigEntry<bool> ShipTeleporter;

			public Config(ConfigFile cfg)
			{
				BoomboxAddOrOverwrite = cfg.Bind<bool>("Boombox", "Add Or Overwrite", true, "Set this to true if you want the boombox to get the new music on top of all the other music, or to false if you only want GOOD music!");
				BoomboxMusic64 = cfg.Bind<bool>("Boombox", "PM64", true, "Hey so I found this album, it's *really* dusty and it sounds suuuuper old. But it says there's '64 times the quality', so it's probably a golden classic?");
				BoomboxMusicTTYD = cfg.Bind<bool>("Boombox", "The Thousand-Year Door", true, "I've heard so many good things about this music, so it must be, like, the most amazing thing on the planet, I can't wait!");
				BoomboxMusicSuper = cfg.Bind<bool>("Boombox", "Super", true, "When I went to grab this CD it turned into a sphere and then back into a CD and I'm scared...");
				BoomboxMusicSticker = cfg.Bind<bool>("Boombox", "Sticker Star", true, "Man, I don't know who threw this into the trash can, because this soundtrack's got some pretty good songs in it.");
				BoomboxMusicColor = cfg.Bind<bool>("Boombox", "Color Splash", true, "Wait is it 'Color' or 'Colour'?");
				BoomboxMusicOrigami = cfg.Bind<bool>("Boombox", "The Origami King", true, "DUDE!!! You won't believe how good the songs I found on this playlist are!! Like, there were so many good ones, I had trouble picking only a few to take with me!");
				HammerModel = cfg.Bind<bool>("Hammer", "Shovel As Hammer", true, "Didn't I put my shovel here? Why is there a hammer all of a sudden?? Who took my shovel???");
				HammerAttack = cfg.Bind<bool>("Hammer", "Hammer Attack", true, "Okay, so, just like that walking chestnut told us: Reel up power, then let go with the right timing for double damage!");
				PaperFlatten = cfg.Bind<bool>("Paper Company", "Flat Employees", true, "Choose if you want everyone else to get a nice and shiny (and certainly not painful) two-dimensional new look!");
				PaperCorpses = cfg.Bind<bool>("Paper Company", "Flat Corpses", true, "I've heard ~ghooooooost~ stories that sometimes, in death, you get a third dimension... Honestly, it... keeps me up at night... *(shudder)*");
				PaperMusic = cfg.Bind<bool>("Paper Company", "Title Screen Music", true, "Makes the title screen play your favorite songs(*1).\n(*1: favoritism not included)");
				PaperLogo = cfg.Bind<bool>("Paper Company", "Title Screen Logo", true, "Slap a new, more colorful logo over that bland old title screen. Just watch out for that shifty tape...");
				ShipJumpAudio = cfg.Bind<bool>("Ship", "Jump Sound Effect", true, "Why only *look* like paper if you can *sound* like it too?? With every jump, you play the authentic papery sounds tha- wait, paper doesn't make sound...");
				ShipRecordPlayer = cfg.Bind<bool>("Ship", "Record Player Music", true, "Some catchy tunes for the ship's record player. Ghosts love it!");
				ShipPlushieMan = cfg.Bind<bool>("Ship", "Plushie Sound Effect", true, "Heehee, don't tell anyone, but I put a little speaker in that pajama man plushie so it plays a different sound, teeheehee...");
				ShipQuotaReached = cfg.Bind<bool>("Ship", "Quota Reached Sound", true, "Get this victorious jingle every time you reach quota. Because, be honest, it's impossible to not be happy when hearing this.");
				ShipFired = cfg.Bind<bool>("Ship", "Fired Sound Effect", true, "Blegh. Getting fired. Hate getting fired. Hopefully this sound will make it, like, less painful.");
				ShipTeleporter = cfg.Bind<bool>("Ship", "Teleport Sound Effect", true, "I heard the Teleporters use something called 'quantum entanglement', but I don't buy it... It probably just uses some sort of tunnel system, is my guess.");
				ShipTeamDead = cfg.Bind<bool>("Ship", "Team Dead Sound", true, "Wait, you all DIED?! Man, that's just messed up... Anyways, this might be a good little jingle to suit the mood.");
				ShipLevelUp = cfg.Bind<bool>("Ship", "Level Up Sound", true, "Wow, employee, you rock! Seeing you level up fills me with a certain nostalgia that sounds like ta-dada-daaaa tada-dada-dadaa DA!!");
				ShipDiscoBall = cfg.Bind<bool>("Ship", "Disco Ball Music", true, "Oh! Yeah! Groovy... Who said disco is dead when this song is alive and kicking? Huh, what do you mean 'this was written by the dead'?!");
				ShipInverseTeleporter = cfg.Bind<bool>("Ship", "Inverse Teleporter Sound", true, "Inverse teleporting into the facility is so exhilirating! It just... it's just, like... you know... like jazz! You know...?");
				ShipFishPartner = cfg.Bind<bool>("Ship", "Fishbowl Friend", true, "Ewww, that thing must be all soggy... Though I'm amazed at its resilience. It must be great with kids.");
				ShipCozyLights = cfg.Bind<bool>("Ship", "Cozy Lights Music", true, "Ahhhhhh... Nothing better than kicking back with a nice cup of joe after a long day of adventuring...");
			}
		}

		public static Plugin instance;

		internal static ManualLogSource Logger;

		public static string sAssemblyLocation = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

		public static AssetBundle PaperAssetBundle;

		public static AssetBundle HammerAssetBundle;

		public static AssetBundle Boombox64AssetBundle;

		public static AssetBundle BoomboxTTYDAssetBundle;

		public static AssetBundle BoomboxSuperAssetBundle;

		public static AssetBundle BoomboxStickerAssetBundle;

		public static AssetBundle BoomboxColorAssetBundle;

		public static AssetBundle BoomboxOrigamiAssetBundle;

		public static AssetBundle ShipAssetBundle;

		public static bool LoadBoomboxSongs = true;

		public static List<AudioClip> AllBoomboxSongs = new List<AudioClip>();

		public static float HammerTimer;

		public static int DiscoBallUnlockableID;

		public static AudioClip OriginalShovelReelSFX;

		public static bool LCSimonTendoPlaylistsModCompatabile = false;

		public static Config MyConfig { get; internal set; }

		private void Awake()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			instance = this;
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"Plugin LCPaperCompanyMod is loaded!\n\n\n");
			Harmony val = new Harmony("LCPaperCompanyMod");
			val.PatchAll();
			HarmonyFileLog.Enabled = false;
			MyConfig = new Config(((BaseUnityPlugin)this).Config);
			ConfigDisplay.DisplayConfigs();
			LoadAssetBundles();
			if (Config.ShipDiscoBall.Value || Config.ShipRecordPlayer.Value || Config.ShipPlushieMan.Value)
			{
				LCSimonTendoPlaylistsModCompatabile = CheckForPlugin("LCSimonTendoPlaylistsMod");
			}
		}

		public static bool CheckForPlugin(string pluginName, bool printDebug = true)
		{
			foreach (PluginInfo value in Chainloader.PluginInfos.Values)
			{
				if (value.Metadata.Name == pluginName)
				{
					if (printDebug)
					{
						Logger.LogDebug((object)("Successfully found " + pluginName));
					}
					return true;
				}
			}
			if (printDebug)
			{
				Logger.LogDebug((object)("Failed to find " + pluginName));
			}
			return false;
		}

		public static void LoadAssetBundles()
		{
			Logger.LogInfo((object)"DISPLAYING SUCCESSFULLY LOADED ASSETBUNDLES...");
			if (LoadBoomboxSongs)
			{
				if (Config.BoomboxMusic64.Value)
				{
					Boombox64AssetBundle = AssetBundle.LoadFromFile(Path.Combine(sAssemblyLocation, "boombox64assetbundle"));
					if ((Object)(object)Boombox64AssetBundle == (Object)null)
					{
						Logger.LogError((object)"Failed to load Boombox64 AssetBundle");
					}
					else
					{
						AllBoomboxSongs.AddRange(Boombox64AssetBundle.LoadAllAssets<AudioClip>());
						Logger.LogInfo((object)"Boombox64 AssetBundle");
					}
				}
				if (Config.BoomboxMusicTTYD.Value)
				{
					BoomboxTTYDAssetBundle = AssetBundle.LoadFromFile(Path.Combine(sAssemblyLocation, "boomboxttydassetbundle"));
					if ((Object)(object)BoomboxTTYDAssetBundle == (Object)null)
					{
						Logger.LogError((object)"Failed to load BoomboxTTYD AssetBundle");
					}
					else
					{
						AllBoomboxSongs.AddRange(BoomboxTTYDAssetBundle.LoadAllAssets<AudioClip>());
						Logger.LogInfo((object)"BoomboxTTYD AssetBundle");
					}
				}
				if (Config.BoomboxMusicSuper.Value)
				{
					BoomboxSuperAssetBundle = AssetBundle.LoadFromFile(Path.Combine(sAssemblyLocation, "boomboxsuperassetbundle"));
					if ((Object)(object)BoomboxSuperAssetBundle == (Object)null)
					{
						Logger.LogError((object)"Failed to load BoomboxSuper AssetBundle");
					}
					else
					{
						AllBoomboxSongs.AddRange(BoomboxSuperAssetBundle.LoadAllAssets<AudioClip>());
						Logger.LogInfo((object)"BoomboxSuper AssetBundle");
					}
				}
				if (Config.BoomboxMusicSticker.Value)
				{
					BoomboxStickerAssetBundle = AssetBundle.LoadFromFile(Path.Combine(sAssemblyLocation, "boomboxstickerassetbundle"));
					if ((Object)(object)BoomboxStickerAssetBundle == (Object)null)
					{
						Logger.LogError((object)"Failed to load BoomboxSticker AssetBundle");
					}
					else
					{
						AllBoomboxSongs.AddRange(BoomboxStickerAssetBundle.LoadAllAssets<AudioClip>());
						Logger.LogInfo((object)"BoomboxSticker AssetBundle");
					}
				}
				if (Config.BoomboxMusicColor.Value)
				{
					BoomboxColorAssetBundle = AssetBundle.LoadFromFile(Path.Combine(sAssemblyLocation, "boomboxcolorassetbundle"));
					if ((Object)(object)BoomboxColorAssetBundle == (Object)null)
					{
						Logger.LogError((object)"Failed to load BoomboxColor AssetBundle");
					}
					else
					{
						AllBoomboxSongs.AddRange(BoomboxColorAssetBundle.LoadAllAssets<AudioClip>());
						Logger.LogInfo((object)"BoomboxColor AssetBundle");
					}
				}
				if (Config.BoomboxMusicOrigami.Value)
				{
					BoomboxOrigamiAssetBundle = AssetBundle.LoadFromFile(Path.Combine(sAssemblyLocation, "boomboxorigamiassetbundle"));
					if ((Object)(object)BoomboxOrigamiAssetBundle == (Object)null)
					{
						Logger.LogError((object)"Failed to load BoomboxOrigami AssetBundle");
					}
					else
					{
						AllBoomboxSongs.AddRange(BoomboxOrigamiAssetBundle.LoadAllAssets<AudioClip>());
						Logger.LogInfo((object)"BoomboxOrigami AssetBundle");
					}
				}
			}
			if (Config.HammerAttack.Value || Config.HammerModel.Value)
			{
				HammerAssetBundle = AssetBundle.LoadFromFile(Path.Combine(sAssemblyLocation, "hammerassetbundle"));
				if ((Object)(object)HammerAssetBundle == (Object)null)
				{
					Logger.LogError((object)"Failed to load Hammer AssetBundle");
				}
				else
				{
					Logger.LogInfo((object)"Hammer AssetBundle");
				}
			}
			if (Config.PaperLogo.Value || Config.PaperMusic.Value)
			{
				PaperAssetBundle = AssetBundle.LoadFromFile(Path.Combine(sAssemblyLocation, "paperassetbundle"));
				if ((Object)(object)PaperAssetBundle == (Object)null)
				{
					Logger.LogError((object)"Failed to load Paper AssetBundle");
				}
				else
				{
					Logger.LogInfo((object)"Paper AssetBundle");
				}
			}
			if (Config.ShipCozyLights.Value || Config.ShipDiscoBall.Value || Config.ShipFired.Value || Config.ShipJumpAudio.Value || Config.ShipLevelUp.Value || Config.ShipPlushieMan.Value || Config.ShipQuotaReached.Value || Config.ShipRecordPlayer.Value || Config.ShipTeamDead.Value || Config.ShipTeleporter.Value || Config.ShipInverseTeleporter.Value || Config.ShipFishPartner.Value)
			{
				ShipAssetBundle = AssetBundle.LoadFromFile(Path.Combine(sAssemblyLocation, "shipassetbundle"));
				if ((Object)(object)ShipAssetBundle == (Object)null)
				{
					Logger.LogError((object)"Failed to load Ship AssetBundle");
				}
				else
				{
					Logger.LogInfo((object)"Ship AssetBundle\n\n\n");
				}
			}
		}

		public static void Flatten()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB[] array = Object.FindObjectsOfType<PlayerControllerB>();
			PlayerControllerB[] array2 = array;
			foreach (PlayerControllerB val in array2)
			{
				if (!((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController))
				{
					Vector3 localScale = default(Vector3);
					((Vector3)(ref localScale)).Set(0.03f, 2f, 2f);
					((Component)val).gameObject.transform.GetChild(0).localScale = localScale;
					Logger.LogDebug((object)("flattened " + ((Object)val).name + "!"));
				}
			}
		}

		public static void SetHammerTerminalKeyword()
		{
			Terminal val = Object.FindObjectOfType<Terminal>();
			TerminalKeyword val2 = null;
			bool flag = false;
			bool flag2 = false;
			TerminalKeyword[] allKeywords = val.terminalNodes.allKeywords;
			foreach (TerminalKeyword val3 in allKeywords)
			{
				if (((Object)val3).name == "Shovel")
				{
					val3.word = "hammer";
					flag = true;
					continue;
				}
				if (((Object)val3).name == "Buy")
				{
					val2 = val3;
					flag2 = true;
				}
				if (flag && flag2)
				{
					break;
				}
			}
			if ((Object)(object)val2 == (Object)null)
			{
				return;
			}
			TerminalNode val4 = null;
			CompatibleNoun[] compatibleNouns = val2.compatibleNouns;
			foreach (CompatibleNoun val5 in compatibleNouns)
			{
				if (((Object)val5.noun).name == "Shovel")
				{
					val4 = val5.result;
					break;
				}
			}
			if (!((Object)(object)val4 == (Object)null))
			{
				val4.displayText = "You have requested to order hammers. Amount: [variableAmount].\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\n\n";
				val4.terminalOptions[0].result.displayText = "Ordered [variableAmount] hammers. Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\n\n";
			}
		}

		public static void SetBoombox(BoomboxItem __instance)
		{
			if (Config.BoomboxAddOrOverwrite.Value)
			{
				List<AudioClip> list = __instance.musicAudios.ToList();
				list.AddRange(AllBoomboxSongs);
				__instance.musicAudios = list.ToArray();
			}
			else
			{
				__instance.musicAudios = AllBoomboxSongs.ToArray();
			}
			__instance.musicRandomizer = new Random(GetRandomSeed());
		}

		public static int GetRandomSeed()
		{
			int num = Random.Range(0, 10);
			int num2 = Random.Range(0, 10);
			int num3 = Random.Range(0, 10);
			int num4 = Random.Range(0, 10);
			int num5 = Random.Range(0, 10);
			string s = num.ToString() + num2 + num3 + num4 + num5;
			return int.Parse(s);
		}

		public static void AddSharedAudio(string oName, GameObject gObject)
		{
			switch (oName)
			{
			case "Disco Ball":
				SharedAudioMethods.AudioClipAddNew(ShipAssetBundle.LoadAsset<AudioClip>("Assets/ShipSounds/BooNightFever.ogg"), SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod", gObject, false, true), true, 100, false);
				break;
			case "Record player":
				SharedAudioMethods.AudioClipAddNew(ShipAssetBundle.LoadAsset<AudioClip>("Assets/ShipSounds/BooMansionRecordPlayer.ogg"), SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod", gObject, false, true), true, 100, false);
				break;
			case "Plushie pajama man":
				SharedAudioMethods.AudioClipAddNew(ShipAssetBundle.LoadAsset<AudioClip>("Assets/ShipSounds/Lucky.ogg"), SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod", gObject, false, true), true, 64, false);
				break;
			}
		}
	}
	public class RuntimePatches
	{
		[HarmonyPatch(typeof(AutoParentToShip), "Awake")]
		public class NewAutoParentToShipAwake
		{
			[HarmonyPostfix]
			public static void AddChildrenToInpersistentObjects(AutoParentToShip __instance)
			{
				if (((Object)((Component)__instance).gameObject).name == "FishBowlContainer(Clone)" && Plugin.Config.ShipFishPartner.Value)
				{
					GameObject val = Plugin.ShipAssetBundle.LoadAsset<GameObject>("Assets/ShipSounds/Goldfish/Sushie.prefab");
					Object.Instantiate<GameObject>(val, ((Component)__instance).gameObject.transform.GetChild(1).GetChild(0).GetChild(0), false);
					((Component)((Component)__instance).gameObject.transform.GetChild(1).GetChild(0).GetChild(0)).GetComponent<MeshFilter>().mesh = null;
				}
				if (((Object)((Component)__instance).gameObject).name == "ShipCozyLights(Clone)" && Plugin.Config.ShipCozyLights.Value)
				{
					GameObject val2 = Plugin.ShipAssetBundle.LoadAsset<GameObject>("Assets/ShipSounds/CozyLights/CaféMusicAudio.prefab");
					Object.Instantiate<GameObject>(val2, ((Component)__instance).gameObject.transform, false);
					((Component)__instance).gameObject.GetComponent<CozyLights>().turnOnAudio = ((Component)((Component)__instance).gameObject.transform.GetChild(2)).GetComponent<AudioSource>();
				}
			}
		}

		[HarmonyPatch(typeof(CozyLights), "SetAudio")]
		public class NewCozyLightsSetAudio
		{
			[HarmonyPrefix]
			public static bool StopCozyLightsMusicDuringDisco(CozyLights __instance, bool ___cozyLightsOn)
			{
				if (((Object)((Component)__instance).gameObject).name == "ShipCozyLights(Clone)" && Plugin.Config.ShipCozyLights.Value)
				{
					__instance.soundInterval = 2f;
					if ((___cozyLightsOn && StartOfRound.Instance.unlockablesList.unlockables[Plugin.DiscoBallUnlockableID].hasBeenUnlockedByPlayer && !StartOfRound.Instance.unlockablesList.unlockables[Plugin.DiscoBallUnlockableID].inStorage) || (!___cozyLightsOn && __instance.turnOnAudio.isPlaying))
					{
						__instance.turnOnAudio.Stop();
						return false;
					}
				}
				return true;
			}
		}

		[HarmonyPatch(typeof(GrabbableObject), "Start")]
		public class NewGrabbableObjectStart
		{
			[HarmonyPostfix]
			public static void SetShovelModelToHammer(GrabbableObject __instance)
			{
				if (Plugin.Config.HammerModel.Value && ((Object)((Component)__instance).gameObject).name == "ShovelItem(Clone)")
				{
					GameObject val = Plugin.HammerAssetBundle.LoadAsset<GameObject>("Assets/Hammer/Model/PaperMarioHammer.prefab");
					Object.Instantiate<GameObject>(val, ((Component)__instance).gameObject.transform.GetChild(0), false);
					((Component)((Component)__instance).gameObject.transform.GetChild(0)).gameObject.GetComponent<MeshFilter>().mesh = null;
					Plugin.Logger.LogDebug((object)("set hammer model on " + ((Object)((Component)__instance).gameObject).name));
				}
			}
		}
	}
	public class TitleScreen
	{
		[HarmonyPatch(typeof(MenuManager), "Start")]
		public class NewMenuManagerStart
		{
			[HarmonyPostfix]
			public static void LoadMenuMusicAndLogo(MenuManager __instance)
			{
				if (!Plugin.Config.PaperLogo.Value && !Plugin.Config.PaperMusic.Value)
				{
					return;
				}
				int num = Random.Range(0, 100);
				int num2 = 40;
				int num3 = num2 + 20;
				int num4 = num3 + 15;
				int num5 = num4 + 15;
				int num6 = num5 + 5;
				int num7 = num6 + 5;
				Plugin.Logger.LogDebug((object)$"MenuManager.Start; Rolled RandomNr {num}");
				if (Plugin.Config.PaperMusic.Value)
				{
					if (num >= 0 && num <= num2)
					{
						__instance.menuMusic = Plugin.PaperAssetBundle.LoadAsset<AudioClip>("Assets/PaperCompanyTitle/Songs/Title TTYD.ogg");
					}
					else if (num > num2 && num <= num3)
					{
						__instance.menuMusic = Plugin.PaperAssetBundle.LoadAsset<AudioClip>("Assets/PaperCompanyTitle/Songs/Title Origami.ogg");
					}
					else if (num > num3 && num <= num4)
					{
						__instance.menuMusic = Plugin.PaperAssetBundle.LoadAsset<AudioClip>("Assets/PaperCompanyTitle/Songs/Title 64.ogg");
					}
					else if (num > num4 && num <= num5)
					{
						__instance.menuMusic = Plugin.PaperAssetBundle.LoadAsset<AudioClip>("Assets/PaperCompanyTitle/Songs/Title Super.ogg");
					}
					else if (num > num5 && num <= num6)
					{
						__instance.menuMusic = Plugin.PaperAssetBundle.LoadAsset<AudioClip>("Assets/PaperCompanyTitle/Songs/Title Color.ogg");
					}
					else if (num > num6 && num < num7)
					{
						__instance.menuMusic = Plugin.PaperAssetBundle.LoadAsset<AudioClip>("Assets/PaperCompanyTitle/Songs/Title Sticker.ogg");
					}
					else
					{
						__instance.menuMusic = Plugin.PaperAssetBundle.LoadAsset<AudioClip>("Assets/PaperCompanyTitle/Songs/Title TTYD.ogg");
					}
				}
				if (!Plugin.Config.PaperLogo.Value)
				{
					return;
				}
				GameObject val = GameObject.Find("HeaderImage");
				if ((Object)(object)val == (Object)null)
				{
					return;
				}
				GameObject val2 = Object.Instantiate<GameObject>(val, val.transform.parent, false);
				((Object)val2).name = "LCPaperCompanyMod";
				Image component = val2.GetComponent<Image>();
				if ((Object)(object)component == (Object)null)
				{
					return;
				}
				if (num >= 0 && num <= num2)
				{
					if (((Object)((Graphic)val.GetComponent<Image>()).mainTexture).name == "LogoTextV1")
					{
						component.sprite = Plugin.PaperAssetBundle.LoadAsset<Sprite>("Assets/PaperCompanyTitle/Logos/PaperCompanyLogoTTYD.png");
					}
					else
					{
						component.sprite = Plugin.PaperAssetBundle.LoadAsset<Sprite>("Assets/PaperCompanyTitle/Logos/PaperCompanyLogoTTYDAlt.png");
					}
				}
				else if (num > num2 && num <= num3)
				{
					component.sprite = Plugin.PaperAssetBundle.LoadAsset<Sprite>("Assets/PaperCompanyTitle/Logos/PaperCompanyLogoOrigami.png");
				}
				else if (num > num3 && num <= num4)
				{
					component.sprite = Plugin.PaperAssetBundle.LoadAsset<Sprite>("Assets/PaperCompanyTitle/Logos/PaperCompanyLogo64.png");
				}
				else if (num > num4 && num <= num5)
				{
					component.sprite = Plugin.PaperAssetBundle.LoadAsset<Sprite>("Assets/PaperCompanyTitle/Logos/PaperCompanyLogoSuper.png");
				}
				else if (num > num5 && num <= num6)
				{
					component.sprite = Plugin.PaperAssetBundle.LoadAsset<Sprite>("Assets/PaperCompanyTitle/Logos/PaperCompanyLogoColor.png");
				}
				else if (num > num6 && num <= num7)
				{
					component.sprite = Plugin.PaperAssetBundle.LoadAsset<Sprite>("Assets/PaperCompanyTitle/Logos/PaperCompanyLogoSticker.png");
				}
				else
				{
					component.sprite = Plugin.PaperAssetBundle.LoadAsset<Sprite>("Assets/PaperCompanyTitle/Logos/PaperCompanyLogoTTYD.png");
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LCPaperCompanyMod";

		public const string PLUGIN_NAME = "LCPaperCompanyMod";

		public const string PLUGIN_VERSION = "1.0.8";
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}