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 Spellcheck v1.1.0
SamuelMach.TerminalTypos.dll
Decompiled 2 years agousing System; using System.Collections.Generic; 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.Logging; using HarmonyLib; using LobbyCompatibility.Attributes; using Microsoft.CodeAnalysis; using UnityEngine; [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("SamuelMach.TerminalTypos")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("TerminalTypos")] [assembly: AssemblyTitle("SamuelMach.TerminalTypos")] [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 TerminalTypos { [BepInPlugin("SamuelMach.TerminalTypos", "TerminalTypos", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [LobbyCompatibility(/*Could not decode attribute arguments.*/)] public class TerminalTypos : BaseUnityPlugin { public static TerminalTypos 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; Patch(); Logger.LogInfo((object)"SamuelMach.TerminalTypos v1.0.0 has loaded!"); } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("SamuelMach.TerminalTypos"); } 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 = "SamuelMach.TerminalTypos"; public const string PLUGIN_NAME = "TerminalTypos"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace TerminalTypos.Patches { [HarmonyPatch(typeof(Terminal), "ParsePlayerSentence")] public class TerminalPatch { private static void Postfix(ref TerminalNode __result) { int num = GameObject.Find("TerminalScript").GetComponent<Terminal>().terminalNodes.specialNodes.IndexOf(__result); if (num != 10 && num != 11) { return; } TerminalTypos.Logger.LogInfo((object)"Player made a typo"); List<string> list = new List<string>(); List<int> list2 = new List<int>(); if (StartOfRound.Instance.shipRoomLights.areLightsOn) { list.Add("lights"); list2.Add(10); } list.Add("speakers"); list2.Add(10); if (StartOfRound.Instance.shipDoorsEnabled && !StartOfRound.Instance.hangarDoorsClosed) { list.Add("door"); list2.Add(10); } list.Add("surge"); list2.Add(10); if ((Object)(object)Object.FindObjectOfType<TVScript>() != (Object)null) { list.Add("tv"); list2.Add(10); } else { TerminalTypos.Logger.LogInfo((object)"No TV found"); } if (WalkieTalkie.allWalkieTalkies.Count > 0) { list.Add("walkie-talkie"); list2.Add(10); } else { TerminalTypos.Logger.LogInfo((object)"No walkie talkies found"); } if ((Object)(object)Object.FindObjectOfType<ShipAlarmCord>() != (Object)null) { list.Add("horn"); list2.Add(10); } else { TerminalTypos.Logger.LogInfo((object)"No horn found"); } if (ShipTeleporter.hasBeenSpawnedThisSession || ShipTeleporter.hasBeenSpawnedThisSessionInverse) { list.Add("tp"); list2.Add(10); } if (RoundManager.Instance.possibleCodesForBigDoors.Length != 0) { list.Add("code"); list2.Add(10); } string text = WeightedRandom.getRandomWeighted(list, list2)[0]; TerminalTypos.Logger.LogInfo((object)("System going on a fritz: " + text)); string text2 = text; string text3 = text2; if (text3 == null) { return; } switch (text3.Length) { case 4: switch (text3[0]) { case 'd': if (text3 == "door") { StartOfRound.Instance.SetShipDoorsClosed(true); } break; case 'h': if (text3 == "horn") { Object.FindObjectOfType<ShipAlarmCord>().HoldCordDown(); Object.FindObjectOfType<ShipAlarmCord>().cordPulledDownTimer = 5f; } break; case 'c': if (text3 == "code") { TerminalAccessibleObject[] array = Object.FindObjectsOfType<TerminalAccessibleObject>(); foreach (TerminalAccessibleObject val in array) { val.SetDoorOpen(false); } } break; } break; case 2: switch (text3[1]) { case 'v': if (text3 == "tv") { Object.FindObjectOfType<TVScript>().TurnTVOnOff(false); } break; case 'p': if (text3 == "tp") { ShipTeleporter[] array2 = Object.FindObjectsOfType<ShipTeleporter>(); foreach (ShipTeleporter val2 in array2) { val2.PressTeleportButtonOnLocalClient(); } } break; } break; case 6: if (text3 == "lights") { StartOfRound.Instance.shipRoomLights.SetShipLightsBoolean(false); } break; case 8: if (text3 == "speakers") { StartOfRound.Instance.DisableShipSpeaker(); } break; case 5: if (text3 == "surge") { StartOfRound.Instance.PowerSurgeShip(); } break; case 13: if (!(text3 == "walkie-talkie")) { break; } { foreach (WalkieTalkie allWalkieTalky in WalkieTalkie.allWalkieTalkies) { allWalkieTalky.SwitchWalkieTalkieOn(true); } break; } } } } internal class WeightedRandom { public static List<string> getRandomWeighted(List<string> a, List<int> weights) { int num = 0; foreach (int weight in weights) { num += weight; } Random random = new Random(); int num2 = random.Next(1, num); return a.GetRange((int)Math.Floor((double)(a.Count * num2 / num)), 1); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }