Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of PirMod v1.0.1
PirMod.dll
Decompiled 3 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; 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 Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("PirMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+bb0c8e942ad14873c308e036566cdeb59d7ff11a")] [assembly: AssemblyProduct("PirMod")] [assembly: AssemblyTitle("PirMod")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 PirMod { [BepInPlugin("PirMod", "PirMod", "1.0.1")] public class PirMod : BaseUnityPlugin { public static ConfigEntry<bool> cfgInfiniteSprint; public static ConfigEntry<bool> cfgMineMonster; public static ConfigEntry<bool> cfgStarterShovel; public static ConfigEntry<bool> cfgTurretTweaks; public const string PLUGIN_GUID = "PirMod"; public const string PLUGIN_NAME = "PirMod"; public const string PLUGIN_VERSION = "1.0.1"; public static PirMod Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; cfgInfiniteSprint = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "InfiniteSprint", false, "Enable infinite stamina."); cfgMineMonster = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "MineMonster", true, "Monsters can step on and trigger landmines."); cfgStarterShovel = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "StarterShovel", false, "Spawn a shovel when the game starts."); cfgTurretTweaks = ((BaseUnityPlugin)this).Config.Bind<bool>("Features", "TurretTweaks", true, "Allow hitting turrets with a shovel to disable them."); Patch(); Logger.LogInfo((object)"PirMod v1.0.1 has loaded!"); } internal static void Patch() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("PirMod"); } Logger.LogDebug((object)"[PirMod] Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"[PirMod] Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"[PirMod] Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"[PirMod] Finished unpatching!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "PirMod"; public const string PLUGIN_NAME = "PirMod"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace PirMod.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class InfiniteSprintPatch { [HarmonyPatch("Update")] [HarmonyPostfix] private static void InfiniteStamina(PlayerControllerB __instance) { if (PirMod.cfgInfiniteSprint.Value && !((Object)(object)NetworkManager.Singleton == (Object)null) && ((NetworkBehaviour)__instance).IsOwner) { __instance.sprintMeter = 1f; } } } [HarmonyPatch(typeof(NetworkManager))] internal static class NetworkPrefabPatch2 { private static readonly string MOD_GUID = "PirMod"; [HarmonyPostfix] [HarmonyPatch("SetSingleton")] private static void RegisterPrefab() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(MOD_GUID + " Prefab"); ((Object)val).hideFlags = (HideFlags)(((Object)val).hideFlags | 0x3D); Object.DontDestroyOnLoad((Object)(object)val); NetworkObject obj = val.AddComponent<NetworkObject>(); FieldInfo field = typeof(NetworkObject).GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(obj, GetHash(MOD_GUID)); NetworkManager.Singleton.PrefabHandler.AddNetworkPrefab(val); static uint GetHash(string value) { return value?.Aggregate(17u, (uint current, char c) => (current * 31) ^ c) ?? 0; } } } [HarmonyPatch(typeof(Landmine))] internal class MineMonsterPatch { [HarmonyPatch("OnTriggerEnter")] [HarmonyPrefix] private static void MonsterTrigger(Landmine __instance, Collider other) { if (PirMod.cfgMineMonster.Value && !__instance.hasExploded && NetworkManager.Singleton.IsServer) { EnemyAI componentInParent = ((Component)other).gameObject.GetComponentInParent<EnemyAI>(); if ((Object)(object)componentInParent != (Object)null && !componentInParent.isEnemyDead) { Debug.Log((object)("[MyFirstMod] " + componentInParent.enemyType.enemyName + " stepped on a mine! BOOM!")); __instance.ExplodeMineServerRpc(); componentInParent.KillEnemyOnOwnerClient(true); } } } } [HarmonyPatch(typeof(StartOfRound))] internal class StarterShovelPatch { [HarmonyPatch("StartGame")] [HarmonyPostfix] private static void SpawnItemOnLanding(StartOfRound __instance) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) if (PirMod.cfgStarterShovel.Value && (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)) { Item val = ((IEnumerable<Item>)__instance.allItemsList.itemsList).FirstOrDefault((Func<Item, bool>)((Item i) => i.itemName == "Shovel")); if ((Object)(object)val != (Object)null) { Vector3 val2 = __instance.playerSpawnPositions[0].position + new Vector3(0f, 1f, 0f); GameObject val3 = Object.Instantiate<GameObject>(val.spawnPrefab, val2, Quaternion.identity); val3.GetComponent<GrabbableObject>().fallTime = 0f; val3.GetComponent<NetworkObject>().Spawn(false); Debug.Log((object)"TESTING: Shovel spawned on landing!"); } } } } [HarmonyPatch] internal class TurretTweaks { private static int mapHazardLayer = LayerMask.GetMask(new string[1] { "MapHazards" }); [HarmonyPatch(typeof(Shovel), "HitShovel")] [HarmonyPostfix] private static void CheckForTurretHit(Shovel __instance) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) if (!PirMod.cfgTurretTweaks.Value) { return; } PlayerControllerB playerHeldBy = ((GrabbableObject)__instance).playerHeldBy; if ((Object)(object)playerHeldBy == (Object)null) { return; } Vector3 position = ((Component)playerHeldBy.gameplayCamera).transform.position; Vector3 forward = ((Component)playerHeldBy.gameplayCamera).transform.forward; RaycastHit val = default(RaycastHit); if (Physics.SphereCast(position, 0.5f, forward, ref val, 1.5f, mapHazardLayer)) { Turret componentInParent = ((Component)((RaycastHit)(ref val)).collider).gameObject.GetComponentInParent<Turret>(); if ((Object)(object)componentInParent != (Object)null && componentInParent.turretActive) { RoundManager.Instance.PlayAudibleNoise(((RaycastHit)(ref val)).point, 10f, 1f, 0, false, 0); playerHeldBy.playerBodyAnimator.SetTrigger("shovelHit"); __instance.shovelAudio.PlayOneShot(__instance.reelUp); componentInParent.ToggleTurretServerRpc(false); } } } [HarmonyPatch(typeof(Turret), "ToggleTurretClientRpc")] [HarmonyPostfix] private static void ForceStopAudioOnNetwork(Turret __instance, bool __0) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) if (__0) { return; } __instance.turretMode = (TurretMode)0; AudioSource[] componentsInChildren = ((Component)__instance).gameObject.GetComponentsInChildren<AudioSource>(); AudioSource[] array = componentsInChildren; foreach (AudioSource val in array) { if (val.isPlaying) { val.Stop(); } } } } }