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 ChatsRevenge v1.6.0
ChatsRevenge.dll
Decompiled a year agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; 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 System.Threading.Tasks; using BepInEx; using BepInEx.Logging; using ChatsRevenge.Patches; using ChatsRevenge.Utils; using GameNetcodeStuff; using HarmonyLib; using LC_API.ServerAPI; using Newtonsoft.Json; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Networking; using UnityEngine.Rendering.HighDefinition; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyTitle("MyFirstPlugin")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("MyFirstPlugin")] [assembly: AssemblyCopyright("Copyright © 2023")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("bef4a970-cf63-4f92-a4a1-e7d8d3748309")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] namespace ChatsRevenge { [BepInPlugin("ChatsRevenge", "ChatsRevenge", "1.6.0")] public class Plugin : BaseUnityPlugin { public PlayerControllerB _localPlayer; public PlayerControllerB currentTarget; public Terminal terminal; public RoundManager currentRound; public SelectableLevel currentLevel; public pythonSocket socket = new pythonSocket(); private const string PluginName = "ChatsRevenge"; public const string VersionString = "1.6.0"; public string version = "1.6.0"; private static readonly Harmony Harmony = new Harmony("ChatsRevenge"); private static HUDManager _hudManager; public static ManualLogSource Log = new ManualLogSource("ChatsRevenge"); public IDictionary<string, GameObject> prefabs = new Dictionary<string, GameObject>(); public IDictionary<string, AudioClip> clips = new Dictionary<string, AudioClip>(); public IDictionary<string, GameObject> ambiants = new Dictionary<string, GameObject>(); public IDictionary<string, GameObject> UIElements = new Dictionary<string, GameObject>(); public List<GameObject> minesThisRound = new List<GameObject>(); private LocalVolumetricFog[] fogs; private GameObject TimeAndWeather = null; private string SIGNATURE = "CHATSREVENGE"; public static Plugin Instance { get; private set; } private void Awake() { Instance = this; ((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: ChatsRevenge, VersionString: 1.6.0 is loading..."); Harmony.PatchAll(); ((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: ChatsRevenge, VersionString: 1.6.0 is loaded."); Log = ((BaseUnityPlugin)this).Logger; PlayerPatches.plugin = this; pythonSocket.plugin = this; Harmony.PatchAll(typeof(ModUtils)); Harmony.PatchAll(typeof(PlayerPatches)); socket.start(); StartLogicLoop(); } private async void StartLogicLoop() { while ((Object)(object)StartOfRound.Instance == (Object)null) { await Task.Delay(1000); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"StartOfRound.Instance found..."); _localPlayer = StartOfRound.Instance.localPlayerController; while ((Object)(object)_localPlayer == (Object)null) { await Task.Delay(250); _localPlayer = StartOfRound.Instance.localPlayerController; } while ((Object)(object)_hudManager == (Object)null) { await Task.Delay(250); _hudManager = HUDManager.Instance; } handleIncomingPings(); } private void handleIncomingPings() { preAction(); Networking.GetString = (Action<string, string>)Delegate.Combine(Networking.GetString, (Action<string, string>)delegate(string message, string signature) { OnGetData(message, signature); }); } public void log(string message) { ((BaseUnityPlugin)this).Logger.LogInfo((object)message); } public void logError(string message) { ((BaseUnityPlugin)this).Logger.LogError((object)message); } public void spin() { } private void OnGetData(string message, string sig) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Unknown result type (might be due to invalid IL or missing references) if (sig.Equals(SIGNATURE)) { broadcastData broadcastData = JsonConvert.DeserializeObject<broadcastData>(message); if (broadcastData.command == "playsound") { Vector3 loc = default(Vector3); ((Vector3)(ref loc))..ctor(broadcastData.x, broadcastData.y, broadcastData.z); PlaySoundLocal(broadcastData.text, loc); } else if (broadcastData.command == "voidItem") { voidItem(broadcastData.clientId, broadcastData.INT); } else if (broadcastData.command == "destroyHeldItem") { DestroyHeldItemLocal(broadcastData.clientId, broadcastData.INT); } else if (broadcastData.command == "ChangeWeather") { ChangeWeatherLocal((LevelWeatherType)broadcastData.INT); } else if (broadcastData.command == "AnnounceAction") { AnnounceActionLocal(broadcastData.text); } else if (broadcastData.command == "lethalcompany_dropAllItems") { DropHeldItemsLocal(broadcastData.clientId); } else if (broadcastData.command == "playsoundplayer") { PlaySoundPlayerLocationLocal(broadcastData.text, broadcastData.clientId); } else if (broadcastData.command == "giveImmunity") { giveImmunityLocal(broadcastData.clientId); } else if (broadcastData.command == "DrunkPlayer") { DrunkPlayerLocal(broadcastData.clientId, broadcastData.x); } else if (broadcastData.command == "SpawnAllVents") { SpawnAllVentsServer(); } else if (broadcastData.command == "MultiplyBank") { MultiplyBankServer(broadcastData.x); } else if (broadcastData.command == "SyncBank") { SyncBank(broadcastData.INT); } else if (broadcastData.command == "SpawnEnemy") { SpawnEnemyServer(broadcastData.text, broadcastData.INT, new Vector3(broadcastData.x, broadcastData.y, broadcastData.z), broadcastData.eulerY); } else if (broadcastData.command == "SpawnGameObject") { SpawnGameObjectServer(broadcastData.text, new Vector3(broadcastData.x, broadcastData.y, broadcastData.z), broadcastData.eulerY); } else if (broadcastData.command == "") { fakeGhostLocal(broadcastData.clientId); } else if (broadcastData.command == "beamUpPlayer") { beamUpPlayerLocal(broadcastData.clientId, new Vector3(broadcastData.x, broadcastData.y, broadcastData.z), broadcastData.eulerY, broadcastData.INT == 1, broadcastData.BOOL); } else if (broadcastData.command == "despawnEnemy") { despawnEnemyLocal(broadcastData.clientId, broadcastData.BOOL); } else if (broadcastData.command == "AnnounceActionDelayed") { AnnounceActionDelayedLocal(broadcastData.text, broadcastData.INT); } else if (broadcastData.command == "leaveEarly") { leaveEarlyServer(); } else if (broadcastData.command == "changeBatteries") { changeBatteries(broadcastData.clientId, broadcastData.x); } else if (broadcastData.command == "meetQuota") { meetQuotaLocal(); } else if (broadcastData.command == "revive") { reviveLocal(); } else if (broadcastData.command == "spawnEnemyNearPlayer") { spawnEnemyNearPlayerServer(broadcastData.clientId, broadcastData.text, broadcastData.INT); } else if (broadcastData.command == "BugInvestation") { BugInvestationServer(broadcastData.clientId); } } } public void LoadPrefabs() { GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>(); GameObject[] array2 = array; foreach (GameObject val in array2) { if (((Object)val).name == "Landmine") { prefabs["landmine"] = val; } } GameObject[] array3 = Object.FindObjectsOfType<GameObject>(); GameObject[] array4 = array3; foreach (GameObject val2 in array4) { if (val2.activeInHierarchy) { if (((Object)val2).name == "EclipseObject") { ambiants[((Object)val2).name] = val2; log(((Object)val2).name); } if (((Object)val2).name.ToLower().Contains("fog")) { ambiants[((Object)val2).name] = val2; } if (((Object)val2.transform).name == "TimeAndWeather") { TimeAndWeather = val2; } if (((Object)val2).name == "SprintMeter") { UIElements[((Object)val2).name] = val2; } if (((Object)val2).name == "Self") { UIElements[((Object)val2).name] = val2; } if (((Object)val2).name == "SelfRed") { UIElements[((Object)val2).name] = val2; } if (((Object)val2).name == "WeightUI") { UIElements[((Object)val2).name] = val2; } if (((Object)val2).name == "Inventory") { UIElements[((Object)val2).name] = val2; } } } AudioClip[] array5 = Resources.FindObjectsOfTypeAll<AudioClip>(); AudioClip[] array6 = array5; foreach (AudioClip val3 in array6) { if (!clips.ContainsKey(((Object)val3).name)) { if (((Object)val3).name == "ShipTeleporterBeam") { clips[((Object)val3).name] = val3; } if (((Object)val3).name == "ShipTeleporterBeamPlayerBody") { clips[((Object)val3).name] = val3; } if (((Object)val3).name == "TurretSeePlayer") { clips[((Object)val3).name] = val3; } if (((Object)val3).name == "Spring1") { clips[((Object)val3).name] = val3; } if (((Object)val3).name == "Spring2") { clips[((Object)val3).name] = val3; } if (((Object)val3).name == "Spring3") { clips[((Object)val3).name] = val3; } if (((Object)val3).name == "JackInTheBoxTheme") { clips[((Object)val3).name] = val3; } if (((Object)val3).name == "VoiceCry2") { clips[((Object)val3).name] = val3; } if (((Object)val3).name == "VoiceHey") { clips[((Object)val3).name] = val3; } if (((Object)val3).name == "VoiceCry") { clips[((Object)val3).name] = val3; } if (((Object)val3).name == "Laugh2") { clips[((Object)val3).name] = val3; } if (((Object)val3).name == "Breathing") { clips[((Object)val3).name] = val3; } } } if (!clips.ContainsKey("mario")) { AudioClip audioFromFile = ModUtils.GetAudioFromFile("https://audio.jukehost.co.uk/Bp1CR9Ccf7XIBN99pFWWnTLdG73ZpQXL"); clips["mario"] = audioFromFile; } } public void AnnounceActionLocal(string action) { log("AnnounceActionLocal"); HUDManager.Instance.DisplayTip("Chat's Revenge!", action, true, true, "LC_Tip1"); } public void AnnounceActionDelayed(string action, int duration) { log("AnnounceActionDelayed"); broadcastData broadcastData = new broadcastData { clientId = currentTarget.playerClientId, command = "AnnounceActionDelayed", text = action, INT = duration }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); AnnounceActionDelayedLocal(action, duration); } private void AnnounceActionDelayedLocal(string action, int duration) { log("AnnounceActionDelayedLocal"); Thread thread = new Thread((ThreadStart)delegate { AnnounceActionDelayedRoutine(action, duration); }); thread.IsBackground = true; thread.Start(); } private void AnnounceActionDelayedRoutine(string action, int duration) { log("AnnounceActionDelayedRoutine"); Thread.Sleep(duration); log("Thread.Sleep done"); Instance.AnnounceActionLocal(action); } public void AnnounceAction(string action) { broadcastData broadcastData = new broadcastData { command = "AnnounceAction", text = action }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); AnnounceActionLocal(action); } private PlayerControllerB getPlayer(ulong clientID) { PlayerControllerB result = null; PlayerControllerB[] allPlayerScripts = currentRound.playersManager.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.playerClientId == clientID) { result = val; } } return result; } public void DropHeldItems() { DropHeldItemsLocal(currentTarget.playerClientId); broadcastData broadcastData = new broadcastData { clientId = currentTarget.playerClientId, command = "lethalcompany_dropAllItems" }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); DropHeldItemsLocal(currentTarget.playerClientId); } private void DropHeldItemsLocal(ulong clientID) { PlayerControllerB player = getPlayer(clientID); if (((NetworkBehaviour)player).IsOwner) { player.DropAllHeldItems(true, false); } } public void DestroyHeldItem(int slot = -1) { if (playerValid()) { log("destroying item"); broadcastData broadcastData = new broadcastData { INT = slot, clientId = currentTarget.playerClientId, command = "DestroyHeldItem" }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); DestroyHeldItemLocal(currentTarget.playerClientId, slot); } } public void DestroyHeldItems() { int currentItemSlot = currentTarget.currentItemSlot; for (int i = 0; i < currentTarget.ItemSlots.Length; i++) { currentTarget.currentItemSlot = i; DestroyHeldItem(i); } currentTarget.isHoldingObject = false; currentTarget.twoHanded = false; currentTarget.carryWeight = 1f; currentTarget.currentlyHeldObjectServer = null; currentTarget.currentItemSlot = currentItemSlot; } public void DestroyHeldItemLocal(ulong playerID, int itemSlot) { //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = null; PlayerControllerB[] allPlayerScripts = currentRound.playersManager.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (val2.playerClientId == playerID) { val = val2; } } if (!((Object)(object)val == (Object)null)) { if (itemSlot == -1) { itemSlot = val.currentItemSlot; } val.currentItemSlot = itemSlot; GrabbableObject val3 = val.ItemSlots[itemSlot]; if ((Object)(object)val3 != (Object)null) { log("DestroyHeldItemLocal"); val.currentlyHeldObjectServer = val3; val.DespawnHeldObject(); } if (((NetworkBehaviour)val).IsOwner) { ((Behaviour)HUDManager.Instance.holdingTwoHandedItem).enabled = false; ((Behaviour)HUDManager.Instance.itemSlotIcons[itemSlot]).enabled = false; HUDManager.Instance.ClearControlTips(); } } } private void voidItem(ulong clientID, int itemSlot) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = currentRound.playersManager.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.playerClientId == clientID) { GrabbableObject val2 = val.ItemSlots[itemSlot]; ((Component)val2).transform.position = new Vector3(10000f, 10000f, 10000f); } } } private bool playerValid() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown PlayerControllerB localPlayerController = currentRound.playersManager.localPlayerController; if ((Object)localPlayerController != (Object)null) { _localPlayer = localPlayerController; } return !((Object)_localPlayer == (Object)null); } public void preAction() { currentRound = RoundManager.Instance; currentLevel = currentRound.currentLevel; terminal = Object.FindObjectOfType<Terminal>(); LoadPrefabs(); log("starting action!"); _localPlayer = currentRound.playersManager.localPlayerController; currentTarget = _localPlayer; if (_localPlayer.isPlayerDead) { currentTarget = _localPlayer.spectatedPlayerScript; } } public void PlaySound(string clipName, Vector3 loc) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0095: Unknown result type (might be due to invalid IL or missing references) if (playerValid()) { log("PlaySound"); broadcastData broadcastData = new broadcastData { x = loc.x, y = loc.y, z = loc.z, clientId = _localPlayer.playerClientId, command = "playsound", text = clipName }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); log(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0)); PlaySoundLocal(clipName, loc); } } public void PlaySoundLocal(string clipName, Vector3 loc) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0042: 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_005f: Expected O, but got Unknown if (((NetworkBehaviour)_localPlayer).IsOwner) { log("PlaySoundLocal"); AudioClip val = clips[clipName]; GameObject val2 = new GameObject("One shot audio"); val2.transform.position = loc; AudioSource val3 = (AudioSource)val2.AddComponent(typeof(AudioSource)); val3.clip = val; val3.spatialBlend = 1f; val3.volume = 10f; val3.Play(); Object.Destroy((Object)(object)val2, val.length * ((Time.timeScale < 0.01f) ? 0.01f : Time.timeScale)); } } public void PlaySoundPlayerLocation(string clipName, ulong clientID) { if (playerValid()) { broadcastData broadcastData = new broadcastData { clientId = _localPlayer.playerClientId, command = "playsoundplayer", text = clipName }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); log(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0)); PlaySoundPlayerLocationLocal(clipName, clientID); } } public void PlaySoundPlayerLocationLocal(string clipName, ulong clientID) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = currentRound.playersManager.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.playerClientId == clientID) { try { AudioClip val2 = clips[clipName]; AudioSource val3 = (AudioSource)((Component)val).gameObject.AddComponent(typeof(AudioSource)); val3.clip = val2; val3.spatialBlend = 1f; val3.volume = 10f; ((Component)val3).transform.position = ((Component)val).transform.position; val3.Play(); Object.Destroy((Object)(object)val3, val2.length * ((Time.timeScale < 0.01f) ? 0.01f : Time.timeScale)); } catch { } } } } public void ChangeWeather(LevelWeatherType weather) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected I4, but got Unknown //IL_002e: Unknown result type (might be due to invalid IL or missing references) broadcastData broadcastData = new broadcastData { clientId = _localPlayer.playerClientId, command = "ChangeWeather", INT = (int)weather }; ChangeWeatherLocal(weather); Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); } public void ChangeWeatherLocal(LevelWeatherType weather) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Invalid comparison between Unknown and I4 //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Invalid comparison between Unknown and I4 //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Invalid comparison between Unknown and I4 //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Invalid comparison between Unknown and I4 //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_02e4: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_054c: Invalid comparison between Unknown and I4 //IL_03e4: Unknown result type (might be due to invalid IL or missing references) //IL_041b: Unknown result type (might be due to invalid IL or missing references) //IL_0420: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Unknown result type (might be due to invalid IL or missing references) //IL_045c: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) //IL_049a: Unknown result type (might be due to invalid IL or missing references) //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04d5: Unknown result type (might be due to invalid IL or missing references) //IL_04da: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_04fa: Unknown result type (might be due to invalid IL or missing references) //IL_0515: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_0535: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Unknown result type (might be due to invalid IL or missing references) //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0578: Unknown result type (might be due to invalid IL or missing references) //IL_0330: Unknown result type (might be due to invalid IL or missing references) //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_05ae: Unknown result type (might be due to invalid IL or missing references) //IL_05b4: Invalid comparison between Unknown and I4 //IL_061e: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Invalid comparison between Unknown and I4 //IL_0632: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) //IL_06b1: Unknown result type (might be due to invalid IL or missing references) //IL_06b6: Unknown result type (might be due to invalid IL or missing references) //IL_06bb: Unknown result type (might be due to invalid IL or missing references) //IL_06c0: Unknown result type (might be due to invalid IL or missing references) //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_06d1: Unknown result type (might be due to invalid IL or missing references) //IL_06d3: Unknown result type (might be due to invalid IL or missing references) if (StartOfRound.Instance.hangarDoorsClosed && currentTarget.isInHangarShipRoom && !StartOfRound.Instance.shipHasLanded) { SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { val.currentWeather = weather; } return; } if ((int)TimeOfDay.Instance.currentLevelWeather != -1) { log("removing old weather " + ((object)(LevelWeatherType)(ref TimeOfDay.Instance.currentLevelWeather)).ToString()); TimeOfDay.Instance.effects[TimeOfDay.Instance.currentLevelWeather].effectEnabled = false; if ((Object)(object)TimeOfDay.Instance.effects[TimeOfDay.Instance.currentLevelWeather].effectObject != (Object)null) { TimeOfDay.Instance.effects[TimeOfDay.Instance.currentLevelWeather].effectObject.SetActive(false); } if ((Object)(object)TimeOfDay.Instance.effects[TimeOfDay.Instance.currentLevelWeather].effectPermanentObject != (Object)null) { TimeOfDay.Instance.effects[TimeOfDay.Instance.currentLevelWeather].effectPermanentObject.SetActive(false); } if ((int)TimeOfDay.Instance.currentLevelWeather == 5) { ambiants["EclipseObject"].SetActive(false); TimeOfDay.Instance.sunDirect.colorTemperature = 4705f; TimeOfDay.Instance.sunDirect.useColorTemperature = false; HDAdditionalLightData component = ((Component)TimeOfDay.Instance.sunDirect).GetComponent<HDAdditionalLightData>(); component.SetColor(TimeOfDay.Instance.sunDirect.color, 4705f); component.EnableColorTemperature(false); } } currentLevel.currentWeather = weather; TimeOfDay.Instance.currentLevelWeather = weather; if ((int)weather != 4) { currentTarget.isUnderwater = false; } if ((int)weather == -1) { TimeOfDay.Instance.currentWeatherVariable = 0f; TimeOfDay.Instance.currentWeatherVariable2 = 0f; RoundManager.Instance.minOutsideEnemiesToSpawn = (int)TimeOfDay.Instance.currentWeatherVariable; RoundManager.Instance.minEnemiesToSpawn = (int)TimeOfDay.Instance.currentWeatherVariable; } else { log("switching to new " + ((object)(LevelWeatherType)(ref weather)).ToString()); TimeOfDay.Instance.effects[TimeOfDay.Instance.currentLevelWeather].effectEnabled = true; if ((Object)(object)TimeOfDay.Instance.effects[TimeOfDay.Instance.currentLevelWeather].effectObject != (Object)null) { TimeOfDay.Instance.effects[TimeOfDay.Instance.currentLevelWeather].effectObject.SetActive(true); } if ((Object)(object)TimeOfDay.Instance.effects[TimeOfDay.Instance.currentLevelWeather].effectPermanentObject != (Object)null) { TimeOfDay.Instance.effects[TimeOfDay.Instance.currentLevelWeather].effectPermanentObject.SetActive(true); } for (int j = 0; j < currentLevel.randomWeathers.Length; j++) { if (currentLevel.randomWeathers[j].weatherType == currentLevel.currentWeather) { TimeOfDay.Instance.currentWeatherVariable = currentLevel.randomWeathers[j].weatherVariable; TimeOfDay.Instance.currentWeatherVariable2 = currentLevel.randomWeathers[j].weatherVariable2; } } } if (TimeAndWeather.GetComponents<LocalVolumetricFog>().Length == 0) { LocalVolumetricFog val2 = TimeAndWeather.AddComponent<LocalVolumetricFog>(); ((Component)val2).transform.position = new Vector3(4.2f, 1.5f, -14.53f); val2.parameters.anisotropy = 0f; val2.parameters.albedo = new Color(0.441f, 0.459f, 0.5f, 1f); val2.parameters.blendingMode = (LocalVolumetricFogBlendingMode)1; val2.parameters.distanceFadeEnd = 10000f; val2.parameters.distanceFadeStart = 10000f; val2.parameters.falloffMode = (LocalVolumetricFogFalloffMode)1; val2.parameters.invertFade = false; val2.parameters.meanFreePath = 4f; val2.parameters.negativeFade = new Vector3(0f, 0.06f, 0f); val2.parameters.positiveFade = new Vector3(0f, 0.41f, 0f); val2.parameters.size = new Vector3(356f, 68.6f, 356f); val2.parameters.textureOffset = new Vector3(0f, 0f, 0f); val2.parameters.textureScrollingSpeed = new Vector3(0f, 0f, -0.7f); val2.parameters.textureTiling = new Vector3(1f, 1f, 1f); } if ((int)currentLevel.currentWeather == 3) { TimeAndWeather.GetComponent<LocalVolumetricFog>().parameters.size = new Vector3(356f, 68.6f, 356f); } else { TimeAndWeather.GetComponent<LocalVolumetricFog>().parameters.size = new Vector3(0.001f, 0.001f, 0.001f); } if ((int)currentLevel.currentWeather == 5) { ambiants["EclipseObject"].SetActive(true); HDAdditionalLightData component2 = ((Component)TimeOfDay.Instance.sunDirect).GetComponent<HDAdditionalLightData>(); component2.EnableColorTemperature(true); RoundManager.Instance.minOutsideEnemiesToSpawn = (int)TimeOfDay.Instance.currentWeatherVariable; RoundManager.Instance.minEnemiesToSpawn = (int)TimeOfDay.Instance.currentWeatherVariable; } if ((int)TimeOfDay.Instance.currentLevelWeather == 1) { NavMeshHit val3 = default(NavMeshHit); Random random = new Random(StartOfRound.Instance.randomMapSeed + 2); int num = random.Next(5, 15); if (random.Next(0, 100) < 7) { num = random.Next(5, 30); } for (int k = 0; k < num; k++) { Vector3 val4 = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(RoundManager.Instance.outsideAINodes[random.Next(0, RoundManager.Instance.outsideAINodes.Length)].transform.position, 30f, val3, random, -1) + Vector3.up; GameObject val5 = Object.Instantiate<GameObject>(RoundManager.Instance.quicksandPrefab, val4, Quaternion.identity, RoundManager.Instance.mapPropsContainer.transform); } } } public void giveImmunity() { broadcastData broadcastData = new broadcastData { clientId = _localPlayer.playerClientId, command = "giveImmunity" }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); giveImmunityLocal(currentTarget.playerClientId); } public void giveImmunityLocal(ulong clientID) { if (((NetworkBehaviour)_localPlayer).IsOwner && _localPlayer.playerClientId == clientID) { SetImmuneLocal(on: true); } } public void SetImmuneLocal(bool on) { if (!_localPlayer.isPlayerDead) { if (on) { PlaySoundPlayerLocation("mario", _localPlayer.playerClientId); PlayerPatches.clientID = _localPlayer.playerClientId; PlayerPatches.immune = true; PlayerPatches.immuneStartTime = Time.realtimeSinceStartup; } else { PlayerPatches.immune = false; } } } public void DrunkPlayer(float drunkness = 20f) { DrunkPlayerLocal(currentTarget.playerClientId, drunkness); broadcastData broadcastData = new broadcastData { clientId = _localPlayer.playerClientId, command = "DrunkPlayer", x = drunkness }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); } public void DrunkPlayerLocal(ulong clientID, float drunkness = 20f) { PlayerControllerB player = getPlayer(clientID); if ((Object)(object)player != (Object)null) { currentTarget.drunkness = drunkness; } } public void SpawnAllVents() { SpawnAllVentsServer(); broadcastData broadcastData = new broadcastData { clientId = _localPlayer.playerClientId, command = "SpawnAllVents" }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); } public void SpawnAllVentsServer() { if (!((NetworkBehaviour)_localPlayer).IsServer || (Object)(object)currentRound == (Object)null) { return; } for (int i = 0; i < currentRound.allEnemyVents.Length; i++) { if (!currentRound.allEnemyVents[i].occupied) { currentRound.SpawnEnemyFromVent(currentRound.allEnemyVents[i]); } } } public void buyRandomItems(int count = 4) { for (int i = 0; i < count; i++) { int item = Random.Range(0, terminal.buyableItemsList.Length); terminal.orderedItemsFromTerminal.Add(item); Terminal obj = terminal; obj.numberOfItemsInDropship++; } int[] array = terminal.orderedItemsFromTerminal.ToArray(); if (!((NetworkBehaviour)terminal).IsServer && array.Length <= 12) { terminal.useCreditsCooldown = true; terminal.BuyItemsServerRpc(array, terminal.groupCredits, terminal.numberOfItemsInDropship); terminal.orderedItemsFromTerminal.Clear(); } } public void MultiplyBank(double factor) { MultiplyBankServer(factor); broadcastData broadcastData = new broadcastData { clientId = _localPlayer.playerClientId, command = "MultiplyBank", x = (float)factor }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); } public void MultiplyBankServer(double factor) { if (((NetworkBehaviour)_localPlayer).IsServer) { terminal.groupCredits = (int)((double)Object.FindObjectOfType<Terminal>().groupCredits * factor); broadcastData broadcastData = new broadcastData { command = "SyncBank", INT = terminal.groupCredits }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); } } public void SyncBank(int credits) { terminal.groupCredits = credits; } public void BugInvestation() { bool flag = true; PlayerControllerB val = null; if (currentTarget.isInsideFactory == flag) { val = currentTarget; } if ((Object)(object)val == (Object)null) { PlayerControllerB[] allPlayerScripts = currentRound.playersManager.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (val2.isInsideFactory == flag) { val = val2; break; } } } BugInvestationServer(val.playerClientId); broadcastData broadcastData = new broadcastData { command = "BugInvestation", clientId = val.playerClientId }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); } public void BugInvestationServer(ulong clientID) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)_localPlayer).IsServer) { return; } PlayerControllerB player = getPlayer(clientID); int num = 4; for (int i = 0; i < num; i++) { Vector3 position = ((Component)currentRound.allEnemyVents[Random.Range(0, currentRound.allEnemyVents.Length)]).transform.position; float eulerY = (180 + 2 * i / num * 180) % 360; if ((Object)(object)player != (Object)null) { float num2 = 6.28f * (float)i / (float)num; position = ((Component)player).transform.position; position.x += 3f * Mathf.Sin(num2); position.z += 3f * Mathf.Cos(num2); } SpawnEnemy("hoarderbug", position, eulerY); } string[] array = new string[6] { "hoarderbug", "hoarderbug", "hoarderbug", "hoarderbug", "sandspider", "centipede" }; EnemyVent[] allEnemyVents = currentRound.allEnemyVents; foreach (EnemyVent val in allEnemyVents) { SpawnEnemy(array[Random.Range(0, array.Length)], ((Component)val).transform.position, ((Component)val).transform.eulerAngles.y); } } public void spawnEnemyNearPlayer(string enemyName, int insd = 0) { spawnEnemyNearPlayerServer(currentTarget.playerClientId, enemyName, insd); broadcastData broadcastData = new broadcastData { command = "spawnEnemyNearPlayer", text = enemyName, clientId = currentTarget.playerClientId, INT = insd }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); } public void spawnEnemyNearPlayerServer(ulong clientID, string enemyName, int insd = 0) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_0130: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)_localPlayer).IsServer) { return; } PlayerControllerB val = null; PlayerControllerB player = getPlayer(clientID); bool flag = insd == 1; bool flag2 = insd == 0; log("1"); Vector3 position = ((Component)currentRound.allEnemyVents[Random.Range(0, currentRound.allEnemyVents.Length)]).transform.position; log("2"); if (flag2) { position = GameObject.FindGameObjectsWithTag("OutsideAINode")[Random.Range(0, GameObject.FindGameObjectsWithTag("OutsideAINode").Length - 1)].transform.position; } log("3"); if (player.isInsideFactory == flag) { val = player; } if (insd == -1) { val = player; } if ((Object)(object)val == (Object)null) { PlayerControllerB[] allPlayerScripts = currentRound.playersManager.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (val2.isInsideFactory == flag) { val = val2; break; } } } if ((Object)(object)val != (Object)null) { Quaternion rotation = ((Component)val).transform.rotation; float num = (float)((double)((Quaternion)(ref rotation)).eulerAngles.y * 3.14 / 180.0); position = ((Component)val).transform.position; position.x += 3f * Mathf.Sin(num); position.z += 3f * Mathf.Cos(num); } SpawnEnemy(enemyName, position); } public void spawnEnemyNearestVent(string enemyName, int amount = 1) { //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) int num = Random.Range(0, currentRound.allEnemyVents.Length); PlayerControllerB val = null; if (currentTarget.isInsideFactory) { val = currentTarget; } else { PlayerControllerB[] allPlayerScripts = currentRound.playersManager.allPlayerScripts; foreach (PlayerControllerB val2 in allPlayerScripts) { if (val2.isInsideFactory && !val2.isPlayerDead) { val = val2; break; } } } if ((Object)(object)val != (Object)null) { Vector3 position = ((Component)val).transform.position; float num2 = 0f; if (position.x == -10f && position.y == -10f && position.z == -10f) { num = Random.Range(0, currentRound.allEnemyVents.Length); } else { for (int j = 0; j < currentRound.allEnemyVents.Length; j++) { Vector3 val3 = currentRound.allEnemyVents[j].floorNode.position - position; float magnitude = ((Vector3)(ref val3)).magnitude; if (magnitude < num2 || num2 == 0f) { num2 = magnitude; num = j; } } } } Vector3 position2 = ((Component)currentRound.allEnemyVents[num]).transform.position; Quaternion rotation = ((Component)currentRound.allEnemyVents[num]).transform.rotation; SpawnEnemy(enemyName, position2, ((Quaternion)(ref rotation)).eulerAngles.y, amount); } public void SpawnMine() { //IL_000c: 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) //IL_0014: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) Quaternion rotation = ((Component)currentTarget).transform.rotation; float num = (float)((double)((Quaternion)(ref rotation)).eulerAngles.y * 3.14 / 180.0); Vector3 position = ((Component)currentTarget).transform.position; position.x += 3f * Mathf.Sin(num); position.z += 3f * Mathf.Cos(num); Vector3 loc = position; rotation = ((Component)currentTarget).transform.rotation; SpawnGameObject("landmine", loc, ((Quaternion)(ref rotation)).eulerAngles.y); } private void SpawnEnemy(string enemyNmae, Vector3 loc, float eulerY = 0f, int amount = 1) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) SpawnEnemyServer(enemyNmae, amount, loc, eulerY); broadcastData broadcastData = new broadcastData { command = "SpawnEnemy", eulerY = eulerY, INT = amount, text = enemyNmae, x = loc.x, y = loc.y, z = loc.z }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); } private void SpawnEnemyServer(string enemyName, int amount, Vector3 loc, float eulerY = 0f) { //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) if (!((NetworkBehaviour)_localPlayer).IsServer) { return; } log("spawning " + enemyName); EnemyType val = null; foreach (SpawnableEnemyWithRarity outsideEnemy in currentLevel.OutsideEnemies) { if (((Object)outsideEnemy.enemyType.enemyPrefab).name.ToLower() == enemyName.ToLower()) { val = outsideEnemy.enemyType; } } if ((Object)(object)val == (Object)null) { foreach (SpawnableEnemyWithRarity enemy in currentLevel.Enemies) { if (((Object)enemy.enemyType.enemyPrefab).name.ToLower() == enemyName.ToLower()) { val = enemy.enemyType; } } } try { for (int i = 0; i < amount; i++) { currentRound.SpawnEnemyGameObject(loc, eulerY, -1, val); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Failed to spawn enemies. " + ex.ToString())); } } private void moveEnemy(EnemyAI enemy, Vector3 loc, float eulerY) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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) log("moving enemy"); enemy.serverPosition = loc; enemy.agent.Warp(loc); Vector3 position = ((Component)enemy).gameObject.transform.position; ((Vector3)(ref position)).Set(loc.x, loc.y, loc.z); ((Component)enemy).transform.position = loc; position = ((Component)enemy).transform.position; ((Vector3)(ref position)).Set(loc.x, loc.y, loc.z); ((Component)enemy).transform.position = loc; position = ((Component)enemy).transform.position; ((Vector3)(ref position)).Set(loc.x, loc.y, loc.z); } private void SpawnGameObject(string objectName, Vector3 loc, float eulerY = 0f) { //IL_0003: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) SpawnGameObjectServer(objectName, loc, eulerY); broadcastData broadcastData = new broadcastData { command = "SpawnGameObject", eulerY = eulerY, text = objectName, x = loc.x, y = loc.y, z = loc.z }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); } private void SpawnGameObjectServer(string objectName, Vector3 loc, float eulerY = 0f) { //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_0032: 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 (!((NetworkBehaviour)_localPlayer).IsServer) { return; } Quaternion val = Quaternion.Euler(0f, eulerY, 0f); GameObject val2 = Object.Instantiate<GameObject>(prefabs[objectName], loc, val); if (!((Object)(object)val2 != (Object)null)) { return; } try { val2.GetComponent<NetworkObject>().Spawn(true); minesThisRound.Add(val2); } catch { } } public void beamUpPlayer(ulong playerID, bool teleport = true, bool toShip = true) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) Vector3 position = StartOfRound.Instance.playerSpawnPositions[0].position; float num = 0f; bool flag = false; float eulerY = 0f; if (!toShip) { EnemyVent[] allEnemyVents = currentRound.allEnemyVents; List<DoorLock> list = Object.FindObjectsOfType<DoorLock>().ToList(); List<DoorLock> list2 = new List<DoorLock>(); foreach (DoorLock item in list) { if (!item.isLocked) { list2.Add(item); } } if (Random.Range(0, 100) <= 5 && StartOfRound.Instance.shipHasLanded) { position = StartOfRound.Instance.playerSpawnPositions[0].position; flag = false; } else if (RoundManager.Instance.insideAINodes.Length != 0) { flag = true; Quaternion rotation; if (Random.Range(0, list2.Count + allEnemyVents.Length - 1) < list2.Count) { int index = Random.Range(0, list2.Count); rotation = ((Component)list2[index]).gameObject.transform.rotation; num = (float)((double)(((Quaternion)(ref rotation)).eulerAngles.y - 90f) * 3.14 / 180.0); position = ((Component)list2[index]).gameObject.transform.position; } else { int num2 = Random.Range(0, allEnemyVents.Length); rotation = ((Component)allEnemyVents[num2]).gameObject.transform.rotation; num = (float)((double)(((Quaternion)(ref rotation)).eulerAngles.y - 90f) * 3.14 / 180.0); position = ((Component)allEnemyVents[num2]).gameObject.transform.position; } position.x += 1f * Mathf.Sin(num); position.z += 1f * Mathf.Cos(num); eulerY = (float)((double)(num * 180f) / 3.14); } } int iNT = 0; if (flag) { iNT = 1; } beamUpPlayerLocal(playerID, position, eulerY, flag, teleport); broadcastData broadcastData = new broadcastData { command = "beamUpPlayer", clientId = playerID, x = position.x, y = position.y, z = position.z, INT = iNT, BOOL = teleport, eulerY = eulerY }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); } private void beamUpPlayerLocal(ulong playerID, Vector3 loc, float eulerY, bool inside, bool teleport = true) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) Thread thread = new Thread((ThreadStart)delegate { //IL_000d: Unknown result type (might be due to invalid IL or missing references) beamUpPlayerRoutine(playerID, loc, eulerY, inside, teleport); }); thread.IsBackground = true; thread.Start(); } private void beamUpPlayerRoutine(ulong playerID, Vector3 loc, float eulerY, bool inside, bool teleport = true) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) try { PlayerControllerB player = getPlayer(playerID); player.beamUpParticle.Play(); player.movementAudio.PlayOneShot(clips["ShipTeleporterBeamPlayerBody"]); } catch { log("error playing teleport sfx"); } Thread.Sleep(3000); if (teleport) { teleportPlayer(playerID, loc, eulerY, inside); } } private void teleportPlayer(ulong playerID, Vector3 loc, float eulerY, bool inside) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: 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) PlayerControllerB player = getPlayer(playerID); if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>())) { Object.FindObjectOfType<AudioReverbPresets>().audioPresets[3].ChangeAudioReverbForPlayer(player); } player.isInElevator = !inside; player.isInHangarShipRoom = !inside; player.isInsideFactory = inside; player.averageVelocity = 0f; player.velocityLastFrame = Vector3.zero; player.TeleportPlayer(loc, true, eulerY, false, true); player.isInsideFactory = inside; if (inside && Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>())) { Object.FindObjectOfType<AudioReverbPresets>().audioPresets[2].ChangeAudioReverbForPlayer(player); } for (int i = 0; i < player.ItemSlots.Length; i++) { if ((Object)(object)player.ItemSlots[i] != (Object)null) { player.ItemSlots[i].isInFactory = inside; } } Debug.Log((object)"Teleport B"); player.movementAudio.PlayOneShot(clips["ShipTeleporterBeam"]); if (GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } } public void fakeGhost() { ulong playerClientId = currentTarget.playerClientId; fakeGhostLocal(playerClientId); broadcastData broadcastData = new broadcastData { command = "fakeGhost", clientId = playerClientId }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); } private void fakeGhostLocal(ulong clientID) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) if (_localPlayer.playerClientId == clientID) { RoundManager.Instance.FlickerLights(true, true); string[] array = new string[4] { "VoiceCry2", "VoiceHey", "Breathing", "Laugh2" }; string clipName = array[Random.Range(0, array.Length)]; Vector3 position = ((Component)_localPlayer).transform.position; float num = Random.Range(0f, 3.14f); position.x += 1f * Mathf.Sin(num); position.z += 1f * Mathf.Cos(num); PlaySoundLocal(clipName, position); } } public void despawnNearestEnemy(bool real = true) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) EnemyAI val = null; float num = -1f; foreach (EnemyAI spawnedEnemy in currentRound.SpawnedEnemies) { Vector3 val2 = ((Component)spawnedEnemy).gameObject.transform.position - ((Component)currentTarget).transform.position; ((Vector3)(ref val2)).Set(val2.x, val2.y * 2f, val2.z); float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude < num || (Object)(object)val == (Object)null) { num = magnitude; val = spawnedEnemy; } } if ((Object)(object)val != (Object)null) { despawnEnemyLocal(((NetworkBehaviour)val).NetworkObjectId, real); broadcastData broadcastData = new broadcastData { command = "despawnEnemy", clientId = ((NetworkBehaviour)val).NetworkObjectId, BOOL = real }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); } } private void despawnEnemyLocal(ulong enemyID, bool real) { log("despawnEnemyLocal, enemyID " + enemyID); Thread thread = new Thread((ThreadStart)delegate { despawnEnemyLocalRoutine(enemyID, real); }); thread.IsBackground = true; thread.Start(); } private void copyParticleSystem(ref ParticleSystem origin, ref ParticleSystem target) { //IL_0021: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014e: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_0272: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) ((Component)target).GetComponent<Renderer>().material = ((Component)origin).GetComponent<Renderer>().material; List<Vector4> list = new List<Vector4>(); ParticleSystemCustomData val = (ParticleSystemCustomData)0; origin.GetCustomParticleData(list, val); target.SetCustomParticleData(list, val); Particle[] array = (Particle[])(object)new Particle[5]; int num = 0; int num2 = 0; origin.GetParticles(array, num, num2); target.SetParticles(array, num, num2); ParticleSystemTriggerEventType val2 = (ParticleSystemTriggerEventType)0; List<Particle> list2 = new List<Particle>(); ParticlePhysicsExtensions.GetTriggerParticles(origin, val2, list2); ParticlePhysicsExtensions.SetTriggerParticles(target, val2, list2); target.SetPlaybackState(origin.GetPlaybackState()); EmissionModule emission = target.emission; EmissionModule emission2 = origin.emission; ((EmissionModule)(ref emission)).rateOverTime = ((EmissionModule)(ref emission2)).rateOverTime; MainModule main = target.main; MainModule main2 = origin.main; ((MainModule)(ref main)).simulationSpace = ((MainModule)(ref main2)).simulationSpace; main2 = origin.main; ((MainModule)(ref main)).playOnAwake = ((MainModule)(ref main2)).playOnAwake; main2 = origin.main; ((MainModule)(ref main)).customSimulationSpace = ((MainModule)(ref main2)).customSimulationSpace; main2 = origin.main; ((MainModule)(ref main)).maxParticles = ((MainModule)(ref main2)).maxParticles; main2 = origin.main; ((MainModule)(ref main)).duration = ((MainModule)(ref main2)).duration; main2 = origin.main; ((MainModule)(ref main)).loop = ((MainModule)(ref main2)).loop; main2 = origin.main; ((MainModule)(ref main)).startLifetime = ((MainModule)(ref main2)).startLifetime; main2 = origin.main; ((MainModule)(ref main)).startDelay = ((MainModule)(ref main2)).startDelay; main2 = origin.main; ((MainModule)(ref main)).startSpeed = ((MainModule)(ref main2)).startSpeed; main2 = origin.main; ((MainModule)(ref main)).startRotation3D = ((MainModule)(ref main2)).startRotation3D; main2 = origin.main; ((MainModule)(ref main)).startSize3D = ((MainModule)(ref main2)).startSize3D; main2 = origin.main; ((MainModule)(ref main)).startSize = ((MainModule)(ref main2)).startSize; main2 = origin.main; ((MainModule)(ref main)).emitterVelocityMode = ((MainModule)(ref main2)).emitterVelocityMode; main2 = origin.main; ((MainModule)(ref main)).emitterVelocity = ((MainModule)(ref main2)).emitterVelocity; main2 = origin.main; ((MainModule)(ref main)).ringBufferMode = ((MainModule)(ref main2)).ringBufferMode; main2 = origin.main; ((MainModule)(ref main)).ringBufferLoopRange = ((MainModule)(ref main2)).ringBufferLoopRange; main2 = origin.main; ((MainModule)(ref main)).gravityModifier = ((MainModule)(ref main2)).gravityModifier; main2 = origin.main; ((MainModule)(ref main)).gravityModifierMultiplier = ((MainModule)(ref main2)).gravityModifierMultiplier; main2 = origin.main; ((MainModule)(ref main)).gravitySource = ((MainModule)(ref main2)).gravitySource; main2 = origin.main; ((MainModule)(ref main)).scalingMode = ((MainModule)(ref main2)).scalingMode; main2 = origin.main; ((MainModule)(ref main)).useUnscaledTime = ((MainModule)(ref main2)).useUnscaledTime; main2 = origin.main; ((MainModule)(ref main)).simulationSpeed = ((MainModule)(ref main2)).simulationSpeed; } private void despawnEnemyLocalRoutine(ulong enemyID, bool real) { //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) log("despawnEnemyLocalRoutine, enemyID " + enemyID); EnemyAI[] array = Object.FindObjectsOfType<EnemyAI>(); EnemyAI[] array2 = array; foreach (EnemyAI val in array2) { if (((NetworkBehaviour)val).NetworkObjectId != enemyID) { continue; } log("despawnEnemyLocalRoutine, enemy found"); try { ParticleSystem target = ((Component)val).gameObject.AddComponent<ParticleSystem>(); copyParticleSystem(ref _localPlayer.beamUpParticle, ref target); ((Component)target).transform.localPosition = ((Component)target).transform.localPosition + new Vector3(0f, 1f, 0f); target.Play(); val.creatureSFX.PlayOneShot(clips["ShipTeleporterBeamPlayerBody"]); } catch { ((BaseUnityPlugin)this).Logger.LogError((object)"error playing kill animation"); } if (real) { Thread.Sleep(3000); bool flag = ((Object)val.enemyType.enemyPrefab).name.ToLower() == "nutcrackerenemy"; if (flag) { log("Dropping gun"); ((GrabbableObject)((Component)val).GetComponent<NutcrackerEnemyAI>().gun).DiscardItemFromEnemy(); } else { moveEnemy(val, new Vector3(1000f, 1000f, 1000f), 0f); } if (((NetworkBehaviour)_localPlayer).IsServer) { val.KillEnemy(flag); } else if (flag) { val.KillEnemy(flag); } else { moveEnemy(val, new Vector3(1000f, 1000f, 1000f), 0f); } } break; } } public void leaveEarly() { leaveEarlyServer(); broadcastData broadcastData = new broadcastData { command = "leaveEarly" }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); } private void leaveEarlyServer() { if (((NetworkBehaviour)_localPlayer).IsServer) { TimeOfDay.Instance.SetShipLeaveEarlyClientRpc(TimeOfDay.Instance.normalizedTimeOfDay + 0.1f, TimeOfDay.Instance.votesForShipToLeaveEarly); } } public void changeBatteries(ulong playerID, float charge) { broadcastData broadcastData = new broadcastData { command = "changeBatteries", clientId = playerID, x = charge }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); changeBatteriesLocal(playerID, charge); } private void changeBatteriesLocal(ulong playerID, float charge) { PlayerControllerB player = getPlayer(playerID); int currentItemSlot = player.currentItemSlot; for (int i = 0; i < player.ItemSlots.Length; i++) { GrabbableObject val = player.ItemSlots[i]; if (val.insertedBattery != null) { val.insertedBattery.charge = charge; if (charge > 0f) { val.insertedBattery.empty = false; } else { val.insertedBattery.empty = true; } } } } public void revive() { reviveLocal(); broadcastData broadcastData = new broadcastData { command = "revive" }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); } public void reviveLocal() { StartOfRound.Instance.ReviveDeadPlayers(); HUDManager.Instance.HideHUD(false); foreach (KeyValuePair<string, GameObject> uIElement in Instance.UIElements) { uIElement.Value.SetActive(true); } } public void meetQuota() { broadcastData broadcastData = new broadcastData { command = "meetQuota" }; Networking.Broadcast(JsonConvert.SerializeObject((object)broadcastData, (Formatting)0), SIGNATURE); meetQuotaLocal(); } public void meetQuotaLocal() { if (TimeOfDay.Instance.profitQuota > TimeOfDay.Instance.quotaFulfilled) { TimeOfDay.Instance.quotaFulfilled = TimeOfDay.Instance.profitQuota; ((TMP_Text)StartOfRound.Instance.profitQuotaMonitorText).text = $"PROFIT QUOTA:\n${TimeOfDay.Instance.profitQuota} / ${TimeOfDay.Instance.profitQuota}"; } } } } namespace ChatsRevenge.Utils { internal static class ModUtils { public static AudioClip GetAudioFromFile(string audiopath) { UnityWebRequest audioClip = UnityWebRequestMultimedia.GetAudioClip(audiopath, (AudioType)13); audioClip.SendWebRequest(); while (!audioClip.isDone) { } return DownloadHandlerAudioClip.GetContent(audioClip); } } [JsonObject] internal class broadcastData { [JsonProperty] public string command { get; set; } [JsonProperty] public string text { get; set; } [JsonProperty] public bool BOOL { get; set; } public int INT { get; set; } [JsonProperty] public float x { get; set; } [JsonProperty] public float y { get; set; } [JsonProperty] public float z { get; set; } [JsonProperty] public float eulerY { get; set; } [JsonProperty] public ulong clientId { get; set; } } public class pythonSocket : MonoBehaviour { [SerializeField] private string IP = "127.0.0.1"; [SerializeField] private int rxPort = 7885; [SerializeField] private int txPort = 7886; private int indx = -1; private UdpClient client; private IPEndPoint pythonHost; private Thread readDataThread; public string currentCMD = ""; public static Plugin plugin { get; set; } public void SendData(string message) { try { byte[] bytes = Encoding.UTF8.GetBytes(message); client.Send(bytes, bytes.Length, pythonHost); } catch (Exception ex) { plugin.log(ex.ToString()); } } public void start() { pythonHost = new IPEndPoint(IPAddress.Parse(IP), txPort); client = new UdpClient(rxPort); readDataThread = new Thread(readData); readDataThread.IsBackground = true; readDataThread.Start(); } public void OnDestroy() { client.Close(); } private void readData() { while (true) { try { IPEndPoint remoteEP = new IPEndPoint(IPAddress.Any, 0); byte[] bytes = client.Receive(ref remoteEP); string @string = Encoding.UTF8.GetString(bytes); string[] array = @string.Split(new char[1] { ';' }); int num = int.Parse(array[0]); string text = array[1]; string text2 = array[2]; string text3 = array[3]; if (text.Contains("lethalcompany")) { if (indx == -1 || (indx != num && num == 0)) { indx = num; SendData("lethalcompany " + Plugin.Instance.version); } else if (num != indx) { indx = num; currentCMD = @string; } } } catch (Exception ex) { Plugin.Instance.log(ex.ToString()); } } } } } namespace ChatsRevenge.Patches { [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerPatches { public static bool immune { get; set; } public static ulong clientID { get; set; } public static float immuneDuration { get; set; } = 16.5f; public static float immuneStartTime { get; set; } public static Plugin plugin { get; set; } private static void ProcessInput(string input) { //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0211: 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_0245: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) string[] array = input.Split(new char[1] { ';' }); int num = int.Parse(array[0]); string text = array[1]; string text2 = array[2]; string text3 = array[3]; Plugin.Instance.preAction(); bool flag = true; Plugin.Instance.log(input); if (text == "lethalcompany_fakeAction") { string[] array2 = new string[15] { "lethalcompany_spawnMine", "lethalcompany_doubleCredits", "lethalcompany_halfCredits", "lethalcompany_bugs", "lethalcompany_lootbox", "lethalcompany_vents", "lethalcompany_clearweather", "lethalcompany_teleportShip", "lethalcompany_immunity", "lethalcompany_spawnJester", "lethalcompany_spawnBracken", "lethalcompany_spawnSpider", "lethalcompany_spawnCoilheads", "lethalcompany_teleport", "lethalcompany_killEnemy" }; text = array2[Random.Range(0, array2.Length)]; flag = false; } switch (text) { case "lethalcompany_turretSound": { Vector3 position2 = ((Component)Plugin.Instance.currentTarget).transform.position; float num3 = Random.Range(0f, 3.14f); position2.x += 3f * Mathf.Sin(num3); position2.z += 3f * Mathf.Cos(num3); Plugin.Instance.PlaySound("TurretSeePlayer", position2); break; } case "lethalcompany_coilheadSound": { string clipName = "Spring" + Random.Range(1, 4); Vector3 position3 = ((Component)Plugin.Instance.currentTarget).transform.position; float num4 = Random.Range(0f, 3.14f); position3.x += 1f * Mathf.Sin(num4); position3.z += 1f * Mathf.Cos(num4); Plugin.Instance.PlaySound(clipName, position3); break; } case "lethalcompany_jesterSound": { Vector3 position = ((Component)Plugin.Instance.currentTarget).transform.position; float num2 = Random.Range(0f, 3.14f); position.x += 3f * Mathf.Sin(num2); position.z += 3f * Mathf.Cos(num2); Plugin.Instance.PlaySound("JackInTheBoxTheme", position); break; } case "lethalcompany_girlSound": Plugin.Instance.fakeGhost(); break; case "lethalcompany_destroyAllItem": Plugin.Instance.DestroyHeldItems(); Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " destroyed " + Plugin.Instance.currentTarget.playerUsername + "'s items!"); break; case "lethalcompany_destroyCurrentItem": Plugin.Instance.DestroyHeldItem(); Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " destroyed " + Plugin.Instance.currentTarget.playerUsername + "'s current item!"); break; case "lethalcompany_dropAllItems": Plugin.Instance.DropHeldItems(); Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " made " + Plugin.Instance.currentTarget.playerUsername + " drop their items!"); break; case "lethalcompany_stormy": if (flag) { Plugin.Instance.ChangeWeather((LevelWeatherType)2); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " made the weather stormy!"); break; case "lethalcompany_foggy": if (flag) { Plugin.Instance.ChangeWeather((LevelWeatherType)3); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " made the weather foggy!"); break; case "lethalcompany_rainy": if (flag) { Plugin.Instance.ChangeWeather((LevelWeatherType)1); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " made the weather rainy!"); break; case "lethalcompany_eclipse": if (flag) { Plugin.Instance.ChangeWeather((LevelWeatherType)5); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " made the weather eclipsed!"); break; case "lethalcompany_flooded": if (flag) { Plugin.Instance.ChangeWeather((LevelWeatherType)4); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " made the weather flooded!"); break; case "lethalcompany_clearweather": if (flag) { Plugin.Instance.ChangeWeather((LevelWeatherType)(-1)); } else { Plugin.Instance.AnnounceActionDelayed("Fake Action! Weather didnt't clear! Jebaited", 5000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " cleared the weather!"); break; case "lethalcompany_immunity": if (flag) { Plugin.Instance.giveImmunity(); } else { Plugin.Instance.AnnounceActionDelayed("Fake action! Jebaited, no immunity for you!", 8000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " gave " + plugin.currentTarget.playerUsername + " immunity!"); break; case "lethalcompany_drunk": if (flag) { Plugin.Instance.DrunkPlayer(); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " made " + plugin.currentTarget.playerUsername + " drink on the job!"); break; case "lethalcompany_vents": if (flag) { Plugin.Instance.SpawnAllVents(); } else { Plugin.Instance.AnnounceActionDelayed("Fake Action! Vents didn't open! Jebaited", 10000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " caused all vents to spawn enemies!"); break; case "lethalcompany_lootbox": if (flag) { Plugin.Instance.buyRandomItems(); } else { Plugin.Instance.AnnounceActionDelayed("Fake action! Jebaited, no loot for you!", 30000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " bought you a lootbox with 4 random items!"); break; case "lethalcompany_doubleCredits": if (flag) { Plugin.Instance.MultiplyBank(2.0); } else { Plugin.Instance.AnnounceActionDelayed("Fake Action! Credits didn't change! Jebaited", 8000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " doubled your credits!"); break; case "lethalcompany_halfCredits": if (flag) { Plugin.Instance.MultiplyBank(0.5); } else { Plugin.Instance.AnnounceActionDelayed("Fake Action! Credits didn't change! Jebaited", 8000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " halfed your credits!"); break; case "lethalcompany_bugs": if (flag) { Plugin.Instance.BugInvestation(); } else { Plugin.Instance.AnnounceActionDelayed("Fake Action! No Bug infestation! Jebaited", 8000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " caused a Bug infestation inside!"); break; case "lethalcompany_spawnJester": if (flag) { Plugin.Instance.spawnEnemyNearPlayer("jesterenemy", 1); } else { Plugin.Instance.AnnounceActionDelayed("Fake Action! No Jester! Jebaited", 8000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " spawned a Jester inside!"); break; case "lethalcompany_spawnSpider": if (flag) { Plugin.Instance.spawnEnemyNearPlayer("sandspider", 1); } else { Plugin.Instance.AnnounceActionDelayed("Fake Action! No Spider! Jebaited", 8000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " spawned a Spider inside!"); break; case "lethalcompany_spawnCoilhead": if (flag) { Plugin.Instance.spawnEnemyNearPlayer("springman", 1); } else { Plugin.Instance.AnnounceActionDelayed("Fake Action! No Coilhead! Jebaited", 8000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " spawned a Coilhead inside!"); break; case "lethalcompany_spawnBracken": if (flag) { Plugin.Instance.spawnEnemyNearPlayer("flowerman", 1); } else { Plugin.Instance.AnnounceActionDelayed("Fake Action! No Brcacken! Jebaited", 8000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " spawned a Bracken inside!"); break; case "lethalcompany_spawnNutcracker": if (flag) { Plugin.Instance.spawnEnemyNearPlayer("nutcrackerenemy", 1); } else { Plugin.Instance.AnnounceActionDelayed("Fake Action! No Nutcracker! Jebaited", 8000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " spawned a Nutcracker inside!"); break; case "lethalcompany_spawnThumper": if (flag) { Plugin.Instance.spawnEnemyNearPlayer("crawler", 1); } else { Plugin.Instance.AnnounceActionDelayed("Fake Action! No Thumper! Jebaited", 8000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " spawned a Thumper inside!"); break; case "lethalcompany_spawnDog": if (flag) { Plugin.Instance.spawnEnemyNearPlayer("mouthdog"); } else { Plugin.Instance.AnnounceActionDelayed("Fake Action! No Dog! Jebaited", 8000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " spawned a Dog outside!"); break; case "lethalcompany_spawnBees": Plugin.Instance.spawnEnemyNearPlayer("redlocustbees"); Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " spawned Bees outside!"); break; case "lethalcompany_spawnMine": if (flag) { Plugin.Instance.SpawnMine(); } else { Plugin.Instance.AnnounceActionDelayed("Fake Action! Jebaited", 3000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " spawned a landmine near " + Plugin.Instance.currentTarget.playerUsername + "!"); break; case "lethalcompany_teleport": if (!((Object)(object)StartOfRound.Instance.currentLevel == (Object)null)) { if (flag) { Plugin.Instance.beamUpPlayer(Plugin.Instance.currentTarget.playerClientId, flag, toShip: false); } else { Plugin.Instance.AnnounceActionDelayed("Fake Action! Jebaited!", 3000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " teleported " + Plugin.Instance.currentTarget.playerUsername + " to a random location!"); } break; case "lethalcompany_killEnemy": if (!((Object)(object)StartOfRound.Instance.currentLevel == (Object)null)) { if (flag) { Plugin.Instance.despawnNearestEnemy(flag); } else { Plugin.Instance.AnnounceActionDelayed("Fake Action! Jebaited", 3000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " is killing the nearest enemy!"); } break; case "lethalcompany_leaveEarly": Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " made the ship leave early!"); Plugin.Instance.leaveEarly(); break; case "lethalcompany_drainBattey": Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " drained " + Plugin.Instance.currentTarget.playerUsername + "'s batteries!"); Plugin.Instance.changeBatteries(Plugin.Instance.currentTarget.playerClientId, 0f); break; case "lethalcompany_chargeBattey": Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " charged " + Plugin.Instance.currentTarget.playerUsername + "'s batteries!"); Plugin.Instance.changeBatteries(Plugin.Instance.currentTarget.playerClientId, 1f); break; case "lethalcompany_revive": Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " revived everyone!"); Plugin.Instance.revive(); break; case "lethalcompany_teleportShip": if (!((Object)(object)StartOfRound.Instance.currentLevel == (Object)null)) { if (flag) { Plugin.Instance.beamUpPlayer(Plugin.Instance.currentTarget.playerClientId, flag); } else { Plugin.Instance.AnnounceActionDelayed("Fake Action! Jebaited!", 3000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " teleported " + Plugin.Instance.currentTarget.playerUsername + " back to the ship!"); } break; case "lethalcompany_meetQuota": if (flag) { Plugin.Instance.meetQuota(); } else { Plugin.Instance.AnnounceActionDelayed("Fake Action! You didn't reach the quota", 8000); } Plugin.Instance.AnnounceAction("Viewer " + text2 + " of " + text3 + " made you reach the quota!"); break; } } [HarmonyPatch(typeof(FloodWeather), "Update")] [HarmonyPrefix] private static bool Update_Prefix(FloodWeather __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //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) if ((int)TimeOfDay.Instance.currentLevelWeather != 4) { Vector3 position = ((Component)__instance).transform.position; ((Vector3)(ref position)).Set(0f, 0f, 0f); return false; } return true; } [HarmonyPatch(typeof(FloodWeather), "Update")] [HarmonyPostfix] private static void Update_Postfix(FloodWeather __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //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) if ((int)TimeOfDay.Instance.currentLevelWeather != 4) { Vector3 position = ((Component)__instance).transform.position; ((Vector3)(ref position)).Set(0f, 0f, 0f); } } [HarmonyPatch(typeof(StartOfRound), "ShipLeave")] [HarmonyPostfix] public static void ResetLevel(StartOfRound __instance) { TimeOfDay.Instance.DisableAllWeather(true); TimeOfDay.Instance.currentWeatherVariable = 0f; TimeOfDay.Instance.currentWeatherVariable2 = 0f; foreach (GameObject item in Plugin.Instance.minesThisRound) { Plugin.Instance.log("despawning mine"); if (((NetworkBehaviour)Plugin.Instance._localPlayer).IsServer) { item.GetComponent<NetworkObject>().Despawn(true); } } Plugin.Instance.minesThisRound.Clear(); foreach (KeyValuePair<string, GameObject> uIElement in Plugin.Instance.UIElements) { uIElement.Value.SetActive(true); } } [HarmonyPatch(typeof(RoundManager), "LoadNewLevel")] [HarmonyPostfix] private static void ModifyLevel(ref SelectableLevel newLevel) { try { addEnemyToLevel(ref newLevel, "hoarderbug"); addEnemyToLevel(ref newLevel, "sandspider"); addEnemyToLevel(ref newLevel, "springman"); addEnemyToLevel(ref newLevel, "jesterenemy"); addEnemyToLevel(ref newLevel, "nutcrackerenemy"); addEnemyToLevel(ref newLevel, "flowerman"); addEnemyToLevel(ref newLevel, "crawler"); addEnemyToLevel(ref newLevel, "mouthdog", indoors: false); addEnemyToLevel(ref newLevel, "forestgiant", indoors: false); addEnemyToLevel(ref newLevel, "redlocustbees", indoors: false); } catch (Exception ex) { Plugin.Instance.log("couldnt add an enemy! " + ex); } } public static void addEnemyToLevel(ref SelectableLevel newLevel, string enemyName, bool indoors = true) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown bool flag = false; if (false) { return; } EnemyType[] array = Resources.FindObjectsOfTypeAll<EnemyType>(); foreach (EnemyType val in array) { if (((Object)val.enemyPrefab).name.ToLower() == enemyName) { SpawnableEnemyWithRarity val2 = new SpawnableEnemyWithRarity(); val2.enemyType = val; val2.rarity = 0; if (indoors) { newLevel.Enemies.Add(val2); } else { newLevel.OutsideEnemies.Add(val2); } break; } } } [HarmonyPatch("KillPlayer")] [HarmonyPrefix] private static bool KillPlayer_Prefix(PlayerControllerB __instance) { if (__instance.playerClientId == clientID && immune) { return false; } return true; } [HarmonyPatch("DamagePlayer")] [HarmonyPrefix] public static void DamagePlayer_Prefix(PlayerControllerB __instance, ref int damageNumber) { if (__instance.playerClientId == clientID && immune) { damageNumber = 0; } } [HarmonyPatch(typeof(HUDManager), "CanTipDisplay")] [HarmonyPostfix] private static void CanTipDisplay_Postfix(ref bool __result, bool isWarning, bool useSave, string prefsKey) { __result = true; HUDManager.Instance.HideHUD(false); HUDManager.Instance.scanInfoAnimator.SetBool("display", false); if (!Plugin.Instance._localPlayer.isPlayerDead) { return; } foreach (KeyValuePair<string, GameObject> uIElement in Plugin.Instance.UIElements) { uIElement.Value.SetActive(false); } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPostfix] private static void overrideSpin(PlayerControllerB __instance) { if (__instance.playerClientId == clientID) { float realtimeSinceStartup = Time.realtimeSinceStartup; if (immune) { __instance.sprintMeter = 1f; } if (realtimeSinceStartup - immuneStartTime > immuneDuration) { immune = false; } float x = __instance.moveInputVector.x; float y = __instance.moveInputVector.y; __instance.moveInputVector.y = x; __instance.moveInputVector.x = y; } string currentCMD = Plugin.Instance.socket.currentCMD; try { if (currentCMD != "") { ProcessInput(currentCMD); } } catch (Exception ex) { Plugin.Instance.logError(ex.ToString()); } Plugin.Instance.socket.currentCMD = ""; } } } namespace MyFirstPlugin.MonoBehaviours { internal class MyFirstPluginComponent : MonoBehaviour { public void Awake() { } public void Start() { } public void Update() { } public void LateUpdate() { } } }