Decompiled source of MoreBosses Reloaded v0.1.2

plugins/MoreBosses-Reloaded.dll

Decompiled a month ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Microsoft.CodeAnalysis;
using Microsoft.Extensions.Configuration;
using TrainworksReloaded.Core;
using TrainworksReloaded.Core.Extensions;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("MoreBosses-Reloaded")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("0.1.2.0")]
[assembly: AssemblyInformationalVersion("0.1.2+76703e6bada03f1e839339450b27343d33ca0781")]
[assembly: AssemblyProduct("MoreBosses-Reloaded")]
[assembly: AssemblyTitle("MoreBosses-Reloaded")]
[assembly: AssemblyVersion("0.1.2.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.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;
		}
	}
	[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 MoreBossesReloaded.Plugin
{
	public struct ScenarioSet
	{
		public string Scenario;

		public string Boss;

		public List<string> Enemies;

		public string Sins;

		public readonly void CollectReferencedFiles(ICollection<string> referencedFiles)
		{
			if (Scenario != null)
			{
				referencedFiles.Add(Scenario);
			}
			if (Boss != null)
			{
				referencedFiles.Add(Boss);
			}
			if (Sins != null)
			{
				referencedFiles.Add(Sins);
			}
			foreach (string enemy in Enemies)
			{
				referencedFiles.Add(enemy);
			}
		}
	}
	internal class ConfigDescriptionBuilder
	{
		public string English { get; set; } = "";


		public string French { get; set; } = "";


		public string German { get; set; } = "";


		public string Russian { get; set; } = "";


		public string Portuguese { get; set; } = "";


		public string Chinese { get; set; } = "";


		public string Spanish { get; set; } = "";


		public string ChineseTraditional { get; set; } = "";


		public string Korean { get; set; } = "";


		public string Japanese { get; set; } = "";


		public override string ToString()
		{
			StringBuilder stringBuilder = new StringBuilder();
			if (!string.IsNullOrEmpty(English))
			{
				stringBuilder.AppendLine(English);
			}
			if (!string.IsNullOrEmpty(French))
			{
				stringBuilder.AppendLine(French);
			}
			if (!string.IsNullOrEmpty(German))
			{
				stringBuilder.AppendLine(German);
			}
			if (!string.IsNullOrEmpty(Russian))
			{
				stringBuilder.AppendLine(Russian);
			}
			if (!string.IsNullOrEmpty(Portuguese))
			{
				stringBuilder.AppendLine(Portuguese);
			}
			if (!string.IsNullOrEmpty(Chinese))
			{
				stringBuilder.AppendLine(Chinese);
			}
			if (!string.IsNullOrEmpty(Spanish))
			{
				stringBuilder.AppendLine(Spanish);
			}
			if (!string.IsNullOrEmpty(ChineseTraditional))
			{
				stringBuilder.AppendLine(ChineseTraditional);
			}
			if (!string.IsNullOrEmpty(Korean))
			{
				stringBuilder.AppendLine(Korean);
			}
			if (!string.IsNullOrEmpty(Japanese))
			{
				stringBuilder.AppendLine(Japanese);
			}
			return stringBuilder.ToString().TrimEnd();
		}
	}
	[BepInPlugin("MoreBosses-Reloaded", "MoreBosses-Reloaded", "0.1.2")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource Logger = new ManualLogSource("MoreBosses-Reloaded");

		private ConfigEntry<bool>? ArkionSoulCrusher;

		public List<ScenarioSet> Scenarios = new List<ScenarioSet>();

		public void Awake()
		{
			Logger = ((BaseUnityPlugin)this).Logger;
			GatherConfig();
			GatherScenarios();
			List<string> files = new List<string>();
			foreach (ScenarioSet scenario in Scenarios)
			{
				scenario.CollectReferencedFiles(files);
			}
			Railhead.GetBuilder().Configure("MoreBosses-Reloaded", (Action<IConfigurationBuilder>)delegate(IConfigurationBuilder c)
			{
				ConfigurationExtensions.AddMergedJsonFile(c, files);
			});
			Logger.LogInfo((object)"Plugin MoreBosses-Reloaded is loaded!");
		}

		public void GatherConfig()
		{
			ArkionSoulCrusher = ((BaseUnityPlugin)this).Config.Bind<bool>("Scenarios", "Enable Arkion Soul Crusher", true, new ConfigDescriptionBuilder
			{
				English = "Enable Arkion Soul Crusher Scenario (Slay: Apply Dazed 1 to your units).",
				Chinese = "启用阿尔基翁的灵魂粉碎者形态(杀戮时对你的单位施加眩晕 1)。"
			}.ToString());
		}

		public void GatherScenarios()
		{
			if (ArkionSoulCrusher.Value)
			{
				Scenarios.Add(new ScenarioSet
				{
					Scenario = "json/scenarios/ArkionSoulCrusher.json",
					Boss = "json/bosses/ArkionSoulCrusher.json",
					Enemies = new List<string>(1) { "json/enemies/ChosenChampion.json" },
					Sins = "json/sins/SoulCrusher.json"
				});
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "MoreBosses-Reloaded";

		public const string PLUGIN_NAME = "MoreBosses-Reloaded";

		public const string PLUGIN_VERSION = "0.1.2";
	}
}