Decompiled source of RedHood BS v1.0.1

RedHoodModel.dll

Decompiled 18 hours ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ModelReplacement;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = "")]
[assembly: AssemblyCompany("RedHoodModel")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RedHoodModel")]
[assembly: AssemblyTitle("RedHoodModel")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace RedHoodModel;

[BepInPlugin("kami_nii.RedHoodModel", "RedHoodModel", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
	internal static ManualLogSource Log;

	public static ConfigEntry<string> SuitNames { get; private set; }

	public static ConfigEntry<bool> EnableForAllSuits { get; private set; }

	private void Awake()
	{
		Log = ((BaseUnityPlugin)this).Logger;
		SuitNames = ((BaseUnityPlugin)this).Config.Bind<string>("Suits", "Suit names", "RedHood", "Comma separated list of suit names that use the Red Hood model. The bundled More Suits suit is named RedHood.");
		EnableForAllSuits = ((BaseUnityPlugin)this).Config.Bind<bool>("Suits", "Replace every suit", false, "If true, every suit uses the Red Hood model (ignores the suit name list).");
		Assets.Load();
		if (EnableForAllSuits.Value)
		{
			ModelReplacementAPI.RegisterModelReplacementOverride(typeof(MRRedHood));
		}
		else
		{
			string[] array = SuitNames.Value.Split(',');
			for (int i = 0; i < array.Length; i++)
			{
				string text = array[i].Trim();
				if (text.Length != 0)
				{
					ModelReplacementAPI.RegisterSuitModelReplacement(text, typeof(MRRedHood));
					Log.LogInfo((object)("Registered Red Hood model for suit '" + text + "'"));
				}
			}
		}
		Log.LogInfo((object)"RedHoodModel 1.0.1 loaded");
	}
}
public static class PluginInfo
{
	public const string GUID = "kami_nii.RedHoodModel";

	public const string NAME = "RedHoodModel";

	public const string VERSION = "1.0.1";
}
public static class Assets
{
	public const string BundleName = "redhoodbundle";

	public static AssetBundle MainAssetBundle;

	public static void Load()
	{
		if ((Object)(object)MainAssetBundle != (Object)null)
		{
			return;
		}
		string text = "RedHoodModel.redhoodbundle";
		using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(text))
		{
			if (stream == null)
			{
				Plugin.Log.LogError((object)("Embedded asset bundle '" + text + "' not found"));
				return;
			}
			MainAssetBundle = AssetBundle.LoadFromStream(stream);
		}
		if ((Object)(object)MainAssetBundle == (Object)null)
		{
			Plugin.Log.LogError((object)"Failed to load the Red Hood asset bundle");
		}
	}
}
public class MRRedHood : BodyReplacementBase
{
	protected override GameObject LoadAssetsAndReturnModel()
	{
		return Assets.MainAssetBundle.LoadAsset<GameObject>("RedHood");
	}
}