Decompiled source of StartWithTeleporter v1.0.0

TeleporterOnly.dll

Decompiled 7 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using TeleporterOnly.Patches;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("TeleporterOnly")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("TeleporterOnly")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4236996d-781e-4fa5-b761-417887dcd2c5")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace TeleporterOnly
{
	[BepInPlugin("Daran.TeleporterOnlyMod", "Teleporter Only Mod", "1.0.0.0")]
	public class TeleporterOnly : BaseUnityPlugin
	{
		private const string modGUID = "Daran.TeleporterOnlyMod";

		private const string modName = "Teleporter Only Mod";

		private const string modVersion = "1.0.0.0";

		private readonly Harmony harmony = new Harmony("Daran.TeleporterOnlyMod");

		private static TeleporterOnly Instance;

		internal ManualLogSource logger;

		private void Awake()
		{
			if ((Object)(object)Instance == (Object)null)
			{
				Instance = this;
			}
			logger = Logger.CreateLogSource("Daran.TeleporterOnlyMod");
			logger.LogInfo((object)"The Daran.TeleporterOnlyMod mod has started");
			harmony.PatchAll(typeof(TeleporterOnly));
			harmony.PatchAll(typeof(GameNetworkManagerPatch));
		}
	}
}
namespace TeleporterOnly.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	internal class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void infiniteSprintPatch(ref float ___sprintMeter)
		{
			___sprintMeter = 1f;
		}
	}
	[HarmonyPatch(typeof(GameNetworkManager))]
	internal class GameNetworkManagerPatch
	{
		[HarmonyPatch("ResetUnlockablesListValues")]
		[HarmonyPrefix]
		private static void teleporterStart()
		{
			ManualLogSource val = Logger.CreateLogSource("LoadUnlockablesPatch");
			val.LogInfo((object)"Modifying unlockables to start with teleporters");
			List<UnlockableItem> unlockables = StartOfRound.Instance.unlockablesList.unlockables;
			if (unlockables != null)
			{
				for (int i = 0; i < unlockables.Count; i++)
				{
					if (unlockables[i].unlockableName == "Teleporter" || unlockables[i].unlockableName == "Inverse Teleporter")
					{
						val.LogInfo((object)("Unlocking " + unlockables[i].unlockableName));
						unlockables[i].hasBeenUnlockedByPlayer = true;
						unlockables[i].alreadyUnlocked = true;
					}
				}
			}
			else
			{
				val.LogInfo((object)"What the fuck how is it null?");
			}
		}
	}
}