Decompiled source of GrannysCompanyRevised v1.1.0

GrannysCompanyRevised.dll

Decompiled 2 years ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GrannysCompanyRevised.Patches;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(/*Could not decode attribute arguments.*/)]
[assembly: AssemblyTitle("GrannysCompanyRevised")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("GrannysCompanyRevised")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: ComVisible(false)]
[assembly: TargetFramework(".NETCore,Version=v5.0", FrameworkDisplayName = ".NET for Windows Universal")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace GrannysCompanyRevised
{
	[BepInPlugin("Lethallethalizer", "GrannysCompanyRevised", "1.1.0.0")]
	public class Grannysbase : BaseUnityPlugin
	{
		private const string modGUID = "Lethallethalizer";

		private const string modName = "GrannysCompanyRevised";

		private const string modVersion = "1.1.0.0";

		private readonly Harmony harmony = new Harmony("Lethallethalizer");

		internal static Grannysbase Instance;

		internal static ManualLogSource mls;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			mls = Logger.CreateLogSource("Lethallethalizer");
			mls.LogInfo((object)"Successfully grannified");
			harmony.PatchAll(typeof(Grannysbase));
			harmony.PatchAll(typeof(RoundManagerPatch));
			harmony.PatchAll(typeof(MobSomethingPatch));
			harmony.PatchAll(typeof(CrawlerPatch));
			harmony.PatchAll(typeof(HoarderBugPatch));
			harmony.PatchAll(typeof(FlowermanPatch));
			harmony.PatchAll(typeof(SandSpiderPatch));
		}
	}
}
namespace GrannysCompanyRevised.Patches
{
	[HarmonyPatch(typeof(CrawlerAI))]
	internal class CrawlerPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void Postfix(ref float ___maxSearchAndRoamRadius, ref float ___BaseAcceleration, ref float ___SpeedAccelerationEffect)
		{
			___maxSearchAndRoamRadius = 200f;
			___BaseAcceleration = 100f;
			___SpeedAccelerationEffect = 7f;
		}
	}
	[HarmonyPatch(typeof(FlowermanAI))]
	internal class FlowermanPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void Postfix(ref float ___velX, ref float ___velZ)
		{
			___velX = 65f;
			___velZ = 65f;
		}
	}
	[HarmonyPatch(typeof(EnemyAI))]
	internal class MobSomethingPatch
	{
		internal static ManualLogSource mls;

		[HarmonyPostfix]
		[HarmonyPatch("Start")]
		private static void Postfix(EnemyAI __instance)
		{
			__instance.enemyType.MaxCount = 6;
			__instance.enemyType.canDie = true;
			__instance.enemyType.doorSpeedMultiplier = 3f;
			__instance.enemyType.PowerLevel = 1;
			__instance.enemyType.canBeStunned = false;
			__instance.enemyType.spawningDisabled = false;
			__instance.enemyHP = 6;
			if (((Object)__instance).name == "DressGirl")
			{
				__instance.enemyType.MaxCount = 2;
				__instance.enemyType.canDie = false;
			}
			if (((Object)__instance).name == "PufferEnemy")
			{
				__instance.enemyType.MaxCount = 2;
				__instance.enemyType.canDie = true;
				__instance.enemyHP = 1;
			}
			if (((Object)__instance).name == "Blob")
			{
				__instance.enemyType.MaxCount = 4;
				__instance.enemyType.canDie = false;
			}
			if (((Object)__instance).name == "SpringMan")
			{
				__instance.enemyType.MaxCount = 3;
				__instance.enemyType.canDie = false;
			}
			if (((Object)__instance).name == "NutcrackerEnemy")
			{
				__instance.enemyType.MaxCount = 4;
			}
			if (((Object)__instance).name == "Flowerman")
			{
				__instance.enemyType.MaxCount = 3;
				__instance.enemyHP = 10;
			}
			if (((Object)__instance).name == "MouthDog")
			{
				__instance.enemyType.MaxCount = 10;
				__instance.enemyHP = 12;
			}
			if (((Object)__instance).name == "ForestGiant")
			{
				__instance.enemyType.MaxCount = 4;
				__instance.enemyType.canDie = false;
			}
			if (((Object)__instance).name == "SandWorm")
			{
				__instance.enemyType.MaxCount = 1;
				__instance.enemyType.canDie = false;
			}
			mls = Logger.CreateLogSource("GrannyshouseIdontwanttosaty");
			mls.LogInfo((object)((Object)__instance).name);
		}
	}
	[HarmonyPatch(typeof(HoarderBugAI))]
	internal class HoarderBugPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void Postfix(ref float ___angryTimer, ref float ___velX, ref float ___velZ)
		{
			___angryTimer = 10f;
			___velX = 50f;
			___velZ = 50f;
		}
	}
	[HarmonyPatch(typeof(SandSpiderAI))]
	internal class SandSpiderPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void Postfix(ref float ___spiderSpeed, ref float ___chaseTimer)
		{
			___spiderSpeed = 4f;
			___chaseTimer = 99f;
		}
	}
	[HarmonyPatch(typeof(RoundManager))]
	internal class RoundManagerPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void Postfix(ref float ___scrapValueMultiplier, ref float ___scrapAmountMultiplier, ref float ___mapSizeMultiplier, ref int ___hourTimeBetweenEnemySpawnBatches)
		{
			___scrapValueMultiplier = 0.8f;
			___scrapAmountMultiplier = 0.45f;
			___hourTimeBetweenEnemySpawnBatches = 1;
		}
	}
}