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 CompanyManager v1.0.1
CompanyManager.dll
Decompiled 2 years agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CompanyManager.Component; using GameNetcodeStuff; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("CompanyManager")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("CompanyManager")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("8a47a621-66a8-4121-bd65-4e9eb588540f")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyVersion("1.0.0.0")] namespace CompanyManager { [BepInPlugin("MythicalRev.CompanyManager", "CompanyManager", "1.0.0.0")] public class CompanyManagerClass : BaseUnityPlugin { private const string modGUID = "MythicalRev.CompanyManager"; private const string modName = "CompanyManager"; private const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("MythicalRev.CompanyManager"); internal static CompanyManagerClass Instance; public static ManualLogSource mls; public static ConfigEntry<string> guiKeybind; internal static GUILoader myGUI; private static bool hasGUISynced; internal static bool isHost; public static ConfigEntry<bool> desiresSilence; public static ConfigEntry<bool> mustBeWokenUp; public static ConfigEntry<bool> stopWallSFXWhenOpening; public static ConfigEntry<float> timeToWaitBeforeGrabbingItem; public static ConfigEntry<float> irritability; public static ConfigEntry<float> judgementSpeed; public static ConfigEntry<float> startingPatience; public static ConfigEntry<float> sensitivity; public static ConfigEntry<float> grabPlayerAnimationTime; public static ConfigEntry<int> maximumItemsToAnger; public static ConfigEntry<int> maxPlayersToKillBeforeSatisfied; private void Awake() { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("MythicalRev.CompanyManager"); mls.LogInfo((object)"Company is now Managed"); harmony.PatchAll(typeof(CompanyManagerClass)); ConfigFile(); GameObject val = new GameObject("GUILoader"); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)61; val.AddComponent<GUILoader>(); myGUI = (GUILoader)(object)val.GetComponent("GUILoader"); setGUIVars(); UpdateCFGVarsFromGUI(); } private void ConfigFile() { guiKeybind = ((BaseUnityPlugin)this).Config.Bind<string>("Keybinds", "GuiToggleKey", "F12", "SUPPORTED KEYS A-Z | 0-9 | F1-F12 "); desiresSilence = ((BaseUnityPlugin)this).Config.Bind<bool>("GUI Booleans", "Desires Silence", true, "SUPPORTED VALUES true | false "); mustBeWokenUp = ((BaseUnityPlugin)this).Config.Bind<bool>("GUI Booleans", "Must Be Woken Up", true, "SUPPORTED VALUES true | false "); stopWallSFXWhenOpening = ((BaseUnityPlugin)this).Config.Bind<bool>("GUI Booleans", "Stop Wall SFX When Opening", true, "SUPPORTED VALUES true | false "); timeToWaitBeforeGrabbingItem = ((BaseUnityPlugin)this).Config.Bind<float>("GUI Floats", "Stop Wall SFX When Opening", 10f, "Min - Max 1f - 100f "); irritability = ((BaseUnityPlugin)this).Config.Bind<float>("GUI Floats", "Irritability", 1f, "Min - Max 1f - 10f "); judgementSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("GUI Floats", "Judgement Speed", 1f, "Min - Max 1f - 10f "); startingPatience = ((BaseUnityPlugin)this).Config.Bind<float>("GUI Floats", "Starting Patience", 3f, "Min - Max 1f - 10f "); sensitivity = ((BaseUnityPlugin)this).Config.Bind<float>("GUI Floats", "Sensitivity", 1f, "Min - Max 1f - 10f "); grabPlayerAnimationTime = ((BaseUnityPlugin)this).Config.Bind<float>("GUI Floats", "Grab Player Animation Time", 2f, "Min - Max 1f - 10f "); maximumItemsToAnger = ((BaseUnityPlugin)this).Config.Bind<int>("GUI Ints", "Maximum Items To Anger", -1, "Min - Max -1 - 10 "); maxPlayersToKillBeforeSatisfied = ((BaseUnityPlugin)this).Config.Bind<int>("GUI Ints", "Max Players To Kill Before Satisfied", 1, "Min - Max 1 - 36 "); } private void setGUIVars() { myGUI.guiDesiresSilence = desiresSilence.Value; myGUI.guiMustBeWokenUp = mustBeWokenUp.Value; myGUI.guiStopWallSFXWhenOpening = stopWallSFXWhenOpening.Value; myGUI.guiMaximumItemsToAnger = maximumItemsToAnger.Value; myGUI.guiMaxPlayersToKillBeforeSatisfied = maxPlayersToKillBeforeSatisfied.Value; myGUI.guiIrritability = irritability.Value; myGUI.guiTimeToWaitBeforeGrabbingItem = timeToWaitBeforeGrabbingItem.Value; myGUI.guiJudgementSpeed = judgementSpeed.Value; myGUI.guiStartingPatience = startingPatience.Value; myGUI.guiSensitivity = sensitivity.Value; myGUI.guiGrabPlayerAnimationTime = grabPlayerAnimationTime.Value; hasGUISynced = true; } public void UpdateCFGVarsFromGUI() { if (!hasGUISynced) { setGUIVars(); } desiresSilence.Value = myGUI.guiDesiresSilence; mustBeWokenUp.Value = myGUI.guiMustBeWokenUp; stopWallSFXWhenOpening.Value = myGUI.guiStopWallSFXWhenOpening; maximumItemsToAnger.Value = myGUI.guiMaximumItemsToAnger; maxPlayersToKillBeforeSatisfied.Value = myGUI.guiMaxPlayersToKillBeforeSatisfied; irritability.Value = myGUI.guiIrritability; timeToWaitBeforeGrabbingItem.Value = myGUI.guiTimeToWaitBeforeGrabbingItem; judgementSpeed.Value = myGUI.guiJudgementSpeed; startingPatience.Value = myGUI.guiStartingPatience; sensitivity.Value = myGUI.guiSensitivity; grabPlayerAnimationTime.Value = myGUI.guiGrabPlayerAnimationTime; } } } namespace CompanyManager.Patches { [HarmonyPatch(typeof(CompanyMood))] internal class CompanyMoodPatch { [HarmonyPatch(typeof(CompanyMood))] [HarmonyPostfix] private static void patchClass() { } } [HarmonyPatch(typeof(PlayerControllerB))] public class PlayerControllerBPatch { [HarmonyPatch("Update")] [HarmonyPrefix] private static void patchControllerUpdate() { CompanyManagerClass.myGUI.guiIsHost = CompanyManagerClass.isHost; CompanyManagerClass.Instance.UpdateCFGVarsFromGUI(); } } } namespace CompanyManager.Component { internal class GUILoader : MonoBehaviour { private KeyboardShortcut openCloseMenu; private bool isMenuOpen; internal bool wasKeyDown; private int toolbarInt = 0; private string[] toolbarStrings = new string[4] { "Company Mood Settings", "Timings", "Company Desires", "Other" }; private int MENUWIDTH = 600; private int MENUHEIGHT = 800; private int MENUX; private int MENUY; private int ITEMWIDTH = 300; private int CENTERX; public bool guiDesiresSilence; public bool guiMustBeWokenUp; public bool guiStopWallSFXWhenOpening; public int guiMaximumItemsToAnger; public int guiMaxPlayersToKillBeforeSatisfied; public float guiTimeToWaitBeforeGrabbingItem; public float guiIrritability; public float guiJudgementSpeed; public float guiStartingPatience; public float guiSensitivity; public float guiGrabPlayerAnimationTime; private GUIStyle menuStyle; private GUIStyle buttonStyle; private GUIStyle labelStyle; private GUIStyle toggleStyle; private GUIStyle hScrollStyle; public bool guiIsHost; private KeyCode guiKeycode = (KeyCode)Enum.Parse(typeof(KeyCode), CompanyManagerClass.guiKeybind.Value); private void Awake() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) CompanyManagerClass.mls.LogInfo((object)"GUILoader loaded."); openCloseMenu = new KeyboardShortcut(guiKeycode, Array.Empty<KeyCode>()); isMenuOpen = false; MENUX = Screen.width / 2; MENUY = Screen.height / 2; CENTERX = MENUX + (MENUWIDTH / 2 - ITEMWIDTH / 2); } private Texture2D MakeTex(int width, int height, Color col) { //IL_0011: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown Color[] array = (Color[])(object)new Color[width * height]; for (int i = 0; i < array.Length; i++) { array[i] = col; } Texture2D val = new Texture2D(width, height); val.SetPixels(array); val.Apply(); return val; } private void intitializeMenu() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) if (menuStyle == null) { menuStyle = new GUIStyle(GUI.skin.box); buttonStyle = new GUIStyle(GUI.skin.button); labelStyle = new GUIStyle(GUI.skin.label); toggleStyle = new GUIStyle(GUI.skin.toggle); hScrollStyle = new GUIStyle(GUI.skin.horizontalSlider); menuStyle.normal.textColor = Color.white; menuStyle.normal.background = MakeTex(2, 2, new Color(0.01f, 0.01f, 0.1f, 0.9f)); menuStyle.fontSize = 18; ((Object)menuStyle.normal.background).hideFlags = (HideFlags)61; buttonStyle.normal.textColor = Color.white; buttonStyle.fontSize = 18; labelStyle.normal.textColor = Color.white; labelStyle.normal.background = MakeTex(2, 2, new Color(0.01f, 0.01f, 0.1f, 0.9f)); labelStyle.fontSize = 18; labelStyle.alignment = (TextAnchor)4; ((Object)labelStyle.normal.background).hideFlags = (HideFlags)61; toggleStyle.normal.textColor = Color.white; toggleStyle.fontSize = 18; hScrollStyle.normal.textColor = Color.white; hScrollStyle.normal.background = MakeTex(2, 2, new Color(0f, 0f, 0.2f, 0.9f)); ((Object)hScrollStyle.normal.background).hideFlags = (HideFlags)61; } } public void OnDestroy() { CompanyManagerClass.mls.LogInfo((object)"The GUILoader was destroyed"); } public void Update() { if (((KeyboardShortcut)(ref openCloseMenu)).IsDown() && !wasKeyDown) { wasKeyDown = true; isMenuOpen = true; } if (((KeyboardShortcut)(ref openCloseMenu)).IsUp() && wasKeyDown) { wasKeyDown = false; isMenuOpen = !isMenuOpen; if (isMenuOpen) { Cursor.visible = true; Cursor.lockState = (CursorLockMode)2; } else { Cursor.visible = false; } } } public void OnGUI() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0350: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_0422: Unknown result type (might be due to invalid IL or missing references) //IL_0463: Unknown result type (might be due to invalid IL or missing references) //IL_04a4: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_0572: Unknown result type (might be due to invalid IL or missing references) //IL_05b1: Unknown result type (might be due to invalid IL or missing references) if (!guiIsHost) { return; } if (menuStyle == null) { intitializeMenu(); } if (isMenuOpen) { GUI.Box(new Rect((float)MENUX, (float)MENUY, (float)MENUWIDTH, (float)MENUHEIGHT), "Company Manager", menuStyle); toolbarInt = GUI.Toolbar(new Rect((float)MENUX, (float)(MENUY - 30), (float)MENUWIDTH, 30f), toolbarInt, toolbarStrings, buttonStyle); switch (toolbarInt) { case 0: guiIrritability = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 160), (float)ITEMWIDTH, 30f), guiIrritability, 1f, 10f); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 130), (float)ITEMWIDTH, 30f), "How Irritated The Company Gets " + guiIrritability, labelStyle); guiMaximumItemsToAnger = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 160), (float)ITEMWIDTH, 30f), (float)guiMaximumItemsToAnger, -1f, 10f); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 130), (float)ITEMWIDTH, 30f), "Max amount of items to anger The Company " + guiMaximumItemsToAnger, labelStyle); guiSensitivity = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 160), (float)ITEMWIDTH, 30f), guiSensitivity, -1f, 10f); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 130), (float)ITEMWIDTH, 30f), "How Sensitive The Company Is " + guiSensitivity, labelStyle); guiStartingPatience = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 160), (float)ITEMWIDTH, 30f), guiStartingPatience, 1f, 10f); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 130), (float)ITEMWIDTH, 30f), "Starting Patience Of The Company " + guiStartingPatience, labelStyle); break; case 1: guiGrabPlayerAnimationTime = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 160), (float)ITEMWIDTH, 30f), guiGrabPlayerAnimationTime, 1f, 10f); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 130), (float)ITEMWIDTH, 30f), "How Long The Grab Player Animation Is " + guiSensitivity, labelStyle); guiTimeToWaitBeforeGrabbingItem = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 160), (float)ITEMWIDTH, 30f), guiTimeToWaitBeforeGrabbingItem, 1f, 100f); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 130), (float)ITEMWIDTH, 30f), "How Long The Company Waits To Grab Items " + guiTimeToWaitBeforeGrabbingItem, labelStyle); break; case 2: guiDesiresSilence = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 30), (float)(ITEMWIDTH + 100), 30f), guiDesiresSilence, "Does The Company Desire Silence", toggleStyle); guiMustBeWokenUp = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 30), (float)(ITEMWIDTH + 100), 30f), guiMustBeWokenUp, "Does The Company Need To Be Woken Up", toggleStyle); guiMaxPlayersToKillBeforeSatisfied = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 160), (float)ITEMWIDTH, 30f), (float)guiMaxPlayersToKillBeforeSatisfied, 1f, 36f); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 130), (float)ITEMWIDTH, 30f), "How Many Players Eaten To Satisfy The Company " + guiTimeToWaitBeforeGrabbingItem, labelStyle); break; case 3: guiStopWallSFXWhenOpening = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 30), (float)(ITEMWIDTH + 100), 30f), guiStopWallSFXWhenOpening, "Stop The Wall SFX From Playing When Company Door Is Opened", toggleStyle); guiJudgementSpeed = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 160), (float)ITEMWIDTH, 30f), guiJudgementSpeed, 1f, 10f); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 130), (float)ITEMWIDTH, 30f), "How Fast The Company Judges " + guiTimeToWaitBeforeGrabbingItem, labelStyle); break; } } } } }