Decompiled source of VivaLaMurder v1.0.9

viva la murder.dll

Decompiled 4 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using FishNet;
using FishNet.Connection;
using FishNet.Managing.Server;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[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.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("murderminemurder, murderminer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("liberate the murder wizards")]
[assembly: AssemblyFileVersion("1.0.8.0")]
[assembly: AssemblyInformationalVersion("1.0.8")]
[assembly: AssemblyProduct("liberatethemurderwizards")]
[assembly: AssemblyTitle("liberate the murder wizards (we lovem urder)")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.8.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 vivadehmurder
{
	[BepInPlugin("murderminemurderer.vivalamurder", "vivalamurder", "1.0.8")]
	[BepInProcess("MageArena.exe")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class liberatethemurderwizards : BaseUnityPlugin
	{
		public static ManualLogSource Logger;

		public static bool debug = false;

		public const string guid = "murderminemurderer.vivalamurder";

		public static string modsync = "client";

		private void Awake()
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"viva la murder loaded");
			if (Chainloader.PluginInfos.ContainsKey("com.magearena.modsync") || Chainloader.PluginInfos.ContainsKey("murderminemurderer.castlespawn"))
			{
				configman.dotheconfig(((BaseUnityPlugin)this).Config);
				new Harmony("murderminemurderer.vivalamurder").PatchAll();
			}
			else
			{
				Logger.LogFatal((object)"retard!!! u 'need' modsync or castlespanw");
			}
		}
	}
	public static class configman
	{
		public static ConfigEntry<float> respawntime;

		public static ConfigEntry<bool> soupmen;

		public static ConfigEntry<bool> prefer_stabbing;

		public static ConfigEntry<float> graceperiod;

		public static ConfigEntry<float> speed;

		public static ConfigEntry<float> slowspeed;

		public static ConfigEntry<float> fireballcd;

		public static ConfigEntry<int> fireballamnt;

		public static void dotheconfig(ConfigFile config)
		{
			string text = "ExtinctionWizards";
			graceperiod = config.Bind<float>(text, "graceperiod", 290f, (ConfigDescription)null);
			speed = config.Bind<float>(text, "speed", 20f, (ConfigDescription)null);
			slowspeed = config.Bind<float>(text, "slowspeed", 5.4f, "speed while fireball is on cooldown");
			respawntime = config.Bind<float>(text, "respawntime", 55f, "how fast ExtinctionWizards respawn");
			fireballcd = config.Bind<float>(text, "fireballcd", 17.5f, (ConfigDescription)null);
			fireballamnt = config.Bind<int>(text, "fireballamnt", 2, "how many fireballs to shoot (will shoot +1 of whatever u put)");
			prefer_stabbing = config.Bind<bool>(text, "prefer_stabbing", true, "prefer stabbing people regardless of distance");
			soupmen = config.Bind<bool>(text, "soup_men_drop", false, (ConfigDescription)null);
		}
	}
	[HarmonyPatch(typeof(DungeonGenerator))]
	public class murdercult
	{
		public static float lobstarttime;

		[HarmonyPatch("GenerateMap")]
		[HarmonyPatch("GenerateSmallMap")]
		[HarmonyPrefix]
		private static void anthologyofthekiller()
		{
			lobstarttime = Time.time;
			liberatethemurderwizards.Logger.LogInfo((object)lobstarttime);
		}
	}
	[HarmonyPatch(typeof(ShadowWizardAI))]
	public class murdermine
	{
		public static ServerManager servman;

		public static List<GameObject> souparray = new List<GameObject>();

		public static GameObject cryreact;

		public static GameObject ijustwannahavefunfunfun;

		public static FieldInfo concretetremor = typeof(Serverchecksiguess).GetField("numberOfSoupsCreated", BindingFlags.Instance | BindingFlags.Public);

		public static Serverchecksiguess cryingmyselfariverwahwah;

		[HarmonyPostfix]
		[HarmonyPatch("DoAiInterval")]
		private static void vivadamurder(ref ShadowWizardAI __instance)
		{
			__instance.isCastleDefender = false;
			__instance.inited = true;
			if ((Object)(object)__instance.navAgent != (Object)null && murdercult.lobstarttime != 0f && Time.time - murdercult.lobstarttime > configman.graceperiod.Value)
			{
				float num = (float)typeof(ShadowWizardAI).GetField("fireBallCdTimer", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(__instance);
				__instance.navAgent.speed = ((num == 0f || Time.time - num > configman.fireballcd.Value) ? configman.speed.Value : configman.slowspeed.Value);
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(Serverchecksiguess), "Awake")]
		private static void superpositionbetweenfuckedand(ref Serverchecksiguess __instance)
		{
			cryingmyselfariverwahwah = __instance;
		}

		[HarmonyPrefix]
		[HarmonyPatch("ShootFireball")]
		private static void murderballmurdercult(ref ShadowWizardAI __instance, ref Vector3 target)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			Type typeFromHandle = typeof(ShadowWizardAI);
			MethodInfo method = typeFromHandle.GetMethod("ShootFireballServer", BindingFlags.Instance | BindingFlags.NonPublic);
			for (int i = 1; i < configman.fireballamnt.Value; i++)
			{
				method.Invoke(__instance, new object[2] { target, false });
			}
		}

		[HarmonyPatch("DoAiInterval")]
		[HarmonyTranspiler]
		private static IEnumerable<CodeInstruction> fleshofthekiller(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			if (configman.prefer_stabbing.Value)
			{
				for (int i = 1071; i <= 1079; i++)
				{
					list[i].opcode = OpCodes.Nop;
				}
			}
			return list.AsEnumerable();
		}

		[HarmonyTranspiler]
		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		public static IEnumerable<CodeInstruction> samsaramurdercult(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			bool flag = false;
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i] != null && liberatethemurderwizards.debug)
				{
					liberatethemurderwizards.Logger.LogInfo((object)(i + " op: " + list[i].opcode.Name + ": " + list[i].operand));
				}
				if (list[i].opcode == OpCodes.Ldc_R4 && list[i + 1] != null && list[i + 1].opcode == OpCodes.Newobj)
				{
					list[i].operand = configman.respawntime.Value;
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				liberatethemurderwizards.Logger.LogWarning((object)"not found find me find me find me find me find me find me find me");
			}
			return list.AsEnumerable();
		}

		private static void spawnat(GameObject orig, Vector3 pos, Vector3 scale = default(Vector3))
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: 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_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: 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)
			GameObject val = Object.Instantiate<GameObject>(orig);
			val.transform.position = pos;
			if (scale != default(Vector3))
			{
				val.transform.localScale = scale;
			}
			servman.Spawn(val, (NetworkConnection)null, default(Scene));
		}

		private static void findsoup()
		{
			GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
			GameObject[] array2 = array;
			foreach (GameObject val in array2)
			{
				if (((Object)val).name.Contains("Soup") && (configman.soupmen.Value || !((Object)val).name.Contains("Man")))
				{
					souparray.Add(val);
				}
				else if (((Object)val).name.Contains("CrystalREactorr") && !Object.op_Implicit((Object)(object)cryreact))
				{
					cryreact = val;
				}
				else if (((Object)val).name.Contains("RitualDagger") && !Object.op_Implicit((Object)(object)ijustwannahavefunfunfun))
				{
					ijustwannahavefunfunfun = val;
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch("ServerDeathRobes")]
		public static void riskreward_theory_proposed_to_trick_the_mind_of_retards_easily_influenced(Vector3 pos)
		{
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
			servman = InstanceFinder.ServerManager;
			if (!InstanceFinder.IsHostStarted)
			{
				return;
			}
			if (souparray.Count < 1)
			{
				findsoup();
			}
			if (souparray.Count <= 1)
			{
				return;
			}
			Vector3 pos2 = pos + new Vector3(0f, 1.5f, 0f);
			Vector3 scale = default(Vector3);
			((Vector3)(ref scale))..ctor(1.6f, 1.6f, 1.6f);
			if (Random.RandomRangeInt(0, 4) != 3)
			{
				GameObject val = souparray[Random.RandomRangeInt(0, souparray.Count)];
				concretetremor.SetValue(cryingmyselfariverwahwah, (int)concretetremor.GetValue(cryingmyselfariverwahwah) + 1);
				spawnat(val, pos2, scale);
				if (!((Object)val).name.ToLower().Contains("logs") && !((Object)val).name.Contains("Man"))
				{
					concretetremor.SetValue(cryingmyselfariverwahwah, (int)concretetremor.GetValue(cryingmyselfariverwahwah) + 1);
					Serverchecksiguess obj = cryingmyselfariverwahwah;
					obj.numberOfSoupsCreated++;
					spawnat(val, pos2);
				}
				return;
			}
			int num = Random.RandomRangeInt(1, 3);
			while (true)
			{
				int num2 = Random.RandomRangeInt(1, 3);
				int num3 = num2;
				if (num3 == 1 && (Object)(object)cryreact != (Object)null)
				{
					spawnat(cryreact, pos2);
					return;
				}
				int num4 = num3;
				if (num4 == 2 && (Object)(object)ijustwannahavefunfunfun != (Object)null)
				{
					break;
				}
				num = ((num == 2) ? 1 : 2);
			}
			spawnat(ijustwannahavefunfunfun, pos2, new Vector3(1.3f, 1.3f, 1.3f));
		}

		[HarmonyTranspiler]
		[HarmonyPatch("DoAiInterval")]
		public static IEnumerable<CodeInstruction> samsaramurdercult(IEnumerable<CodeInstruction> instructions)
		{
			bool flag = false;
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i] != null && liberatethemurderwizards.debug)
				{
					liberatethemurderwizards.Logger.LogInfo((object)(i + " op: " + list[i].opcode.Name + ": " + list[i].operand));
				}
				if (list[i].opcode == OpCodes.Ldc_R4 && (float)list[i].operand == 10f && list[i + 1] != null && list[i - 1].opcode == OpCodes.Sub && list[i + 12] != null && list[i + 12].opcode == OpCodes.Ldc_R4 && (float)list[i + 12].operand == 50f)
				{
					list[i].operand = configman.fireballcd.Value;
					flag = true;
					break;
				}
			}
			if (!flag)
			{
				liberatethemurderwizards.Logger.LogWarning((object)"not found find me find me find me find me find me find me find me");
			}
			return list.AsEnumerable();
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "viva la murder";

		public const string PLUGIN_NAME = "liberatethemurderwizards";

		public const string PLUGIN_VERSION = "1.0.8";
	}
}