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 HelloNeighborKey v1.0.1
Terabit.HelloNeighborKey.dll
Decompiled a month agousing System; using System.Diagnostics; using System.IO; 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 HarmonyLib; using Microsoft.CodeAnalysis; 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("Terabit.HelloNeighborKey")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.1.0")] [assembly: AssemblyInformationalVersion("1.0.1")] [assembly: AssemblyProduct("HelloNeighborKeyMod")] [assembly: AssemblyTitle("Terabit.HelloNeighborKey")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 HelloNeighborKeyMod { [BepInPlugin("Terabit.HelloNeighborKey", "HelloNeighborKeyMod", "1.0.1")] public class HelloNeighborKeyMod : BaseUnityPlugin { public static AssetBundle HelloNeighborKey; public static ConfigEntry<string> KeyColor; public static HelloNeighborKeyMod Instance { get; private set; } internal static ManualLogSource Logger { get; private set; } internal static Harmony? Harmony { get; set; } private void Awake() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Instance = this; KeyColor = ((BaseUnityPlugin)this).Config.Bind<string>("General", "KeyColor", "Blue", new ConfigDescription("The color you want the key to be.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[2] { "Blue", "Red" }), Array.Empty<object>())); string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); HelloNeighborKey = AssetBundle.LoadFromFile(Path.Combine(directoryName, "modassets")); if ((Object)(object)HelloNeighborKey == (Object)null) { Logger.LogError((object)"Failed to load the keys."); return; } Patch(); Logger.LogInfo((object)"Terabit.HelloNeighborKey v1.0.1 just spawned in."); Logger.LogInfo((object)"\r\n ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⠉⠉⠉⠉⠉⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣤⣤⣤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⢀⣀⣿⣿⣿⣿⣀⡀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⢠⣶⣿⣿⣿⣿⣿⣿⣿⣿⣶⡄⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⡿⠋⠉⠉⠙⢿⣿⣿⣿⡆⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⡏⠀⠀⠀⠀⠀⠀⢹⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣆⠀⠀⠀⠀⠀⠀⣸⣿⣿⣿⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠸⣿⣿⣿⣷⣄⣀⣀⣠⣾⣿⣿⣿⠇⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠘⠿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠃⠀⠀⠀⠀⠀⠀⠀⠀⠀\r\n⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠉⠁⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀"); Logger.LogInfo((object)$"Component active: {((Component)this).gameObject.activeInHierarchy}, enabled: {((Behaviour)this).enabled}"); } 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("Terabit.HelloNeighborKey"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Terabit.HelloNeighborKey"; public const string PLUGIN_NAME = "HelloNeighborKeyMod"; public const string PLUGIN_VERSION = "1.0.1"; } } namespace HelloNeighborKeyMod.Patches { [HarmonyPatch(typeof(TVScript))] public class ExampleTVPatch { [HarmonyPatch("SwitchTVLocalClient")] [HarmonyPrefix] private static void SwitchTVPrefix(TVScript __instance) { StartOfRound.Instance.shipRoomLights.SetShipLightsBoolean(__instance.tvOn); } } [HarmonyPatch(typeof(GrabbableObject), "Start")] internal class KeyReplacementPatch { private const float ScaleMultiplier = 0.0015f; [HarmonyPostfix] private static void Postfix(GrabbableObject __instance) { //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance.itemProperties == (Object)null || __instance.itemProperties.itemName != "Key") { return; } GameObject val = HelloNeighborKeyMod.HelloNeighborKey.LoadAsset<GameObject>("HelloNeighborKey"); if ((Object)(object)val == (Object)null) { HelloNeighborKeyMod.Logger.LogError((object)"Custom key is not found in the bundle. St00pid"); return; } MeshFilter component = val.GetComponent<MeshFilter>(); MeshRenderer component2 = val.GetComponent<MeshRenderer>(); if ((Object)(object)__instance.mainObjectRenderer != (Object)null && (Object)(object)component2 != (Object)null) { string text = HelloNeighborKeyMod.KeyColor.Value + "KeyMat"; Material val2 = HelloNeighborKeyMod.HelloNeighborKey.LoadAsset<Material>(text); if ((Object)(object)val2 != (Object)null) { Material[] array = (Material[])(object)new Material[((Renderer)component2).sharedMaterials.Length]; for (int i = 0; i < array.Length; i++) { array[i] = val2; } ((Renderer)__instance.mainObjectRenderer).sharedMaterials = array; } else { HelloNeighborKeyMod.Logger.LogWarning((object)("Material '" + text + "' not found in the bundle, using the default material")); ((Renderer)__instance.mainObjectRenderer).sharedMaterials = ((Renderer)component2).sharedMaterials; } MeshFilter component3 = ((Component)__instance.mainObjectRenderer).GetComponent<MeshFilter>(); if ((Object)(object)component3 != (Object)null) { Mesh val3 = (component3.mesh = ScaleMesh(component.sharedMesh, 0.0015f)); BoxCollider component4 = ((Component)__instance).GetComponent<BoxCollider>(); if ((Object)(object)component4 != (Object)null) { Bounds bounds = val3.bounds; component4.center = ((Bounds)(ref bounds)).center; bounds = val3.bounds; component4.size = ((Bounds)(ref bounds)).size; } } } __instance.itemProperties.positionOffset = new Vector3(-0.3f, 0.05f, 0.04f); __instance.itemProperties.rotationOffset = new Vector3(0f, 95f, -95f); __instance.itemProperties.restingRotation = new Vector3(0f, 0f, 5f); string text2 = HelloNeighborKeyMod.KeyColor.Value + "KeyIcon"; Sprite val5 = HelloNeighborKeyMod.HelloNeighborKey.LoadAsset<Sprite>(text2); if ((Object)(object)val5 != (Object)null) { __instance.itemProperties.itemIcon = val5; } else { HelloNeighborKeyMod.Logger.LogWarning((object)("Icon '" + text2 + "' not found in the bundle, keeping the default icon")); } HelloNeighborKeyMod.Logger.LogDebug((object)"Successfully stole all of Mr Peterson's keys."); } private static Mesh ScaleMesh(Mesh source, float scale) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) Mesh val = Object.Instantiate<Mesh>(source); Vector3[] vertices = val.vertices; for (int i = 0; i < vertices.Length; i++) { ref Vector3 reference = ref vertices[i]; reference *= scale; } val.vertices = vertices; val.RecalculateBounds(); return val; } } }