Decompiled source of Piggys Reanimation v1.0.0

PiggysReanimation.dll

Decompiled 8 months ago
using System;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PiggysAnimation.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("RadiationIsCool")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RadiationIsCool")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8ee335db-0cbe-470c-8fbc-69263f01b35a")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[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 PiggysAnimation
{
	[BepInPlugin("Piggy.PiggysAnimation", "PiggysAnimation", "0.0.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string modGUID = "Piggy.PiggysAnimation";

		private const string modName = "PiggysAnimation";

		private const string modVersion = "0.0.1";

		private readonly Harmony harmony = new Harmony("Piggy.PiggysAnimation");

		private static Plugin Instance;

		public static ManualLogSource mls;

		public static AssetBundle Bundle;

		public static bool enableSkinWalkers;

		public static bool useTerminal;

		public static bool useTerminalCredit;

		public static bool maskedShipDeparture;

		public static GameObject jesterInteraction;

		public static RuntimeAnimatorController endgameStats;

		public static RuntimeAnimatorController ingamePlayerHUD;

		public static RuntimeAnimatorController profitQuota;

		public static RuntimeAnimatorController rewardsScreen;

		public static RuntimeAnimatorController scrapItemInfo;

		public static string PluginDirectory;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			PluginDirectory = ((BaseUnityPlugin)this).Info.Location;
			LoadAssets();
			mls = Logger.CreateLogSource("Piggy.PiggysAnimation");
			mls.LogInfo((object)"Piggy's animation is loaded");
			harmony.PatchAll(typeof(Plugin));
			harmony.PatchAll(typeof(StartOfRoundPatch));
		}

		private void LoadAssets()
		{
			try
			{
				Bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(PluginDirectory), "reanimationpack"));
			}
			catch (Exception ex)
			{
				mls.LogError((object)("Couldn't load asset bundle: " + ex.Message));
				return;
			}
			try
			{
				endgameStats = Bundle.LoadAsset<RuntimeAnimatorController>("RE_EndgameStats.controller");
				ingamePlayerHUD = Bundle.LoadAsset<RuntimeAnimatorController>("RE_IngamePlayerHUD.controller");
				profitQuota = Bundle.LoadAsset<RuntimeAnimatorController>("RE_ProfitQuota.controller");
				rewardsScreen = Bundle.LoadAsset<RuntimeAnimatorController>("RE_RewardsScreen.controller");
				scrapItemInfo = Bundle.LoadAsset<RuntimeAnimatorController>("RE_ScrapItemInfo.controller");
				((BaseUnityPlugin)this).Logger.LogInfo((object)"Successfully loaded assets!");
			}
			catch (Exception ex2)
			{
				((BaseUnityPlugin)this).Logger.LogError((object)("Couldn't load assets: " + ex2.Message));
			}
		}
	}
}
namespace PiggysAnimation.Patches
{
	[HarmonyPatch(typeof(StartOfRound))]
	internal class StartOfRoundPatch
	{
		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Start_PreFix()
		{
			GameObject.Find("EndgameStats").GetComponent<Animator>().runtimeAnimatorController = Plugin.endgameStats;
			GameObject.Find("ProfitQuota").GetComponent<Animator>().runtimeAnimatorController = Plugin.profitQuota;
		}
	}
}