Please disclose if your mod was created primarily 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 SimpleCommands v1.7.1
BepInEx/plugins/SimpleCommands/Simple-Commands.dll
Decompiled 6 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using JLL; using JLL.API; using JLL.API.Compatability; using JLL.API.LevelProperties; using LethalLevelLoader; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Simple-Commands.NetcodePatcher; using SimpleCommands.Commands; using SimpleCommands.Commands.Compatability; using SimpleCommands.Components; using SimpleCommands.Managers; using SimpleCommands.Patches; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using WeatherRegistry; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Simple-Commands")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Simple-Commands")] [assembly: AssemblyTitle("Simple-Commands")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace SimpleCommands { [BepInPlugin("JacobG5.SimpleCommands", "SimpleCommands", "1.7.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class SimpleCommandsBase : BaseUnityPlugin { private const string modGUID = "JacobG5.SimpleCommands"; private const string modName = "SimpleCommands"; private const string modVersion = "1.7.1"; private readonly Harmony harmony = new Harmony("JacobG5.SimpleCommands"); public static SimpleCommandsBase SimpleCommandsInstance; private ManualLogSource mls; public static ConfigEntry<string> commandPrefix; public static ConfigEntry<bool> hostOnly; public static ConfigEntry<bool> hideDefault; public static ConfigEntry<int> spawnCap; public static bool LLLPresent { get; private set; } public static bool WRPresent { get; private set; } private void Awake() { if ((Object)(object)SimpleCommandsInstance == (Object)null) { SimpleCommandsInstance = this; } hostOnly = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "hostOnly", true, "Restricts commands to only being executed by the host."); hideDefault = ((BaseUnityPlugin)this).Config.Bind<bool>("Main", "hideDefault", false, "Hides command feedback by default. ('hide' flag now shows command feedback.)"); spawnCap = ((BaseUnityPlugin)this).Config.Bind<int>("Main", "spawnCap", 20, "Cap for spawn commands."); commandPrefix = ((BaseUnityPlugin)this).Config.Bind<string>("Main", "commandPrefix", "/", "Prefix for SimpleCommands"); mls = Logger.CreateLogSource("JacobG5.SimpleCommands"); JLL.NetcodePatch(mls, Assembly.GetExecutingAssembly().GetTypes()); JLL.Instance.networkObject.AddComponent<SimpleCommandsNetworkManager>(); JLL.HarmonyPatch(harmony, mls, new Type[3] { typeof(HUDManagerPatch), typeof(PlayerControllerBPatch), typeof(TerminalPatch) }); LLLPresent = JCompatabilityHelper.IsLoaded("imabatby.lethallevelloader", StringComparison.InvariantCultureIgnoreCase); WRPresent = JCompatabilityHelper.IsLoaded("mrov.WeatherRegistry", StringComparison.InvariantCultureIgnoreCase); RegisterBaseCommands(); } private void RegisterBaseCommands() { SimpleCommand.Register(new HelpCommand()); SimpleCommand.Register(new ClearCommand()); SimpleCommand.Register(new ListCommand()); SimpleCommand.Register(new TeleportCommand()); SimpleCommand.Register(new PayCommand()); SimpleCommand.Register(new RouteCommand()); SimpleCommand.Register(new AllCheatsCommand()); SimpleCommand.Register(new FlyCommand()); SimpleCommand.Register(new InvulnerabilityCommand()); SimpleCommand.Register(new InfiniteSprintCommand()); SimpleCommand.Register(new SpeedCommand()); SimpleCommand.Register(new TerminalCommand()); SimpleCommand.Register(new SpawnCommand<Item>("item", "spawns items", "items", "Spawnable Items", new(string, string)[2] { ("Store", "Filters to show store items"), ("Scrap", "Filters to show scrap items") }, (Item item) => item.itemName, delegate(string[] filters) { bool flag2 = filters.Contains("Store"); bool flag3 = filters.Contains("Scrap"); if ((flag2 || flag3) && flag2 != flag3) { IEnumerable<Item> result; if (!flag2) { result = StartOfRound.Instance.currentLevel.spawnableScrap.Select((SpawnableItemWithRarity x) => x.spawnableItem); } else { IEnumerable<Item> buyableItemsList = JLevelPropertyRegistry.GetTerminal().buyableItemsList; result = buyableItemsList; } return result; } return RoundManager.Instance.playersManager.allItemsList.itemsList; }, delegate(Item item, Vector3 pos, SimpleCommand.CommandParameters parameters) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(item.spawnPrefab, pos, Quaternion.identity); GrabbableObject component = val.GetComponent<GrabbableObject>(); component.fallTime = 0f; if (item.isScrap) { component.SetScrapValue(Mathf.RoundToInt((float)Random.Range(item.minValue, item.maxValue) * RoundManager.Instance.scrapValueMultiplier)); } ((Component)component).GetComponent<NetworkObject>().Spawn(false); })); SimpleCommand.Register(new SpawnCommand<KeyValuePair<string, SimplePrefabs.SimplePrefab>>("prefab", "spawns prefabs", "prefabs", "Spawnable Prefabs", (from name in Enum.GetNames(typeof(SimplePrefabs.PrefabSource)) select (name, "Filters to show " + name.ToLower() + " prefabs")).ToArray(), (KeyValuePair<string, SimplePrefabs.SimplePrefab> prefabEntry) => prefabEntry.Key, delegate(string[] filters) { if (filters.Length == 0) { return SimplePrefabs.Prefabs; } IEnumerable<SimplePrefabs.PrefabSource> whitelist = Enum.GetNames(typeof(SimplePrefabs.PrefabSource)).Where(((IEnumerable<string>)filters).Contains<string>).Select(Enum.Parse<SimplePrefabs.PrefabSource>); return SimplePrefabs.Prefabs.Where<KeyValuePair<string, SimplePrefabs.SimplePrefab>>((KeyValuePair<string, SimplePrefabs.SimplePrefab> x) => whitelist.Contains(x.Value.source)); }, delegate(KeyValuePair<string, SimplePrefabs.SimplePrefab> prefabEntry, Vector3 pos, SimpleCommand.CommandParameters parameters) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_002a: 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_001f: 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) prefabEntry.Value.SpawnPrefab((((Component)parameters.sender).transform.position == pos) ? (pos + prefabEntry.Value.spawnOffset) : pos, ((Component)parameters.sender).transform.rotation); })); SimpleCommand.Register(new SpawnCommand<EnemyType>("spawn", "spawns enemies", "enemies", "Spawnable Enemies", new(string, string)[2] { ("Indoor", "Filters to show interior enemies"), ("Outdoor", "Filters to show exterior enemies") }, (EnemyType enemy) => enemy.enemyName, delegate(string[] filters) { bool flag = filters.Contains("Indoor"); bool outdoor = filters.Contains("Outdoor"); if ((flag || outdoor) && flag != outdoor) { mls.LogInfo((object)$"{flag} {outdoor}"); return JLevelPropertyRegistry.AllSortedEnemies.Where((EnemyType enemy) => (enemy.isOutsideEnemy || enemy.isDaytimeEnemy) == outdoor); } return JLevelPropertyRegistry.AllSortedEnemies; }, delegate(EnemyType enemy, Vector3 pos, SimpleCommand.CommandParameters parameters) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) RoundManager.Instance.SpawnEnemyGameObject(pos, 0f, 0, enemy); }, requireNavmesh: true)); SimpleCommand.Register(new HealCommand()); SimpleCommand.Register(new DamageCommand()); SimpleCommand.Register(new ExplodeCommand()); SimpleCommand.Register(new ExtendCommand()); SimpleCommand.Register(new ChargeCommand()); SimpleCommand.Register(new PosCommand()); SimpleCommand.Register(new WeatherCommand()); if (WRPresent) { SimpleCommand.Register(new WeatherRegistryCommand()); } if (LLLPresent) { SimpleCommand.Register(new ExtendedLevelsCommand()); } } internal static void LogInfo(string message, JLogLevel level) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) if (JLogHelper.AcceptableLogLevel(level)) { SimpleCommandsInstance.mls.LogInfo((object)message); } } } } namespace SimpleCommands.Patches { [HarmonyPatch(typeof(HUDManager))] internal class HUDManagerPatch { [HarmonyPatch("AddTextToChatOnServer")] [HarmonyPrefix] public static bool patchAddTextToChatOnServer(ref string chatMessage, int playerId, HUDManager __instance) { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) if (playerId != -1) { PlayerControllerB val = __instance.playersManager.allPlayerScripts[playerId]; string prefix = SimpleCommand.GetPrefix(); if (chatMessage.StartsWith(prefix)) { string text = chatMessage.Substring(prefix.Length); text = text.Replace("&//=", "").Replace(prefix, "&//="); Vector3 targetPos = ((Component)val).transform.position; RaycastHit val2 = default(RaycastHit); if (Physics.Raycast(new Ray(((Component)val.gameplayCamera).transform.position, ((Component)val.gameplayCamera).transform.forward), ref val2, 200f, 1073742656)) { targetPos = ((RaycastHit)(ref val2)).point; } if (((NetworkBehaviour)val).IsHost || ((NetworkBehaviour)val).IsServer) { SimpleCommandsNetworkManager.Instance.CommandExecutionClientRpc(playerId, text, SimpleCommandsBase.hideDefault.Value, targetPos); } else { SimpleCommandsBase.LogInfo("Sending Command Request.", (JLogLevel)1); SimpleCommandsNetworkManager.Instance.RequestCommandExecutionServerRpc(playerId, text, targetPos); } chatMessage = string.Empty; return false; } } return true; } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerControllerBPatch { [HarmonyPatch("Start")] [HarmonyPostfix] public static void patchStart(PlayerControllerB __instance) { ((Component)__instance).gameObject.AddComponent<PlayerModification>(); } [HarmonyPrefix] [HarmonyPatch("DamagePlayer")] [HarmonyPatch("KillPlayer")] public static bool patchDamagePlayer(PlayerControllerB __instance) { if (((Component)__instance).GetComponent<PlayerModification>().invulnerable) { __instance.health = 100; return false; } return true; } } [HarmonyPatch(typeof(Terminal))] internal class TerminalPatch { [HarmonyReversePatch(/*Could not decode attribute arguments.*/)] [HarmonyPatch(typeof(Terminal), "CallFunctionInAccessibleTerminalObject")] public static void terminalObjectRequest(Terminal instance, string word) { throw new NotImplementedException("It's a stub"); } } } namespace SimpleCommands.Managers { public static class LethalLibCompatibility { internal static void RegisterLethalLibPrefabs() { SimpleCommandsBase.LogInfo($"LethalLib Map Hazards: {MapObjects.mapObjects.Count}", (JLogLevel)2); foreach (RegisteredMapObject mapObject in MapObjects.mapObjects) { SimplePrefabs.RegisterSimplePrefab(((Object)mapObject.mapObject.prefabToSpawn).name, new SimplePrefabs.SimplePrefab(mapObject.mapObject.prefabToSpawn, SimplePrefabs.PrefabSource.Hazard)); } } } public class SimpleCommandsNetworkManager : NetworkBehaviour { public static SimpleCommandsNetworkManager Instance; public void Awake() { Instance = this; SimplePrefabs.RegisterBasePrefabs(); } [ServerRpc(RequireOwnership = false)] public void RequestCommandExecutionServerRpc(int playerId, string commandMessage, Vector3 targetPos) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //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_0071: 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_009b: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3835659538u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); bool flag = commandMessage != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(commandMessage, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref targetPos); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3835659538u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; SimpleCommandsBase.LogInfo("[Server] Processing Command Request from " + StartOfRound.Instance.allPlayerScripts[playerId].playerUsername + ".", (JLogLevel)1); if (SimpleCommand.tryParseCommand(commandMessage, out SimpleCommand command, out SimpleCommand.CommandParameters parameters, targetPos)) { if (command == null || parameters == null) { return; } if (command.permissionRequired && SimpleCommandsBase.hostOnly.Value) { SendErrorTipClientRpc(playerId, "Permission Denied", "Only the host is allowed to execute commands due to the server's config.", isError: true); return; } } CommandExecutionClientRpc(playerId, commandMessage, SimpleCommandsBase.hideDefault.Value, targetPos); } [ClientRpc] public void CommandExecutionClientRpc(int playerId, string commandMessage, bool hideDefault, Vector3 targetPos) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //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_0071: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3869478541u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); bool flag = commandMessage != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(commandMessage, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hideDefault, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref targetPos); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3869478541u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; CommandExecution(StartOfRound.Instance.allPlayerScripts[playerId], commandMessage, hideDefault, targetPos); } } private void CommandExecution(PlayerControllerB sender, string commandMessage, bool hideDefault, Vector3 targetPos) { //IL_0053: Unknown result type (might be due to invalid IL or missing references) HUDManager instance = HUDManager.Instance; SimpleCommandsBase.LogInfo("Parsing: " + commandMessage, (JLogLevel)2); string[] array = commandMessage.Split("&//="); string[] array2 = array; foreach (string text in array2) { if (text == "") { continue; } if (SimpleCommand.tryParseCommand(text, out SimpleCommand command, out SimpleCommand.CommandParameters parameters, targetPos)) { if (command == null || parameters == null) { break; } string text2 = (parameters.IsEmpty() ? "" : ("\n" + parameters.asString())); SimpleCommandsBase.LogInfo("Player: " + sender.playerUsername + " | Executing: " + SimpleCommand.GetPrefix() + command.name + text2, (JLogLevel)2); parameters.sender = sender; bool success; string text3 = command.Execute(sender, parameters, out success); if (text3 == null || !(text3 != "")) { continue; } SimpleCommandsBase.LogInfo($"\nSuccess: {success}\nResult: {text3}", (JLogLevel)2); if (success) { if ((((NetworkBehaviour)instance).IsHost || ((NetworkBehaviour)instance).IsServer) && (parameters.isFlagged("hide") == hideDefault || command.overrideShowOutput)) { instance.AddTextToChatOnServer(text3, -1); } } else if (JLLExtentions.IsLocalPlayer(sender)) { JHudHelper.QueueDisplayTip("Command Failure:", text3, false, false, "LC_Tip1"); } } else if (JLLExtentions.IsLocalPlayer(sender)) { JHudHelper.QueueDisplayTip("Unknown Command:", SimpleCommand.GetPrefix() + text.Split(' ')[0], true, false, "LC_Tip1"); } } } [ClientRpc] public void SendErrorTipClientRpc(int playerId, string title, string description, bool isError) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //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_0071: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_0106: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(746899919u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, playerId); bool flag = title != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(title, false); } bool flag2 = description != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe(description, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isError, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 746899919u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; HUDManager instance = HUDManager.Instance; if (JLLExtentions.IsLocalPlayer(instance.playersManager.allPlayerScripts[playerId])) { instance.DisplayTip(title, description, isError, false, "LC_Tip1"); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(3835659538u, new RpcReceiveHandler(__rpc_handler_3835659538), "RequestCommandExecutionServerRpc"); ((NetworkBehaviour)this).__registerRpc(3869478541u, new RpcReceiveHandler(__rpc_handler_3869478541), "CommandExecutionClientRpc"); ((NetworkBehaviour)this).__registerRpc(746899919u, new RpcReceiveHandler(__rpc_handler_746899919), "SendErrorTipClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3835659538(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string commandMessage = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref commandMessage, false); } Vector3 targetPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref targetPos); target.__rpc_exec_stage = (__RpcExecStage)1; ((SimpleCommandsNetworkManager)(object)target).RequestCommandExecutionServerRpc(playerId, commandMessage, targetPos); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3869478541(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string commandMessage = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref commandMessage, false); } bool hideDefault = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hideDefault, default(ForPrimitives)); Vector3 targetPos = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref targetPos); target.__rpc_exec_stage = (__RpcExecStage)1; ((SimpleCommandsNetworkManager)(object)target).CommandExecutionClientRpc(playerId, commandMessage, hideDefault, targetPos); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_746899919(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string title = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref title, false); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); string description = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref description, false); } bool isError = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isError, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((SimpleCommandsNetworkManager)(object)target).SendErrorTipClientRpc(playerId, title, description, isError); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "SimpleCommandsNetworkManager"; } } } namespace SimpleCommands.Components { public class PlayerModification : MonoBehaviour { public PlayerControllerB player; public bool infinateSprint = false; public bool invulnerable = false; public bool enableFlying = false; private bool flying = false; private float lastJumpPress = 0f; public Vector2 flightSpeed = new Vector2(2.6f, 8f); private float oldMovementSpeed = 0f; private InputAction jumpAction; private InputAction crouchAction; public float defaultSpeed; public void Start() { player = ((Component)this).gameObject.GetComponent<PlayerControllerB>(); InputActionAsset actions = IngamePlayerSettings.Instance.playerInput.actions; jumpAction = actions.FindAction("Jump", false); crouchAction = actions.FindAction("Crouch", false); defaultSpeed = player.movementSpeed; } public void Update() { if (infinateSprint) { player.sprintMeter = 1f; } bool flag = !player.quickMenuManager.isMenuOpen && ((NetworkBehaviour)player).IsOwner && player.isPlayerControlled && !player.inSpecialInteractAnimation && !player.isTypingChat; if (!enableFlying) { return; } if (flag && jumpAction.WasPressedThisFrame()) { if (Time.realtimeSinceStartup - lastJumpPress < 0.4f) { SetFlying(!flying); } lastJumpPress = Time.realtimeSinceStartup; } if (!flying) { return; } float num = 0f; if (flag) { if (jumpAction.IsPressed()) { num = flightSpeed.y; } else if (crouchAction.IsPressed()) { num = flightSpeed.y * -1.4f; } } player.fallValueUncapped = (player.fallValue = num * (player.isSprinting ? 1.6f : 1f)); if (player.thisController.isGrounded) { SetFlying(value: false); } player.takingFallDamage = false; } public void SetFlying(bool value) { if (!value || !player.thisController.isGrounded) { flying = value; if (value) { oldMovementSpeed = player.movementSpeed; PlayerControllerB obj = player; obj.movementSpeed *= flightSpeed.x; } else { player.movementSpeed = oldMovementSpeed; } } } } } namespace SimpleCommands.Commands { internal class ActionCommand : SimpleCommand { public readonly Action<CommandParameters> Action; public ActionCommand(string name, string description, Action<CommandParameters> action) { Action = action; base..ctor(name, description); } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { Action(parameters); success = true; return string.Empty; } } public class ChargeCommand : SimpleCommand { public ChargeCommand() : base("charge", "charges held item") { instructions.Add("[/cmd]"); instructions.Add("[/cmd] [target]"); } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown PlayerControllerB val = sender; if (!parameters.IsEmpty()) { string stringAt = parameters.GetStringAt(0); PlayerControllerB player = SimpleCommand.GetPlayer(stringAt); if (!((Object)(object)player != (Object)null)) { success = false; return SimpleCommand.UnknownPlayerException(stringAt); } val = player; } GrabbableObject currentlyHeldObjectServer = val.currentlyHeldObjectServer; if ((Object)(object)currentlyHeldObjectServer != (Object)null && currentlyHeldObjectServer.itemProperties.requiresBattery) { currentlyHeldObjectServer.insertedBattery = new Battery(false, 1f); } success = true; return "Charged " + val.playerUsername + "'s Item."; } } public class ClearCommand : SimpleCommand { public ClearCommand() : base("clear", "clears chat") { instructions.Add("[/cmd] - clears chat"); } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { success = true; SimpleCommand.ClearChat(); JHudHelper.ClearDisplayTipQueue(); return ""; } } public abstract class BaseDamageCommand : SimpleCommand { public BaseDamageCommand(string name, string description) : base(name, description) { instructions.Add("[/cmd]"); instructions.Add("[/cmd] [value]"); instructions.Add("[/cmd] [value] [damageType]"); instructions.Add("[/cmd] [target]"); instructions.Add("[/cmd] [target] [value]"); instructions.Add("[/cmd] [target] [value] [damageType]"); } public static CauseOfDeath GetDamageType(string name) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: 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_0049: 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_0070: Unknown result type (might be due to invalid IL or missing references) foreach (CauseOfDeath value in Enum.GetValues(typeof(CauseOfDeath))) { CauseOfDeath result = value; if (((object)(CauseOfDeath)(ref result)).ToString().ToLower() == name.ToLower()) { return result; } } return (CauseOfDeath)0; } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB effected = sender; int amount = DefaultValue(); CauseOfDeath causeOfDeath = (CauseOfDeath)0; if (!parameters.IsEmpty()) { string stringAt = parameters.GetStringAt(0); PlayerControllerB player = SimpleCommand.GetPlayer(stringAt); bool flag = false; if ((Object)(object)player != (Object)null) { effected = player; flag = true; } else { bool isNumber; int numberAt = parameters.GetNumberAt(0, out isNumber); if (!isNumber) { success = false; return SimpleCommand.UnknownNumberException(); } amount = numberAt; } if (parameters.Count() > 1) { if (flag) { bool isNumber2; int numberAt2 = parameters.GetNumberAt(1, out isNumber2); if (!isNumber2) { success = false; return SimpleCommand.UnknownNumberException(); } amount = numberAt2; } else { causeOfDeath = GetDamageType(parameters.GetStringAt(1)); } } if (flag && parameters.Count() > 2) { causeOfDeath = GetDamageType(parameters.GetStringAt(2)); } } success = true; return ApplyDamage(amount, effected, causeOfDeath); } public abstract int DefaultValue(); public abstract string ApplyDamage(int amount, PlayerControllerB effected, CauseOfDeath causeOfDeath); } public class HealCommand : BaseDamageCommand { public HealCommand() : base("heal", "heals players") { } public override string ApplyDamage(int amount, PlayerControllerB effected, CauseOfDeath causeOfDeath) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: 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) effected.DamagePlayer(-amount, true, true, causeOfDeath, 0, false, default(Vector3)); effected.health = Mathf.Clamp(amount, 0, 100); return "Healed " + effected.playerUsername + " to " + ((effected.health == 100) ? "max" : "effected.health") + " HP."; } public override int DefaultValue() { return 100; } } public class DamageCommand : BaseDamageCommand { public DamageCommand() : base("damage", "hurts players") { } public override string ApplyDamage(int amount, PlayerControllerB effected, CauseOfDeath causeOfDeath) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) effected.DamagePlayer(amount, true, true, causeOfDeath, 0, false, default(Vector3)); return $"Delt {amount} damage to {effected.playerUsername}."; } public override int DefaultValue() { return 10; } } public class ExplodeCommand : BaseDamageCommand { public ExplodeCommand() : base("explode", "explodes players") { } public override string ApplyDamage(int amount, PlayerControllerB effected, CauseOfDeath causeOfDeath) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) Landmine.SpawnExplosion(((Component)effected).transform.position, true, 0f, 8f, amount, (float)amount * 0.75f, (GameObject)null, false); return $"Exploded {effected.playerUsername}. {amount} dmg."; } public override int DefaultValue() { return 69; } } public class ExtendCommand : SimpleCommand { public ExtendCommand() : base("extend", "extends quota") { instructions.Add("[/cmd] - Extends Quota 1 Day"); instructions.Add("[/cmd] [days]"); } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { int num = (parameters.IsEmpty() ? 1 : parameters.GetNumber()); if (num != 0) { TimeOfDay instance = TimeOfDay.Instance; instance.timeUntilDeadline += instance.totalTime * (float)num; instance.UpdateProfitQuotaCurrentTime(); success = true; return "Extended Deadline " + num + " day(s)."; } success = false; return ""; } } public class ListCommand : SimpleCommand { public ListCommand() : base("list", "lists players") { overrideShowOutput = true; permissionRequired = false; instructions.Add("[/cmd]"); instructions.Add("[/cmd] [page]"); } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { success = true; if (!JLLExtentions.IsLocalPlayer(sender)) { return ""; } List<string> list = new List<string>(); PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts; PlayerControllerB[] array = allPlayerScripts; foreach (PlayerControllerB val in array) { if (val.isPlayerControlled && !val.isPlayerDead) { list.Add(val.playerUsername.Replace(' ', '_')); } } return PagedList("Players in Lobby:", list, (!parameters.IsEmpty()) ? parameters.GetNumber() : 0, 4); } } public class HelpCommand : SimpleCommand { public HelpCommand() : base("help", "lists commands") { overrideShowOutput = true; permissionRequired = false; instructions.Add("[/cmd] - Lists Commands"); instructions.Add("[/cmd] [page]"); instructions.Add("[/cmd] [cmd]"); instructions.Add("[/cmd] [cmd] [page]"); instructions.Add("[/cmd] [cmd] (flags)"); instructions.Add("[/cmd] [cmd] (flags) [page]"); } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { success = true; if (!JLLExtentions.IsLocalPlayer(sender)) { return ""; } int page = 0; if (!parameters.IsEmpty()) { page = parameters.GetNumberAt(0, out var isNumber); if (!isNumber) { string @string = parameters.GetString(); SimpleCommand simpleCommand = SimpleCommand.tryGetCommand(@string); if (simpleCommand != null) { if (parameters.Count(2)) { string string2 = parameters.GetString(); if (string2 == "flags") { if (parameters.Count(3)) { page = parameters.GetNumberAt(2); } SimpleCommand.ClearChat(); return PagedList(simpleCommand.name.ToUpper() + " Accepted Flags:", simpleCommand.tagInfo, page); } page = parameters.GetNumberAt(1); } SimpleCommand.ClearChat(); return PagedList(simpleCommand.name.ToUpper() + " Use Cases:\n" + SimpleCommand.GetPrefix() + "help " + simpleCommand.name + " flags\nfor flag info]", simpleCommand.instructions, page).Replace("[/cmd]", SimpleCommand.GetPrefix() + @string); } if (@string.ToLower() == "flags") { return "Flags Example:\n" + SimpleCommand.GetPrefix() + "pay | hide\n" + SimpleCommand.GetPrefix() + "help [cmd] flags\nto see flag modifiers."; } } } List<string> list = new List<string>(); foreach (SimpleCommand command in SimpleCommand.GetCommands()) { list.Add(SimpleCommand.GetPrefix() + command.name + " - " + command.description); } SimpleCommand.ClearChat(); return PagedList("List of Commands:", list, page); } } public class PayCommand : SimpleCommand { public PayCommand() : base("pay", "free credits") { instructions.Add("[/cmd] - Grants 100 credits"); instructions.Add("[/cmd] [value]"); } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { success = false; Terminal terminal = SimpleCommand.GetTerminal(); if ((Object)(object)terminal == (Object)null) { return SimpleCommand.MissingTerminal(); } int num = ((!parameters.IsEmpty()) ? parameters.GetNumber() : 100); if (num != 0) { terminal.groupCredits += num; success = true; return "Received " + num + " Credits."; } return ""; } } public abstract class BasePlayerModCommand : SimpleCommand { public BasePlayerModCommand(string name, string description, string extraParams = "") : base(name, description) { instructions.Add("[/cmd] " + extraParams); instructions.Add("[/cmd] [target] " + extraParams); } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { PlayerControllerB val = sender; success = false; if (!parameters.IsEmpty()) { string stringAt = parameters.GetStringAt(0); PlayerControllerB player = SimpleCommand.GetPlayer(stringAt); if ((Object)(object)player != (Object)null) { val = player; parameters.place++; } } PlayerModification playerMod = default(PlayerModification); if (((Component)val).TryGetComponent<PlayerModification>(ref playerMod)) { success = true; return ModifyPlayer(playerMod, parameters); } return ""; } public abstract string ModifyPlayer(PlayerModification playerMod, CommandParameters parameters); } public class AllCheatsCommand : BasePlayerModCommand { public AllCheatsCommand() : base("cheats", "enable / disable cheats", "(On | Off)") { } public override string ModifyPlayer(PlayerModification playerMod, CommandParameters parameters) { bool value; bool flag = !parameters.HasNext() || !parameters.GetBoolAt(parameters.place, out value) || value; playerMod.invulnerable = (playerMod.infinateSprint = (playerMod.enableFlying = flag)); return (flag ? "Enabled" : "Disabled") + " All Cheats for " + playerMod.player.playerUsername; } } public class InfiniteSprintCommand : BasePlayerModCommand { public InfiniteSprintCommand() : base("stamina", "toggle infinate sprint") { } public override string ModifyPlayer(PlayerModification playerMod, CommandParameters parameters) { playerMod.infinateSprint = !playerMod.infinateSprint; return $"Infinite Stamina for {playerMod.player.playerUsername} set to {playerMod.infinateSprint}"; } } public class InvulnerabilityCommand : BasePlayerModCommand { public InvulnerabilityCommand() : base("god", "toggle invulnerability") { } public override string ModifyPlayer(PlayerModification playerMod, CommandParameters parameters) { playerMod.invulnerable = !playerMod.invulnerable; return $"Invulnerability for {playerMod.player.playerUsername} set to {playerMod.invulnerable}"; } } public class FlyCommand : BasePlayerModCommand { public FlyCommand() : base("fly", "toggle flight") { } public override string ModifyPlayer(PlayerModification playerMod, CommandParameters parameters) { playerMod.enableFlying = !playerMod.enableFlying; return $"Can Fly for {playerMod.player.playerUsername} set to {playerMod.enableFlying}"; } } public class SpeedCommand : BasePlayerModCommand { public SpeedCommand() : base("speed", "sets player speed value", "[value]") { instructions.Add("[/cmd] reset - Resets speed to default value"); instructions.Add("[/cmd] [target] reset"); } public override string ModifyPlayer(PlayerModification playerMod, CommandParameters parameters) { if (parameters.HasNext()) { bool isNumber; float floatAt = parameters.GetFloatAt(parameters.place, out isNumber); if (isNumber) { playerMod.player.movementSpeed = floatAt; return $"Set {playerMod.player.playerUsername}'s movement speed to {floatAt}"; } if (parameters.GetString().Equals("reset", StringComparison.InvariantCultureIgnoreCase)) { playerMod.player.movementSpeed = playerMod.defaultSpeed; return "Resetting " + playerMod.player.playerUsername + "'s movement speed"; } } return $"{playerMod.player.playerUsername} currently has a movement speed of {playerMod.player.movementSpeed}"; } } public class RouteCommand : SimpleCommand { public RouteCommand() : base("route", "route the ship to a moon for free") { instructions.Add("[/cmd] [numberless_planetname]"); } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { success = false; if (!StartOfRound.Instance.CanChangeLevels()) { return "Can not route ship at this time."; } if (parameters.IsEmpty()) { return "No Level Name Provided."; } string @string = parameters.GetString(); List<KeyValuePair<string, SelectableLevel>> list = new List<KeyValuePair<string, SelectableLevel>>(); int index = 0; SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { string text = new string(val.PlanetName.SkipWhile((char c) => !char.IsLetter(c)).ToArray()); if (text.StartsWith(@string, StringComparison.InvariantCultureIgnoreCase)) { list.Add(new KeyValuePair<string, SelectableLevel>(text, val)); if (text.Length < list[index].Key.Length) { index = list.Count - 1; } } } if (list.Count > 0) { if (((NetworkBehaviour)StartOfRound.Instance).IsServer) { StartOfRound.Instance.ChangeLevelClientRpc(list[index].Value.levelID, SimpleCommand.GetTerminal().groupCredits); } success = true; return "Routing to " + list[index].Value.PlanetName; } return "Unknown level: " + @string; } } public abstract class SimpleCommand { public class CommandParameters { private readonly string[] parameters; private readonly string[] flags; private Vector3 targetPos; public int place = 0; private static readonly Dictionary<string, bool> boolValues = new Dictionary<string, bool> { { "true", true }, { "false", false }, { "on", true }, { "off", false }, { "1", true }, { "0", false } }; public PlayerControllerB sender { get; internal set; } public CommandParameters(string[] parameters, string[] flags, Vector3 targetPos) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) this.parameters = parameters; this.flags = flags; this.targetPos = targetPos + Vector3.up; } public Vector3 GetTargetPos() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return targetPos; } public bool isFlagged(string flag) { for (int i = 0; i < flags.Length; i++) { if (flags[i].Equals(flag, StringComparison.InvariantCultureIgnoreCase)) { return true; } } return false; } public string[] GetFlags() { return flags; } public bool Count(int value) { return parameters.Length >= value; } public int Count() { return parameters.Length; } public bool IsEmpty() { return parameters.Length == 0; } public bool HasNext() { return place < parameters.Length; } public string asString() { return "parameters: [" + string.Join(", ", parameters) + "], flags: [" + string.Join(", ", flags) + "]"; } public string GetLowerCase() { return GetString().ToLower(); } public string GetString() { place++; return GetStringAt(Math.Min(parameters.Length - 1, place - 1)); } public string GetStringAt(int index) { return parameters[index]; } public string GetLast() { return GetStringAt(parameters.Length - 1); } public int GetNumber() { place++; bool isNumber; return GetNumberAt(Math.Min(parameters.Length - 1, place - 1), out isNumber); } public int GetNumberAt(int index) { bool isNumber; return GetNumberAt(index, out isNumber); } public int GetNumberAt(int index, out bool isNumber) { isNumber = int.TryParse(parameters[index], out var result); if (isNumber) { return result; } return 0; } public float GetFloat() { place++; bool isNumber; return GetFloatAt(Math.Min(parameters.Length - 1, place - 1), out isNumber); } public float GetFloatAt(int index) { bool isNumber; return GetFloatAt(index, out isNumber); } public float GetFloatAt(int index, out bool isNumber) { isNumber = float.TryParse(parameters[index], out var result); if (isNumber) { return result; } return 0f; } public bool GetBool() { GetBoolAt(place, out var value); place++; return value; } public bool GetBoolAt(int index) { GetBoolAt(index, out var value); return value; } public bool GetBoolAt(int index, out bool value) { return boolValues.TryGetValue(parameters[index].ToLower(), out value); } public PlayerControllerB? GetPlayer() { PlayerControllerB playerAt = GetPlayerAt(Math.Min(parameters.Length - 1, place)); place++; return playerAt; } public PlayerControllerB? GetPlayerAt(int index) { return SimpleCommand.GetPlayer(parameters[index]); } public bool GetVector(out Vector3 vector) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return GetRelativeVector(Vector3.zero, out vector); } public bool GetVectorAt(int startIndex, out Vector3 vector) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) return GetRelativeVectorAt(startIndex, Vector3.zero, out vector); } public bool GetRelativeVector(Vector3 origin, out Vector3 vector) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) bool relativeVectorAt = GetRelativeVectorAt(Math.Min(parameters.Length - 1, place), origin, out vector); place += 3; return relativeVectorAt; } public bool GetRelativeVectorAt(int startIndex, Vector3 origin, out Vector3 vector) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) vector = Vector3.zero; if (startIndex + 2 < parameters.Length) { float[] array = new float[3]; for (int i = 0; i < 3; i++) { string stringAt = GetStringAt(startIndex + i); if (float.TryParse(stringAt, out var result)) { array[i] = result; continue; } if (GetRelative(stringAt, i, origin, out var output)) { array[i] = output; continue; } return false; } vector = new Vector3(array[0], array[1], array[2]); return true; } return false; } private bool GetRelative(string num, int i, Vector3 origin, out float output) { //IL_003c: 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_004e: Unknown result type (might be due to invalid IL or missing references) output = 0f; switch (num[0]) { case '~': { if (1 == 0) { } float num2 = i switch { 0 => origin.x, 1 => origin.y, 2 => origin.z, _ => ((Vector3)(ref origin)).magnitude, }; if (1 == 0) { } output = num2; break; } case '^': { if (1 == 0) { } float num2 = i switch { 0 => targetPos.x, 1 => targetPos.y, 2 => targetPos.z, _ => ((Vector3)(ref targetPos)).magnitude, }; if (1 == 0) { } output = num2; break; } default: return false; } if (float.TryParse(num.Substring(1, num.Length - 1), out var result)) { output += result; } return true; } } public string name; public string description; public bool permissionRequired = true; public bool overrideShowOutput = false; public List<string> instructions = new List<string>(); public List<string> tagInfo = new List<string>(); private static readonly List<SimpleCommand> SimpleCommands = new List<SimpleCommand>(); public SimpleCommand(string name, string description) { this.name = name; this.description = description; } public abstract string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success); public string PagedList(string header, List<string> entries, int page, int pageMax = 6) { if (entries.Count == 0) { return header + "\nNo Entries Found."; } List<string> list = new List<string>(); int num = (int)Math.Ceiling((float)entries.Count / (float)pageMax); page = Math.Clamp(page - 1, 0, num - 1); if (entries.Count > pageMax) { for (int i = Math.Clamp(page * pageMax, 0, entries.Count - 1); i < Math.Min(entries.Count, (page + 1) * pageMax); i++) { list.Add(entries[i]); } list.Add($"[Page {Math.Min(page + 1, num)} of {num}]"); } else { list = entries; } return header + "\n" + string.Join("\n", list); } public static string UnknownPlayerException(string username) { return ((username == "") ? "Unknown" : ("\"" + username + "\"")) + " is not in this lobby."; } public static string UnknownNumberException() { return "A Number was not able to be parsed."; } public static string UnknownVectorException() { return "A Position (X Y Z) was not able to be parsed."; } public static string MissingTerminal() { return "Missing Terminal."; } public static List<SimpleCommand> GetCommands() { return SimpleCommands; } public static string GetPrefix() { return SimpleCommandsBase.commandPrefix.Value; } public static void Register(string name, Action<CommandParameters> action, string description = "") { Register(new ActionCommand(name, description, action)); } public static void Register(SimpleCommand command) { if (!command.overrideShowOutput) { command.tagInfo.Add("'Hide':\nHides command chat output."); } SimpleCommands.Add(command); command.OnRegister(); SimpleCommandsBase.LogInfo("Registered Simple Command: " + GetPrefix() + " " + command.name, (JLogLevel)2); } public virtual void OnRegister() { } public static bool tryParseCommand(string cmd, out SimpleCommand? command, out CommandParameters? parameters, Vector3 targetPos) { //IL_00b8: Unknown result type (might be due to invalid IL or missing references) parameters = null; string[] array = cmd.Split(' '); command = tryGetCommand(array[0]); if (command == null) { return false; } List<string> list = new List<string>(); List<string> list2 = new List<string>(); bool flag = true; for (int i = 1; i < array.Length; i++) { if (flag) { if (!(array[i] == "")) { if (array[i] == "|") { flag = false; } else { list.Add(array[i]); } } } else { list2.Add(array[i].ToLower()); } } parameters = new CommandParameters(list.ToArray(), list2.ToArray(), targetPos); return true; } public static SimpleCommand? tryGetCommand(string name) { foreach (SimpleCommand simpleCommand in SimpleCommands) { if (simpleCommand.name.ToLower() == name.ToLower()) { return simpleCommand; } } return null; } public static PlayerControllerB? GetPlayer(string name) { List<PlayerControllerB> list = new List<PlayerControllerB>(); PlayerControllerB[] allPlayerScripts = RoundManager.Instance.playersManager.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.playerUsername.ToLower().Replace(' ', '_').StartsWith(name.ToLower().Replace(' ', '_'))) { list.Add(val); } } if (list.Count > 0) { int index = 0; for (int j = 0; j < list.Count; j++) { if (((Object)list[j]).name.Length < ((Object)list[index]).name.Length) { index = j; } } return list[index]; } return null; } public static Terminal GetTerminal() { return JLevelPropertyRegistry.GetTerminal(); } public static void ClearChat() { HUDManager instance = HUDManager.Instance; instance.ChatMessageHistory.Clear(); ((TMP_Text)instance.chatText).SetText("", true); instance.lastChatMessage = ""; } } public class SimplePrefabs { public class SimplePrefab { public GameObject prefab; public Vector3 spawnOffset = Vector3.zero; public readonly PrefabSource source; public SimplePrefab(GameObject prefab) : this(prefab, PrefabSource.Custom) { } internal SimplePrefab(GameObject prefab, PrefabSource source) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) this.prefab = prefab; this.source = source; } public void SpawnPrefab(Vector3 pos, Quaternion rot) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: 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) if (Object.op_Implicit((Object)(object)prefab.GetComponent<NetworkObject>())) { if (((NetworkBehaviour)RoundManager.Instance).IsServer || ((NetworkBehaviour)RoundManager.Instance).IsClient) { GameObject val = Object.Instantiate<GameObject>(prefab); SetPrefabProperties(ref val, pos, rot); val.GetComponent<NetworkObject>().Spawn(false); } } else { GameObject val2 = Object.Instantiate<GameObject>(prefab); SetPrefabProperties(ref val2, pos, rot); } } public virtual void SetPrefabProperties(ref GameObject prefab, Vector3 pos, Quaternion rot) { //IL_0008: 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) prefab.transform.position = pos; prefab.transform.rotation = rot; } } public class CruiserPrefab : SimplePrefab { public CruiserPrefab(GameObject prefab) : base(prefab, PrefabSource.Vehicle) { } public override void SetPrefabProperties(ref GameObject prefab, Vector3 pos, Quaternion rot) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) base.SetPrefabProperties(ref prefab, pos, rot); VehicleController val = default(VehicleController); if (prefab.TryGetComponent<VehicleController>(ref val)) { val.hasBeenSpawned = true; val.inDropshipAnimation = false; } } } public enum PrefabSource { Custom, Vehicle, Hazard } internal static readonly Dictionary<string, SimplePrefab> Prefabs = new Dictionary<string, SimplePrefab>(); private static bool registeredBasePrefabs = false; public static void RegisterSimplePrefab(string name, SimplePrefab prefab) { if (!Prefabs.ContainsKey(name)) { Prefabs.Add(name.Replace(' ', '_'), prefab); } } public static void RegisterSimplePrefab(string name, GameObject prefab) { RegisterSimplePrefab(name, new SimplePrefab(prefab)); } internal static void RegisterBasePrefabs() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (registeredBasePrefabs) { return; } registeredBasePrefabs = true; SimpleCommandsBase.LogInfo("Registering Base Game Prefabs.", (JLogLevel)2); Terminal terminal = JLevelPropertyRegistry.GetTerminal(); RegisterSimplePrefab("Cruiser", (SimplePrefab)new CruiserPrefab(terminal.buyableVehicles[0].vehiclePrefab) { spawnOffset = new Vector3(0f, 14f, 0f) }); SimpleCommandsBase.LogInfo($"Vanilla Map Hazards: {terminal.moonsCatalogueList[1].spawnableMapObjects.Length}", (JLogLevel)2); SpawnableMapObject[] spawnableMapObjects = terminal.moonsCatalogueList[1].spawnableMapObjects; foreach (SpawnableMapObject val in spawnableMapObjects) { string name = ((Object)val.prefabToSpawn).name; if (1 == 0) { } string text = ((name == "SpikeRoofTrapHazard") ? "SpikeRoofTrap" : ((!(name == "TurretContainer")) ? name : "Turret")); if (1 == 0) { } name = text; RegisterSimplePrefab(name, new SimplePrefab(val.prefabToSpawn, PrefabSource.Hazard)); } if (JCompatabilityHelper.IsLoaded((CachedMods)3)) { LethalLibCompatibility.RegisterLethalLibPrefabs(); } } } public class SpawnCommand<T> : SimpleCommand { public class ListCommand : SimpleCommand { private readonly string header; private readonly SpawnCommand<T> parentCommand; public readonly Dictionary<string, string> filters; public ListCommand(SpawnCommand<T> parentCommand, string cmd, string header, (string, string)[] filters) : base(cmd, "lists spawnable " + cmd) { instructions.Add("[/cmd] - Lists " + header.ToLower()); instructions.Add("[/cmd] [page]"); this.parentCommand = parentCommand; this.header = header; this.filters = new Dictionary<string, string>(); for (int i = 0; i < filters.Length; i++) { (string, string) tuple = filters[i]; this.filters.Add(tuple.Item1, tuple.Item2); tagInfo.Add("'" + tuple.Item1 + "':\n" + tuple.Item2); } } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { success = true; if (!JLLExtentions.IsLocalPlayer(sender)) { return ""; } SimpleCommand.ClearChat(); string[] arg = filters.Keys.Where(parameters.isFlagged).ToArray(); return PagedList(header + ":" + ((filters.Keys.Count > 0) ? ("\nFilters: " + string.Join(' ', filters.Keys)) : string.Empty), parentCommand.RetreiveCollection(arg).Select(parentCommand.Identify.Invoke).ToList(), (!parameters.IsEmpty()) ? parameters.GetNumber() : 0, 8); } } private readonly Func<T, string> Identify; private readonly Func<string[], IEnumerable<T>> RetreiveCollection; private readonly bool RequiresNavmesh; private readonly Action<T, Vector3, CommandParameters> Result; public readonly ListCommand? ListCmd; public SpawnCommand(string name, string description, Func<T, string> identify, Func<string[], IEnumerable<T>> collection, Action<T, Vector3, CommandParameters> result, bool requireNavmesh = false) : base(name, description) { instructions.Add("[/cmd] [id]"); instructions.Add("[/cmd] [id] [count]"); instructions.Add("[/cmd] [id] [target]"); instructions.Add("[/cmd] [id] [target] [count]"); instructions.Add("[/cmd] [id] [x] [y] [z]"); instructions.Add("[/cmd] [id] [x] [y] [z] [count]"); if (requireNavmesh) { tagInfo.Add("'Ignore':\nIgnores nav mesh restrictions (May Throw Errors)"); } else { tagInfo.Add("'Snap':\nSnaps to nav mesh"); } tagInfo.Add("'Uncapped':\nIgnores cap to spawn commands"); Identify = identify; RetreiveCollection = collection; RequiresNavmesh = requireNavmesh; Result = result; } public SpawnCommand(string name, string description, string listCmd, string listHeader, (string, string)[] filterInfos, Func<T, string> identify, Func<string[], IEnumerable<T>> collection, Action<T, Vector3, CommandParameters> result, bool requireNavmesh = false) : this(name, description, identify, collection, result, requireNavmesh) { ListCmd = new ListCommand(this, listCmd, listHeader, filterInfos); } public override void OnRegister() { if (ListCmd != null) { SimpleCommand.Register(ListCmd); } } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) success = false; if (((NetworkBehaviour)sender).IsHost || ((NetworkBehaviour)sender).IsServer) { string text = ""; Vector3 val = parameters.GetTargetPos(); int num = 1; if (!parameters.IsEmpty()) { text = parameters.GetString(); if (parameters.Count() >= 4) { if (!parameters.GetRelativeVector(((Component)sender).transform.position, out var vector)) { return SimpleCommand.UnknownVectorException(); } val = vector; if (parameters.HasNext()) { num = Math.Max(num, parameters.GetNumber()); } } else if (parameters.Count(2)) { bool isNumber; int numberAt = parameters.GetNumberAt(1, out isNumber); string @string = parameters.GetString(); PlayerControllerB player = SimpleCommand.GetPlayer(@string); if (isNumber) { num = numberAt; } else { if (!((Object)(object)player != (Object)null)) { return SimpleCommand.UnknownPlayerException(@string); } val = ((Component)player).transform.position; if (parameters.HasNext()) { num = Math.Max(num, parameters.GetNumber()); } } if ((Object)(object)player != (Object)null) { val = ((Component)player).transform.position; } } } if (Utility.IsNullOrWhiteSpace(text)) { return "Empty Identifer"; } List<T> list = new List<T>(); int index = 0; string text2 = null; foreach (T item in RetreiveCollection((ListCmd == null) ? new string[0] : ListCmd.filters.Keys.Where(parameters.isFlagged).ToArray())) { string text3 = Identify(item); if (text3.Replace(' ', '_').StartsWith(text, StringComparison.InvariantCultureIgnoreCase)) { list.Add(item); if (text2 == null || text3.Length < text2.Length) { index = list.Count - 1; text2 = text3; } } } if (list.Count > 0 && text2 != null) { bool flag = parameters.isFlagged("snap"); if (RequiresNavmesh || flag) { NavMeshHit val2 = default(NavMeshHit); if (NavMesh.SamplePosition(val, ref val2, 5f, -1)) { IterateResult(list[index], ((NavMeshHit)(ref val2)).position, parameters, num); success = true; return $"Spawned {text2} at {((NavMeshHit)(ref val2)).position}."; } if (!flag && !parameters.isFlagged("ignore")) { return "Failed to spawn. (Couldn't Find NavMesh.)"; } } IterateResult(list[index], val, parameters, num); success = true; return $"Spawned {text2} at {val}."; } return "Unknown Identifier: " + text2; } return ""; } private void IterateResult(T item, Vector3 pos, CommandParameters parameters, int count) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) int num = (parameters.isFlagged("uncapped") ? int.MaxValue : SimpleCommandsBase.spawnCap.Value); for (int i = 0; i < count && i < num; i++) { Result(item, pos, parameters); } } } public class TeleportCommand : SimpleCommand { public TeleportCommand() : base("tp", "teleports players") { instructions.Add("[/cmd] [destination] - Teleports Self"); instructions.Add("[/cmd] (ship | main | exit{#}) - Teleports Self"); instructions.Add("[/cmd] [target] [destination]"); instructions.Add("[/cmd] [target] (ship | main | exit{#})"); instructions.Add("[/cmd] [x] [y] [z] - Teleports self"); instructions.Add("[/cmd] [target] [x] [y] [z]"); tagInfo.Add("'Animate':\nTeleport instantly skipping teleport animation."); tagInfo.Add("'Inside':\nSets the teleported player inside the facility."); tagInfo.Add("'Outside':\nSets the teleported player outside the facility."); } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) string text = ""; string formalName = ""; bool instant = !parameters.isFlagged("animate"); success = false; bool isInside = sender.isInsideFactory; if (parameters.isFlagged("inside")) { isInside = true; } else if (parameters.isFlagged("outside")) { isInside = false; } switch (parameters.Count()) { case 1: { string @string = parameters.GetString(); PlayerControllerB player = SimpleCommand.GetPlayer(@string); if ((Object)(object)player != (Object)null) { text = sender.playerUsername; formalName = player.playerUsername; TeleportPlayer(sender, ((Component)player).transform.position, instant, isInside); break; } if (GetSpecialLocation(@string, out Vector3 pos2, out formalName, ref isInside)) { text = sender.playerUsername; TeleportPlayer(sender, pos2, instant, isInside); break; } if (formalName != "") { return formalName + " could not be found."; } return SimpleCommand.UnknownPlayerException(@string); } case 2: { string @string = parameters.GetString(); PlayerControllerB player = SimpleCommand.GetPlayer(@string); if ((Object)(object)player == (Object)null) { return SimpleCommand.UnknownPlayerException(@string); } string string2 = parameters.GetString(); PlayerControllerB player2 = SimpleCommand.GetPlayer(string2); if ((Object)(object)player2 == (Object)null) { if (!GetSpecialLocation(string2, out Vector3 pos, out formalName, ref isInside)) { if (formalName != "") { return formalName + " not found."; } return SimpleCommand.UnknownPlayerException(string2); } text = player.playerUsername; TeleportPlayer(player, pos, instant, isInside); } else { text = sender.playerUsername; formalName = player.playerUsername; TeleportPlayer(player, ((Component)player2).transform.position, instant, isInside); } break; } case 3: { if (parameters.GetRelativeVector(((Component)sender).transform.position, out var vector2)) { text = sender.playerUsername; formalName = vector2.x + ", " + vector2.y + ", " + vector2.z; TeleportPlayer(sender, vector2, instant, isInside); break; } return SimpleCommand.UnknownVectorException(); } case 4: { string @string = parameters.GetString(); PlayerControllerB player = SimpleCommand.GetPlayer(@string); if ((Object)(object)player != (Object)null) { if (parameters.GetRelativeVector(((Component)player).transform.position, out var vector)) { text = player.playerUsername; formalName = vector.x + ", " + vector.y + ", " + vector.z; TeleportPlayer(player, vector, instant, isInside); break; } return SimpleCommand.UnknownVectorException(); } return SimpleCommand.UnknownPlayerException(@string); } } if (text != "") { success = true; return "Teleporting " + text + " to " + formalName; } return ""; } private bool GetSpecialLocation(string name, out Vector3 pos, out string formalName, ref bool isInside) { //IL_0027: 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_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_007c: 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_0086: 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) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: 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_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Unknown result type (might be due to invalid IL or missing references) switch (name) { case "ship": isInside = false; pos = new Vector3(0f, 0f, -14f); formalName = "Autopilot Ship"; return true; case "breaker": { BreakerBox val = Object.FindObjectOfType<BreakerBox>(); formalName = "Breaker Box"; isInside = true; if ((Object)(object)val != (Object)null) { pos = NavMeshSnap(((Component)val).transform.position); return true; } pos = Vector3.zero; return false; } case "apparatus": { LungProp[] array = Object.FindObjectsOfType<LungProp>(); isInside = true; formalName = "Apparatus"; LungProp[] array2 = array; foreach (LungProp val2 in array2) { if (val2.isLungDocked) { pos = NavMeshSnap(((Component)val2).transform.position); return true; } } pos = Vector3.zero; return false; } default: { int num = -1; if (name == "main") { num = 0; } else if (name.StartsWith("exit")) { string text = name; if (int.TryParse(text.Substring(4, text.Length - 4), out var result)) { num = result; } } if (num >= 0) { Vector3? entranceTeleportLocation = JLevelPropertyRegistry.GetEntranceTeleportLocation(num, !isInside, true); formalName = ((num == 0) ? "Main Entrance" : $"Fire Exit #{num}"); if (entranceTeleportLocation.HasValue) { pos = entranceTeleportLocation.Value; return true; } pos = Vector3.zero; return false; } string text2 = string.Empty; int num2 = name.Length - 1; while (num2 > 0 && char.IsNumber(name[num2])) { text2 = name[num2] + text2; num2--; } int num3 = 0; if (int.TryParse(text2, out var result2)) { num3 = result2; } name = name.Remove(name.Length - text2.Length, text2.Length); SimpleCommandsBase.LogInfo($"POI Parse: '{name}' '{text2}' {num3}", (JLogLevel)2); if (JLevelPropertyRegistry.HasPOI(name)) { formalName = name; Vector3 pos2 = default(Vector3); if (JLevelPropertyRegistry.GetPOI(name, num3, ref pos2)) { pos = NavMeshSnap(pos2); return true; } pos = Vector3.zero; return false; } formalName = ""; pos = Vector3.zero; return false; } } } private Vector3 NavMeshSnap(Vector3 pos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: 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) //IL_001b: 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) NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(pos, ref val, 3f, -1)) { return ((NavMeshHit)(ref val)).position; } return pos; } private void TeleportPlayer(PlayerControllerB player, Vector3 pos, bool instant, bool isInside) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (instant) { player.isInsideFactory = isInside; player.TeleportPlayer(pos, false, 0f, false, true); } else { ((MonoBehaviour)player).StartCoroutine(beamUpPlayer(player, pos, isInside)); } } private IEnumerator beamUpPlayer(PlayerControllerB player, Vector3 pos, bool isInside) { //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) if ((Object)(object)player == (Object)null) { Debug.Log((object)"Targeted player is null"); yield break; } player.shipTeleporterId = 1; player.beamUpParticle.Play(); yield return (object)new WaitForSeconds(3f); player.isInsideFactory = isInside; player.averageVelocity = 0f; player.velocityLastFrame = Vector3.zero; player.TeleportPlayer(pos, false, 0f, false, true); player.shipTeleporterId = -1; } } public class PosCommand : SimpleCommand { public PosCommand() : base("pos", "shows player position") { permissionRequired = false; instructions.Add("[/cmd] - Shows Player Position"); } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { //IL_001a: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) success = true; if (JLLExtentions.IsLocalPlayer(sender)) { JHudHelper.QueueDisplayTip($"Pos: {((Component)sender).transform.position}", $"Rot: {((Component)sender).transform.rotation}", false, false, "LC_Tip1"); SimpleCommandsBase.LogInfo($"Pos: {((Component)sender).transform.position} | Rot: {((Component)sender).transform.rotation}", (JLogLevel)2); } return ""; } } public class TerminalCommand : SimpleCommand { public TerminalCommand() : base("terminal", "Send Terminal Codes") { instructions.Add("[/cmd] [code] - Used for opening doors / disabling hazards."); } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { success = false; Terminal terminal = SimpleCommand.GetTerminal(); if ((Object)(object)terminal == (Object)null) { return SimpleCommand.MissingTerminal(); } if (!parameters.IsEmpty()) { string @string = parameters.GetString(); TerminalPatch.terminalObjectRequest(terminal, @string); success = true; return ""; } return ""; } } public class WeatherCommand : SimpleCommand { public static Dictionary<string, string> weatherAlias = new Dictionary<string, string>(); public WeatherCommand() : base("weather", "changes weather") { instructions.Add("[/cmd] (clear | dusty | foggy | rainy | stormy | flooded | eclipsed)"); if (JCompatabilityHelper.IsLoaded((CachedMods)1)) { instructions.Add("{Check /weatherregistry for weather registry weather ids}"); } weatherAlias.Add("clear", "none"); weatherAlias.Add("dust", "dustclouds"); weatherAlias.Add("dusty", "dustclouds"); weatherAlias.Add("fog", "foggy"); weatherAlias.Add("rain", "rainy"); weatherAlias.Add("storm", "stormy"); weatherAlias.Add("flood", "flooded"); weatherAlias.Add("eclipse", "eclipsed"); } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: 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) success = false; if (!StartOfRound.Instance.inShipPhase) { return "Can not change weather mid round!"; } if (parameters.Count() >= 1) { string text = parameters.GetLowerCase(); string text2 = string.Empty; if (weatherAlias.TryGetValue(text, out string value)) { text = value; } if (SimpleCommandsBase.WRPresent) { foreach (string customWeatherName in JWeatherRegistryHelper.GetCustomWeatherNames()) { if (customWeatherName.ToLower().Replace(" ", "_").Equals(text)) { text2 = customWeatherName; break; } } } SelectableLevel currentLevel = StartOfRound.Instance.currentLevel; if (text2.Equals(string.Empty)) { LevelWeatherType currentWeather; switch (text) { case "none": currentWeather = (LevelWeatherType)(-1); break; case "dustclouds": currentWeather = (LevelWeatherType)0; break; case "foggy": currentWeather = (LevelWeatherType)3; break; case "rainy": currentWeather = (LevelWeatherType)1; break; case "stormy": currentWeather = (LevelWeatherType)2; break; case "flooded": currentWeather = (LevelWeatherType)4; break; case "eclipsed": currentWeather = (LevelWeatherType)5; break; default: return "Unknown Weather: " + text; } currentLevel.currentWeather = currentWeather; } else { JWeatherRegistryHelper.ChangeWeather(text2, currentLevel); } success = true; return "Set Weather for " + currentLevel.PlanetName + " to " + text + "."; } return ""; } } } namespace SimpleCommands.Commands.Compatability { public class ExtendedLevelsCommand : SimpleCommand { public ExtendedLevelsCommand() : base("levels", "LethalLevelLoader ExtendedLevels (iAmBatby)") { overrideShowOutput = true; permissionRequired = false; instructions.Add("[/cmd] - lists levels registered through LLL"); instructions.Add("[/cmd] [page]"); } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { success = true; if (!JLLExtentions.IsLocalPlayer(sender)) { return ""; } SimpleCommand.ClearChat(); return PagedList("Extended Levels:", PatchedContent.ExtendedLevels.Select((ExtendedLevel level) => level.NumberlessPlanetName).ToList(), (!parameters.IsEmpty()) ? parameters.GetNumber() : 0, 7); } } public class WeatherRegistryCommand : SimpleCommand { public WeatherRegistryCommand() : base("weatherregistry", "WeatherRegistry (mrov)") { overrideShowOutput = true; permissionRequired = false; instructions.Add("[/cmd] - lists weathers registered through WeatherRegistry"); instructions.Add("[/cmd] [page]"); } public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success) { success = true; if (!JLLExtentions.IsLocalPlayer(sender)) { return ""; } SimpleCommand.ClearChat(); return PagedList("WeatherRegistry:", WeatherManager.Weathers.Select((Weather weather) => ((Object)weather).name.Replace(" ", "_")).ToList(), (!parameters.IsEmpty()) ? parameters.GetNumber() : 0, 7); } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace Simple-Commands.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }