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 ConstantSpawning v1.0.4
Constant Spawning.dll
Decompiled 2 years agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalCompanyTestMod.Component; using Steamworks.Data; using Unity.Netcode; 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("LethalCompanyTestMod")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LethalCompanyTestMod")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d4f6b961-e8ae-4e4b-950c-37644e42d4ca")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace LethalCompanyTestMod { public static class stuff { public static bool spawningloop = false; public static string enemytype = "blob"; public static float spawnduration = 20f; public static float spawntimer = 0f; public static bool inside = true; public static bool timerstarted = false; public static Stopwatch sw; public static float last = 0f; } [BepInPlugin("Posiedon.GameMaster", "Lethal Company GameMaster", "1.0.0.0")] public class TestMod : BaseUnityPlugin { private const string modGUID = "Posiedon.GameMaster"; private const string modName = "Lethal Company GameMaster"; private const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("Posiedon.GameMaster"); public static Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>> levelEnemySpawns; public static Dictionary<SpawnableEnemyWithRarity, int> enemyRaritys; public static Dictionary<SpawnableEnemyWithRarity, AnimationCurve> enemyPropCurves; public static ManualLogSource mls; private static ConfigEntry<string> ServerName; private static ConfigEntry<string> RoundPost; private static ConfigEntry<string> PrefixSetting; private static ConfigEntry<bool> ShouldEnemiesSpawnNaturally; private static ConfigEntry<float> SpringSpeed; private static ConfigEntry<float> PopUpTimer; private static ConfigEntry<float> MaxJesterSpeed; private static ConfigEntry<float> CrankingTimer; private static ConfigEntry<float> JesterResetTimer; private static ConfigEntry<int> MinScrap; private static ConfigEntry<int> MaxScrap; private static ConfigEntry<int> MinScrapValue; private static ConfigEntry<int> MaxScrapValue; private static ConfigEntry<bool> HideCommandMessages; private static ConfigEntry<bool> HideEnemySpawnMessages; internal static ConfigEntry<bool> EnableInfiniteSprint; private static ConfigEntry<bool> EnableInfiniteCredits; private static ConfigEntry<bool> EnableInfiniteDeadline; private static ConfigEntry<int> XPChange; private static ConfigEntry<bool> CustomCompanyBuyRate; private static ConfigEntry<bool> UseRandomBuyRate; private static ConfigEntry<float> MinimumCompanyBuyRate; private static ConfigEntry<float> MaximumCompanyBuyRate; private static ConfigEntry<bool> CustomTimeScale; private static ConfigEntry<bool> UseRandomTimeScale; private static ConfigEntry<float> MinimumTimeScale; private static ConfigEntry<float> MaximumTimeScale; private static ConfigEntry<bool> CustomDeadline; private static ConfigEntry<bool> UseRandomDeadline; private static ConfigEntry<int> MinimumDeadline; private static ConfigEntry<int> MaximumDeadline; private static ConfigEntry<bool> SpawnSelectedEnemy; private static ConfigEntry<string> SelectedEnemy; private static ConfigEntry<bool> cfgNightVision; private static ConfigEntry<bool> cfgSpeedHack; private static ConfigEntry<bool> cfgGodMode; private static ConfigEntry<bool> EnableAIModifiers; private static ConfigEntry<bool> EnableScrapModifiers; public static SelectableLevel currentLevel; private static EnemyVent[] currentLevelVents; private static RoundManager currentRound; private static SpawnableEnemyWithRarity jesterRef; internal static GUILoader myGUI; private static bool noClipEnabled; internal static bool enableGod; internal static bool nightVision; internal static PlayerControllerB playerRef; private static bool speedHack; internal static float nightVisionIntensity; internal static float nightVisionRange; internal static Color nightVisionColor; private static bool hasGUISynced; internal static bool isHost; internal static TestMod Instance; private void Awake() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown Instance = this; mls = Logger.CreateLogSource("GameMaster"); mls.LogInfo((object)"Loaded Posiedon.GameMaster. Patching."); harmony.PatchAll(typeof(TestMod)); mls = ((BaseUnityPlugin)this).Logger; enemyRaritys = new Dictionary<SpawnableEnemyWithRarity, int>(); levelEnemySpawns = new Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>>(); enemyPropCurves = new Dictionary<SpawnableEnemyWithRarity, AnimationCurve>(); GameObject val = new GameObject("GUILoader"); Object.DontDestroyOnLoad((Object)(object)val); ((Object)val).hideFlags = (HideFlags)61; val.AddComponent<GUILoader>(); myGUI = (GUILoader)(object)val.GetComponent("GUILoader"); SetBindings(); setGUIVars(); noClipEnabled = false; enableGod = false; GameObject val2 = new GameObject("My Manager"); val2.AddComponent<Commandloop>(); Object.DontDestroyOnLoad((Object)(object)val2); ((Object)val2).hideFlags = (HideFlags)61; } private void setGUIVars() { myGUI.guiHideCommandMessage = HideCommandMessages.Value; myGUI.guiHideEnemySpawnMessages = HideEnemySpawnMessages.Value; myGUI.guiShouldEnemiesSpawnNaturally = ShouldEnemiesSpawnNaturally.Value; myGUI.guiEnableAIModifiers = EnableAIModifiers.Value; myGUI.guiEnableInfiniteSprint = EnableInfiniteSprint.Value; myGUI.guiEnableInfiniteCredits = EnableInfiniteCredits.Value; myGUI.guiEnableGod = cfgGodMode.Value; myGUI.guiEnableNightVision = cfgNightVision.Value; myGUI.guiEnableSpeedHack = cfgSpeedHack.Value; myGUI.guiEnableScrapModifiers = EnableScrapModifiers.Value; myGUI.guiEnableCustomBuyRate = CustomCompanyBuyRate.Value; myGUI.guiUseRandomBuyRate = UseRandomBuyRate.Value; myGUI.guiUseCustomTimeScale = CustomTimeScale.Value; myGUI.guiUseRandomTimeScale = UseRandomTimeScale.Value; myGUI.guiEnableInfiniteDeadline = EnableInfiniteDeadline.Value; myGUI.guiEnableCustomDeadline = CustomDeadline.Value; myGUI.guiUseRandomDeadline = UseRandomDeadline.Value; myGUI.guiServerName = ServerName.Value; myGUI.guiRoundPost = RoundPost.Value; myGUI.guiXPChange = XPChange.Value.ToString(); myGUI.guiSelectedEnemy = SelectedEnemy.Value; myGUI.guiPrefix = PrefixSetting.Value; myGUI.guiMinScrap = MinScrap.Value; myGUI.guiMaxScrap = MaxScrap.Value; myGUI.guiMinScrapValue = MinScrapValue.Value; myGUI.guiMaxScrapValue = MaxScrapValue.Value; myGUI.guiMinimumDeadline = MinimumDeadline.Value; myGUI.guiMaximumDeadline = MaximumDeadline.Value; myGUI.guiSpringSpeed = SpringSpeed.Value; myGUI.guiPopupTimer = PopUpTimer.Value; myGUI.guiMaxJesterSpeed = MaxJesterSpeed.Value; myGUI.guiCrankingTimer = CrankingTimer.Value; myGUI.guiJesterResetTimer = JesterResetTimer.Value; myGUI.guiMinTimeScale = MinimumTimeScale.Value; myGUI.guiMaxTimeScale = MaximumTimeScale.Value; myGUI.guiMinBuyRate = MinimumCompanyBuyRate.Value; myGUI.guiMaxBuyRate = MaximumCompanyBuyRate.Value; hasGUISynced = true; } internal void UpdateCFGVarsFromGUI() { if (!hasGUISynced) { setGUIVars(); } HideCommandMessages.Value = myGUI.guiHideCommandMessage; HideEnemySpawnMessages.Value = myGUI.guiHideEnemySpawnMessages; ShouldEnemiesSpawnNaturally.Value = myGUI.guiShouldEnemiesSpawnNaturally; EnableAIModifiers.Value = myGUI.guiEnableAIModifiers; EnableInfiniteSprint.Value = myGUI.guiEnableInfiniteSprint; EnableInfiniteCredits.Value = myGUI.guiEnableInfiniteCredits; cfgGodMode.Value = myGUI.guiEnableGod; cfgNightVision.Value = myGUI.guiEnableNightVision; cfgSpeedHack.Value = myGUI.guiEnableSpeedHack; EnableScrapModifiers.Value = myGUI.guiEnableScrapModifiers; CustomCompanyBuyRate.Value = myGUI.guiEnableCustomBuyRate; UseRandomBuyRate.Value = myGUI.guiUseRandomBuyRate; CustomTimeScale.Value = myGUI.guiUseCustomTimeScale; UseRandomTimeScale.Value = myGUI.guiUseRandomTimeScale; EnableInfiniteDeadline.Value = myGUI.guiEnableInfiniteDeadline; CustomDeadline.Value = myGUI.guiEnableCustomDeadline; UseRandomDeadline.Value = myGUI.guiUseRandomDeadline; ServerName.Value = myGUI.guiServerName; RoundPost.Value = myGUI.guiRoundPost; XPChange.Value = int.Parse(myGUI.guiXPChange); SelectedEnemy.Value = myGUI.guiSelectedEnemy; PrefixSetting.Value = myGUI.guiPrefix; MinScrap.Value = myGUI.guiMinScrap; MaxScrap.Value = myGUI.guiMaxScrap; MinScrapValue.Value = myGUI.guiMinScrapValue; MaxScrapValue.Value = myGUI.guiMaxScrapValue; MinimumDeadline.Value = myGUI.guiMinimumDeadline; MaximumDeadline.Value = myGUI.guiMaximumDeadline; SpringSpeed.Value = myGUI.guiSpringSpeed; PopUpTimer.Value = myGUI.guiPopupTimer; MaxJesterSpeed.Value = myGUI.guiMaxJesterSpeed; CrankingTimer.Value = myGUI.guiCrankingTimer; JesterResetTimer.Value = myGUI.guiJesterResetTimer; MinimumTimeScale.Value = myGUI.guiMinTimeScale; MaximumTimeScale.Value = myGUI.guiMaxTimeScale; MinimumCompanyBuyRate.Value = myGUI.guiMinBuyRate; MaximumCompanyBuyRate.Value = myGUI.guiMaxBuyRate; } private void Update() { if (myGUI.guiSpawnButtonPressed) { SpawnEnemyWithConfigManager(myGUI.guiSelectedEnemy); } } private void SetBindings() { //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Expected O, but got Unknown //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Expected O, but got Unknown //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Expected O, but got Unknown //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_0480: Unknown result type (might be due to invalid IL or missing references) //IL_048a: Expected O, but got Unknown //IL_04bd: Unknown result type (might be due to invalid IL or missing references) //IL_04c7: Expected O, but got Unknown //IL_053a: Unknown result type (might be due to invalid IL or missing references) //IL_0544: Expected O, but got Unknown //IL_0577: Unknown result type (might be due to invalid IL or missing references) //IL_0581: Expected O, but got Unknown //IL_0609: Unknown result type (might be due to invalid IL or missing references) //IL_0613: Expected O, but got Unknown //IL_063b: Unknown result type (might be due to invalid IL or missing references) //IL_0645: Expected O, but got Unknown ServerName = ((BaseUnityPlugin)this).Config.Bind<string>("Server Settings", "Server Name", "<color=red>G</color><color=blue>a</color><color=yellow>m</color><color=green>e</color><color=orange>M</color><color=purple>a</color><color=red>s</color><color=blue>t</color><color=yellow>e</color><color=green>r</color>", "Set the server name when creating a server"); RoundPost = ((BaseUnityPlugin)this).Config.Bind<string>("Server Settings", "Round Comment", "<color=white>Start the spawns by typing '/(enemy internal name) (spawn frequency in seconds)', type /quit to stop the spawns. Good Luck!</color>", "A message that the server sends every round"); HideCommandMessages = ((BaseUnityPlugin)this).Config.Bind<bool>("Command Settings", "Hide Spawn Messages", true, "Should the server hide your commands? true will hide, false will show"); HideEnemySpawnMessages = ((BaseUnityPlugin)this).Config.Bind<bool>("Command Settings", "Hide Enemy Spawn Messages", true, "Should the server hide messages an enemy may send when it spawns? true will hide, false will show."); PrefixSetting = ((BaseUnityPlugin)this).Config.Bind<string>("Command Settings", "Command Prefix", "/", "An optional prefix for chat commands"); ShouldEnemiesSpawnNaturally = ((BaseUnityPlugin)this).Config.Bind<bool>("AI Settings", "Natural enemy spawn", true, "If true, enemies will spawn naturally. If false, enemies will spawn only when told to by this script."); SpringSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("AI Settings", "Spring Head - Speed", 100f, new ConfigDescription("Base speed for springhead", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 150f), Array.Empty<object>())); PopUpTimer = ((BaseUnityPlugin)this).Config.Bind<float>("AI Settings", "Jester - PopUp", 0.5f, new ConfigDescription("How long it takes the jester to popup", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 100f), Array.Empty<object>())); MaxJesterSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("AI Settings", "Jester - Max Speed Multiplier", 5f, new ConfigDescription("The maximum speed the jester can go, multiplier", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>())); CrankingTimer = ((BaseUnityPlugin)this).Config.Bind<float>("AI Settings", "Jester - Cranking", 0.5f, new ConfigDescription("The time it takes the jester to begin cranking", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 100f), Array.Empty<object>())); JesterResetTimer = ((BaseUnityPlugin)this).Config.Bind<float>("AI Settings", "Jester - Reset", 5000f, new ConfigDescription("The time it takes for the jester to reset when no one is in the building", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 5000f), Array.Empty<object>())); EnableAIModifiers = ((BaseUnityPlugin)this).Config.Bind<bool>("AI Settings", "Enable AI modifiers", false, "If enabled, the server will override the AI settings, if disabled, it will use default settings."); SpawnSelectedEnemy = ((BaseUnityPlugin)this).Config.Bind<bool>("Enemy Spawning", "Spawn Selected enemy", false, "On click, this will spawn the selected enemy then get set back to false. Only to be used with configuration manager."); SelectedEnemy = ((BaseUnityPlugin)this).Config.Bind<string>("Enemy Spawning", "Name of Enemy", "Spring", "Enter the name of the enemy you'd like to spawn. Can be partial, use the github or web to find a list of names. Only to be used with configuration manager."); XPChange = ((BaseUnityPlugin)this).Config.Bind<int>("Host Settings", "XP Change", 25, "Sets the amount of XP to additionally gain or lose. Can be negative."); EnableInfiniteSprint = ((BaseUnityPlugin)this).Config.Bind<bool>("Host Settings", "Enable infinite sprint", false, "If true, stamina will never deplete, if false, stamina will work as normal."); EnableInfiniteCredits = ((BaseUnityPlugin)this).Config.Bind<bool>("Host Settings", "Enable infinite credits", false, "If true, credits will always revert back to the preset value. If false, they will work as normal."); cfgGodMode = ((BaseUnityPlugin)this).Config.Bind<bool>("Host Settings", "Enable God Mode", false, "If true, you cannot die. *note if you fall down into a pit you may not be able to get out. Disabling will not kill you immediately."); cfgNightVision = ((BaseUnityPlugin)this).Config.Bind<bool>("Host Settings", "Enable Night Vision", false, "If true, you will be able to see in the dark"); cfgSpeedHack = ((BaseUnityPlugin)this).Config.Bind<bool>("Host Settings", "Enable Speed Hack", false, "If true, will enable the built in speed hack, it's very fast."); cfgGodMode.SettingChanged += godModeCFGChanged; cfgNightVision.SettingChanged += nightVisionCFGChanged; cfgSpeedHack.SettingChanged += speedHackCFGChanged; EnableScrapModifiers = ((BaseUnityPlugin)this).Config.Bind<bool>("Scrap Settings", "Enable Scrap mofifiers", false, "If enabled, will use our scrap modifiers, if disabled, will use the game generated scrap settings"); MinScrap = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap Settings", "Minimum Scap", 20, "Set the minimum pieces of scrap in the level"); MaxScrap = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap Settings", "Maximum Scap", 45, "Set the maximum pieces of scrap in the level"); MinScrapValue = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap Settings", "Minimum Scap value", 3000, "Set the minimum value of scrap in the level"); MaxScrapValue = ((BaseUnityPlugin)this).Config.Bind<int>("Scrap Settings", "Maximum Scap value", 8000, "Set the maximum value of scrap in the level"); CustomCompanyBuyRate = ((BaseUnityPlugin)this).Config.Bind<bool>("Company Scrap Buying Settings", "Override Company Buying Rate", false, "Recommended if using infinite deadline, overrides in game calculation of the company buy rate if true to use our method."); UseRandomBuyRate = ((BaseUnityPlugin)this).Config.Bind<bool>("Company Scrap Buying Settings", "Make custom buying rate Random", false, "If true, will pick a random value in between your minimum and maximum buy rate every day. If false, will use your MAXIMUM buying rate settting."); MinimumCompanyBuyRate = ((BaseUnityPlugin)this).Config.Bind<float>("Company Scrap Buying Settings", "Minimum buying rate", 0.1f, new ConfigDescription("Minimum buy rate for random", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 10f), Array.Empty<object>())); MaximumCompanyBuyRate = ((BaseUnityPlugin)this).Config.Bind<float>("Company Scrap Buying Settings", "Maximum buying rate", 1f, new ConfigDescription("Maximum buy rate for random, OR if random is off, the buy rate used every day", (AcceptableValueBase)(object)new AcceptableValueRange<float>(-1f, 10f), Array.Empty<object>())); CustomTimeScale = ((BaseUnityPlugin)this).Config.Bind<bool>("Time Settings", "Override day speed", false, "If true, will use either random speed multiplier between min and max, or if random is turned off, the maximum"); UseRandomTimeScale = ((BaseUnityPlugin)this).Config.Bind<bool>("Time Settings", "Make day speed random", false, "If true, will pick a random multiplier between the minimum and maximum, if false, will use maximum"); MinimumTimeScale = ((BaseUnityPlugin)this).Config.Bind<float>("Time Settings", "Minimum day speed", 0.1f, new ConfigDescription("Minimum speed for random day length", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>())); MaximumTimeScale = ((BaseUnityPlugin)this).Config.Bind<float>("Time Settings", "Maximum day speed", 1f, new ConfigDescription("Maximum speed for random day length, or the set value if not random", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>())); EnableInfiniteDeadline = ((BaseUnityPlugin)this).Config.Bind<bool>("Deadline settings", "Enable infinite deadline", false, "If true, the deadline will never go down and will always stay at 8 days. If false, it will drop like normal. Overrides custom deadline."); CustomDeadline = ((BaseUnityPlugin)this).Config.Bind<bool>("Deadline settings", "Override deadline", false, "If true, will use either a random deadline between the min and max, or if random is truned off, the maximum."); UseRandomDeadline = ((BaseUnityPlugin)this).Config.Bind<bool>("Deadline settings", "Use random deadline", false, "If true, will use a randomy deadline between the minimum and maximum. If false, will use maximum."); MinimumDeadline = ((BaseUnityPlugin)this).Config.Bind<int>("Deadline settings", "Minimum deadline", 1, new ConfigDescription("Minimum amount of days for random deadline", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())); MaximumDeadline = ((BaseUnityPlugin)this).Config.Bind<int>("Deadline settings", "Maximum deadline", 3, new ConfigDescription("Maximum amount of days for random deadline, or the set value if not random", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())); } private void speedHackCFGChanged(object sender, EventArgs e) { if (isHost) { toggleSpeedHack(); } } private void nightVisionCFGChanged(object sender, EventArgs e) { if (isHost) { nightVision = cfgNightVision.Value; } } private void godModeCFGChanged(object sender, EventArgs e) { if (isHost) { enableGod = cfgGodMode.Value; } } public void EnableNoClip() { if (!isHost) { return; } noClipEnabled = !noClipEnabled; mls.LogInfo((object)"noclip function called"); if (noClipEnabled) { Collider[] array = Object.FindObjectsByType<Collider>((FindObjectsInactive)0, (FindObjectsSortMode)0); Collider[] array2 = array; foreach (Collider val in array2) { val.enabled = false; } } } private static bool toggleNightVision() { if (isHost) { nightVision = !nightVision; cfgNightVision.Value = nightVision; } return nightVision; } private static bool toggleGodMode() { if (isHost) { enableGod = !enableGod; cfgGodMode.Value = enableGod; } return enableGod; } private static void toggleSpeedHack() { if (isHost) { speedHack = !playerRef.isSpeedCheating; playerRef.isSpeedCheating = speedHack; } } [HarmonyPatch(typeof(GameNetworkManager), "SteamMatchmaking_OnLobbyCreated")] [HarmonyPrefix] private static void UpdateServerSettings(ref HostSettings ___lobbyHostSettings, ref Lobby lobby) { if (ServerName.Value != "") { ___lobbyHostSettings.lobbyName = ServerName.Value; } } [HarmonyPatch(typeof(RoundManager), "Start")] [HarmonyPrefix] private static void setIsHost() { mls.LogInfo((object)("Host Status: " + ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost)); isHost = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost; } [HarmonyPatch(typeof(RoundManager), "LoadNewLevel")] [HarmonyPrefix] private static bool ModifyLevel(ref SelectableLevel newLevel) { //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Expected O, but got Unknown currentRound = RoundManager.Instance; if (!levelEnemySpawns.ContainsKey(newLevel)) { List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>(); foreach (SpawnableEnemyWithRarity enemy in newLevel.Enemies) { list.Add(enemy); } levelEnemySpawns.Add(newLevel, list); } levelEnemySpawns.TryGetValue(newLevel, out var value); newLevel.Enemies = value; foreach (SpawnableEnemyWithRarity enemy2 in newLevel.Enemies) { mls.LogInfo((object)("Inside: " + enemy2.enemyType.enemyName)); if (!enemyRaritys.ContainsKey(enemy2)) { enemyRaritys.Add(enemy2, enemy2.rarity); } int value2 = 0; enemyRaritys.TryGetValue(enemy2, out value2); enemy2.rarity = value2; } foreach (SpawnableEnemyWithRarity outsideEnemy in newLevel.OutsideEnemies) { mls.LogInfo((object)("Outside: " + outsideEnemy.enemyType.enemyName)); if (!enemyRaritys.ContainsKey(outsideEnemy)) { enemyRaritys.Add(outsideEnemy, outsideEnemy.rarity); } int value3 = 0; enemyRaritys.TryGetValue(outsideEnemy, out value3); outsideEnemy.rarity = value3; } foreach (SpawnableEnemyWithRarity enemy3 in newLevel.Enemies) { if (!enemyPropCurves.ContainsKey(enemy3)) { enemyPropCurves.Add(enemy3, enemy3.enemyType.probabilityCurve); } AnimationCurve value4 = new AnimationCurve(); enemyPropCurves.TryGetValue(enemy3, out value4); enemy3.enemyType.probabilityCurve = value4; } HUDManager.Instance.AddTextToChatOnServer("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", -1); if (RoundPost.Value != "") { HUDManager.Instance.AddTextToChatOnServer(RoundPost.Value, -1); } SelectableLevel val = newLevel; if (EnableScrapModifiers.Value) { val.minScrap = MinScrap.Value; val.maxScrap = MaxScrap.Value; val.minTotalScrapValue = MinScrapValue.Value; val.maxTotalScrapValue = MaxScrapValue.Value; } SpawnableMapObject[] spawnableMapObjects = val.spawnableMapObjects; foreach (SpawnableMapObject val2 in spawnableMapObjects) { if ((Object)(object)val2.prefabToSpawn.GetComponentInChildren<Landmine>() != (Object)null) { } } newLevel = val; return true; } [HarmonyPatch(typeof(RoundManager), "AdvanceHourAndSpawnNewBatchOfEnemies")] [HarmonyPrefix] private static void updateCurrentLevelInfo(ref EnemyVent[] ___allEnemyVents, ref SelectableLevel ___currentLevel) { currentLevel = ___currentLevel; currentLevelVents = ___allEnemyVents; } private static void SetSpawnTimer() { stuff.spawningloop = true; } private static void TurnOffTimer() { stuff.spawntimer = 0f; stuff.spawningloop = false; stuff.timerstarted = false; stuff.sw.Stop(); } [HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")] [HarmonyPrefix] private static void GameMasterCommands(HUDManager __instance) { //IL_09f2: Unknown result type (might be due to invalid IL or missing references) //IL_0a36: Unknown result type (might be due to invalid IL or missing references) //IL_0a7a: Unknown result type (might be due to invalid IL or missing references) //IL_0aeb: Unknown result type (might be due to invalid IL or missing references) //IL_0b2f: Unknown result type (might be due to invalid IL or missing references) //IL_0b73: Unknown result type (might be due to invalid IL or missing references) string text = __instance.chatTextField.text; string text2 = "/"; mls.LogInfo((object)text); if (PrefixSetting.Value != "") { text2 = PrefixSetting.Value; } if (!text.ToLower().StartsWith(text2.ToLower())) { return; } string text3 = "Default Title"; string text4 = "Default Body"; if (!isHost) { text3 = "Command"; text4 = "Unable to send command since you are not host."; HUDManager.Instance.DisplayTip(text3, text4, false, false, "LC_Tip1"); if (HideCommandMessages.Value) { __instance.chatTextField.text = ""; } return; } if (text.ToLower().StartsWith(text2 + "stop")) { TurnOffTimer(); } if (text.ToLower().StartsWith(text2 + "loop")) { stuff.spawningloop = true; text3 = "Loop Started with:"; string[] array = text.Split(new char[1] { ' ' }); text4 = array[1].ToLower(); if (array.Length == 2) { bool flag = false; string text5 = ""; foreach (SpawnableEnemyWithRarity enemy in currentLevel.Enemies) { if (enemy.enemyType.enemyName.ToLower().Contains(array[1].ToLower())) { try { stuff.enemytype = array[1].ToLower(); stuff.inside = true; SetSpawnTimer(); } catch { mls.LogInfo((object)"Could not spawn enemy"); } break; } } if (!flag) { foreach (SpawnableEnemyWithRarity outsideEnemy in currentLevel.OutsideEnemies) { if (outsideEnemy.enemyType.enemyName.ToLower().Contains(array[1].ToLower())) { try { stuff.enemytype = array[1].ToLower(); stuff.inside = false; SetSpawnTimer(); } catch (Exception ex) { mls.LogInfo((object)"Could not spawn enemy"); mls.LogInfo((object)("The game tossed an error: " + ex.Message)); } break; } } } } if (array.Length > 2) { bool flag2 = false; text3 = "Loop Started with:"; text4 = array[1].ToLower(); if (int.TryParse(array[2], out var result)) { string text6 = ""; foreach (SpawnableEnemyWithRarity enemy2 in currentLevel.Enemies) { if (enemy2.enemyType.enemyName.ToLower().Contains(array[1].ToLower())) { stuff.enemytype = array[1].ToLower(); stuff.spawnduration = result; stuff.inside = true; SetSpawnTimer(); } } if (!flag2) { foreach (SpawnableEnemyWithRarity outsideEnemy2 in currentLevel.OutsideEnemies) { if (outsideEnemy2.enemyType.enemyName.ToLower().Contains(array[1].ToLower())) { try { stuff.enemytype = array[1].ToLower(); stuff.spawnduration = result; stuff.inside = false; SetSpawnTimer(); } catch { mls.LogInfo((object)"Failed to spawn enemies, check your command."); } if (flag2) { text4 = "Spawned " + result + " " + text6 + "s"; break; } } } } } else { mls.LogInfo((object)"Failed to spawn enemies, check your command."); } mls.LogInfo((object)("Length of input array: " + array.Length)); } } if (text.ToLower().StartsWith(text2 + "spawn")) { text3 = "Spawned Enemies"; string[] array2 = text.Split(new char[1] { ' ' }); if (array2.Length == 2) { bool flag3 = false; string text7 = ""; foreach (SpawnableEnemyWithRarity enemy3 in currentLevel.Enemies) { if (enemy3.enemyType.enemyName.ToLower().Contains(array2[1].ToLower())) { try { flag3 = true; text7 = enemy3.enemyType.enemyName; SpawnEnemy(enemy3, 1, inside: true); mls.LogInfo((object)("Spawned " + enemy3.enemyType.enemyName)); } catch { mls.LogInfo((object)"Could not spawn enemy"); } text4 = "Spawned: " + text7; break; } } if (!flag3) { foreach (SpawnableEnemyWithRarity outsideEnemy3 in currentLevel.OutsideEnemies) { if (outsideEnemy3.enemyType.enemyName.ToLower().Contains(array2[1].ToLower())) { try { flag3 = true; text7 = outsideEnemy3.enemyType.enemyName; mls.LogInfo((object)outsideEnemy3.enemyType.enemyName); mls.LogInfo((object)("The index of " + outsideEnemy3.enemyType.enemyName + " is " + currentLevel.OutsideEnemies.IndexOf(outsideEnemy3))); SpawnEnemy(outsideEnemy3, 1, inside: false); mls.LogInfo((object)("Spawned " + outsideEnemy3.enemyType.enemyName)); } catch (Exception ex2) { mls.LogInfo((object)"Could not spawn enemy"); mls.LogInfo((object)("The game tossed an error: " + ex2.Message)); } text4 = "Spawned: " + text7; break; } } } } if (array2.Length > 2) { bool flag4 = false; if (int.TryParse(array2[2], out var result2)) { string text8 = ""; foreach (SpawnableEnemyWithRarity enemy4 in currentLevel.Enemies) { if (enemy4.enemyType.enemyName.ToLower().Contains(array2[1].ToLower())) { flag4 = true; text8 = enemy4.enemyType.enemyName; SpawnEnemy(enemy4, result2, inside: true); if (flag4) { text4 = "Spawned " + result2 + " " + text8 + "s"; break; } } } if (!flag4) { foreach (SpawnableEnemyWithRarity outsideEnemy4 in currentLevel.OutsideEnemies) { if (outsideEnemy4.enemyType.enemyName.ToLower().Contains(array2[1].ToLower())) { flag4 = true; text8 = outsideEnemy4.enemyType.enemyName; try { mls.LogInfo((object)("The index of " + outsideEnemy4.enemyType.enemyName + " is " + currentLevel.OutsideEnemies.IndexOf(outsideEnemy4))); SpawnEnemy(outsideEnemy4, result2, inside: false); mls.LogInfo((object)("Spawned another " + outsideEnemy4.enemyType.enemyName)); } catch { mls.LogInfo((object)"Failed to spawn enemies, check your command."); } if (flag4) { text4 = "Spawned " + result2 + " " + text8 + "s"; break; } } } } } else { mls.LogInfo((object)"Failed to spawn enemies, check your command."); } mls.LogInfo((object)("Length of input array: " + array2.Length)); } } if (text.ToLower().StartsWith(text2 + "weather")) { text3 = "Weather Change"; string[] array3 = text.Split(new char[1] { ' ' }); if (array3.Length > 1) { if (array3[1].ToLower().Contains("rain")) { currentRound.timeScript.currentLevelWeather = (LevelWeatherType)1; mls.LogInfo((object)("tried to change the weather to " + array3[1])); } if (array3[1].ToLower().Contains("eclipse")) { currentRound.timeScript.currentLevelWeather = (LevelWeatherType)5; mls.LogInfo((object)("tried to change the weather to " + array3[1])); } if (array3[1].ToLower().Contains("flood")) { currentRound.timeScript.currentLevelWeather = (LevelWeatherType)4; mls.LogInfo((object)("tried to change the weather to " + array3[1])); } if (array3[1].ToLower().Contains("dust") || array3[1].ToLower().Contains("fog") || array3[1].ToLower().Contains("mist")) { currentRound.timeScript.currentLevelWeather = (LevelWeatherType)0; mls.LogInfo((object)("tried to change the weather to " + array3[1])); } if (array3[1].ToLower().Contains("storm")) { currentRound.timeScript.currentLevelWeather = (LevelWeatherType)2; mls.LogInfo((object)("tried to change the weather to " + array3[1])); } if (array3[1].ToLower().Contains("none")) { currentRound.timeScript.currentLevelWeather = (LevelWeatherType)(-1); mls.LogInfo((object)("tried to change the weather to " + array3[1])); } text4 = "tried to change the weather to " + array3[1]; } } if (text.ToLower().StartsWith(text2 + "togglelights")) { BreakerBox val = Object.FindObjectOfType<BreakerBox>(); if ((Object)(object)val != (Object)null) { text3 = "Light Change"; if (val.isPowerOn) { currentRound.TurnBreakerSwitchesOff(); currentRound.TurnOnAllLights(false); val.isPowerOn = false; text4 = "Turned the lights off"; } else { currentRound.PowerSwitchOnClientRpc(); text4 = "Turned the lights on"; } } } if (text.ToLower().StartsWith(text2 + "buy")) { text3 = "Item Buying"; Terminal val2 = Object.FindObjectOfType<Terminal>(); if ((Object)(object)val2 != (Object)null) { List<string> list = new List<string> { "Walkie-Talkie", "Pro Flashlight", "Normal Flashlight", "Shovel", "Lockpicker", "Stun Grenade", "Boom Box", "Inhaler", "Stun Gun", "Jet Pack", "Extension Ladder", "Radar Booster" }; Dictionary<string, int> dictionary = new Dictionary<string, int> { { "Walkie-Talkie", 0 }, { "Pro Flashlight", 4 }, { "Normal Flashlight", 1 }, { "Shovel", 2 }, { "Lockpicker", 3 }, { "Stun Grenade", 5 }, { "Boom Box", 6 }, { "Inhaler", 7 }, { "Stun Gun", 8 }, { "Jet Pack", 9 }, { "Extension Ladder", 10 }, { "Radar Booster", 11 } }; string[] array4 = text.Split(new char[1] { ' ' }); if (array4.Length > 1) { bool flag5 = false; if (array4.Length > 2) { if (!int.TryParse(array4[2], out var result3)) { mls.LogInfo((object)("Couldn't parse command [ " + array4[2] + " ]")); if (HideCommandMessages.Value) { __instance.chatTextField.text = ""; } return; } foreach (string item in list) { if (item.ToLower().Contains(array4[1])) { flag5 = true; List<int> list2 = new List<int>(); for (int i = 0; i < result3; i++) { list2.Add(dictionary[item]); } mls.LogInfo((object)list2.Count()); val2.BuyItemsServerRpc(list2.ToArray(), val2.groupCredits, 0); text4 = "Bought " + result3 + " " + item + "s"; break; } } if (!flag5) { mls.LogInfo((object)("Couldn't figure out what [ " + array4[1] + " ] was.")); if (HideCommandMessages.Value) { __instance.chatTextField.text = ""; } return; } } if (!flag5) { bool flag6 = false; foreach (string item2 in list) { if (item2.ToLower().Contains(array4[1])) { flag6 = true; int[] array5 = new int[1] { dictionary[item2] }; val2.BuyItemsServerRpc(array5, val2.groupCredits, 0); text4 = "Bought " + 1 + " " + item2; } } if (!flag6) { mls.LogInfo((object)("Couldn't figure out what [ " + array4[1] + " ] was. Trying via int parser.")); } if (!int.TryParse(array4[1], out var result4)) { mls.LogInfo((object)("Couldn't figure out what [ " + array4[1] + " ] was. Int parser failed, please try again.")); if (HideCommandMessages.Value) { __instance.chatTextField.text = ""; } return; } int[] array6 = new int[1] { result4 }; val2.BuyItemsServerRpc(array6, val2.groupCredits, 0); text4 = "Bought item with ID [" + result4 + "]"; } } } } if (text.ToLower().Contains("god")) { cfgGodMode.Value = !cfgGodMode.Value; hasGUISynced = false; text3 = "God Mode"; text4 = "God Mode set to: " + enableGod; } if (text.ToLower().Contains("night") || text.ToLower().Contains("vision")) { text4 = ((!toggleNightVision()) ? "Disabled Night Vision" : "Enabled Night Vision"); text3 = "Night Vision"; hasGUISynced = false; } if (text.ToLower().Contains("speed")) { cfgSpeedHack.Value = !cfgSpeedHack.Value; hasGUISynced = false; text4 = "Speed hack set to: " + speedHack; text3 = "Speed hack"; } HUDManager.Instance.DisplayTip(text3, text4, false, false, "LC_Tip1"); if (HideCommandMessages.Value) { __instance.chatTextField.text = ""; } } private static void SpawnEnemyWithConfigManager(string enemyName) { if (!isHost) { return; } mls.LogInfo((object)"CFGMGR tried to spawn an enemy"); bool flag = false; string text = ""; foreach (SpawnableEnemyWithRarity enemy in currentLevel.Enemies) { if (enemy.enemyType.enemyName.ToLower().Contains(enemyName.ToLower())) { try { flag = true; text = enemy.enemyType.enemyName; SpawnEnemy(enemy, 1, inside: true); mls.LogInfo((object)("Spawned " + enemy.enemyType.enemyName)); } catch { mls.LogInfo((object)"Could not spawn enemy"); } break; } } if (flag) { return; } foreach (SpawnableEnemyWithRarity outsideEnemy in currentLevel.OutsideEnemies) { if (outsideEnemy.enemyType.enemyName.ToLower().Contains(enemyName.ToLower())) { try { flag = true; text = outsideEnemy.enemyType.enemyName; mls.LogInfo((object)outsideEnemy.enemyType.enemyName); mls.LogInfo((object)("The index of " + outsideEnemy.enemyType.enemyName + " is " + currentLevel.OutsideEnemies.IndexOf(outsideEnemy))); SpawnEnemy(outsideEnemy, 1, inside: false); mls.LogInfo((object)("Spawned " + outsideEnemy.enemyType.enemyName)); break; } catch (Exception ex) { mls.LogInfo((object)"Could not spawn enemy"); mls.LogInfo((object)("The game tossed an error: " + ex.Message)); break; } } } } public static void SpawnEnemy(SpawnableEnemyWithRarity enemy, int amount, bool inside) { //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (!isHost) { return; } mls.LogInfo((object)"Got to the main SpawnEnemy function"); if (inside) { try { for (int i = 0; i < amount; i++) { currentRound.SpawnEnemyOnServer(currentRound.allEnemyVents[Random.Range(0, currentRound.allEnemyVents.Length)].floorNode.position, currentRound.allEnemyVents[i].floorNode.eulerAngles.y, currentLevel.Enemies.IndexOf(enemy)); } return; } catch { mls.LogInfo((object)"Failed to spawn enemies, check your command."); return; } } for (int j = 0; j < amount; j++) { mls.LogInfo((object)("Spawned an enemy. Total Spawned: " + j)); GameObject val = Object.Instantiate<GameObject>(currentLevel.OutsideEnemies[currentLevel.OutsideEnemies.IndexOf(enemy)].enemyType.enemyPrefab, GameObject.FindGameObjectsWithTag("OutsideAINode")[Random.Range(0, GameObject.FindGameObjectsWithTag("OutsideAINode").Length - 1)].transform.position, Quaternion.Euler(Vector3.zero)); val.gameObject.GetComponentInChildren<NetworkObject>().Spawn(true); } } [HarmonyPatch(typeof(RoundManager), "SpawnEnemyFromVent")] [HarmonyPrefix] private static void logSpawnEnemyFromVent() { mls.LogInfo((object)"Attempting to spawn an enemy"); } [HarmonyPatch(typeof(RoundManager), "EnemyCannotBeSpawned")] [HarmonyPrefix] private static bool OverrideCannotSpawn() { return false; } [HarmonyPatch(typeof(DressGirlAI), "Start")] [HarmonyPrefix] private static void IncreaseHaunt(ref float ___hauntInterval) { if (isHost && EnableAIModifiers.Value) { ___hauntInterval = 2f; if (!HideEnemySpawnMessages.Value) { HUDManager.Instance.AddTextToChatOnServer("<color=red>Demon spawned.</color>", -1); } } } [HarmonyPatch(typeof(DressGirlAI), "BeginChasing")] [HarmonyPostfix] private static void IncreaseChaseTimer(ref int ___currentBehaviourStateIndex, ref float ___chaseTimer) { if (isHost && EnableAIModifiers.Value) { ___chaseTimer = 60f; } } [HarmonyPatch(typeof(SpringManAI), "Update")] [HarmonyPrefix] private static void IncreaseSpring(ref float ___currentChaseSpeed, ref float ___currentAnimSpeed) { if (isHost && !EnableAIModifiers.Value) { ___currentChaseSpeed = SpringSpeed.Value; } } [HarmonyPatch(typeof(JesterAI), "SetJesterInitialValues")] [HarmonyPostfix] private static void JesterDangerous(ref float ___popUpTimer, ref float ___beginCrankingTimer, ref float ___noPlayersToChaseTimer, ref float ___maxAnimSpeed) { if (EnableAIModifiers.Value && isHost) { ___popUpTimer = PopUpTimer.Value; ___beginCrankingTimer = CrankingTimer.Value; ___noPlayersToChaseTimer = JesterResetTimer.Value; ___maxAnimSpeed = MaxJesterSpeed.Value; if (!HideEnemySpawnMessages.Value) { HUDManager.Instance.AddTextToChatOnServer("<color=blue>Boing.</color>", -1); } } } [HarmonyPatch(typeof(JesterAI), "Update")] [HarmonyPrefix] private static void RemoveRewind(ref float ___noPlayersToChaseTimer) { if (EnableAIModifiers.Value && isHost) { ___noPlayersToChaseTimer = JesterResetTimer.Value; } } [HarmonyPatch(typeof(CrawlerAI), "HitEnemy")] [HarmonyPrefix] private static void PatchThumperDeath() { } [HarmonyPatch(typeof(CrawlerAI), "Start")] [HarmonyPrefix] private static void ThumperSpeed(ref float ___agentSpeedWithNegative, ref float ___maxSearchAndRoamRadius) { if (EnableAIModifiers.Value && isHost) { ___maxSearchAndRoamRadius = 300f; if (!HideEnemySpawnMessages.Value) { HUDManager.Instance.AddTextToChatOnServer("<color=red> >:) </color>", -1); } } } } public class Commandloop : MonoBehaviour { private static void Spawnthing() { bool flag = false; foreach (SpawnableEnemyWithRarity enemy in TestMod.currentLevel.Enemies) { if (enemy.enemyType.enemyName.ToLower().Contains(stuff.enemytype)) { try { flag = true; TestMod.SpawnEnemy(enemy, 1, inside: true); } catch { TestMod.mls.LogInfo((object)"Could not spawn enemy"); } break; } } if (flag) { return; } foreach (SpawnableEnemyWithRarity outsideEnemy in TestMod.currentLevel.OutsideEnemies) { if (outsideEnemy.enemyType.enemyName.ToLower().Contains(stuff.enemytype)) { TestMod.SpawnEnemy(outsideEnemy, 1, inside: false); break; } } } private void Update() { if (!stuff.spawningloop) { return; } if (!stuff.timerstarted) { stuff.timerstarted = true; return; } stuff.spawntimer += Time.deltaTime; if (stuff.spawntimer >= stuff.spawnduration) { HUDManager.Instance.DisplayTip("Spawning thing", stuff.enemytype.ToString(), false, false, "LC_Tip1"); stuff.spawntimer = 0f; Spawnthing(); } } } } namespace LethalCompanyTestMod.Patches { [HarmonyPatch(typeof(PlayerControllerB))] public class PlayerControllerBPatch { [HarmonyPatch("Update")] [HarmonyPrefix] private static void patchControllerUpdate() { TestMod.myGUI.guiIsHost = TestMod.isHost; TestMod.Instance.UpdateCFGVarsFromGUI(); } [HarmonyPatch("Start")] [HarmonyPrefix] private static void getNightVision(ref PlayerControllerB __instance) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) TestMod.playerRef = __instance; TestMod.nightVision = ((Behaviour)TestMod.playerRef.nightVision).enabled; TestMod.nightVisionIntensity = TestMod.playerRef.nightVision.intensity; TestMod.nightVisionColor = TestMod.playerRef.nightVision.color; TestMod.nightVisionRange = TestMod.playerRef.nightVision.range; TestMod.playerRef.nightVision.color = Color.green; TestMod.playerRef.nightVision.intensity = 1000f; TestMod.playerRef.nightVision.range = 10000f; } [HarmonyPatch("SetNightVisionEnabled")] [HarmonyPostfix] private static void updateNightVision() { //IL_0058: 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) if (TestMod.nightVision) { TestMod.playerRef.nightVision.color = Color.green; TestMod.playerRef.nightVision.intensity = 1000f; TestMod.playerRef.nightVision.range = 10000f; } else { TestMod.playerRef.nightVision.color = TestMod.nightVisionColor; TestMod.playerRef.nightVision.intensity = TestMod.nightVisionIntensity; TestMod.playerRef.nightVision.range = TestMod.nightVisionRange; } ((Behaviour)TestMod.playerRef.nightVision).enabled = true; } [HarmonyPatch("AllowPlayerDeath")] [HarmonyPrefix] private static bool OverrideDeath() { if (!TestMod.isHost) { return true; } return !TestMod.enableGod; } [HarmonyPatch("Update")] [HarmonyPostfix] private static void InfiniteSprint(ref float ___sprintMeter) { if (TestMod.EnableInfiniteSprint.Value && TestMod.isHost) { Mathf.Clamp(___sprintMeter += 0.02f, 0f, 1f); } } } } namespace LethalCompanyTestMod.Component { internal class GUILoader : MonoBehaviour { private KeyboardShortcut openCloseMenu; private bool isMenuOpen; public bool noClipButton; internal bool wasKeyDown; private int toolbarInt = 0; private string[] toolbarStrings = new string[4] { "AI Modification/Spawning", "Host Settings", "Time Settings", "Scrap Settings" }; private int MENUWIDTH = 600; private int MENUHEIGHT = 800; private int MENUX; private int MENUY; private int ITEMWIDTH = 300; private int CENTERX; public bool guiHideCommandMessage; public bool guiHideEnemySpawnMessages; public bool guiShouldEnemiesSpawnNaturally; public bool guiEnableAIModifiers; public bool guiEnableInfiniteSprint; public bool guiEnableInfiniteCredits; public bool guiEnableGod; public bool guiEnableNightVision; public bool guiEnableSpeedHack; public bool guiEnableScrapModifiers; public bool guiEnableCustomBuyRate; public bool guiUseRandomBuyRate; public bool guiUseCustomTimeScale; public bool guiUseRandomTimeScale; public bool guiEnableInfiniteDeadline; public bool guiEnableCustomDeadline; public bool guiUseRandomDeadline; public bool guiSpawnButtonPressed; public string guiServerName; public string guiRoundPost; public string guiXPChange; public string guiSelectedEnemy; public string guiPrefix; public int guiMinScrap; public int guiMaxScrap; public int guiMinScrapValue; public int guiMaxScrapValue; public int guiMinimumDeadline; public int guiMaximumDeadline; public float guiSpringSpeed; public float guiPopupTimer; public float guiMaxJesterSpeed; public float guiCrankingTimer; public float guiJesterResetTimer; public float guiMinTimeScale; public float guiMaxTimeScale; public float guiMinBuyRate; public float guiMaxBuyRate; private GUIStyle menuStyle; private GUIStyle buttonStyle; private GUIStyle labelStyle; private GUIStyle toggleStyle; private GUIStyle hScrollStyle; public bool guiIsHost; private void Awake() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) TestMod.mls.LogInfo((object)"GUILoader loaded."); openCloseMenu = new KeyboardShortcut((KeyCode)277, 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() { TestMod.mls.LogInfo((object)"The GUILoader was destroyed :("); } public void Update() { if (((KeyboardShortcut)(ref openCloseMenu)).IsDown() && !wasKeyDown) { wasKeyDown = 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0174: 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_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_0305: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_040f: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0475: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Unknown result type (might be due to invalid IL or missing references) //IL_04e2: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Unknown result type (might be due to invalid IL or missing references) //IL_0563: Unknown result type (might be due to invalid IL or missing references) //IL_059a: Unknown result type (might be due to invalid IL or missing references) //IL_05cf: Unknown result type (might be due to invalid IL or missing references) //IL_0606: Unknown result type (might be due to invalid IL or missing references) //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_067d: Unknown result type (might be due to invalid IL or missing references) //IL_06be: Unknown result type (might be due to invalid IL or missing references) //IL_06ff: Unknown result type (might be due to invalid IL or missing references) //IL_0740: Unknown result type (might be due to invalid IL or missing references) //IL_0786: Unknown result type (might be due to invalid IL or missing references) //IL_07c4: Unknown result type (might be due to invalid IL or missing references) //IL_0802: Unknown result type (might be due to invalid IL or missing references) //IL_0842: Unknown result type (might be due to invalid IL or missing references) //IL_0889: Unknown result type (might be due to invalid IL or missing references) //IL_08ca: Unknown result type (might be due to invalid IL or missing references) //IL_0911: Unknown result type (might be due to invalid IL or missing references) //IL_0953: Unknown result type (might be due to invalid IL or missing references) //IL_0994: Unknown result type (might be due to invalid IL or missing references) //IL_09d4: Unknown result type (might be due to invalid IL or missing references) //IL_0a1b: Unknown result type (might be due to invalid IL or missing references) //IL_0a5a: Unknown result type (might be due to invalid IL or missing references) //IL_0aa1: Unknown result type (might be due to invalid IL or missing references) //IL_0ae3: Unknown result type (might be due to invalid IL or missing references) //IL_0b21: Unknown result type (might be due to invalid IL or missing references) //IL_0b5e: Unknown result type (might be due to invalid IL or missing references) //IL_0ba5: Unknown result type (might be due to invalid IL or missing references) //IL_0be4: Unknown result type (might be due to invalid IL or missing references) //IL_0c2b: Unknown result type (might be due to invalid IL or missing references) //IL_0c6b: Unknown result type (might be due to invalid IL or missing references) //IL_0cab: Unknown result type (might be due to invalid IL or missing references) //IL_0cf2: Unknown result type (might be due to invalid IL or missing references) //IL_0d33: Unknown result type (might be due to invalid IL or missing references) //IL_0d7a: Unknown result type (might be due to invalid IL or missing references) //IL_0dbb: Unknown result type (might be due to invalid IL or missing references) //IL_0e02: Unknown result type (might be due to invalid IL or missing references) //IL_0e43: Unknown result type (might be due to invalid IL or missing references) //IL_0e8a: 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), "GameMaster", menuStyle); toolbarInt = GUI.Toolbar(new Rect((float)MENUX, (float)(MENUY - 30), (float)MENUWIDTH, 30f), toolbarInt, toolbarStrings, buttonStyle); switch (toolbarInt) { case 0: guiSelectedEnemy = GUI.TextField(new Rect((float)(MENUX + (MENUWIDTH / 2 - ITEMWIDTH)), (float)(MENUY + 30), (float)ITEMWIDTH, 30f), guiSelectedEnemy); guiSpawnButtonPressed = GUI.Button(new Rect((float)(MENUX + MENUWIDTH / 2), (float)(MENUY + 30), (float)ITEMWIDTH, 30f), "Spawn Enemy", buttonStyle); guiSpringSpeed = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 160), (float)ITEMWIDTH, 30f), guiSpringSpeed, 0.1f, 150f); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 130), (float)ITEMWIDTH, 30f), "Speed of the CoilHead " + guiSpringSpeed, labelStyle); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 200), (float)ITEMWIDTH, 30f), "Jester Popup speed " + guiPopupTimer, labelStyle); guiPopupTimer = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 230), (float)ITEMWIDTH, 30f), guiPopupTimer, 0.1f, 100f); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 270), (float)ITEMWIDTH, 30f), "Jester cranking speed " + guiCrankingTimer, labelStyle); guiCrankingTimer = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 300), (float)ITEMWIDTH, 30f), guiCrankingTimer, 0.1f, 10f); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 340), (float)ITEMWIDTH, 30f), "Jester reset speed " + guiJesterResetTimer, labelStyle); guiJesterResetTimer = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 370), (float)ITEMWIDTH, 30f), guiJesterResetTimer, 5f, 5000f); guiEnableAIModifiers = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 410), (float)ITEMWIDTH, 30f), guiEnableAIModifiers, "Enable AI Modifications", toggleStyle); guiShouldEnemiesSpawnNaturally = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 440), (float)ITEMWIDTH, 30f), guiShouldEnemiesSpawnNaturally, "Should Enemies Spawn Naturally", toggleStyle); break; case 1: GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 30), (float)ITEMWIDTH, 30f), "Server Name", labelStyle); guiServerName = GUI.TextField(new Rect((float)CENTERX, (float)(MENUY + 60), (float)ITEMWIDTH, 30f), guiServerName); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 100), (float)ITEMWIDTH, 30f), "Server Message", labelStyle); guiRoundPost = GUI.TextField(new Rect((float)CENTERX, (float)(MENUY + 130), (float)ITEMWIDTH, 30f), guiRoundPost); guiHideCommandMessage = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 170), (float)ITEMWIDTH, 30f), guiHideCommandMessage, "Hide Command Messages", toggleStyle); guiHideEnemySpawnMessages = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 200), (float)ITEMWIDTH, 30f), guiHideEnemySpawnMessages, "Hide Enemy Spawn Messages", toggleStyle); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 230), (float)ITEMWIDTH, 30f), "Command Prefix", labelStyle); guiPrefix = GUI.TextField(new Rect((float)CENTERX, (float)(MENUY + 260), (float)ITEMWIDTH, 30f), guiPrefix); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 300), (float)ITEMWIDTH, 30f), "XP Change", labelStyle); guiXPChange = GUI.TextField(new Rect((float)CENTERX, (float)(MENUY + 330), (float)ITEMWIDTH, 30f), guiXPChange); guiEnableInfiniteSprint = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 360), (float)ITEMWIDTH, 30f), guiEnableInfiniteSprint, "Infinite Sprint", toggleStyle); guiEnableInfiniteCredits = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 390), (float)ITEMWIDTH, 30f), guiEnableInfiniteCredits, "Infinite Credits", toggleStyle); guiEnableGod = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 420), (float)ITEMWIDTH, 30f), guiEnableGod, "God Mode", toggleStyle); guiEnableNightVision = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 450), (float)ITEMWIDTH, 30f), guiEnableNightVision, "NightVision", toggleStyle); guiEnableSpeedHack = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 480), (float)ITEMWIDTH, 30f), guiEnableSpeedHack, "SpeedHack", toggleStyle); break; case 2: guiEnableInfiniteDeadline = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 30), (float)(ITEMWIDTH + 100), 30f), guiEnableInfiniteDeadline, "Infinite Deadline(overrides all deadline settings)", toggleStyle); guiEnableCustomDeadline = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 60), (float)ITEMWIDTH, 30f), guiEnableCustomDeadline, "Custom Deadline", toggleStyle); guiUseRandomDeadline = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 90), (float)ITEMWIDTH, 30f), guiUseRandomDeadline, "Random Deadline", toggleStyle); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 130), (float)ITEMWIDTH, 30f), "Minimum Deadline " + guiMinimumDeadline, labelStyle); guiMinimumDeadline = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 160), (float)ITEMWIDTH, 30f), (float)guiMinimumDeadline, 1f, 20f); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 200), (float)ITEMWIDTH, 30f), "Maximum Deadline " + guiMaximumDeadline, labelStyle); guiMaximumDeadline = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 230), (float)ITEMWIDTH, 30f), (float)guiMaximumDeadline, 1f, 20f); guiUseCustomTimeScale = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 270), (float)ITEMWIDTH, 30f), guiUseCustomTimeScale, "Custom Timescale", toggleStyle); guiUseRandomTimeScale = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 300), (float)ITEMWIDTH, 30f), guiUseRandomTimeScale, "Random Timescale", toggleStyle); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 330), (float)ITEMWIDTH, 30f), "Minimum Timescale " + guiMinTimeScale, labelStyle); guiMinTimeScale = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 360), (float)ITEMWIDTH, 30f), guiMinTimeScale, 0.1f, 10f); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 400), (float)ITEMWIDTH, 30f), "Maximum Timescale " + guiMaxTimeScale, labelStyle); guiMaxTimeScale = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 430), (float)ITEMWIDTH, 30f), guiMaxTimeScale, 0.1f, 10f); break; case 3: guiEnableCustomBuyRate = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 30), (float)ITEMWIDTH, 30f), guiEnableCustomBuyRate, "Custom Buyrate", toggleStyle); guiUseRandomBuyRate = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 60), (float)ITEMWIDTH, 30f), guiUseRandomBuyRate, "Random Buyrate", toggleStyle); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 110), (float)ITEMWIDTH, 30f), "Min Buy Rate " + guiMinBuyRate, labelStyle); guiMinBuyRate = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 140), (float)ITEMWIDTH, 30f), guiMinBuyRate, -1f, 10f); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 180), (float)ITEMWIDTH, 30f), "Max Buy Rate " + guiMaxBuyRate, labelStyle); guiMaxBuyRate = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 210), (float)ITEMWIDTH, 30f), guiMaxBuyRate, -1f, 10f); guiEnableScrapModifiers = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 260), (float)ITEMWIDTH, 30f), guiEnableScrapModifiers, "Enable Scrap Modifiers", toggleStyle); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 310), (float)ITEMWIDTH, 30f), "Minimum Amount of Scrap " + guiMinScrap, labelStyle); guiMinScrap = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 340), (float)ITEMWIDTH, 30f), (float)guiMinScrap, 0f, 500f); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 380), (float)ITEMWIDTH, 30f), "Maximum Amount of Scrap " + guiMaxScrap, labelStyle); guiMaxScrap = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 410), (float)ITEMWIDTH, 30f), (float)guiMaxScrap, 0f, 500f); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 450), (float)ITEMWIDTH, 30f), "Min Scrap Value " + guiMinScrapValue, labelStyle); guiMinScrapValue = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 480), (float)ITEMWIDTH, 30f), (float)guiMinScrapValue, 0f, 100000f); GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 520), (float)ITEMWIDTH, 30f), "Max Scrap Value " + guiMaxScrapValue, labelStyle); guiMaxScrapValue = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 550), (float)ITEMWIDTH, 30f), (float)guiMaxScrapValue, 0f, 100000f); break; } } } } }