Decompiled source of KinImmortal v1.0.0

KinImmortal.dll

Decompiled 6 hours ago
using System;
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.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ProjectM;
using ProjectM.Gameplay.Scripting;
using ProjectM.Gameplay.WarEvents;
using ProjectM.Scripting;
using Stunlock.Core;
using Unity.Entities;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("KinImmortal")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("KinImmortal")]
[assembly: AssemblyTitle("KinImmortal")]
[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 KinImmortal
{
	[BepInPlugin("kindred.KinImmortal", "KinImmortal", "1.0.0")]
	public sealed class Plugin : BasePlugin
	{
		private static class MiniBehaviour
		{
			internal static Harmony Harmony { get; set; }

			internal static ManualLogSource LogSource { get; set; }

			internal static void OnLoad()
			{
				//IL_002c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0032: Expected O, but got Unknown
				if (IsVRisingServer())
				{
					Harmony harmony = Harmony;
					if (harmony != null)
					{
						harmony.PatchAll(typeof(MiniBehaviour));
					}
					ManualLogSource logSource = LogSource;
					bool flag = default(bool);
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(9, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loaded [");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0");
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("]");
					}
					logSource.LogInfo(val);
				}
			}

			internal static bool OnUnload()
			{
				return true;
			}

			[HarmonyPatch(typeof(WarEventRegistrySystem), "RegisterWarEventEntities")]
			[HarmonyPostfix]
			private static void Postfix()
			{
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Expected O, but got Unknown
				//IL_0011: Unknown result type (might be due to invalid IL or missing references)
				//IL_0017: Expected O, but got Unknown
				bool flag = default(bool);
				try
				{
					if (TryBreakCurse())
					{
						ManualLogSource logSource = LogSource;
						BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag);
						if (flag)
						{
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Initialized [");
							((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0");
							((BepInExLogInterpolatedStringHandler)val).AppendLiteral("]");
						}
						logSource.LogInfo(val);
					}
				}
				catch (Exception ex)
				{
					ManualLogSource logSource2 = LogSource;
					BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(0, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<Exception>(ex);
					}
					logSource2.LogError(val2);
				}
				finally
				{
					Harmony harmony = Harmony;
					if (harmony != null)
					{
						harmony.UnpatchSelf();
					}
				}
			}
		}

		private static bool TryBreakCurse()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			ServerGameManager serverGameManager = WorldUtility.FindServerWorld(true).GetExistingSystemManaged<ServerScriptMapper>().GetServerGameManager();
			Entity prefabEntity = ((ServerGameManager)(ref serverGameManager)).GetPrefabEntity(new PrefabGUID(-1923843097));
			if (((ServerGameManager)(ref serverGameManager)).HasComponent<ScriptSpawn>(prefabEntity))
			{
				((ServerGameManager)(ref serverGameManager)).RemoveComponent<ScriptSpawn>(prefabEntity);
			}
			if (((ServerGameManager)(ref serverGameManager)).HasComponent<ScriptUpdate>(prefabEntity))
			{
				((ServerGameManager)(ref serverGameManager)).RemoveComponent<ScriptUpdate>(prefabEntity);
			}
			if (((ServerGameManager)(ref serverGameManager)).HasComponent<Script_Dracula_BloodBuff_DataServer>(prefabEntity))
			{
				((ServerGameManager)(ref serverGameManager)).RemoveComponent<Script_Dracula_BloodBuff_DataServer>(prefabEntity);
			}
			return true;
		}

		private static bool IsVRisingServer()
		{
			return Application.productName == "VRisingServer";
		}

		public override void Load()
		{
			MiniBehaviour.OnLoad();
		}

		public override bool Unload()
		{
			return MiniBehaviour.OnUnload();
		}

		public Plugin()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Expected O, but got Unknown
			MiniBehaviour.Harmony = new Harmony("kindred.KinImmortal");
			MiniBehaviour.LogSource = ((BasePlugin)this).Log;
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "kindred.KinImmortal";

		public const string PLUGIN_NAME = "KinImmortal";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}