Decompiled source of ClassicVoidFields v0.1.2

ClassicVoidFields.dll

Decompiled 2 weeks 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.Missions.Arena.NullWard;
using HarmonyLib;
using RoR2;
using UnityEngine;
using UnityEngine.Networking;

[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")]
namespace Prototype;

[BepInPlugin("prototype.arena.classic", "ClassicVoidFields", "0.1.2")]
public class ClassicVoidFields : BaseUnityPlugin
{
	public const string identifier = "prototype.arena.classic";

	public const string version = "0.1.2";

	private static bool timerEnabled;

	private void Awake()
	{
		Harmony instance = null;
		SceneCatalog.onMostRecentSceneDefChanged += delegate(SceneDef stage)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			Harmony obj = instance;
			if (obj != null)
			{
				obj.UnpatchSelf();
			}
			if (NetworkServer.active && stage.baseSceneName == "arena")
			{
				stage.sceneType = (SceneType)2;
				instance = Harmony.CreateAndPatchAll(((object)this).GetType(), (string)null);
			}
		};
	}

	[HarmonyPatch(typeof(SceneDirector), "PopulateScene")]
	[HarmonyPrefix]
	private static void AdjustInteractableCredit(SceneDirector __instance)
	{
		__instance.interactableCredit = 0;
	}

	[HarmonyPatch(typeof(FogDamageController), "Start")]
	[HarmonyPrefix]
	private static void IncreaseDamageOverTime(FogDamageController __instance)
	{
		if (Version.TryParse(RoR2Application.GetBuildId(), out Version result) && result < new Version(1, 3, 7))
		{
			__instance.healthFractionPerSecond = 0.01f;
			__instance.healthFractionRampCoefficientPerSecond = 0.1f;
		}
		else
		{
			__instance.healthFractionPerSecond /= 1.25f;
		}
	}

	[HarmonyPatch(typeof(ArenaMissionController), "EndRound")]
	[HarmonyPrefix]
	private static void MovePortal(ArenaMissionController __instance)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0059: Expected O, but got Unknown
		PortalSpawner[] completionPortalSpawners = __instance.completionPortalSpawners;
		int num = 0;
		if (num < completionPortalSpawners.Length)
		{
			PortalSpawner obj = completionPortalSpawners[num];
			((Component)obj).transform.position = new Vector3(-75f, 37.5f, 210f);
			((Component)obj).transform.rotation = Quaternion.Euler(0f, -175f, 0f);
			obj.rng = new Xoroshiro128Plus(0uL);
			obj.maxSpawnDistance = 0f;
			obj.spawnReferenceLocation = null;
			obj.spawnMessageToken = null;
		}
	}

	[HarmonyPatch(typeof(Run), "ShouldUpdateRunStopwatch")]
	[HarmonyPrefix]
	private static bool UpdateStopwatch(Run __instance, ref bool __result)
	{
		__result = timerEnabled && __instance.livingPlayerCount > 0;
		return false;
	}

	[HarmonyPrefix]
	[HarmonyPatch(typeof(Active), "OnEnter")]
	private static void OnEnter()
	{
		timerEnabled = true;
	}

	[HarmonyPrefix]
	[HarmonyPatch(typeof(Active), "OnExit")]
	private static void OnExit()
	{
		timerEnabled = false;
	}
}