Decompiled source of QuickPillars v0.1.2

QuickPillars.dll

Decompiled 7 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security.Permissions;
using BepInEx;
using EntityStates;
using EntityStates.Missions.BrotherEncounter;
using EntityStates.Missions.Moon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using RoR2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Prototype
{
	[BepInPlugin("prototype.pillar.adjustments", "QuickPillars", "0.1.2")]
	public class QuickPillars : BaseUnityPlugin
	{
		public const string version = "0.1.2";

		public const string identifier = "prototype.pillar.adjustments";

		private static BuffDef speed;

		protected void Awake()
		{
			Harmony.CreateAndPatchAll(((object)this).GetType(), (string)null);
			SceneCatalog.onMostRecentSceneDefChanged += delegate(SceneDef stage)
			{
				if (stage.cachedName == "moon2")
				{
					speed = Buffs.EnrageAncientWisp;
					speed.iconSprite = Buffs.WhipBoost.iconSprite;
				}
				else
				{
					speed = null;
				}
			};
			CharacterBody.onBodyStartGlobal += delegate(CharacterBody body)
			{
				if (Object.op_Implicit((Object)(object)speed) && body.isPlayerControlled)
				{
					body.AddBuff(speed);
				}
			};
		}

		[HarmonyPatch(typeof(MoonBatteryMissionController), "Awake")]
		[HarmonyPostfix]
		private static void Awake(MoonBatteryMissionController __instance)
		{
			HoldoutZoneController[] batteryHoldoutZones = __instance.batteryHoldoutZones;
			foreach (HoldoutZoneController val in batteryHoldoutZones)
			{
				if (val.dischargeRate > 0f)
				{
					val.dischargeRate = 1.2f / val.baseChargeDuration;
				}
				if (val.baseChargeDuration > 15f)
				{
					val.baseChargeDuration /= 3f;
					val.baseChargeDuration += 5f;
				}
			}
		}

		[HarmonyPatch(typeof(BloodSiphonNearbyController), "Awake")]
		[HarmonyPrefix]
		private static void Awake(BloodSiphonNearbyController __instance)
		{
			__instance.tickRate *= 0.75f;
			__instance.minHealthFractionCoefficient /= 1.25f;
			__instance.maxHealthFractionCoefficient /= 1.25f;
		}

		[HarmonyPatch(typeof(MoonBatteryActive), "OnEnter")]
		[HarmonyPostfix]
		private static void OnEnter(MoonBatteryActive __instance)
		{
			CombatDirector component = ((EntityState)__instance).GetComponent<CombatDirector>();
			component.monsterCredit /= 4f;
			((Behaviour)component).enabled = false;
			__instance.chargeIndicatorController.flashWhenNotCharging = false;
		}

		[HarmonyPatch(typeof(PreEncounter), "OnEnter")]
		[HarmonyPrefix]
		private static void OnEnter()
		{
			foreach (PlayerCharacterMasterController instance2 in PlayerCharacterMasterController.instances)
			{
				if (Object.op_Implicit((Object)(object)instance2.body) && instance2.body.HasBuff(speed))
				{
					instance2.body.RemoveBuff(speed);
				}
			}
			speed = null;
			MoonBatteryMissionController instance = MoonBatteryMissionController.instance;
			if (!Object.op_Implicit((Object)(object)instance))
			{
				return;
			}
			((Behaviour)instance).enabled = false;
			HoldoutZoneController[] batteryHoldoutZones = instance.batteryHoldoutZones;
			foreach (HoldoutZoneController val in batteryHoldoutZones)
			{
				if (((Behaviour)val).enabled)
				{
					val.FullyChargeHoldoutZone();
				}
			}
		}
	}
}