using 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;
using SimpleCommands.Commands;
using SimpleCommands.Components;
using SimpleCommands.Managers;
using SimpleCommands.Patches;
using Simple_Commands.Commands;
using Simple_Commands.Commands.Compatability;
using Simple_Commands.Managers;
using Simple_Commands.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: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
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;
}
}
}
namespace Simple_Commands.Patches
{
[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 Simple_Commands.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
{
prefab = mapObject.mapObject.prefabToSpawn
});
}
}
}
}
namespace Simple_Commands.Commands
{
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 ToggleCheat(playerMod, parameters);
}
return "";
}
public abstract string ToggleCheat(PlayerModification playerMod, CommandParameters parameters);
}
public class AllCheatsCommand : BasePlayerModCommand
{
public AllCheatsCommand()
: base("cheats", "enable / disable cheats", "(On | Off)")
{
}
public override string ToggleCheat(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 ToggleCheat(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 ToggleCheat(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 ToggleCheat(PlayerModification playerMod, CommandParameters parameters)
{
playerMod.enableFlying = !playerMod.enableFlying;
return $"Can Fly for {playerMod.player.playerUsername} set to {playerMod.enableFlying}";
}
}
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 class SimplePrefabs
{
public class SimplePrefab
{
public GameObject prefab;
public Vector3 spawnOffset = Vector3.zero;
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 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;
}
}
}
internal class PrefabCommand : SimpleCommand
{
public PrefabCommand()
: base("prefab", "spawn registered prefabs")
{
instructions.Add("[/cmd] [name] - Spawns prefab at the player.");
instructions.Add("[/cmd] [name] [target] - Spawns prefab at the target.");
instructions.Add("[/cmd] [name] [x] [y] [z] - Spawns prefab at specified coordinates.");
}
public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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_00a8: 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_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: 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)
success = false;
if (!parameters.IsEmpty())
{
string @string = parameters.GetString();
Vector3 val = ((Component)sender).transform.position;
bool flag = false;
if (parameters.Count() >= 4)
{
if (!parameters.GetRelativeVector(((Component)sender).transform.position, out var vector))
{
return SimpleCommand.UnknownVectorException();
}
val = vector;
flag = true;
}
else if (parameters.Count() >= 2)
{
string string2 = parameters.GetString();
PlayerControllerB player = SimpleCommand.GetPlayer(string2);
if (!((Object)(object)player != (Object)null))
{
return SimpleCommand.UnknownPlayerException(string2);
}
val = ((Component)player).transform.position;
}
List<KeyValuePair<string, SimplePrefab>> list = new List<KeyValuePair<string, SimplePrefab>>();
int index = 0;
foreach (KeyValuePair<string, SimplePrefab> prefab in Prefabs)
{
if (prefab.Key.ToLower().StartsWith(@string.ToLower()))
{
list.Add(prefab);
if (prefab.Key.Length < list[index].Key.Length)
{
index = list.Count - 1;
}
}
}
if (list.Count > 0 && Prefabs.ContainsKey(list[index].Key))
{
SimplePrefab simplePrefab = Prefabs[list[index].Key];
simplePrefab.SpawnPrefab(val + (flag ? Vector3.zero : simplePrefab.spawnOffset), ((Component)sender).transform.rotation);
success = true;
return "Spawned " + list[index].Key + "!";
}
return "Unknown Prefab: " + @string;
}
return "";
}
}
internal class PrefabsCommand : SimpleCommand
{
public PrefabsCommand()
: base("prefabs", "list spawnable prefabs")
{
instructions.Add("[/cmd] - Lists spawnable prefabs");
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("Spawnable Prefabs:", Prefabs.Keys.ToList(), (!parameters.IsEmpty()) ? parameters.GetNumber() : 0, 8);
}
}
private 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 = prefab
});
}
internal static void RegisterBasePrefabs()
{
//IL_0054: 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)
if (registeredBasePrefabs)
{
return;
}
registeredBasePrefabs = true;
SimpleCommandsBase.LogInfo("Registering Base Game Prefabs.", (JLogLevel)2);
Terminal terminal = JLevelPropertyRegistry.GetTerminal();
RegisterSimplePrefab("Cruiser", (SimplePrefab)new CruiserPrefab
{
prefab = 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
{
prefab = val.prefabToSpawn
});
}
if (JCompatabilityHelper.IsLoaded((CachedMods)3))
{
LethalLibCompatibility.RegisterLethalLibPrefabs();
}
}
}
}
namespace Simple_Commands.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 SimpleCommands
{
[BepInPlugin("JacobG5.SimpleCommands", "SimpleCommands", "1.6.0")]
[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.6.0";
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 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.)");
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 AllCheatsCommand());
SimpleCommand.Register(new FlyCommand());
SimpleCommand.Register(new InvulnerabilityCommand());
SimpleCommand.Register(new InfiniteSprintCommand());
SimpleCommand.Register(new TerminalCommand());
SimpleCommand.Register(new ItemCommand());
SimpleCommand.Register(new ItemsCommand());
SimpleCommand.Register(new SimplePrefabs.PrefabCommand());
SimpleCommand.Register(new SimplePrefabs.PrefabsCommand());
SimpleCommand.Register(new PosCommand());
SimpleCommand.Register(new SpawnCommand());
SimpleCommand.Register(new EnemiesCommand());
SimpleCommand.Register(new HealCommand());
SimpleCommand.Register(new DamageCommand());
SimpleCommand.Register(new ExplodeCommand());
SimpleCommand.Register(new ExtendCommand());
SimpleCommand.Register(new RouteCommand());
if (LLLPresent)
{
SimpleCommand.Register(new ExtendedLevelsCommand());
}
SimpleCommand.Register(new WeatherCommand());
if (WRPresent)
{
SimpleCommand.Register(new WeatherRegistryCommand());
}
SimpleCommand.Register(new ChargeCommand());
}
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")]
[HarmonyPrefix]
public static void patchStart(PlayerControllerB __instance)
{
((Component)__instance).gameObject.AddComponent<PlayerModification>();
}
[HarmonyPatch("KillPlayer")]
[HarmonyPrefix]
public static bool patchKillPlayer(PlayerControllerB __instance)
{
return CheckInvulnerability(__instance);
}
[HarmonyPatch("DamagePlayer")]
[HarmonyPrefix]
public static bool patchDamagePlayer(PlayerControllerB __instance)
{
return CheckInvulnerability(__instance);
}
public static bool CheckInvulnerability(PlayerControllerB player)
{
if (((Component)player).GetComponent<PlayerModification>().invulnerable)
{
player.health = 100;
return false;
}
return true;
}
}
}
namespace SimpleCommands.Managers
{
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_0140: 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_019b: 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;
}
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_013e: 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 != 2 && (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 == 2 && (networkManager.IsClient || networkManager.IsHost))
{
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);
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_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 != 2 && (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 == 2 && (networkManager.IsClient || networkManager.IsHost))
{
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();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_SimpleCommandsNetworkManager()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(3835659538u, new RpcReceiveHandler(__rpc_handler_3835659538));
NetworkManager.__rpc_func_table.Add(3869478541u, new RpcReceiveHandler(__rpc_handler_3869478541));
NetworkManager.__rpc_func_table.Add(746899919u, new RpcReceiveHandler(__rpc_handler_746899919));
}
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)2;
((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)2;
((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 void Start()
{
player = ((Component)this).gameObject.GetComponent<PlayerControllerB>();
InputActionAsset actions = IngamePlayerSettings.Instance.playerInput.actions;
jumpAction = actions.FindAction("Jump", false);
crouchAction = actions.FindAction("Crouch", false);
}
public void Update()
{
if (infinateSprint)
{
player.sprintMeter = 1f;
}
if (!player.quickMenuManager.isMenuOpen && ((NetworkBehaviour)player).IsOwner && player.isPlayerControlled && !player.inSpecialInteractAnimation && !player.isTypingChat)
{
HandleInput();
}
if (enableFlying && flying)
{
if (player.thisController.isGrounded)
{
SetFlying(value: false);
}
player.takingFallDamage = false;
}
}
public void HandleInput()
{
if (!enableFlying)
{
return;
}
if (jumpAction.WasPressedThisFrame())
{
if (Time.realtimeSinceStartup - lastJumpPress < 0.4f)
{
SetFlying(!flying);
}
lastJumpPress = Time.realtimeSinceStartup;
}
if (flying)
{
player.fallValueUncapped = (player.fallValue = (jumpAction.IsPressed() ? flightSpeed.y : (crouchAction.IsPressed() ? (flightSpeed.y * -1.4f) : 0f)) * (player.isSprinting ? 1.6f : 1f));
}
}
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
{
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 ItemCommand : SimpleCommand
{
public ItemCommand()
: base("item", "spawns item")
{
instructions.Add("[/cmd] [item]");
instructions.Add("[/cmd] [item] [target]");
instructions.Add("[/cmd] [item] [x] [y] [z]");
}
public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: 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_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: 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_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_0263: 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 = ((Component)sender).transform.position;
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;
}
else if (parameters.Count(2))
{
string @string = parameters.GetString();
PlayerControllerB player = SimpleCommand.GetPlayer(@string);
if (!((Object)(object)player != (Object)null))
{
return SimpleCommand.UnknownPlayerException(@string);
}
val = ((Component)player).transform.position;
}
}
Terminal terminal = SimpleCommand.GetTerminal();
if ((Object)(object)terminal == (Object)null)
{
return SimpleCommand.MissingTerminal();
}
List<Item> list = new List<Item>();
int index = 0;
foreach (Item items in RoundManager.Instance.playersManager.allItemsList.itemsList)
{
if (items.itemName.ToLower().Replace(' ', '_').StartsWith(text.ToLower()))
{
list.Add(items);
if (items.itemName.Length < list[index].itemName.Length)
{
index = list.Count - 1;
}
}
}
if (list.Count > 0)
{
GameObject val2 = Object.Instantiate<GameObject>(list[index].spawnPrefab, val, Quaternion.identity);
GrabbableObject component = val2.GetComponent<GrabbableObject>();
component.fallTime = 0f;
if (list[index].isScrap)
{
component.SetScrapValue(Mathf.RoundToInt((float)Random.Range(list[index].minValue, list[index].maxValue) * RoundManager.Instance.scrapValueMultiplier));
}
((Component)component).GetComponent<NetworkObject>().Spawn(false);
success = true;
return $"Spawned {list[index].itemName} at {val}.";
}
return "Unknown Item: " + text;
}
return "";
}
}
public class ItemsCommand : SimpleCommand
{
public ItemsCommand()
: base("items", "lists items")
{
overrideShowOutput = true;
permissionRequired = false;
instructions.Add("[/cmd] - lists item ids");
instructions.Add("[/cmd] [page]");
tagInfo.Add("'Store':\nFilters to show store items");
tagInfo.Add("'Scrap':\nFilters to show scrap items");
}
public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
{
success = true;
if (!JLLExtentions.IsLocalPlayer(sender))
{
return "";
}
List<Item> list = new List<Item>();
string header = "";
bool flag = parameters.isFlagged("store");
bool flag2 = parameters.isFlagged("scrap");
if (flag || flag2)
{
if (flag)
{
header = "Buyable Items:";
Terminal terminal = SimpleCommand.GetTerminal();
if ((Object)(object)terminal == (Object)null)
{
success = false;
return SimpleCommand.MissingTerminal();
}
list.AddRange(terminal.buyableItemsList);
}
if (flag2)
{
header = "Scrap for Moon:";
foreach (SpawnableItemWithRarity item in StartOfRound.Instance.currentLevel.spawnableScrap)
{
list.Add(item.spawnableItem);
}
}
if (flag && flag2)
{
header = "Buyables & Scrap:";
}
}
else
{
header = "All Items:";
list.AddRange(RoundManager.Instance.playersManager.allItemsList.itemsList);
}
List<string> list2 = new List<string>();
foreach (Item item2 in list)
{
list2.Add(item2.itemName.Replace(' ', '_'));
}
SimpleCommand.ClearChat();
return PagedList(header, list2, (!parameters.IsEmpty()) ? parameters.GetNumber() : 0, 8);
}
}
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, 4);
}
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 SimpleCommand
{
public class CommandParameters
{
private string[] parameters;
private string[] flags;
private Vector3 targetPos;
public int place = 0;
private static Dictionary<string, bool> boolValues = new Dictionary<string, bool>
{
{ "true", true },
{ "false", false },
{ "on", true },
{ "off", false },
{ "1", true },
{ "0", false }
};
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] == flag.ToLower())
{
return true;
}
}
return false;
}
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 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 = 5)
{
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(SimpleCommand command)
{
if (!command.overrideShowOutput)
{
command.tagInfo.Add("'Hide':\nHides command chat output.");
}
SimpleCommands.Add(command);
SimpleCommandsBase.LogInfo("Registered Simple Command: " + GetPrefix() + " " + command.name, (JLogLevel)2);
}
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 SpawnCommand : SimpleCommand
{
public SpawnCommand()
: base("spawn", "spawns item")
{
instructions.Add("[/cmd] [enemy]");
instructions.Add("[/cmd] [enemy] [target]");
instructions.Add("[/cmd] [enemy] [x] [y] [z]");
tagInfo.Add("'Ignore':\nIgnores nav mesh restrictions (Will Throw Errors)");
}
public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: 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_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: 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_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
//IL_0206: Unknown result type (might be due to invalid IL or missing references)
//IL_0215: 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 = ((Component)sender).transform.position;
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;
}
else if (parameters.Count(2))
{
string @string = parameters.GetString();
PlayerControllerB player = SimpleCommand.GetPlayer(@string);
if (!((Object)(object)player != (Object)null))
{
return SimpleCommand.UnknownPlayerException(@string);
}
val = ((Component)player).transform.position;
}
}
List<EnemyType> list = new List<EnemyType>();
int index = 0;
if (!Utility.IsNullOrWhiteSpace(text))
{
foreach (EnemyType allSortedEnemy in JLevelPropertyRegistry.AllSortedEnemies)
{
if (allSortedEnemy.enemyName.ToLower().Replace(' ', '_').StartsWith(text.ToLower()))
{
list.Add(allSortedEnemy);
if (allSortedEnemy.enemyName.Length < list[index].enemyName.Length)
{
index = list.Count - 1;
}
}
}
}
if (list.Count > 0)
{
if ((Object)(object)list[index].enemyPrefab != (Object)null)
{
NavMeshHit val2 = default(NavMeshHit);
if (NavMesh.SamplePosition(val, ref val2, 5f, -1))
{
RoundManager.Instance.SpawnEnemyGameObject(((NavMeshHit)(ref val2)).position, 0f, 0, list[index]);
}
else
{
if (!parameters.isFlagged("ignore"))
{
return "Failed to spawn. (Couldn't Find NavMesh.)";
}
RoundManager.Instance.SpawnEnemyGameObject(val, 0f, 0, list[index]);
}
}
success = true;
return $"Spawned {list[index].enemyName} at {val}.";
}
return "Unknown Enemy: " + text;
}
return "";
}
}
public class EnemiesCommand : SimpleCommand
{
public EnemiesCommand()
: base("enemies", "lists enemies")
{
overrideShowOutput = true;
permissionRequired = false;
instructions.Add("[/cmd] - lists item ids");
instructions.Add("[/cmd] [page]");
tagInfo.Add("'Indoor':\nFilters to show interior enemies");
tagInfo.Add("'Outdoor':\nFilters to show exterior enemies");
}
public override string Execute(PlayerControllerB sender, CommandParameters parameters, out bool success)
{
success = true;
if (!JLLExtentions.IsLocalPlayer(sender))
{
return "";
}
string header = "";
bool flag = parameters.isFlagged("indoor");
bool flag2 = parameters.isFlagged("outdoor");
if (flag || flag2)
{
if (flag)
{
header = "Indoor Enemies:";
}
if (flag2)
{
header = "Outdoor Enemies:";
}
if (flag && flag2)
{
header = "Spawnable Enemies:";
}
}
else
{
header = "Spawnable Enemies:";
flag = true;
flag2 = true;
}
List<string> list = new List<string>();
foreach (EnemyType allSortedEnemy in JLevelPropertyRegistry.AllSortedEnemies)
{
if ((allSortedEnemy.isOutsideEnemy || allSortedEnemy.isDaytimeEnemy) ? flag2 : flag)
{
list.Add(allSortedEnemy.enemyName.Replace(' ', '_'));
}
}
SimpleCommand.ClearChat();
return PagedList(header, list, (!parameters.IsEmpty()) ? parameters.GetNumber() : 0, 8);
}
}
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 Simple-Commands.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}