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 RemoveRunestones v1.0.0
RemoveRunestones.dll
Decompiled 6 days agousing 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 HarmonyLib; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 RemoveRunestones { [BepInPlugin("com.lobo1g.removerunestones", "RemoveRunestones", "1.0.0")] public class RemoveRunestonesPlugin : BaseUnityPlugin { public const string PluginGuid = "com.lobo1g.removerunestones"; public const string PluginName = "RemoveRunestones"; public const string PluginVersion = "1.0.0"; internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<KeyboardShortcut> RemoveKey; internal static ConfigEntry<bool> RequireAdmin; internal static ConfigEntry<bool> ShowHoverHint; private Harmony _harmony; private void Awake() { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Expected O, but got Unknown Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "Enable or disable the mod."); RemoveKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("General", "RemoveKey", new KeyboardShortcut((KeyCode)101, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), "Hold the modifier and press the key while looking at a runestone to remove it. Default: Left Shift + E."); RequireAdmin = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "RequireAdmin", false, "If true, only server admins (or the host in single player) can remove runestones."); ShowHoverHint = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowHoverHint", true, "Show a hint on the runestone hover text."); _harmony = new Harmony("com.lobo1g.removerunestones"); _harmony.PatchAll(); } private void OnDestroy() { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } internal static bool IsAllowed() { if (!Enabled.Value) { return false; } if (!RequireAdmin.Value) { return true; } if ((Object)(object)ZNet.instance == (Object)null) { return false; } return ZNet.instance.LocalPlayerIsAdminOrHost(); } } [HarmonyPatch(typeof(RuneStone), "Interact")] internal static class Runestone_Interact_Patch { private static bool Prefix(RuneStone __instance, Humanoid character, bool hold, bool alt, ref bool __result) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (hold) { return true; } Player val = (Player)(object)((character is Player) ? character : null); if (val == null || (Object)(object)val != (Object)(object)Player.m_localPlayer) { return true; } if (!RemoveRunestonesPlugin.IsAllowed()) { return true; } KeyboardShortcut value = RemoveRunestonesPlugin.RemoveKey.Value; if (!((KeyboardShortcut)(ref value)).IsPressed()) { return true; } ZNetView componentInParent = ((Component)__instance).GetComponentInParent<ZNetView>(); if ((Object)(object)componentInParent == (Object)null || !componentInParent.IsValid()) { ((Character)val).Message((MessageType)2, "Cannot remove this runestone", 0, (Sprite)null, false); __result = true; return false; } componentInParent.ClaimOwnership(); ZNetScene.instance.Destroy(((Component)componentInParent).gameObject); ((Character)val).Message((MessageType)2, "Runestone removed", 0, (Sprite)null, false); __result = true; return false; } } [HarmonyPatch(typeof(RuneStone), "GetHoverText")] internal static class Runestone_HoverText_Patch { private static void Postfix(ref string __result) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (RemoveRunestonesPlugin.ShowHoverHint.Value && RemoveRunestonesPlugin.IsAllowed()) { KeyboardShortcut value = RemoveRunestonesPlugin.RemoveKey.Value; __result += $"\n[<color=yellow><b>{value}</b></color>] Remove"; } } } }