Decompiled source of BossSkins v1.0.1

plugins/BossSkins/BossSkins.dll

Decompiled 4 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 BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Lamb.UI;
using Microsoft.CodeAnalysis;

[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.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: AssemblyCompany("BossSkins")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+e8f79f4ef2de278ca8fc32fd1929320b5c3e8e32")]
[assembly: AssemblyProduct("BossSkins")]
[assembly: AssemblyTitle("BossSkins")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 BossSkins
{
	[BepInPlugin("InfernoDragon0.cotl.BossSkins", "BossSkins", "1.0.1")]
	[HarmonyPatch]
	public class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "InfernoDragon0.cotl.BossSkins";

		public const string PluginName = "BossSkins";

		public const string PluginVer = "1.0.1";

		internal static ManualLogSource Log;

		internal static readonly Harmony Harmony = new Harmony("InfernoDragon0.cotl.BossSkins");

		internal static string PluginPath;

		internal static ConfigEntry<string> extraUnlocks;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			PluginPath = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			extraUnlocks = ((BaseUnityPlugin)this).Config.Bind<string>("BossSkins", "ExtraSkins", "", "Add the codenames for skins you want to select for normal followers as well, separated by commas. Do not use quotation marks. If the skin does not exist, it adds a default deer skin to the selection. EXAMPLE - ExtraSkins = Cat,Dog,Pig");
		}

		private void OnEnable()
		{
			Harmony.PatchAll();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded BossSkins!");
		}

		private void OnDisable()
		{
			Harmony.UnpatchSelf();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Unloaded BossSkins!");
		}
	}
}
namespace BossSkins.Patches
{
	[HarmonyPatch]
	internal class SkinSelectorPatch
	{
		[HarmonyPatch(typeof(UIAppearanceMenuController_Form), "OnShowStarted")]
		[HarmonyPostfix]
		public static void UIAppearanceMenuController_Form_OnShowStarted(UIAppearanceMenuController_Form __instance)
		{
			List<int> list = new List<int>
			{
				WorshipperData._Instance.GetSkinIndexFromName("Boss Death Cat"),
				WorshipperData._Instance.GetSkinIndexFromName("Boss Aym"),
				WorshipperData._Instance.GetSkinIndexFromName("Boss Baal"),
				WorshipperData._Instance.GetSkinIndexFromName("CultLeader 1"),
				WorshipperData._Instance.GetSkinIndexFromName("CultLeader 2"),
				WorshipperData._Instance.GetSkinIndexFromName("CultLeader 3"),
				WorshipperData._Instance.GetSkinIndexFromName("CultLeader 4"),
				WorshipperData._Instance.GetSkinIndexFromName("Sozo"),
				WorshipperData._Instance.GetSkinIndexFromName("CultLeader 1 Healed"),
				WorshipperData._Instance.GetSkinIndexFromName("CultLeader 2 Healed"),
				WorshipperData._Instance.GetSkinIndexFromName("CultLeader 3 Healed"),
				WorshipperData._Instance.GetSkinIndexFromName("CultLeader 4 Healed")
			};
			string[] array = Plugin.extraUnlocks.Value.Split(new char[1] { ',' });
			string[] array2 = array;
			foreach (string text in array2)
			{
				if (string.IsNullOrEmpty(text))
				{
					Plugin.Log.LogInfo((object)"Empty string found in extraUnlocks, skipping.");
					continue;
				}
				Plugin.Log.LogInfo((object)("Adding extra skin: " + text + " to the list."));
				list.Add(WorshipperData._Instance.GetSkinIndexFromName(text));
			}
			List<SkinAndData> list2 = new List<SkinAndData>();
			foreach (int item in list)
			{
				Plugin.Log.LogInfo((object)("BOSS SKIN Enable ID " + item));
				list2.Add(WorshipperData._Instance.Characters[item]);
			}
			__instance._specialEventsHeader.SetActive(true);
			__instance._formItems.AddRange(__instance.Populate(list2, __instance._specialEventsContent, (string[])null));
		}
	}
}