Decompiled source of Boss Level Changer v1.0.1

Boss_Level_Changer.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Microsoft.CodeAnalysis;
using P2.Talk;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Boss_Level_Changer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Boss Level Changer")]
[assembly: AssemblyTitle("Boss_Level_Changer")]
[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 Boss_Level_Changer
{
	[BepInPlugin("com.melonthug.bosslevelchanger", "Boss Level Changer", "1.0.0")]
	public class Plugin : BasePlugin
	{
		public static Plugin Instance;

		public static ManualLogSource Logger;

		public static readonly Dictionary<string, ConfigEntry<int>> BossLevels = new Dictionary<string, ConfigEntry<int>>();

		public static readonly Dictionary<string, int> RealToInternal = new Dictionary<string, int>
		{
			{ "Dodonga", 451 },
			{ "Majidonga", 452 },
			{ "Kacchindonga", 473 },
			{ "Zaknel", 453 },
			{ "Dokaknel", 454 },
			{ "Dogaeen", 456 },
			{ "Cioking", 458 },
			{ "Shookle", 459 },
			{ "Garuru", 462 },
			{ "Mochichichi", 463 },
			{ "Fenicchi", 464 },
			{ "Manboth", 465 },
			{ "Manboroth", 466 },
			{ "Centura", 467 },
			{ "Darantula", 468 },
			{ "Kanogias", 469 },
			{ "Ganodias", 470 },
			{ "Dettankarmen", 471 },
			{ "Zuttankarmen", 472 }
		};

		public override void Load()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Expected O, but got Unknown
			foreach (string key in RealToInternal.Keys)
			{
				BossLevels[key] = ((BasePlugin)this).Config.Bind<int>("Level", key, -1, key + " level");
			}
			Logger = ((BasePlugin)this).Log;
			Harmony val = new Harmony("com.melonthug.bosslevelchanger");
			val.PatchAll();
			Instance = this;
			Logger.LogInfo((object)"[Boss Level Changer] loaded");
		}
	}
	[HarmonyPatch(typeof(GlobalData), "CopyForm")]
	internal class CopyFormHook
	{
		private static void Prefix(ref GlobalData data)
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			((BasePlugin)Plugin.Instance).Config.Reload();
			Il2CppStructArray<int> integerBuffer = data.integerBuffer;
			bool flag = default(bool);
			foreach (string key in Plugin.RealToInternal.Keys)
			{
				Plugin.BossLevels.TryGetValue(key, out var value);
				if (value != null && value.Value > -1)
				{
					Plugin.RealToInternal.TryGetValue(key, out var value2);
					int num = ((Il2CppArrayBase<int>)(object)integerBuffer)[value2];
					((Il2CppArrayBase<int>)(object)integerBuffer)[value2] = value.Value;
					Plugin.BossLevels[key].Value = -1;
					ManualLogSource logger = Plugin.Logger;
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 3, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Changed ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(key);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'s level from ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" -> ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(((Il2CppArrayBase<int>)(object)integerBuffer)[value2]);
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ");
					}
					logger.LogInfo(val);
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "Boss_Level_Changer";

		public const string PLUGIN_NAME = "Boss Level Changer";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}