Decompiled source of CrowdControl LethalCompany v1.1.16
BepInEx/plugins/CrowdControl.dll
Decompiled 3 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.Net; using System.Net.Sockets; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Threading; using BepInEx; using BepInEx.Logging; using BepinControl; using ControlValley; using GameNetcodeStuff; using HarmonyLib; using Newtonsoft.Json; using TMPro; using TerminalApi; using TerminalApi.Classes; using TerminalApi.Events; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("Lethal Company Crowd Control")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("Lethal Company Crowd Control")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("d4f6b961-e8ae-4e4b-950c-37644e42d4ca")] [assembly: AssemblyFileVersion("1.1.16")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyVersion("1.1.16.0")] namespace BepinControl { [BepInPlugin("WarpWorld.CrowdControl", "Crowd Control", "1.1.16")] public class LethalCompanyControl : BaseUnityPlugin { private const string modGUID = "WarpWorld.CrowdControl"; private const string modName = "Crowd Control"; private const string modVersion = "1.1.16"; public static string tsVersion = "1.1.16"; public static Dictionary<string, (string name, string conn)> version = new Dictionary<string, (string, string)>(); private readonly Harmony harmony = new Harmony("WarpWorld.CrowdControl"); public static Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>> levelEnemySpawns; public static Dictionary<SpawnableEnemyWithRarity, int> enemyRaritys; public static Dictionary<SpawnableEnemyWithRarity, AnimationCurve> enemyPropCurves; public static Dictionary<string, GameObject> loadedMapHazards; public static List<TerminalAccessibleObject> levelSecDoors; public static List<SpikeRoofTrap> levelSpikeTraps; private static List<GameObject> spawnedHazards = new List<GameObject>(); public static ManualLogSource mls; public static GameObject SpikeHazardObj; public static GameObject TurretObj; public static GameObject LandminePrefab; public static SelectableLevel currentLevel; public static EnemyVent[] currentLevelVents; public static RoundManager currentRound; public static StartOfRound currentStart; private static SpawnableEnemyWithRarity jesterRef; public static bool noClipEnabled; public static bool enableGod; public static bool nightVision; public static bool infSprint; public static PlayerControllerB playerRef; public static bool speedHack; public static float nightVisionIntensity; public static float oldJetpackRefSpeed; public static float nightVisionRange; public static Color nightVisionColor; private static bool hasGUISynced = false; internal static bool isHost = false; internal static LethalCompanyControl Instance = null; private ControlClient client; public static bool test = false; public static uint msgid = 0u; public static uint msgid2 = 0u; public static uint msgid3 = 0u; public static uint verwait = 0u; public static uint floodtime = 0u; public static Queue<Action> ActionQueue = new Queue<Action>(); private void Awake() { //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Expected O, but got Unknown Instance = this; mls = Logger.CreateLogSource("Crowd Control"); mls.LogInfo((object)"Loaded WarpWorld.CrowdControl. Patching."); harmony.PatchAll(typeof(LethalCompanyControl)); mls.LogInfo((object)"Initializing Crowd Control"); try { client = new ControlClient(); new Thread(client.NetworkLoop).Start(); new Thread(client.RequestLoop).Start(); } catch (Exception ex) { mls.LogInfo((object)("CC Init Error: " + ex.ToString())); } mls.LogInfo((object)"Crowd Control Initialized"); mls = ((BaseUnityPlugin)this).Logger; enemyRaritys = new Dictionary<SpawnableEnemyWithRarity, int>(); levelEnemySpawns = new Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>>(); enemyPropCurves = new Dictionary<SpawnableEnemyWithRarity, AnimationCurve>(); noClipEnabled = false; enableGod = false; infSprint = false; Events.TerminalBeginUsing += new TerminalEventHandler(OnBeginUsing); } private void OnBeginUsing(object sender, TerminalEventArgs e) { HUDManager.Instance.AddTextToChatOnServer("<size=0>/cc_vercheck</size>", -1); } private static string OnCCVersion() { string text = "Checking Crowd Control Versions...\n\n"; foreach (KeyValuePair<string, (string, string)> item in version) { text = text + item.Key + ": version " + item.Value.Item1 + " Live: " + item.Value.Item2 + "\n"; } return text; } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPrefix] private static void startRound() { PatchMonsterSpawns(); currentStart = StartOfRound.Instance; } [HarmonyPatch(typeof(RoundManager), "Start")] [HarmonyPriority(300)] [HarmonyPrefix] public static void PatchMonsterSpawns() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown EnemyAI[] array = Resources.FindObjectsOfTypeAll<EnemyAI>(); foreach (EnemyAI val in array) { SpawnableEnemyWithRarity val2 = new SpawnableEnemyWithRarity(); val2.enemyType = val.enemyType; val2.enemyType.enemyName = val.enemyType.enemyName; val2.enemyType.enemyPrefab = val.enemyType.enemyPrefab; ((Object)val2.enemyType).name = ((Object)val.enemyType).name; mls.LogInfo((object)("Enemy Name: " + ((Object)val.enemyType).name + ", Alternate Name: " + val.enemyType.enemyName)); val2.rarity = 0; if (!RoundManager.Instance.currentLevel.Enemies.Contains(val2)) { if (val2.enemyType.isOutsideEnemy) { RoundManager.Instance.currentLevel.OutsideEnemies.Add(val2); } else { RoundManager.Instance.currentLevel.Enemies.Add(val2); } } } mls.LogInfo((object)"Crowd Control has Patched Enemy Spawns."); } [HarmonyPatch(typeof(RoundManager), "Start")] [HarmonyPrefix] public static void SetIsHost() { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown isHost = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost; verwait = 30u; TerminalApi.AddCommand("crowdcontrol", new CommandInfo { Category = "other", Description = "Checks crowd control version.", DisplayTextSupplier = OnCCVersion }, (string)null, true); } [HarmonyPatch(typeof(RoundManager), "LoadNewLevel")] [HarmonyPrefix] private static bool ModifyLevel(ref SelectableLevel newLevel) { //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Expected O, but got Unknown currentRound = RoundManager.Instance; PatchMonsterSpawns(); 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) { 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) { 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); return true; } [HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")] [HarmonyPostfix] public static void DespawnAllProps(RoundManager __instance) { foreach (GameObject spawnedHazard in spawnedHazards) { if ((Object)(object)spawnedHazard != (Object)null && spawnedHazard.gameObject.GetComponent<NetworkObject>().IsSpawned) { spawnedHazard.gameObject.GetComponent<NetworkObject>().Despawn(true); } else { Object.Destroy((Object)(object)spawnedHazard); } } spawnedHazards.Clear(); } [HarmonyPatch(typeof(RoundManager), "AdvanceHourAndSpawnNewBatchOfEnemies")] [HarmonyPrefix] private static void updateCurrentLevelInfo(ref EnemyVent[] ___allEnemyVents, ref SelectableLevel ___currentLevel) { currentLevel = ___currentLevel; currentLevelVents = ___allEnemyVents; } [HarmonyPatch(typeof(RoundManager), "Update")] [HarmonyPrefix] private static void roundUpdate() { if (CrowdDelegates.givedelay != 0) { CrowdDelegates.givedelay--; } if (verwait != 0) { verwait--; } if (ActionQueue.Count > 0) { ActionQueue.Dequeue()(); } lock (BuffThread.threads) { foreach (BuffThread thread in BuffThread.threads) { if (!thread.paused) { thread.buff.tick(); } } } } private static IEnumerator getVersions() { version.Clear(); HUDManager.Instance.AddTextToChatOnServer("<size=0>/cc_vercheck</size>", -1); yield return (object)new WaitForSeconds(0.5f); foreach (KeyValuePair<string, (string, string)> item in version) { mls.LogError((object)$"{item.Key} is running LC Crowd Control version {item.Value}"); } } private static IEnumerator getTermVersions() { version.Clear(); HUDManager.Instance.AddTextToChatOnServer("<size=0>/cc_vercheck</size>", -1); yield return (object)new WaitForSeconds(0.5f); } [HarmonyPatch(typeof(HUDManager), "AddChatMessage")] [HarmonyPrefix] private static bool CrowdControlCommands(HUDManager __instance, string chatMessage) { //IL_1a6b: Unknown result type (might be due to invalid IL or missing references) //IL_1a71: Invalid comparison between Unknown and I4 //IL_07e4: Unknown result type (might be due to invalid IL or missing references) //IL_07ea: Unknown result type (might be due to invalid IL or missing references) //IL_1adf: Unknown result type (might be due to invalid IL or missing references) //IL_1aee: Unknown result type (might be due to invalid IL or missing references) //IL_1af4: Invalid comparison between Unknown and I4 //IL_1a87: Unknown result type (might be due to invalid IL or missing references) //IL_19e5: Unknown result type (might be due to invalid IL or missing references) //IL_19ea: Unknown result type (might be due to invalid IL or missing references) //IL_19f1: Unknown result type (might be due to invalid IL or missing references) //IL_19fe: Unknown result type (might be due to invalid IL or missing references) //IL_1a04: Unknown result type (might be due to invalid IL or missing references) //IL_1a0e: Unknown result type (might be due to invalid IL or missing references) //IL_1a13: Unknown result type (might be due to invalid IL or missing references) //IL_1a1f: Unknown result type (might be due to invalid IL or missing references) //IL_0cac: Unknown result type (might be due to invalid IL or missing references) //IL_0cb8: Unknown result type (might be due to invalid IL or missing references) //IL_0cc2: Unknown result type (might be due to invalid IL or missing references) //IL_0cc7: Unknown result type (might be due to invalid IL or missing references) //IL_0cd3: Unknown result type (might be due to invalid IL or missing references) //IL_0cdd: Unknown result type (might be due to invalid IL or missing references) //IL_0ce2: Unknown result type (might be due to invalid IL or missing references) //IL_0ce7: Unknown result type (might be due to invalid IL or missing references) //IL_0cee: 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_0cf8: Unknown result type (might be due to invalid IL or missing references) //IL_0d00: Unknown result type (might be due to invalid IL or missing references) //IL_0d05: Unknown result type (might be due to invalid IL or missing references) //IL_0d07: Unknown result type (might be due to invalid IL or missing references) //IL_0d09: Unknown result type (might be due to invalid IL or missing references) //IL_0d0b: Unknown result type (might be due to invalid IL or missing references) //IL_0d10: Unknown result type (might be due to invalid IL or missing references) //IL_1b59: Unknown result type (might be due to invalid IL or missing references) //IL_1b5e: Unknown result type (might be due to invalid IL or missing references) //IL_1b68: Unknown result type (might be due to invalid IL or missing references) //IL_1b6e: Invalid comparison between Unknown and I4 //IL_0d32: Unknown result type (might be due to invalid IL or missing references) //IL_0d43: Unknown result type (might be due to invalid IL or missing references) //IL_0d20: Unknown result type (might be due to invalid IL or missing references) //IL_0d22: Unknown result type (might be due to invalid IL or missing references) //IL_0f4b: Unknown result type (might be due to invalid IL or missing references) //IL_0f50: Unknown result type (might be due to invalid IL or missing references) //IL_0b07: Unknown result type (might be due to invalid IL or missing references) //IL_0b13: Unknown result type (might be due to invalid IL or missing references) //IL_0b1d: Unknown result type (might be due to invalid IL or missing references) //IL_0b22: Unknown result type (might be due to invalid IL or missing references) //IL_0b2e: Unknown result type (might be due to invalid IL or missing references) //IL_0b38: Unknown result type (might be due to invalid IL or missing references) //IL_0b3d: Unknown result type (might be due to invalid IL or missing references) //IL_0b42: Unknown result type (might be due to invalid IL or missing references) //IL_0b49: Unknown result type (might be due to invalid IL or missing references) //IL_0b4d: Unknown result type (might be due to invalid IL or missing references) //IL_0b53: Unknown result type (might be due to invalid IL or missing references) //IL_0b5b: Unknown result type (might be due to invalid IL or missing references) //IL_0b60: Unknown result type (might be due to invalid IL or missing references) //IL_0b62: Unknown result type (might be due to invalid IL or missing references) //IL_0b64: Unknown result type (might be due to invalid IL or missing references) //IL_0b66: Unknown result type (might be due to invalid IL or missing references) //IL_0b6b: Unknown result type (might be due to invalid IL or missing references) //IL_095b: Unknown result type (might be due to invalid IL or missing references) //IL_0967: Unknown result type (might be due to invalid IL or missing references) //IL_0971: Unknown result type (might be due to invalid IL or missing references) //IL_0976: Unknown result type (might be due to invalid IL or missing references) //IL_0982: Unknown result type (might be due to invalid IL or missing references) //IL_098c: Unknown result type (might be due to invalid IL or missing references) //IL_0991: Unknown result type (might be due to invalid IL or missing references) //IL_0996: Unknown result type (might be due to invalid IL or missing references) //IL_099d: Unknown result type (might be due to invalid IL or missing references) //IL_09a1: Unknown result type (might be due to invalid IL or missing references) //IL_09a7: Unknown result type (might be due to invalid IL or missing references) //IL_09af: Unknown result type (might be due to invalid IL or missing references) //IL_09b4: Unknown result type (might be due to invalid IL or missing references) //IL_09b6: Unknown result type (might be due to invalid IL or missing references) //IL_09b8: Unknown result type (might be due to invalid IL or missing references) //IL_09ba: Unknown result type (might be due to invalid IL or missing references) //IL_09bf: Unknown result type (might be due to invalid IL or missing references) //IL_1820: Unknown result type (might be due to invalid IL or missing references) //IL_182a: Unknown result type (might be due to invalid IL or missing references) //IL_1836: Unknown result type (might be due to invalid IL or missing references) //IL_1840: Unknown result type (might be due to invalid IL or missing references) //IL_1845: Unknown result type (might be due to invalid IL or missing references) //IL_1851: Unknown result type (might be due to invalid IL or missing references) //IL_1857: Unknown result type (might be due to invalid IL or missing references) //IL_1266: Unknown result type (might be due to invalid IL or missing references) //IL_1284: Unknown result type (might be due to invalid IL or missing references) //IL_128b: Expected O, but got Unknown //IL_15e4: Unknown result type (might be due to invalid IL or missing references) //IL_15ee: Unknown result type (might be due to invalid IL or missing references) //IL_15f9: Unknown result type (might be due to invalid IL or missing references) //IL_15ff: Unknown result type (might be due to invalid IL or missing references) //IL_14f6: Unknown result type (might be due to invalid IL or missing references) //IL_1514: Unknown result type (might be due to invalid IL or missing references) //IL_151b: Expected O, but got Unknown //IL_0b8d: Unknown result type (might be due to invalid IL or missing references) //IL_0b9e: Unknown result type (might be due to invalid IL or missing references) //IL_0b7b: Unknown result type (might be due to invalid IL or missing references) //IL_0b7d: Unknown result type (might be due to invalid IL or missing references) //IL_09e1: Unknown result type (might be due to invalid IL or missing references) //IL_09f2: Unknown result type (might be due to invalid IL or missing references) //IL_09cf: Unknown result type (might be due to invalid IL or missing references) //IL_09d1: Unknown result type (might be due to invalid IL or missing references) //IL_1b9e: Unknown result type (might be due to invalid IL or missing references) //IL_1bad: Unknown result type (might be due to invalid IL or missing references) //IL_1769: Unknown result type (might be due to invalid IL or missing references) try { string text = chatMessage; if (chatMessage.ToLower() == "/ccversion" && isHost) { if (verwait == 0) { ((MonoBehaviour)__instance).StartCoroutine(getVersions()); } return false; } if (!text.StartsWith("<size=0>")) { return true; } text = text.Replace("<size=0>", ""); text = text.Replace("</size>", ""); if (!text.StartsWith("/cc_")) { return true; } text = text.Replace("/cc_", ""); string[] values = text.Split('_'); string text2 = values[0]; if (text2 != null) { switch (text2.Length) { case 7: switch (text2[0]) { case 'v': if (!(text2 == "version")) { break; } if (!version.ContainsKey(values[1])) { version.Add(values[1], (values[2], values[3])); } return false; case 'p': if (text2 == "poweron") { if (!isHost) { return true; } RoundManager.Instance.PowerSwitchOnClientRpc(); } break; case 'a': if (text2 == "addhour") { if (!isHost) { return true; } TimeOfDay instance = TimeOfDay.Instance; float lengthOfHours = instance.lengthOfHours; instance.globalTime += lengthOfHours; instance.timeUntilDeadline -= lengthOfHours; CrowdDelegates.callFunc(instance, "MoveTimeOfDay", null); } break; case 'r': if (text2 == "remhour") { if (!isHost) { return true; } TimeOfDay instance2 = TimeOfDay.Instance; float lengthOfHours2 = instance2.lengthOfHours; instance2.globalTime -= lengthOfHours2; instance2.timeUntilDeadline += lengthOfHours2; CrowdDelegates.callFunc(instance2, "MoveTimeOfDay", null); } break; case 'c': if (text2 == "credits") { if (!isHost) { return true; } int num27 = int.Parse(values[1]); Terminal val35 = Object.FindObjectOfType<Terminal>(); val35.groupCredits += num27; val35.SyncGroupCreditsServerRpc(val35.groupCredits, val35.numberOfItemsInDropship); if (num27 > 0) { HUDManager.Instance.DisplayTip("Crowd Control", "Crowd Control gave " + num27 + " credits", false, false, "LC_Tip1"); } else { HUDManager.Instance.DisplayTip("Crowd Control", "Crowd Control took " + -1 * num27 + " credits", false, false, "LC_Tip1"); } } break; case 'i': if (text2 == "inverse") { int num28 = int.Parse(values[1]); if ((int)StartOfRound.Instance.localPlayerController.playerClientId == num28) { PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; Random random = new Random(StartOfRound.Instance.randomMapSeed + 17 + (int)GameNetworkManager.Instance.localPlayerController.playerClientId); Vector3 position = RoundManager.Instance.insideAINodes[random.Next(0, RoundManager.Instance.insideAINodes.Length)].transform.position; RoundManager instance3 = RoundManager.Instance; Random random2 = random; Vector3 randomNavMeshPositionInBoxPredictable = instance3.GetRandomNavMeshPositionInBoxPredictable(position, 10f, default(NavMeshHit), random2, -1, 1f); StartOfRound.Instance.localPlayerController.TeleportPlayer(randomNavMeshPositionInBoxPredictable, false, 0f, false, true); localPlayerController.isInsideFactory = true; localPlayerController.isInHangarShipRoom = false; localPlayerController.isInElevator = false; } } break; case 'w': { if (!(text2 == "weather")) { break; } int num26 = int.Parse(values[1]); TimeOfDay.Instance.DisableAllWeather(true); if ((int)StartOfRound.Instance.currentLevel.currentWeather >= 0) { WeatherEffect val34 = TimeOfDay.Instance.effects[StartOfRound.Instance.currentLevel.currentWeather]; if (val34 != null) { val34.effectEnabled = false; if ((Object)(object)val34.effectPermanentObject != (Object)null) { val34.effectPermanentObject.SetActive(false); } if ((Object)(object)val34.effectObject != (Object)null) { val34.effectObject.SetActive(false); } } } StartOfRound.Instance.currentLevel.currentWeather = (LevelWeatherType)num26; if ((int)StartOfRound.Instance.currentLevel.currentWeather >= 0) { WeatherEffect val34 = TimeOfDay.Instance.effects[num26]; if (val34 != null) { val34.effectEnabled = true; if ((Object)(object)val34.effectPermanentObject != (Object)null) { val34.effectPermanentObject.SetActive(true); } if ((Object)(object)val34.effectObject != (Object)null) { val34.effectObject.SetActive(true); } } } try { TimeOfDay.Instance.currentLevelWeather = RoundManager.Instance.currentLevel.currentWeather; if ((int)TimeOfDay.Instance.currentLevelWeather == -1 || RoundManager.Instance.currentLevel.randomWeathers == null) { break; } for (int k = 0; k < RoundManager.Instance.currentLevel.randomWeathers.Length; k++) { if (RoundManager.Instance.currentLevel.randomWeathers[k].weatherType == RoundManager.Instance.currentLevel.currentWeather) { TimeOfDay.Instance.currentWeatherVariable = RoundManager.Instance.currentLevel.randomWeathers[k].weatherVariable; TimeOfDay.Instance.currentWeatherVariable2 = RoundManager.Instance.currentLevel.randomWeathers[k].weatherVariable2; } } } catch (Exception ex2) { mls.LogError((object)ex2.ToString()); } break; } } break; case 8: switch (text2[0]) { case 'v': if (!(text2 == "vercheck")) { break; } if (verwait != 0) { return false; } verwait = 30u; playerRef = StartOfRound.Instance.localPlayerController; HUDManager.Instance.AddTextToChatOnServer($"<size=0>/cc_version_{playerRef.playerUsername}_{tsVersion}_{ControlClient.connect}</size>", -1); return false; case 'p': if (text2 == "poweroff") { if (!isHost) { return true; } RoundManager.Instance.PowerSwitchOffClientRpc(); } break; case 'l': { if (!(text2 == "landmine")) { break; } int num2 = int.Parse(values[1]); PlayerControllerB val9 = null; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val10 in allPlayerScripts) { if ((Object)(object)val10 != (Object)null && ((Behaviour)val10).isActiveAndEnabled && !val10.isPlayerDead && (int)val10.playerClientId == num2 && val10.isPlayerControlled) { val9 = val10; } } if ((Object)(object)val9 == (Object)null) { return true; } GameObject val11 = null; GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>(); foreach (GameObject val12 in array) { if (((Object)val12).name == "Landmine") { val11 = val12; LandminePrefab = val12; break; } } if ((Object)(object)val11 == (Object)null) { return true; } Vector3 val13 = ((Component)val9).transform.position + ((Component)val9).transform.forward * 5f - ((Component)val9).transform.up * 0.5f; Vector3 navMeshPosition2 = RoundManager.Instance.GetNavMeshPosition(val13, default(NavMeshHit), 5f, -1); Vector3 val14 = navMeshPosition2 - val13; if (((Vector3)(ref val14)).magnitude < 6f) { val13 = navMeshPosition2; } GameObject val15 = GameObject.FindGameObjectWithTag("MapPropsContainer"); GameObject val16 = Object.Instantiate<GameObject>(val11, val13, Quaternion.Euler(-90f, 0f, 0f), val15.transform); val16.gameObject.GetComponentInChildren<NetworkObject>().Spawn(true); spawnedHazards.Add(val16); break; } case 'd': if (text2 == "deadline") { float timeUntilDeadline = float.Parse(values[1]); TimeOfDay.Instance.timeUntilDeadline = timeUntilDeadline; TimeOfDay.Instance.UpdateProfitQuotaCurrentTime(); HUDManager.Instance.DisplayDaysLeft((int)Mathf.Floor(TimeOfDay.Instance.timeUntilDeadline / TimeOfDay.Instance.totalTime)); Object.FindObjectOfType<Terminal>().SetItemSales(); } break; } break; case 5: switch (text2[3]) { case 'w': if (!(text2 == "spawn")) { break; } if (!isHost) { return true; } ActionQueue.Enqueue(delegate { foreach (SpawnableEnemyWithRarity outsideEnemy in StartOfRound.Instance.currentLevel.OutsideEnemies) { if (outsideEnemy.enemyType.enemyName.ToLower().Contains(values[1])) { try { SpawnEnemy(outsideEnemy, 1, inside: false); return; } catch (Exception) { return; } } } foreach (SpawnableEnemyWithRarity enemy in StartOfRound.Instance.currentLevel.Enemies) { if (enemy.enemyType.enemyName.ToLower().Contains(values[1])) { try { SpawnEnemy(enemy, 1, inside: false); break; } catch (Exception) { break; } } } }); break; case 'e': { if (!(text2 == "giver")) { break; } if (!isHost) { return true; } CrowdDelegates.givedelay = 20u; int num22 = int.Parse(values[1]); int num23 = int.Parse(values[2]); uint num24 = uint.Parse(values[3]); if (num24 == msgid2) { return true; } msgid2 = num24; PlayerControllerB val31 = null; if (num23 != -1) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val32 in allPlayerScripts) { if ((Object)(object)val32 != (Object)null && ((Behaviour)val32).isActiveAndEnabled && !val32.isPlayerDead && (int)val32.playerClientId == num23 && val32.isPlayerControlled) { val31 = val32; } } if ((Object)(object)val31 == (Object)(object)StartOfRound.Instance.localPlayerController) { num23 = -1; } } else { val31 = StartOfRound.Instance.localPlayerController; } if ((Object)(object)val31 == (Object)null) { val31 = StartOfRound.Instance.localPlayerController; num23 = -1; } Object.FindObjectOfType<Terminal>(); GameObject val33 = Object.Instantiate<GameObject>(StartOfRound.Instance.allItemsList.itemsList[num22].spawnPrefab, ((Component)val31).transform.position, Quaternion.identity, currentStart.propsContainer); val33.GetComponent<GrabbableObject>().fallTime = 0f; val33.GetComponent<NetworkObject>().Spawn(false); CrowdDelegates.msgid++; HUDManager.Instance.AddTextToChatOnServer($"<size=0>/cc_give_{num22}_{num23}_{val33.GetComponent<NetworkObject>().NetworkObjectId}_{CrowdDelegates.msgid}</size>", -1); break; } case 'i': if (text2 == "mimic") { ulong key3 = ulong.Parse(values[1]); CrowdDelegates.setProperty(((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[key3]).gameObject.GetComponent<MaskedPlayerEnemy>(), "enemyEnabled", true); } break; case 'v': { if (!(text2 == "mgive")) { break; } _ = values[1]; int num19 = int.Parse(values[2]); ulong key2 = ulong.Parse(values[3]); uint num20 = uint.Parse(values[4]); if (num20 == msgid3) { return true; } msgid3 = num20; playerRef = StartOfRound.Instance.localPlayerController; if (num19 == -1) { if (!isHost) { return true; } } else { if (isHost) { return true; } if ((int)StartOfRound.Instance.localPlayerController.playerClientId != num19) { return true; } } GrabbableObject component2 = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[key2]).gameObject.GetComponent<GrabbableObject>(); CrowdDelegates.setProperty(playerRef, "currentlyGrabbingObject", component2); CrowdDelegates.setProperty(playerRef, "grabInvalidated", false); NetworkObject networkObject2 = ((NetworkBehaviour)component2).NetworkObject; if ((Object)(object)networkObject2 == (Object)null || !networkObject2.IsSpawned) { return true; } component2.InteractItem(); playerRef.playerBodyAnimator.SetBool("GrabInvalidated", false); playerRef.playerBodyAnimator.SetBool("GrabValidated", false); playerRef.playerBodyAnimator.SetBool("cancelHolding", false); playerRef.playerBodyAnimator.ResetTrigger("Throw"); CrowdDelegates.callFunc(playerRef, "SetSpecialGrabAnimationBool", new object[2] { true, null }); playerRef.isGrabbingObjectAnimation = true; ((Behaviour)playerRef.cursorIcon).enabled = false; ((TMP_Text)playerRef.cursorTip).text = ""; playerRef.twoHanded = component2.itemProperties.twoHanded; PlayerControllerB obj2 = playerRef; obj2.carryWeight += Mathf.Clamp(component2.itemProperties.weight - 1f, 0f, 10f); if (component2.itemProperties.grabAnimationTime > 0f) { playerRef.grabObjectAnimationTime = component2.itemProperties.grabAnimationTime; } else { playerRef.grabObjectAnimationTime = 0.4f; } CrowdDelegates.callFunc(playerRef, "GrabObjectServerRpc", (object)new NetworkObjectReference(networkObject2)); Coroutine val30 = (Coroutine)CrowdDelegates.getProperty(playerRef, "grabObjectCoroutine"); if (val30 != null) { ((MonoBehaviour)playerRef).StopCoroutine(val30); } CrowdDelegates.setProperty(playerRef, "grabObjectCoroutine", ((MonoBehaviour)playerRef).StartCoroutine("GrabObject")); break; } case 'c': { if (!(text2 == "pitch")) { break; } float num25 = float.Parse(values[1]); for (int j = 0; j < StartOfRound.Instance.allPlayerScripts.Length; j++) { try { SoundManager.Instance.playerVoicePitchTargets[j] = num25; SoundManager.Instance.playerVoicePitches[j] = num25; if ((Object)(object)StartOfRound.Instance.allPlayerScripts[j] != (Object)null) { if ((Object)(object)StartOfRound.Instance.allPlayerScripts[j].currentVoiceChatAudioSource != (Object)null) { StartOfRound.Instance.allPlayerScripts[j].currentVoiceChatAudioSource.pitch = num25; } SoundManager.Instance.SetPlayerPitch(num25, j); } } catch (Exception ex) { mls.LogError((object)ex.ToString()); } } break; } case 'r': if (text2 == "doors") { int num21 = int.Parse(values[1]); Object.FindObjectOfType<HangarShipDoor>().PlayDoorAnimation(num21 == 1); } break; case 't': if (text2 == "quota") { int num17 = int.Parse(values[1]); int num18 = int.Parse(values[2]); TimeOfDay.Instance.quotaFulfilled = num17; TimeOfDay.Instance.profitQuota = num18; ((TMP_Text)StartOfRound.Instance.profitQuotaMonitorText).text = $"PROFIT QUOTA:\n${num17} / ${num18}"; } break; } break; case 6: switch (text2[0]) { case 'c': { if (!(text2 == "cspawn")) { break; } if (!isHost) { return true; } int num13 = int.Parse(values[2]); PlayerControllerB player = null; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val21 in allPlayerScripts) { if ((Object)(object)val21 != (Object)null && ((Behaviour)val21).isActiveAndEnabled && !val21.isPlayerDead && (int)val21.playerClientId == num13 && val21.isPlayerControlled) { player = val21; } } if ((Object)(object)player == (Object)null) { return true; } ActionQueue.Enqueue(delegate { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) foreach (SpawnableEnemyWithRarity outsideEnemy2 in StartOfRound.Instance.currentLevel.OutsideEnemies) { if (values[1] == "mimic") { GameObject val36 = null; SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val37 in levels) { if ((Object)(object)val36 == (Object)null) { foreach (SpawnableItemWithRarity item in val37.spawnableScrap) { if (((Object)item.spawnableItem).name.ToLower() == "tragedymask") { val36 = item.spawnableItem.spawnPrefab; } } } } if (!((Object)(object)val36 == (Object)null)) { GameObject obj3 = Object.Instantiate<GameObject>(val36, ((Component)player).transform.position, Quaternion.identity, currentStart.propsContainer); HauntedMaskItem component3 = obj3.GetComponent<HauntedMaskItem>(); GameObject obj4 = Object.Instantiate<GameObject>(component3.mimicEnemy.enemyPrefab, ((Component)player).transform.position + ((Component)player).transform.forward * 5f, Quaternion.Euler(Vector3.zero)); obj4.gameObject.GetComponentInChildren<NetworkObject>().Spawn(true); MaskedPlayerEnemy component4 = obj4.GetComponent<MaskedPlayerEnemy>(); component4.mimickingPlayer = player; component4.SetSuit(player.currentSuitID); ((EnemyAI)component4).SetEnemyOutside(!player.isInsideFactory); component4.SetVisibilityOfMaskedEnemy(); component4.SetMaskType(component3.maskTypeId); HUDManager.Instance.AddTextToChatOnServer($"<size=0>/cc_mimic_{((NetworkBehaviour)component4).NetworkObject.NetworkObjectId}</size>", -1); obj4.gameObject.GetComponentInChildren<EnemyAI>().stunNormalizedTimer = 6f; Object.Destroy((Object)(object)obj3); } return; } if (outsideEnemy2.enemyType.enemyName.ToLower().Contains(values[1])) { try { SpawnCrewEnemy(player, outsideEnemy2, 1, inside: false); return; } catch (Exception) { return; } } } foreach (SpawnableEnemyWithRarity enemy2 in StartOfRound.Instance.currentLevel.Enemies) { if (enemy2.enemyType.enemyName.ToLower().Contains(values[1])) { try { SpawnCrewEnemy(player, enemy2, 1, inside: false); break; } catch (Exception) { break; } } } }); break; } case 'd': if (text2 == "damage") { int num15 = int.Parse(values[1]); playerRef = StartOfRound.Instance.localPlayerController; if ((int)StartOfRound.Instance.localPlayerController.playerClientId != num15) { return true; } int num16 = 25; if (playerRef.health < 25) { num16 = playerRef.health - 1; } playerRef.DamagePlayer(num16, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } break; case 't': { if (!(text2 == "turret")) { break; } int num14 = int.Parse(values[1]); PlayerControllerB val22 = null; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val23 in allPlayerScripts) { if ((Object)(object)val23 != (Object)null && ((Behaviour)val23).isActiveAndEnabled && !val23.isPlayerDead && (int)val23.playerClientId == num14 && val23.isPlayerControlled) { val22 = val23; } } if ((Object)(object)val22 == (Object)null) { return true; } GameObject val24 = null; GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>(); foreach (GameObject val25 in array) { if (((Object)val25).name.ToLower().Contains("turretcont")) { val24 = val25; TurretObj = val25; break; } } if ((Object)(object)val24 == (Object)null) { return true; } Vector3 val26 = ((Component)val22).transform.position + ((Component)val22).transform.forward * 5f - ((Component)val22).transform.up * 0.5f; Vector3 navMeshPosition3 = RoundManager.Instance.GetNavMeshPosition(val26, default(NavMeshHit), 5f, -1); Vector3 val27 = navMeshPosition3 - val26; if (((Vector3)(ref val27)).magnitude < 6f) { val26 = navMeshPosition3; } GameObject val28 = GameObject.FindGameObjectWithTag("MapPropsContainer"); GameObject val29 = Object.Instantiate<GameObject>(val24, val26, Quaternion.Euler(0f, 0f, 0f), val28.transform); val29.gameObject.GetComponentInChildren<NetworkObject>().Spawn(true); spawnedHazards.Add(val29); break; } case 'r': if (text2 == "revive") { StartOfRound.Instance.ReviveDeadPlayers(); HUDManager.Instance.HideHUD(false); } break; } break; case 4: switch (text2[0]) { case 't': if (!(text2 == "take")) { if (!(text2 == "tele")) { break; } int num9 = int.Parse(values[1]); int num10 = int.Parse(values[2]); if ((int)StartOfRound.Instance.localPlayerController.playerClientId != num9) { break; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val19 in allPlayerScripts) { if ((Object)(object)val19 != (Object)null && ((Behaviour)val19).isActiveAndEnabled && !val19.isPlayerDead && (int)val19.playerClientId == num10 && val19.isPlayerControlled) { StartOfRound.Instance.localPlayerController.TeleportPlayer(((Component)val19).transform.position, false, 0f, false, true); } } } else { int num11 = int.Parse(values[1]); playerRef = StartOfRound.Instance.localPlayerController; if ((int)StartOfRound.Instance.localPlayerController.playerClientId != num11) { return true; } playerRef.DespawnHeldObject(); } break; case 'h': if (text2 == "heal") { int num5 = int.Parse(values[1]); playerRef = StartOfRound.Instance.localPlayerController; if ((int)StartOfRound.Instance.localPlayerController.playerClientId != num5) { return true; } playerRef.health = Mathf.Clamp(playerRef.health + 25, 0, 100); if (playerRef.health >= 20) { playerRef.MakeCriticallyInjured(false); } HUDManager.Instance.UpdateHealthUI(playerRef.health, true); } break; case 'g': { if (!(text2 == "give")) { break; } int.Parse(values[1]); int num6 = int.Parse(values[2]); ulong key = ulong.Parse(values[3]); uint num7 = uint.Parse(values[4]); if (num7 == msgid3) { return true; } msgid3 = num7; playerRef = StartOfRound.Instance.localPlayerController; if (num6 == -1) { if (!isHost) { return true; } } else { if (isHost) { return true; } if ((int)StartOfRound.Instance.localPlayerController.playerClientId != num6) { return true; } } GrabbableObject component = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]).gameObject.GetComponent<GrabbableObject>(); CrowdDelegates.setProperty(playerRef, "currentlyGrabbingObject", component); CrowdDelegates.setProperty(playerRef, "grabInvalidated", false); NetworkObject networkObject = ((NetworkBehaviour)component).NetworkObject; if ((Object)(object)networkObject == (Object)null || !networkObject.IsSpawned) { return true; } component.InteractItem(); playerRef.playerBodyAnimator.SetBool("GrabInvalidated", false); playerRef.playerBodyAnimator.SetBool("GrabValidated", false); playerRef.playerBodyAnimator.SetBool("cancelHolding", false); playerRef.playerBodyAnimator.ResetTrigger("Throw"); CrowdDelegates.callFunc(playerRef, "SetSpecialGrabAnimationBool", new object[2] { true, null }); playerRef.isGrabbingObjectAnimation = true; ((Behaviour)playerRef.cursorIcon).enabled = false; ((TMP_Text)playerRef.cursorTip).text = ""; playerRef.twoHanded = component.itemProperties.twoHanded; PlayerControllerB obj = playerRef; obj.carryWeight += Mathf.Clamp(component.itemProperties.weight - 1f, 0f, 10f); if (component.itemProperties.grabAnimationTime > 0f) { playerRef.grabObjectAnimationTime = component.itemProperties.grabAnimationTime; } else { playerRef.grabObjectAnimationTime = 0.4f; } CrowdDelegates.callFunc(playerRef, "GrabObjectServerRpc", (object)new NetworkObjectReference(networkObject)); Coroutine val18 = (Coroutine)CrowdDelegates.getProperty(playerRef, "grabObjectCoroutine"); if (val18 != null) { ((MonoBehaviour)playerRef).StopCoroutine(val18); } CrowdDelegates.setProperty(playerRef, "grabObjectCoroutine", ((MonoBehaviour)playerRef).StartCoroutine("GrabObject")); break; } case 's': if (text2 == "ship") { int num8 = int.Parse(values[1]); if ((int)StartOfRound.Instance.localPlayerController.playerClientId == num8) { StartOfRound.Instance.ForcePlayerIntoShip(); } } break; case 'k': { if (!(text2 == "kill")) { break; } int num12 = int.Parse(values[1]); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val20 in allPlayerScripts) { if ((Object)(object)val20 != (Object)null && ((Behaviour)val20).isActiveAndEnabled && !val20.isPlayerDead && (int)val20.playerClientId == num12 && val20.isPlayerControlled) { val20.KillPlayer(((Component)val20).transform.up * 100f, true, (CauseOfDeath)16, 0, default(Vector3)); } } break; } case 'b': { if (!(text2 == "body")) { break; } int num3 = int.Parse(values[1]); uint num4 = uint.Parse(values[2]); if (num4 == msgid) { return true; } msgid = num4; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val17 in allPlayerScripts) { if ((Object)(object)val17 != (Object)null && ((Behaviour)val17).isActiveAndEnabled && !val17.isPlayerDead && (int)val17.playerClientId == num3 && val17.isPlayerControlled) { val17.SpawnDeadBody((int)val17.playerClientId, ((Component)val17).transform.up * 2f + ((Component)val17).transform.forward * 5f, 0, val17, 0, (Transform)null, default(Vector3)); } } break; } } break; case 9: { if (!(text2 == "spiketrap")) { break; } int num = int.Parse(values[1]); PlayerControllerB val = null; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if ((Object)(object)val2 != (Object)null && ((Behaviour)val2).isActiveAndEnabled && !val2.isPlayerDead && (int)val2.playerClientId == num && val2.isPlayerControlled) { val = val2; } } if ((Object)(object)val == (Object)null) { return true; } GameObject val3 = null; GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>(); foreach (GameObject val4 in array) { if (((Object)val4).name == "SpikeRoofTrapHazard") { val3 = val4; SpikeHazardObj = val4; } } if ((Object)(object)val3 == (Object)null) { return true; } Vector3 val5 = ((Component)val).transform.position + ((Component)val).transform.forward * 5f - ((Component)val).transform.up * 0.5f; Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(val5, default(NavMeshHit), 5f, -1); Vector3 val6 = navMeshPosition - val5; if (((Vector3)(ref val6)).magnitude < 6f) { val5 = navMeshPosition; } GameObject val7 = GameObject.FindGameObjectWithTag("MapPropsContainer"); GameObject val8 = Object.Instantiate<GameObject>(val3, val5, Quaternion.Euler(0f, 0f, 0f), val7.transform); val8.GetComponentInChildren<NetworkObject>().Spawn(true); spawnedHazards.Add(val8); break; } } } } catch (Exception ex3) { mls.LogError((object)ex3.ToString()); } return false; } public static void SpawnEnemyWithConfigManager(string enemyName) { if (!isHost) { return; } bool flag = false; foreach (SpawnableEnemyWithRarity enemy in currentLevel.Enemies) { if (enemy.enemyType.enemyName.ToLower().Contains(enemyName.ToLower())) { try { flag = true; _ = enemy.enemyType.enemyName; SpawnEnemy(enemy, 1, inside: true); } catch { } break; } SelectableLevel[] levels = currentStart.levels; for (int i = 0; i < levels.Length; i++) { SpawnableEnemyWithRarity val = levels[i].Enemies.Find((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.ToLower().Contains(enemyName.ToLower())); if (val != null) { try { flag = true; _ = val.enemyType.enemyName; SpawnEnemy(val, 1, inside: true); } catch { } break; } } } if (flag) { return; } foreach (SpawnableEnemyWithRarity outsideEnemy in currentLevel.OutsideEnemies) { mls.LogInfo((object)("outside enemy: " + outsideEnemy.enemyType.enemyName)); if (outsideEnemy.enemyType.enemyName.ToLower().Contains(enemyName.ToLower())) { try { flag = true; _ = outsideEnemy.enemyType.enemyName; SpawnEnemy(outsideEnemy, 1, inside: false); break; } catch (Exception ex) { mls.LogInfo((object)("The game tossed an error: " + ex.Message)); break; } } SelectableLevel[] levels = currentStart.levels; for (int i = 0; i < levels.Length; i++) { SpawnableEnemyWithRarity val2 = levels[i].OutsideEnemies.Find((SpawnableEnemyWithRarity x) => x.enemyType.enemyName.ToLower().Contains(enemyName.ToLower())); if (val2 != null) { try { flag = true; _ = val2.enemyType.enemyName; SpawnEnemy(val2, 1, inside: false); } catch { } } } } } public static void SpawnEnemy(SpawnableEnemyWithRarity enemy, int amount, bool inside) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; GameObject obj = Object.Instantiate<GameObject>(enemy.enemyType.enemyPrefab, ((Component)localPlayerController).transform.position + ((Component)localPlayerController).transform.forward * 5f, Quaternion.Euler(Vector3.zero)); obj.gameObject.GetComponentInChildren<NetworkObject>().Spawn(true); obj.gameObject.GetComponentInChildren<EnemyAI>().SetEnemyStunned(true, 6f, (PlayerControllerB)null); } public static void SpawnCrewEnemy(PlayerControllerB player, SpawnableEnemyWithRarity enemy, int amount, bool inside) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Object.Instantiate<GameObject>(enemy.enemyType.enemyPrefab, ((Component)player).transform.position + ((Component)player).transform.forward * 5f, Quaternion.Euler(Vector3.zero)); obj.gameObject.GetComponentInChildren<NetworkObject>().Spawn(true); obj.gameObject.GetComponentInChildren<EnemyAI>().SetEnemyStunned(true, 6f, (PlayerControllerB)null); } } } namespace BepinControl.Patches { [HarmonyPatch(typeof(PlayerControllerB))] public class PlayerControllerBPatch { [HarmonyPatch("Start")] [HarmonyPrefix] private static void getNightVision(ref PlayerControllerB __instance) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) LethalCompanyControl.playerRef = __instance; LethalCompanyControl.nightVision = ((Behaviour)LethalCompanyControl.playerRef.nightVision).enabled; LethalCompanyControl.nightVisionIntensity = LethalCompanyControl.playerRef.nightVision.intensity; LethalCompanyControl.nightVisionColor = LethalCompanyControl.playerRef.nightVision.color; LethalCompanyControl.nightVisionRange = LethalCompanyControl.playerRef.nightVision.range; LethalCompanyControl.playerRef.nightVision.color = Color.green; LethalCompanyControl.playerRef.nightVision.intensity = 1000f; LethalCompanyControl.playerRef.nightVision.range = 10000f; } [HarmonyPatch("SetNightVisionEnabled")] [HarmonyPostfix] private static void updateNightVision() { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (LethalCompanyControl.nightVision) { LethalCompanyControl.playerRef.nightVision.color = Color.green; LethalCompanyControl.playerRef.nightVision.intensity = 1000f; LethalCompanyControl.playerRef.nightVision.range = 10000f; } else { LethalCompanyControl.playerRef.nightVision.color = LethalCompanyControl.nightVisionColor; LethalCompanyControl.playerRef.nightVision.intensity = LethalCompanyControl.nightVisionIntensity; LethalCompanyControl.playerRef.nightVision.range = LethalCompanyControl.nightVisionRange; } ((Behaviour)LethalCompanyControl.playerRef.nightVision).enabled = true; } [HarmonyPatch("AllowPlayerDeath")] [HarmonyPrefix] private static bool OverrideDeath() { if (!LethalCompanyControl.isHost) { return true; } return !LethalCompanyControl.enableGod; } [HarmonyPatch("Update")] [HarmonyPostfix] private static void InfiniteSprint(ref float ___sprintMeter) { if (LethalCompanyControl.infSprint && LethalCompanyControl.isHost) { Mathf.Clamp(___sprintMeter += 0.02f, 0f, 1f); } } } } namespace ControlValley { public enum BuffType { HYPER_MOVE, FAST_MOVE, SLOW_MOVE, FREEZE, ULTRA_JUMP, HIGH_JUMP, LOW_JUMP, OHKO, INVUL, NOSTAM, INFSTAM, NIGHT_VISION, HIGH_PITCH, LOW_PITCH, DRUNK, FASTJETPACK, SLOWJETPACK } public class Buff { public BuffType type; private float old; private static int frames; public Buff(BuffType t) { type = t; BuffType buffType = type; if ((uint)(buffType - 7) <= 1u) { PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; old = localPlayerController.health; } } public void addBuff(int duration) { switch (type) { case BuffType.DRUNK: { PlayerControllerB localPlayerController2 = StartOfRound.Instance.localPlayerController; float drunkness = Math.Min((float)duration * 10f, 1200f); localPlayerController2.drunkness = drunkness; localPlayerController2.drunknessSpeed = 1f; localPlayerController2.drunknessInertia = 20f; break; } case BuffType.LOW_PITCH: LethalCompanyControl.ActionQueue.Enqueue(delegate { HUDManager.Instance.AddTextToChatOnServer("<size=0>/cc_pitch_0.65</size>", -1); }); break; case BuffType.HIGH_PITCH: LethalCompanyControl.ActionQueue.Enqueue(delegate { HUDManager.Instance.AddTextToChatOnServer("<size=0>/cc_pitch_1.5</size>", -1); }); break; case BuffType.NIGHT_VISION: _ = StartOfRound.Instance.localPlayerController; LethalCompanyControl.nightVision = true; break; case BuffType.FREEZE: StartOfRound.Instance.localPlayerController.movementSpeed = 0f; break; case BuffType.HYPER_MOVE: StartOfRound.Instance.localPlayerController.movementSpeed = 18f; break; case BuffType.FAST_MOVE: StartOfRound.Instance.localPlayerController.movementSpeed = 9f; break; case BuffType.SLOW_MOVE: StartOfRound.Instance.localPlayerController.movementSpeed = 1.25f; break; case BuffType.ULTRA_JUMP: StartOfRound.Instance.localPlayerController.jumpForce = 50f; break; case BuffType.HIGH_JUMP: StartOfRound.Instance.localPlayerController.jumpForce = 35f; break; case BuffType.LOW_JUMP: StartOfRound.Instance.localPlayerController.jumpForce = 5f; break; case BuffType.FASTJETPACK: { PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; JetpackItem[] array = Object.FindObjectsByType<JetpackItem>((FindObjectsSortMode)0); foreach (JetpackItem val in array) { if ((Object)(object)val != (Object)null && (Object)(object)((GrabbableObject)val).playerHeldBy == (Object)(object)localPlayerController) { LethalCompanyControl.oldJetpackRefSpeed = val.jetpackAcceleration; val.jetpackAcceleration *= 3f; } } break; } case BuffType.OHKO: case BuffType.INVUL: case BuffType.NOSTAM: case BuffType.INFSTAM: break; } } public void removeBuff() { switch (type) { case BuffType.DRUNK: { PlayerControllerB localPlayerController2 = StartOfRound.Instance.localPlayerController; localPlayerController2.drunkness = 0f; localPlayerController2.drunknessSpeed = 0f; localPlayerController2.drunknessInertia = 0f; break; } case BuffType.HIGH_PITCH: case BuffType.LOW_PITCH: LethalCompanyControl.ActionQueue.Enqueue(delegate { HUDManager.Instance.AddTextToChatOnServer("<size=0>/cc_pitch_1.0</size>", -1); }); break; case BuffType.NIGHT_VISION: _ = StartOfRound.Instance.localPlayerController; LethalCompanyControl.nightVision = false; break; case BuffType.HYPER_MOVE: case BuffType.FAST_MOVE: case BuffType.SLOW_MOVE: case BuffType.FREEZE: StartOfRound.Instance.localPlayerController.movementSpeed = 4.6f; break; case BuffType.ULTRA_JUMP: case BuffType.HIGH_JUMP: case BuffType.LOW_JUMP: StartOfRound.Instance.localPlayerController.jumpForce = 13f; break; case BuffType.FASTJETPACK: { PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; JetpackItem[] array = Object.FindObjectsByType<JetpackItem>((FindObjectsSortMode)0); foreach (JetpackItem val in array) { if ((Object)(object)val != (Object)null && (Object)(object)((GrabbableObject)val).playerHeldBy == (Object)(object)localPlayerController) { val.jetpackAcceleration = LethalCompanyControl.oldJetpackRefSpeed; } } break; } case BuffType.OHKO: case BuffType.INVUL: LethalCompanyControl.ActionQueue.Enqueue(delegate { PlayerControllerB localPlayerController3 = StartOfRound.Instance.localPlayerController; localPlayerController3.health = (int)old; if (localPlayerController3.health >= 20) { localPlayerController3.MakeCriticallyInjured(false); } if (localPlayerController3.health < 10) { localPlayerController3.MakeCriticallyInjured(true); } HUDManager.Instance.UpdateHealthUI(localPlayerController3.health, true); }); break; case BuffType.NOSTAM: case BuffType.INFSTAM: break; } } public void tick() { frames++; PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; switch (type) { case BuffType.HIGH_PITCH: if (frames % 16 == 0) { HUDManager.Instance.AddTextToChatOnServer("<size=0>/cc_pitch_1.5</size>", -1); } break; case BuffType.LOW_PITCH: if (frames % 16 == 0) { HUDManager.Instance.AddTextToChatOnServer("<size=0>/cc_pitch_0.65</size>", -1); } break; case BuffType.OHKO: if (localPlayerController.health > 1) { localPlayerController.health = 1; } if (localPlayerController.health >= 20) { localPlayerController.MakeCriticallyInjured(false); } if (localPlayerController.health < 10) { localPlayerController.MakeCriticallyInjured(true); } HUDManager.Instance.UpdateHealthUI(localPlayerController.health, true); break; case BuffType.INVUL: if (localPlayerController.health > 0) { localPlayerController.health = 100; } if (localPlayerController.health >= 20) { localPlayerController.MakeCriticallyInjured(false); } if (localPlayerController.health < 10) { localPlayerController.MakeCriticallyInjured(true); } HUDManager.Instance.UpdateHealthUI(localPlayerController.health, true); break; case BuffType.INFSTAM: localPlayerController.sprintMeter = 1f; localPlayerController.isExhausted = false; break; case BuffType.NOSTAM: localPlayerController.sprintMeter = 0f; localPlayerController.isExhausted = true; break; case BuffType.NIGHT_VISION: break; } } } public class BuffThread { public static List<BuffThread> threads = new List<BuffThread>(); public readonly Buff buff; public int duration; public int remain; public int id; public bool paused; public static bool isRunning(BuffType t) { foreach (BuffThread thread in threads) { if (thread.buff.type == t) { return true; } } return false; } public static void tick() { foreach (BuffThread thread in threads) { if (!thread.paused) { thread.buff.tick(); } } } public static void addTime(int duration) { try { lock (threads) { foreach (BuffThread thread in threads) { Interlocked.Add(ref thread.duration, duration + 5); if (!thread.paused) { int dur = Volatile.Read(ref thread.remain); new TimedResponse(thread.id, dur, CrowdResponse.Status.STATUS_PAUSE).Send(ControlClient.Socket); thread.paused = true; } } } } catch (Exception ex) { LethalCompanyControl.mls.LogInfo((object)ex.ToString()); } } public static void tickTime(int duration) { try { lock (threads) { foreach (BuffThread thread in threads) { int num = Volatile.Read(ref thread.remain); num -= duration; if (num < 0) { num = 0; } Volatile.Write(ref thread.remain, num); } } } catch (Exception ex) { LethalCompanyControl.mls.LogInfo((object)ex.ToString()); } } public static void unPause() { try { lock (threads) { foreach (BuffThread thread in threads) { if (thread.paused) { int dur = Volatile.Read(ref thread.remain); new TimedResponse(thread.id, dur, CrowdResponse.Status.STATUS_RESUME).Send(ControlClient.Socket); thread.paused = false; } } } } catch (Exception ex) { LethalCompanyControl.mls.LogInfo((object)ex.ToString()); } } public BuffThread(int id, BuffType buff, int duration) { this.buff = new Buff(buff); this.duration = duration; remain = duration; this.id = id; paused = false; try { lock (threads) { threads.Add(this); } } catch (Exception ex) { LethalCompanyControl.mls.LogInfo((object)ex.ToString()); } } public void Run() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; buff.addBuff(duration); try { for (int num = Volatile.Read(ref duration); num > 0; num = Volatile.Read(ref duration)) { Interlocked.Add(ref duration, -num); Thread.Sleep(num); } buff.removeBuff(); lock (threads) { threads.Remove(this); } new TimedResponse(id, 0, CrowdResponse.Status.STATUS_STOP).Send(ControlClient.Socket); } catch (Exception ex) { LethalCompanyControl.mls.LogInfo((object)ex.ToString()); } } } public class ControlClient { public static readonly string CV_HOST = "127.0.0.1"; public static readonly int CV_PORT = 51338; private bool paused; public bool inGame = true; public static bool connect = false; private Dictionary<string, CrowdDelegate> Delegate { get; set; } private IPEndPoint Endpoint { get; set; } private Queue<CrowdRequest> Requests { get; set; } private bool Running { get; set; } private bool Saving { get; set; } private bool Spawn { get; set; } public static Socket Socket { get; set; } public ControlClient() { Endpoint = new IPEndPoint(IPAddress.Parse(CV_HOST), CV_PORT); Requests = new Queue<CrowdRequest>(); Running = true; Saving = false; Spawn = true; Socket = null; connect = false; Delegate = new Dictionary<string, CrowdDelegate> { { "heal_full", CrowdDelegates.HealFull }, { "kill", CrowdDelegates.Kill }, { "killcrew", CrowdDelegates.KillCrewmate }, { "damage", CrowdDelegates.Damage }, { "damagecrew", CrowdDelegates.DamageCrew }, { "heal", CrowdDelegates.Heal }, { "healcrew", CrowdDelegates.HealCrew }, { "launch", CrowdDelegates.Launch }, { "fast", CrowdDelegates.FastMove }, { "slow", CrowdDelegates.SlowMove }, { "hyper", CrowdDelegates.HyperMove }, { "freeze", CrowdDelegates.Freeze }, { "drunk", CrowdDelegates.Drunk }, { "fastjetpack", CrowdDelegates.FastJetpack }, { "jumpultra", CrowdDelegates.UltraJump }, { "jumphigh", CrowdDelegates.HighJump }, { "jumplow", CrowdDelegates.LowJump }, { "ohko", CrowdDelegates.OHKO }, { "invul", CrowdDelegates.Invul }, { "drain", CrowdDelegates.DrainStamins }, { "restore", CrowdDelegates.RestoreStamins }, { "infstam", CrowdDelegates.InfiniteStamina }, { "nostam", CrowdDelegates.NoStamina }, { "spawn_pede", CrowdDelegates.Spawn }, { "spawn_spider", CrowdDelegates.Spawn }, { "spawn_hoard", CrowdDelegates.Spawn }, { "spawn_flower", CrowdDelegates.Spawn }, { "spawn_crawl", CrowdDelegates.Spawn }, { "spawn_blob", CrowdDelegates.Spawn }, { "spawn_spring", CrowdDelegates.Spawn }, { "spawn_puff", CrowdDelegates.Spawn }, { "spawn_dog", CrowdDelegates.Spawn }, { "spawn_giant", CrowdDelegates.Spawn }, { "spawn_levi", CrowdDelegates.Spawn }, { "spawn_hawk", CrowdDelegates.Spawn }, { "spawn_girl", CrowdDelegates.Spawn }, { "spawn_mimic", CrowdDelegates.Spawn }, { "spawn_cracker", CrowdDelegates.Spawn }, { "spawn_landmine", CrowdDelegates.Spawn }, { "spawn_turret", CrowdDelegates.Spawn }, { "spawn_spiketrap", CrowdDelegates.Spawn }, { "webs", CrowdDelegates.CreateWebs }, { "killenemies", CrowdDelegates.KillEnemies }, { "spawn_radmech", CrowdDelegates.Spawn }, { "spawn_clay", CrowdDelegates.Spawn }, { "spawn_butler", CrowdDelegates.Spawn }, { "spawn_jester", CrowdDelegates.Spawn }, { "spawn_eater", CrowdDelegates.Spawn }, { "spawn_snake", CrowdDelegates.Spawn }, { "spawn_kiwi", CrowdDelegates.Spawn }, { "cspawn_pede", CrowdDelegates.CrewSpawn }, { "cspawn_spider", CrowdDelegates.CrewSpawn }, { "cspawn_hoard", CrowdDelegates.CrewSpawn }, { "cspawn_flower", CrowdDelegates.CrewSpawn }, { "cspawn_crawl", CrowdDelegates.CrewSpawn }, { "cspawn_blob", CrowdDelegates.CrewSpawn }, { "cspawn_spring", CrowdDelegates.CrewSpawn }, { "cspawn_puff", CrowdDelegates.CrewSpawn }, { "cspawn_dog", CrowdDelegates.CrewSpawn }, { "cspawn_giant", CrowdDelegates.CrewSpawn }, { "cspawn_levi", CrowdDelegates.CrewSpawn }, { "cspawn_hawk", CrowdDelegates.CrewSpawn }, { "cspawn_girl", CrowdDelegates.CrewSpawn }, { "cspawn_cracker", CrowdDelegates.CrewSpawn }, { "cspawn_mimic", CrowdDelegates.CrewSpawn }, { "cspawn_landmine", CrowdDelegates.CrewSpawn }, { "cspawn_turret", CrowdDelegates.CrewSpawn }, { "cspawn_spiketrap", CrowdDelegates.CrewSpawn }, { "cspawn_radmech", CrowdDelegates.CrewSpawn }, { "cspawn_butler", CrowdDelegates.CrewSpawn }, { "cspawn_clay", CrowdDelegates.CrewSpawn }, { "cspawn_jester", CrowdDelegates.CrewSpawn }, { "cspawn_eater", CrowdDelegates.CrewSpawn }, { "cspawn_snake", CrowdDelegates.CrewSpawn }, { "cspawn_kiwi", CrowdDelegates.CrewSpawn }, { "give_binoculars", CrowdDelegates.GiveItem }, { "give_boombox", CrowdDelegates.GiveItem }, { "give_flashlight", CrowdDelegates.GiveItem }, { "give_jetpack", CrowdDelegates.GiveItem }, { "give_key", CrowdDelegates.GiveItem }, { "give_lockpicker", CrowdDelegates.GiveItem }, { "give_lungapparatus", CrowdDelegates.GiveItem }, { "give_mapdevice", CrowdDelegates.GiveItem }, { "give_proflashlight", CrowdDelegates.GiveItem }, { "give_shovel", CrowdDelegates.GiveItem }, { "give_stungrenade", CrowdDelegates.GiveItem }, { "give_extensionladder", CrowdDelegates.GiveItem }, { "give_tzpinhalant", CrowdDelegates.GiveItem }, { "give_walkietalkie", CrowdDelegates.GiveItem }, { "give_zapgun", CrowdDelegates.GiveItem }, { "give_7ball", CrowdDelegates.GiveItem }, { "give_airhorn", CrowdDelegates.GiveItem }, { "give_bottlebin", CrowdDelegates.GiveItem }, { "give_clownhorn", CrowdDelegates.GiveItem }, { "give_goldbar", CrowdDelegates.GiveItem }, { "give_stopsign", CrowdDelegates.GiveItem }, { "give_radarbooster", CrowdDelegates.GiveItem }, { "give_yieldsign", CrowdDelegates.GiveItem }, { "give_shotgun", CrowdDelegates.GiveItem }, { "give_gunAmmo", CrowdDelegates.GiveItem }, { "give_spraypaint", CrowdDelegates.GiveItem }, { "give_giftbox", CrowdDelegates.GiveItem }, { "give_tragedymask", CrowdDelegates.GiveItem }, { "give_comedymask", CrowdDelegates.GiveItem }, { "give_knife", CrowdDelegates.GiveItem }, { "give_easteregg", CrowdDelegates.GiveItem }, { "give_weedkiller", CrowdDelegates.GiveItem }, { "cgive_binoculars", CrowdDelegates.GiveCrewItem }, { "cgive_boombox", CrowdDelegates.GiveCrewItem }, { "cgive_flashlight", CrowdDelegates.GiveCrewItem }, { "cgive_jetpack", CrowdDelegates.GiveCrewItem }, { "cgive_key", CrowdDelegates.GiveCrewItem }, { "cgive_lockpicker", CrowdDelegates.GiveCrewItem }, { "cgive_lungapparatus", CrowdDelegates.GiveCrewItem }, { "cgive_mapdevice", CrowdDelegates.GiveCrewItem }, { "cgive_proflashlight", CrowdDelegates.GiveCrewItem }, { "cgive_shovel", CrowdDelegates.GiveCrewItem }, { "cgive_stungrenade", CrowdDelegates.GiveCrewItem }, { "cgive_extensionladder", CrowdDelegates.GiveCrewItem }, { "cgive_tzpinhalant", CrowdDelegates.GiveCrewItem }, { "cgive_walkietalkie", CrowdDelegates.GiveCrewItem }, { "cgive_zapgun", CrowdDelegates.GiveCrewItem }, { "cgive_7ball", CrowdDelegates.GiveCrewItem }, { "cgive_airhorn", CrowdDelegates.GiveCrewItem }, { "cgive_bottlebin", CrowdDelegates.GiveCrewItem }, { "cgive_clownhorn", CrowdDelegates.GiveCrewItem }, { "cgive_goldbar", CrowdDelegates.GiveCrewItem }, { "cgive_stopsign", CrowdDelegates.GiveCrewItem }, { "cgive_radarbooster", CrowdDelegates.GiveCrewItem }, { "cgive_yieldsign", CrowdDelegates.GiveCrewItem }, { "cgive_shotgun", CrowdDelegates.GiveCrewItem }, { "cgive_gunAmmo", CrowdDelegates.GiveCrewItem }, { "cgive_spraypaint", CrowdDelegates.GiveCrewItem }, { "cgive_giftbox", CrowdDelegates.GiveCrewItem }, { "cgive_tragedymask", CrowdDelegates.GiveCrewItem }, { "cgive_comedymask", CrowdDelegates.GiveCrewItem }, { "cgive_knife", CrowdDelegates.GiveCrewItem }, { "cgive_easteregg", CrowdDelegates.GiveCrewItem }, { "cgive_weedkiller", CrowdDelegates.GiveCrewItem }, { "weather_-1", CrowdDelegates.Weather }, { "weather_1", CrowdDelegates.Weather }, { "weather_2", CrowdDelegates.Weather }, { "weather_3", CrowdDelegates.Weather }, { "weather_4", CrowdDelegates.Weather }, { "weather_5", CrowdDelegates.Weather }, { "weather_6", CrowdDelegates.Weather }, { "lightning", CrowdDelegates.Lightning }, { "takeitem", CrowdDelegates.TakeItem }, { "dropitem", CrowdDelegates.DropItem }, { "takecrewitem", CrowdDelegates.TakeCrewItem }, { "buy_walkie", CrowdDelegates.BuyItem }, { "buy_flashlight", CrowdDelegates.BuyItem }, { "buy_shovel", CrowdDelegates.BuyItem }, { "buy_lockpicker", CrowdDelegates.BuyItem }, { "buy_proflashlight", CrowdDelegates.BuyItem }, { "buy_stungrenade", CrowdDelegates.BuyItem }, { "buy_boombox", CrowdDelegates.BuyItem }, { "buy_inhaler", CrowdDelegates.BuyItem }, { "buy_stungun", CrowdDelegates.BuyItem }, { "buy_jetpack", CrowdDelegates.BuyItem }, { "buy_extensionladder", CrowdDelegates.BuyItem }, { "buy_radarbooster", CrowdDelegates.BuyItem }, { "buy_spraypaint", CrowdDelegates.BuyItem }, { "buy_weedkiller", CrowdDelegates.BuyItem }, { "buy_cruiser", CrowdDelegates.BuyCruiser }, { "turn_off_engine", CrowdDelegates.TurnOffEngine }, { "destroy_vehicle", CrowdDelegates.DestroyVehicle }, { "start_vehicle", CrowdDelegates.TurnOnVehicle }, { "spring_chair", CrowdDelegates.SpringChair }, { "charge", CrowdDelegates.ChargeItem }, { "uncharge", CrowdDelegates.UnchargeItem }, { "breakerson", CrowdDelegates.BreakersOn }, { "breakersoff", CrowdDelegates.BreakersOff }, { "toship", CrowdDelegates.TeleportToShip }, { "crewship", CrowdDelegates.TeleportCrewToShip }, { "body", CrowdDelegates.SpawnBody }, { "crewbody", CrowdDelegates.SpawnCrewBody }, { "nightvision", CrowdDelegates.NightVision }, { "revive", CrowdDelegates.Revive }, { "tocrew", CrowdDelegates.TeleportToCrew }, { "crewto", CrowdDelegates.TeleportCrewTo }, { "screech", CrowdDelegates.Screech }, { "footstep", CrowdDelegates.Footstep }, { "breathing", CrowdDelegates.Breathing }, { "ghost", CrowdDelegates.Ghost }, { "horn", CrowdDelegates.PlayHorn }, { "blob", CrowdDelegates.BlobSound }, { "highpitch", CrowdDelegates.HighPitch }, { "lowpitch", CrowdDelegates.LowPitch }, { "addhour", CrowdDelegates.AddHour }, { "remhour", CrowdDelegates.RemoveHour }, { "addday", CrowdDelegates.AddDay }, { "remday", CrowdDelegates.RemoveDay }, { "givecred_5", CrowdDelegates.AddCredits }, { "givecred_50", CrowdDelegates.AddCredits }, { "givecred_500", CrowdDelegates.AddCredits }, { "givecred_-5", CrowdDelegates.AddCredits }, { "givecred_-50", CrowdDelegates.AddCredits }, { "givecred_-500", CrowdDelegates.AddCredits }, { "givequota_5", CrowdDelegates.AddQuota }, { "givequota_50", CrowdDelegates.AddQuota }, { "givequota_500", CrowdDelegates.AddQuota }, { "givequota_-5", CrowdDelegates.AddQuota }, { "givequota_-50", CrowdDelegates.AddQuota }, { "givequota_-500", CrowdDelegates.AddQuota }, { "giveprofit_25", CrowdDelegates.AddProfit }, { "giveprofit_50", CrowdDelegates.AddProfit }, { "giveprofit_100", CrowdDelegates.AddProfit }, { "giveprofit_-25", CrowdDelegates.AddProfit }, { "giveprofit_-50", CrowdDelegates.AddProfit }, { "giveprofit_-100", CrowdDelegates.AddProfit }, { "addscrap", CrowdDelegates.AddScrap }, { "shipleave", CrowdDelegates.ShipLeave }, { "opendoors", CrowdDelegates.OpenDoors }, { "closedoors", CrowdDelegates.CloseDoors }, { "inverse", CrowdDelegates.InverseTeleport }, { "cinverse", CrowdDelegates.InverseTeleportCrew } }; } public static void HideEffect(string code) { CrowdResponse crowdResponse = new CrowdResponse(0, CrowdResponse.Status.STATUS_NOTVISIBLE); crowdResponse.type = 1; crowdResponse.code = code; crowdResponse.Send(Socket); } public static void ShowEffect(string code) { CrowdResponse crowdResponse = new CrowdResponse(0, CrowdResponse.Status.STATUS_VISIBLE); crowdResponse.type = 1; crowdResponse.code = code; crowdResponse.Send(Socket); } public static void DisableEffect(string code) { CrowdResponse crowdResponse = new CrowdResponse(0, CrowdResponse.Status.STATUS_NOTSELECTABLE); crowdResponse.type = 1; crowdResponse.code = code; crowdResponse.Send(Socket); } public static void EnableEffect(string code) { CrowdResponse crowdResponse = new CrowdResponse(0, CrowdResponse.Status.STATUS_SELECTABLE); crowdResponse.type = 1; crowdResponse.code = code; crowdResponse.Send(Socket); } private void ClientLoop() { LethalCompanyControl.mls.LogInfo((object)"Connected to Crowd Control"); connect = true; new Timer(timeUpdate, null, 0, 200); try { while (Running) { CrowdRequest crowdRequest = CrowdRequest.Recieve(this, Socket); if (crowdRequest != null && !crowdRequest.IsKeepAlive()) { lock (Requests) { Requests.Enqueue(crowdRequest); } } } } catch (Exception) { LethalCompanyControl.mls.LogInfo((object)"Disconnected from Crowd Control"); connect = false; Socket.Close(); } } public void timeUpdate(object state) { inGame = true; if ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayersDead || StartOfRound.Instance.livingPlayers < 1) { inGame = false; } if (Saving || !inGame) { BuffThread.addTime(200); paused = true; } else if (paused) { paused = false; BuffThread.unPause(); BuffThread.tickTime(200); } else { BuffThread.tickTime(200); } } public bool CanSpawn() { return Spawn; } public bool IsRunning() { return Running; } public void NetworkLoop() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; while (Running) { LethalCompanyControl.mls.LogInfo((object)"Attempting to connect to Crowd Control"); try { Socket = new Socket(Endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp); Socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, optionValue: true); if (Socket.BeginConnect(Endpoint, null, null).AsyncWaitHandle.WaitOne(10000, exitContext: true) && Socket.Connected) { ClientLoop(); } else { LethalCompanyControl.mls.LogInfo((object)"Failed to connect to Crowd Control"); } Socket.Close(); } catch (Exception) { LethalCompanyControl.mls.LogInfo((object)"Failed to connect to Crowd Control"); } Thread.Sleep(10000); } } public void RequestLoop() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; while (Running) { try { while (Saving || !inGame) { Thread.Yield(); } CrowdRequest crowdRequest = null; lock (Requests) { if (Requests.Count == 0) { continue; } crowdRequest = Requests.Dequeue(); goto IL_006a; } IL_006a: string reqCode = crowdRequest.GetReqCode(); try { CrowdResponse crowdResponse = (isReady() ? Delegate[reqCode](this, crowdRequest) : new CrowdResponse(crowdRequest.GetReqID(), CrowdResponse.Status.STATUS_RETRY)); if (crowdResponse == null) { new CrowdResponse(crowdRequest.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Request error for '" + reqCode + "'").Send(Socket); } crowdResponse.Send(Socket); } catch (KeyNotFoundException) { new CrowdResponse(crowdRequest.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Request error for '" + reqCode + "'").Send(Socket); } } catch (Exception) { LethalCompanyControl.mls.LogInfo((object)"Disconnected from Crowd Control"); Socket.Close(); } } } public bool isReady() { try { if (!StartOfRound.Instance.shipHasLanded) { return false; } if (!RoundManager.Instance.currentLevel.spawnEnemiesAndScrap) { return false; } } catch (Exception ex) { LethalCompanyControl.mls.LogError((object)ex.ToString()); return false; } return true; } public void Stop() { Running = false; } } public delegate CrowdResponse CrowdDelegate(ControlClient client, CrowdRequest req); public class CrowdDelegates { public enum BuyableItemList { walkie, flashlight, shovel, lockpicker, proflashlight, stungrenade, boombox, inhaler, stungun, jetpack, extensionladder, radarbooster, spraypaint, weedkiller } public enum buyableVehiclesList { Cruiser } public static uint msgid; public static uint givedelay; public static CrowdResponse HealFull(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; try { NetworkManager networkManager = ((NetworkBehaviour)StartOfRound.Instance).NetworkManager; if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening) { status = CrowdResponse.Status.STATUS_RETRY; } else { LethalCompanyControl.test = true; } } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; LethalCompanyControl.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse Kill(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; try { PlayerControllerB playerRef = StartOfRound.Instance.localPlayerController; if (playerRef.health <= 0 || StartOfRound.Instance.timeSinceRoundStarted < 2f || !playerRef.playersManager.shipDoorsEnabled) { status = CrowdResponse.Status.STATUS_RETRY; } else { LethalCompanyControl.ActionQueue.Enqueue(delegate { //IL_0018: 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) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) if (LethalCompanyControl.isHost) { playerRef.KillPlayer(((Component)playerRef).transform.up * 100f, true, (CauseOfDeath)16, 0, default(Vector3)); } else { HUDManager.Instance.AddTextToChatOnServer($"<size=0>/cc_kill_{(int)playerRef.playerClientId}</size>", -1); } }); } } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; LethalCompanyControl.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse KillCrewmate(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; List<PlayerControllerB> list = new List<PlayerControllerB>(); PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null && !val.isPlayerDead && (Object)(object)val != (Object)(object)localPlayerController && ((Behaviour)val).isActiveAndEnabled && val.isPlayerControlled) { list.Add(val); } } if (list.Count <= 0) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { PlayerControllerB player = list[Random.Range(0, list.Count)]; if (StartOfRound.Instance.timeSinceRoundStarted < 2f || !localPlayerController.playersManager.shipDoorsEnabled) { status = CrowdResponse.Status.STATUS_RETRY; } else { LethalCompanyControl.ActionQueue.Enqueue(delegate { HUDManager.Instance.AddTextToChatOnServer($"<size=0>/cc_kill_{(int)player.playerClientId}</size>", -1); }); } } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; LethalCompanyControl.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse Damage(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (BuffThread.isRunning(BuffType.OHKO)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (BuffThread.isRunning(BuffType.INVUL)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { PlayerControllerB playerRef = StartOfRound.Instance.localPlayerController; if (playerRef.health <= 20 || StartOfRound.Instance.timeSinceRoundStarted < 2f || !playerRef.playersManager.shipDoorsEnabled) { status = CrowdResponse.Status.STATUS_RETRY; } else { LethalCompanyControl.ActionQueue.Enqueue(delegate { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) int num = 25; if (playerRef.health < 25) { num = playerRef.health - 1; } playerRef.DamagePlayer(num, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); }); } } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; LethalCompanyControl.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse DamageCrew(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; List<PlayerControllerB> list = new List<PlayerControllerB>(); PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null && val.health >= 20 && !val.isPlayerDead && (Object)(object)val != (Object)(object)localPlayerController && ((Behaviour)val).isActiveAndEnabled && val.isPlayerControlled) { list.Add(val); } } if (list.Count <= 0) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { PlayerControllerB player = list[Random.Range(0, list.Count)]; if (StartOfRound.Instance.timeSinceRoundStarted < 2f || !player.playersManager.shipDoorsEnabled) { status = CrowdResponse.Status.STATUS_RETRY; } else { LethalCompanyControl.ActionQueue.Enqueue(delegate { HUDManager.Instance.AddTextToChatOnServer($"<size=0>/cc_damage_{(int)player.playerClientId}</size>", -1); }); } } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; LethalCompanyControl.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse Heal(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; if (BuffThread.isRunning(BuffType.OHKO)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (BuffThread.isRunning(BuffType.INVUL)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { PlayerControllerB playerRef = StartOfRound.Instance.localPlayerController; if (playerRef.health >= 100 || StartOfRound.Instance.timeSinceRoundStarted < 2f || !playerRef.playersManager.shipDoorsEnabled) { status = CrowdResponse.Status.STATUS_RETRY; } else { LethalCompanyControl.ActionQueue.Enqueue(delegate { playerRef.health = Mathf.Clamp(playerRef.health + 25, 0, 100); if (playerRef.health >= 20) { playerRef.MakeCriticallyInjured(false); } HUDManager.Instance.UpdateHealthUI(playerRef.health, true); }); } } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; LethalCompanyControl.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse HealCrew(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; List<PlayerControllerB> list = new List<PlayerControllerB>(); PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if ((Object)(object)val != (Object)null && val.health < 100 && !val.isPlayerDead && (Object)(object)val != (Object)(object)localPlayerController && ((Behaviour)val).isActiveAndEnabled && val.isPlayerControlled) { list.Add(val); } } if (list.Count <= 0) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } try { PlayerControllerB player = list[Random.Range(0, list.Count)]; if (StartOfRound.Instance.timeSinceRoundStarted < 2f || !player.playersManager.shipDoorsEnabled) { status = CrowdResponse.Status.STATUS_RETRY; } else { LethalCompanyControl.ActionQueue.Enqueue(delegate { HUDManager.Instance.AddTextToChatOnServer($"<size=0>/cc_heal_{(int)player.playerClientId}</size>", -1); }); } } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; LethalCompanyControl.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static CrowdResponse OHKO(ControlClient client, CrowdRequest req) { int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (BuffThread.isRunning(BuffType.OHKO)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (BuffThread.isRunning(BuffType.INVUL)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } new Thread(new BuffThread(req.GetReqID(), BuffType.OHKO, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse Invul(ControlClient client, CrowdRequest req) { int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (BuffThread.isRunning(BuffType.OHKO)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (BuffThread.isRunning(BuffType.INVUL)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } new Thread(new BuffThread(req.GetReqID(), BuffType.INVUL, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse DrainStamins(ControlClient client, CrowdRequest req) { PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; if (localPlayerController.sprintMeter < 0.1f) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } localPlayerController.sprintMeter = 0f; localPlayerController.isExhausted = true; return new CrowdResponse(req.GetReqID()); } public static CrowdResponse RestoreStamins(ControlClient client, CrowdRequest req) { PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; if (localPlayerController.sprintMeter > 0.9f) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } localPlayerController.sprintMeter = 1f; localPlayerController.isExhausted = false; return new CrowdResponse(req.GetReqID()); } public static CrowdResponse InfiniteStamina(ControlClient client, CrowdRequest req) { int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (BuffThread.isRunning(BuffType.INFSTAM)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (BuffThread.isRunning(BuffType.NOSTAM)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } new Thread(new BuffThread(req.GetReqID(), BuffType.INFSTAM, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse NoStamina(ControlClient client, CrowdRequest req) { int num = 30; if (req.duration > 0) { num = req.duration / 1000; } if (BuffThread.isRunning(BuffType.INFSTAM)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } if (BuffThread.isRunning(BuffType.NOSTAM)) { return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY); } new Thread(new BuffThread(req.GetReqID(), BuffType.NOSTAM, num * 1000).Run).Start(); return new TimedResponse(req.GetReqID(), num * 1000); } public static CrowdResponse Footstep(ControlClient client, CrowdRequest req) { CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS; string message = ""; PlayerControllerB playerRef = StartOfRound.Instance.localPlayerController; try { if (StartOfRound.Instance.timeSinceRoundStarted < 2f || !playerRef.playersManager.shipDoorsEnabled) { status = CrowdResponse.Status.STATUS_RETRY; } else { LethalCompanyControl.ActionQueue.Enqueue(delegate { playerRef.PlayFootstepServer(); playerRef.movementAudio.PlayOneShot(StartOfRound.Instance.footstepSurfaces[0].clips[0], 4f); WalkieTalkie.TransmitOneShotAudio(playerRef.movementAudio, StartOfRound.Instance.footstepSurfaces[0].clips[0], 4f); }); } } catch (Exception ex) { status = CrowdResponse.Status.STATUS_RETRY; LethalCompanyControl.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString())); } return new CrowdResponse(req.GetReqID(), status, message); } public static void SpawnAndPlayScreech(SpawnableEnemyWithRarity source) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController; GameObject obj = Object.Instantiate<GameObject>(source.enemyType.enemyPrefab, ((Component)localPlayerController).transform.position + ((Component)localPlayerController).transform.forward * 5f, Quaternion.Euler(Vector3.zero)); obj.gameObject.GetComponentInChildren<EnemyAI>().stunNormalizedTimer = 6f; BaboonBirdAI component = obj.gameObject.GetComponent<BaboonBirdAI>(); localPlayerController.movementAudio.PlayOneShot(component.cawScreamSFX[0], 4f); WalkieTalkie.TransmitOneShotAudio(localPlayerController.movementAudio, component.cawScreamSFX[0], 4f); RoundManager.Instance.PlayAudibleNoise(((Component)localPlayerController).transform.position, 12f, 4f, 0, false, 911); Object.Destroy((Obj