Decompiled source of Skuishee mods v1.0.2

SquishyPlugin.dll

Decompiled 6 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using SquishyPlugin.NetcodePatcher;
using YourThunderstoreTeam.patch;
using YourThunderstoreTeam.service;

[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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: AssemblyCompany("SquishyPlugin")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("0.0.0.0")]
[assembly: AssemblyInformationalVersion("0.0.0-alpha.0")]
[assembly: AssemblyProduct("SquishyPlugin")]
[assembly: AssemblyTitle("SquishyPlugin")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
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;
		}
	}
}
public class Config
{
	public static ConfigEntry<int> creditAmount;

	public static ConfigEntry<int> numberOfDays;

	public static ConfigEntry<bool> infiniteSprint;

	public static ConfigEntry<bool> enhancedMovespeed;

	public static ConfigEntry<bool> flashlightMod;

	public Config(ConfigFile cfg)
	{
		creditAmount = cfg.Bind<int>("General", "Amount of credits", 9999, "Freeze the amount of credits");
		numberOfDays = cfg.Bind<int>("General", "Number of days", 3, "Changes the number of days to hit quota");
		infiniteSprint = cfg.Bind<bool>("General.Toggles", "Infinite Sprint", true, "Toggles infinite sprint");
		enhancedMovespeed = cfg.Bind<bool>("General.Toggles", "Enhanced movespeed", true, "Toggles enhanced movespeed");
		flashlightMod = cfg.Bind<bool>("General.Toggles", "Brighter flashlights", true, "Toggles brighter flashlights");
	}
}
namespace YourThunderstoreTeam
{
	[BepInPlugin("SquishyPlugin", "SquishyPlugin", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		private readonly Harmony _harmony = new Harmony("SquishyPlugin");

		public TemplateService Service;

		public static Plugin Instance { get; set; }

		public static Config SquishConfig { get; internal set; }

		public static ManualLogSource Log => ((BaseUnityPlugin)Instance).Logger;

		public Plugin()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			Instance = this;
		}

		private void Awake()
		{
			Service = new TemplateService();
			SquishConfig = new Config(((BaseUnityPlugin)this).Config);
			Log.LogInfo((object)"Applying patches...");
			ApplyPluginPatch();
			Log.LogInfo((object)"Patches applied");
		}

		private void ApplyPluginPatch()
		{
			_harmony.PatchAll(typeof(FlashLightsPatch));
			_harmony.PatchAll(typeof(TimeOfDayPatch));
			_harmony.PatchAll(typeof(SuitsPatch));
			_harmony.PatchAll(typeof(ShipLightsPatch));
			_harmony.PatchAll(typeof(PlayerControllerBPatch));
			_harmony.PatchAll(typeof(TerminalPatch));
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "SquishyPlugin";

		public const string PLUGIN_NAME = "SquishyPlugin";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace YourThunderstoreTeam.service
{
	public class TemplateService
	{
		public bool ReturnTrue()
		{
			return true;
		}

		public bool ReturnFalse()
		{
			return false;
		}
	}
}
namespace YourThunderstoreTeam.patch
{
	[HarmonyPatch(typeof(FlashlightItem))]
	public class FlashLightsPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void flashLightsIntensityPatch(ref FlashlightItem __instance)
		{
			if (Config.flashlightMod.Value)
			{
				__instance.flashlightBulb.intensity = 1000f;
				__instance.flashlightBulb.range = 1000f;
			}
		}
	}
	[HarmonyPatch(typeof(PlayerControllerB))]
	public class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void infiniteSprintPatch(ref float ___sprintMeter)
		{
			if (Config.infiniteSprint.Value)
			{
				___sprintMeter = 1f;
			}
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void sprintSpeedPatch(ref float ___movementSpeed)
		{
			if (Config.enhancedMovespeed.Value)
			{
				___movementSpeed = 5f;
			}
		}
	}
	[HarmonyPatch(typeof(ShipLights))]
	public class ShipLightsPatch
	{
	}
	[HarmonyPatch(typeof(StartOfRound))]
	[HarmonyPatch("Start")]
	public class StartOfRoundPatch
	{
	}
	[HarmonyPatch(typeof(StartOfRound))]
	public class SuitsPatch
	{
		private static readonly MethodInfo unlockItem = typeof(StartOfRound).GetMethod("SpawnUnlockable", BindingFlags.Instance | BindingFlags.NonPublic);

		public static void SpawnUnlockableDelegate(StartOfRound instance, int ID)
		{
			unlockItem.Invoke(instance, new object[1] { ID });
		}

		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyPostfix]
		public static void StartOfRoundSuitsPatch(StartOfRound __instance)
		{
			Plugin.Log.LogInfo((object)"Setting unlocked suits this round");
			SpawnUnlockableDelegate(__instance, 1);
			SpawnUnlockableDelegate(__instance, 2);
		}
	}
	[HarmonyPatch(typeof(Terminal))]
	public class TerminalPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void freezeCreditsAmountPatch(ref int ___groupCredits)
		{
			___groupCredits = Config.creditAmount.Value;
		}
	}
	[HarmonyPatch(typeof(TimeOfDay))]
	[HarmonyPatch("Awake")]
	public class TimeOfDayPatch
	{
		[HarmonyPostfix]
		public static void deadlineDaysPatch(TimeOfDay __instance)
		{
			if (__instance.quotaVariables != null)
			{
				__instance.quotaVariables.deadlineDaysAmount = Config.numberOfDays.Value;
			}
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace SquishyPlugin.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}