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 GhoulMage LethalCompany v2.0.0
BepinEx/plugins/GhoulMage.LethalCompany.dll
Decompiled 2 years 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.Bootstrap; using BepInEx.Logging; using HarmonyLib; using LC_API.ServerAPI; 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("GhoulMage.LethalCompany")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Development library for Lethal Company mods.")] [assembly: AssemblyFileVersion("2.0.0.0")] [assembly: AssemblyInformationalVersion("2.0.0")] [assembly: AssemblyProduct("GhoulMage.LethalCompany")] [assembly: AssemblyTitle("GhoulMage.LethalCompany")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.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.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace GhoulMage.LethalCompany { [BepInDependency(/*Could not decode attribute arguments.*/)] public abstract class GhoulMagePlugin : BaseUnityPlugin { protected const string Version = "1.0.1"; public const string APIVersion = "2.0.0"; private Action _onSuccesfulLoad; private Action _onFailedLoad; private bool _intializing; private bool _initialized; protected abstract LethalGameVersions GameCompatibility { get; } protected Harmony HarmonyInstance { get; private set; } protected abstract Assembly AssemblyToPatch { get; } protected void Startup(string GUID, string NAME, string VERSION, Action loadCallback, bool patchImmediate = true) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Expected O, but got Unknown if (_intializing) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Trying to startup multiple times..? Aborting."); return; } _intializing = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Mod " + NAME + " ver " + VERSION + " (" + GUID + ") is loaded!")); _onSuccesfulLoad = loadCallback; HarmonyInstance = new Harmony(GUID); if (patchImmediate) { PatchAllASAPIfCompatible(NAME); } else { WaitToCheckCompatibility(); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Created Loader. Will patch all? " + (patchImmediate ? "Yes" : "No"))); } protected void Startup(string GUID, string NAME, string VERSION, Action loadCallback, Action failedLoadCallback, bool patchImmediate = true) { //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Expected O, but got Unknown if (_intializing) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Trying to startup multiple times..? Aborting."); return; } _intializing = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Mod " + NAME + " ver " + VERSION + " (" + GUID + ") is loaded!")); _onSuccesfulLoad = loadCallback; _onFailedLoad = failedLoadCallback; HarmonyInstance = new Harmony(GUID); if (patchImmediate) { PatchAllASAPIfCompatible(NAME); } else { WaitToCheckCompatibility(); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Created Loader. Will patch all? " + (patchImmediate ? "Yes" : "No"))); } private void PatchAllASAPIfCompatible(string name) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown GameObject val = new GameObject(name + " Loader"); Object.DontDestroyOnLoad((Object)val); LatePatcher latePatcher = val.AddComponent<LatePatcher>(); latePatcher.Assembly = AssemblyToPatch; latePatcher.Harmony = HarmonyInstance; latePatcher.compatibleVersions = GameCompatibility; latePatcher.Logger = ((BaseUnityPlugin)this).Logger; latePatcher.VersionCompatibleCallback = _onSuccesfulLoad; latePatcher.VersionIncompatibleCallback = _onFailedLoad; } private void WaitToCheckCompatibility() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_001b: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(((Object)this).name + " Loader"); Object.DontDestroyOnLoad((Object)val); ((Object)val).hideFlags = (HideFlags)61; LatePatcher latePatcher = val.AddComponent<LatePatcher>(); latePatcher.compatibleVersions = GameCompatibility; latePatcher.Logger = ((BaseUnityPlugin)this).Logger; latePatcher.VersionCompatibleCallback = _onSuccesfulLoad; latePatcher.VersionIncompatibleCallback = _onFailedLoad; } internal void FireSuccesfulLoad() { if (_initialized) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Somehow firing OnSuccesfulLoad multiple times..? Aborting."); return; } _initialized = true; _onSuccesfulLoad(); } private void Start() { if (!_intializing) { Initialize(); } } private void OnDestroy() { if (!_intializing) { Initialize(); } } protected abstract void Initialize(); } internal class LatePatcher : MonoBehaviour { internal Harmony Harmony; internal LethalGameVersions compatibleVersions; internal ManualLogSource Logger; internal Assembly Assembly; internal Action VersionCompatibleCallback; internal Action VersionIncompatibleCallback; private void Update() { if (!((Object)(object)GameNetworkManager.Instance != (Object)null)) { return; } if (compatibleVersions.CompatibleWith(LC_Info.GameVersion)) { Logger.LogInfo((object)("Compatible with Game Version " + LC_Info.GameVersion + "!")); if (Harmony != null) { Logger.LogInfo((object)"About to patch everything!"); Harmony.PatchAll(Assembly); } VersionCompatibleCallback?.Invoke(); } else { Logger.LogError((object)("Incompatible due to Game Version " + LC_Info.GameVersion + "...")); VersionIncompatibleCallback?.Invoke(); } Object.DestroyImmediate((Object)(object)((Component)this).gameObject); } } public class LC_Info { public const char VersionPrefix = 'v'; public static string GameVersion { get { if ((Object)(object)GameNetworkManager.Instance == (Object)null) { return "unknown"; } if (HasLoadedMod("LC_API") && ModdedServer.ModdedOnly) { return $"v{ModdedServer.GameVersion}"; } return $"v{GameNetworkManager.Instance.gameVersionNum}"; } } public static int GameVersionNumber { get { if ((Object)(object)GameNetworkManager.Instance == (Object)null) { return -1; } if (HasLoadedMod("LC_API") && ModdedServer.ModdedOnly) { return ModdedServer.GameVersion; } return GameNetworkManager.Instance.gameVersionNum; } } public static bool HasLoadedMod(string guid) { return Chainloader.PluginInfos.ContainsKey(guid); } } public class LethalGameVersions { private string[] _versions; public LethalGameVersions(params string[] versions) { _versions = versions; } public bool CompatibleWith(string version) { string[] versions = _versions; for (int i = 0; i < versions.Length; i++) { if (versions[i].Equals(version)) { return true; } } return false; } public bool CompatibleWith(int version) { return CompatibleWith($"{'v'}{version}"); } } public static class PluginInfo { public const string PLUGIN_GUID = "GhoulMage.LethalCompany"; public const string PLUGIN_NAME = "GhoulMage.LethalCompany"; public const string PLUGIN_VERSION = "2.0.0"; } }