Decompiled source of NostalgiaCriticRabbidModels v0.1.0

Rabbids.dll

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

[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("Rabbids")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Rabbids")]
[assembly: AssemblyTitle("Rabbids")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace ModelReplacement
{
	public class MRRABBIDNEUTRAL : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "rabbidNeutral";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}

		protected override void OnDamageTaken(bool dead)
		{
			((BodyReplacementBase)this).OnDamageTaken(dead);
			AudioClip randomAudio = Assets.audioClip.GetRandomAudio(StartOfRound.Instance.randomMapSeed);
			((BodyReplacementBase)this).controller.movementAudio.PlayOneShot(randomAudio, 0.8f);
		}

		protected override void OnDeath()
		{
			((BodyReplacementBase)this).OnDeath();
			AudioClip deathAudio = Assets.audioClip.GetDeathAudio();
			((BodyReplacementBase)this).controller.movementAudio.PlayOneShot(deathAudio, 1f);
		}
	}
	public class MRNOSTALGARABBID : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "nostalgaRabbid";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}

		protected override void OnDamageTaken(bool dead)
		{
			((BodyReplacementBase)this).OnDamageTaken(dead);
			AudioClip randomAudio = Assets.audioClip.GetRandomAudio(StartOfRound.Instance.randomMapSeed);
			((BodyReplacementBase)this).controller.movementAudio.PlayOneShot(randomAudio, 0.8f);
		}

		protected override void OnDeath()
		{
			((BodyReplacementBase)this).OnDeath();
			AudioClip deathAudio = Assets.audioClip.GetDeathAudio();
			((BodyReplacementBase)this).controller.movementAudio.PlayOneShot(deathAudio, 1f);
		}
	}
	public class MRSILLYRABBID : BodyReplacementBase
	{
		protected override GameObject LoadAssetsAndReturnModel()
		{
			string text = "sillyRabbid";
			return Assets.MainAssetBundle.LoadAsset<GameObject>(text);
		}

		protected override void OnDamageTaken(bool dead)
		{
			((BodyReplacementBase)this).OnDamageTaken(dead);
			AudioClip randomAudio = Assets.audioClip.GetRandomAudio(StartOfRound.Instance.randomMapSeed);
			((BodyReplacementBase)this).controller.movementAudio.PlayOneShot(randomAudio, 0.8f);
		}
	}
	[BepInPlugin("com.Drunger.RabbidsModel", "Nostalgia Critic Rabbid Models", "0.1.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class Plugin : BaseUnityPlugin
	{
		private void Awake()
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			Assets.PopulateAssets();
			ModelReplacementAPI.RegisterSuitModelReplacement("Rabbid", typeof(MRRABBIDNEUTRAL));
			ModelReplacementAPI.RegisterSuitModelReplacement("Nostalgia Rabbid", typeof(MRNOSTALGARABBID));
			ModelReplacementAPI.RegisterSuitModelReplacement("Dumb Rabbid", typeof(MRSILLYRABBID));
			Harmony val = new Harmony("com.Drunger.RabbidsModel");
			val.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin com.Drunger.RabbidsModel is loaded!");
		}
	}
	public static class Assets
	{
		public class RandomAudioClip
		{
			private List<AudioClip> audioClipList = new List<AudioClip>();

			public AudioClip GetRandomAudio(int seed)
			{
				return audioClipList[0];
			}

			public void AddAudio(string name)
			{
				//IL_0009: Unknown result type (might be due to invalid IL or missing references)
				//IL_0014: Expected O, but got Unknown
				AudioClip audioClipFromName = GetAudioClipFromName(name);
				if ((Object)audioClipFromName != (Object)null)
				{
					audioClipList.Add(audioClipFromName);
				}
				else
				{
					Console.WriteLine("clip " + name + " null");
				}
			}

			public AudioClip GetDeathAudio()
			{
				return audioClipList[1];
			}
		}

		public static string mainAssetBundleName = "rabbidsbundle";

		public static AssetBundle MainAssetBundle = null;

		public static RandomAudioClip audioClip = new RandomAudioClip();

		private static string GetAssemblyName()
		{
			return Assembly.GetExecutingAssembly().GetName().Name.Replace(" ", "_");
		}

		public static void PopulateAssets()
		{
			if ((Object)(object)MainAssetBundle == (Object)null)
			{
				Console.WriteLine(GetAssemblyName() + "." + mainAssetBundleName);
				using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName))
				{
					MainAssetBundle = AssetBundle.LoadFromStream(stream);
				}
				audioClip.AddAudio("bwah1");
				audioClip.AddAudio("bwahBoom");
			}
		}

		public static AudioClip GetAudioClipFromName(string name)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Expected O, but got Unknown
			Object val = MainAssetBundle.LoadAsset(name);
			return (AudioClip)((val is AudioClip) ? val : null);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}