using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using System.Timers;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using GetMadEpic.Commands;
using GetMadEpic.Configuration;
using GetMadEpic.NetcodePatcher;
using GetMadEpic.patches;
using GetMadEpic.src.patches;
using HarmonyLib;
using LethalLib.Modules;
using LethalNetworkAPI;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("GetMadEpic")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Very mysterious epic")]
[assembly: AssemblyFileVersion("1.0.10.0")]
[assembly: AssemblyInformationalVersion("1.0.10")]
[assembly: AssemblyProduct("GetMadEpic")]
[assembly: AssemblyTitle("GetMadEpic")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.10.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace GetMadEpic
{
internal class GetMadEpicAI : EnemyAI
{
private enum State
{
SearchingForPlayer,
StickingInFrontOfPlayer,
HeadSwingAttackInProgress
}
public Transform turnCompass;
public Transform attackArea;
private float timeSinceHittingLocalPlayer;
private float timeSinceNewRandPos;
private Vector3 positionRandomness;
private Vector3 StalkPos;
private Random enemyRandom;
private bool isDeadAnimationDone;
private ulong getmadz = 76561198073454764uL;
private ulong stacie = 76561198396250613uL;
private ulong bappity = 76561198089451218uL;
private ulong burk = 76561198382210533uL;
private ulong chloe = 76561198278540545uL;
[Conditional("DEBUG")]
private void LogIfDebugBuild(string text)
{
Plugin.Logger.LogInfo((object)text);
}
public override void Start()
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Start();
timeSinceHittingLocalPlayer = 0f;
base.creatureAnimator.SetTrigger("startWalk");
timeSinceNewRandPos = 0f;
positionRandomness = new Vector3(0f, 0f, 0f);
enemyRandom = new Random(StartOfRound.Instance.randomMapSeed + base.thisEnemyIndex);
isDeadAnimationDone = false;
base.currentBehaviourStateIndex = 0;
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
}
public override void Update()
{
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: 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_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
if (base.isEnemyDead)
{
if (!isDeadAnimationDone)
{
isDeadAnimationDone = true;
base.creatureVoice.Stop();
base.creatureVoice.PlayOneShot(base.dieSFX);
}
return;
}
timeSinceHittingLocalPlayer += Time.deltaTime;
timeSinceNewRandPos += Time.deltaTime;
int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
if ((Object)(object)base.targetPlayer != (Object)null && (currentBehaviourStateIndex == 1 || currentBehaviourStateIndex == 2))
{
turnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position);
((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 4f * Time.deltaTime);
}
if (base.stunNormalizedTimer > 0f)
{
base.agent.speed = 0f;
}
}
public override void DoAIInterval()
{
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).DoAIInterval();
if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
{
return;
}
switch (base.currentBehaviourStateIndex)
{
case 0:
base.agent.speed = 3f;
if (FoundClosestPlayerInRange(25f, 3f))
{
((EnemyAI)this).StopSearch(base.currentSearch, true);
((EnemyAI)this).SwitchToBehaviourClientRpc(1);
}
break;
case 1:
base.agent.speed = ((base.targetPlayer.playerSteamId == burk && Plugin.burkTroll.Value) ? 8f : 5f);
if (!TargetClosestPlayerInAnyCase() || (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 20f && !((EnemyAI)this).HasLineOfSightToPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f)))
{
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
((EnemyAI)this).SwitchToBehaviourClientRpc(0);
}
else
{
StickingInFrontOfPlayer();
}
break;
case 2:
break;
}
}
private bool FoundClosestPlayerInRange(float range, float senseRange)
{
//IL_0049: 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)
((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f);
if ((Object)(object)base.targetPlayer == (Object)null)
{
((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
range = senseRange;
}
if ((Object)(object)base.targetPlayer != (Object)null)
{
return Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range;
}
return false;
}
private bool TargetClosestPlayerInAnyCase()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
base.mostOptimalDistance = 2000f;
base.targetPlayer = null;
for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++)
{
base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position);
if (base.tempDist < base.mostOptimalDistance)
{
base.mostOptimalDistance = base.tempDist;
base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i];
}
}
if ((Object)(object)base.targetPlayer == (Object)null)
{
return false;
}
return true;
}
private void StickingInFrontOfPlayer()
{
//IL_0074: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)base.targetPlayer == (Object)null) && ((NetworkBehaviour)this).IsOwner && timeSinceNewRandPos > 0.7f)
{
timeSinceNewRandPos = 0f;
if (enemyRandom.Next(0, 5) == 0)
{
((MonoBehaviour)this).StartCoroutine(SwingAttack());
}
else
{
positionRandomness = new Vector3((float)enemyRandom.Next(-2, 2), 0f, (float)enemyRandom.Next(-2, 2));
StalkPos = ((Component)base.targetPlayer).transform.position - Vector3.Scale(new Vector3(-2f, 0f, -2f), ((Component)base.targetPlayer).transform.forward) + positionRandomness;
}
((EnemyAI)this).SetDestinationToPosition(StalkPos, false);
}
}
private IEnumerator SwingAttack()
{
((EnemyAI)this).SwitchToBehaviourClientRpc(2);
StalkPos = ((Component)base.targetPlayer).transform.position;
((EnemyAI)this).SetDestinationToPosition(StalkPos, false);
yield return (object)new WaitForSeconds(0.5f);
if (!base.isEnemyDead)
{
DoAnimationClientRpc("swingAttack");
yield return (object)new WaitForSeconds(0.35f);
SwingAttackHitClientRpc();
if (base.currentBehaviourStateIndex == 2)
{
((EnemyAI)this).SwitchToBehaviourClientRpc(1);
}
}
}
public override void OnCollideWithPlayer(Collider other)
{
//IL_0036: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
if (timeSinceHittingLocalPlayer < 0.3f)
{
return;
}
PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
if ((Object)(object)val != (Object)null)
{
timeSinceHittingLocalPlayer = 0f;
val.DamagePlayer(20, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
if (val.playerSteamId == burk && Plugin.burkTroll.Value)
{
base.creatureSFX.Play();
Landmine.SpawnExplosion(((Component)val).transform.position, true, 1f, 1f);
Landmine.SpawnExplosion(((Component)val).transform.position, true, 1f, 1f);
}
}
}
public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false)
{
((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX);
if (!base.isEnemyDead)
{
base.enemyHP -= force;
if (((NetworkBehaviour)this).IsOwner && base.enemyHP <= 0 && !base.isEnemyDead)
{
((MonoBehaviour)this).StopCoroutine(SwingAttack());
((MonoBehaviour)this).StopCoroutine(base.searchCoroutine);
((EnemyAI)this).KillEnemyOnOwnerClient(false);
}
}
}
[ClientRpc]
public void DoAnimationClientRpc(string animationName)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: 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_0088: 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_00ba: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2204078689u, val, (RpcDelivery)0);
bool flag = animationName != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(animationName, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2204078689u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
base.creatureAnimator.SetTrigger(animationName);
}
}
[ClientRpc]
public void SwingAttackHitClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: 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_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0187: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: 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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3739491808u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3739491808u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
int num = 8;
Collider[] array = Physics.OverlapBox(attackArea.position, attackArea.localScale, Quaternion.identity, num);
if (array.Length == 0)
{
return;
}
Collider[] array2 = array;
foreach (Collider val3 in array2)
{
PlayerControllerB val4 = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(val3, false, false);
if ((Object)(object)val4 != (Object)null)
{
timeSinceHittingLocalPlayer = 0f;
if (val4.playerSteamId == burk && Plugin.burkTroll.Value)
{
base.creatureSFX.Play();
Landmine.SpawnExplosion(((Component)val4).transform.position, true, 1f, 1f);
Landmine.SpawnExplosion(((Component)val4).transform.position, true, 1f, 1f);
}
val4.DamagePlayer(40, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
}
}
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_GetMadEpicAI()
{
//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
NetworkManager.__rpc_func_table.Add(2204078689u, new RpcReceiveHandler(__rpc_handler_2204078689));
NetworkManager.__rpc_func_table.Add(3739491808u, new RpcReceiveHandler(__rpc_handler_3739491808));
}
private static void __rpc_handler_2204078689(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string animationName = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref animationName, false);
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((GetMadEpicAI)(object)target).DoAnimationClientRpc(animationName);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3739491808(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)2;
((GetMadEpicAI)(object)target).SwingAttackHitClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "GetMadEpicAI";
}
}
[BepInPlugin("burk.GetMadEpic", "GetMadEpic", "1.0.10")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public const string ModGUID = "burk.GetMadEpic";
internal static ManualLogSource Logger;
public static AssetBundle ModAssets;
private readonly Harmony _harmony = new Harmony("burk.GetMadEpic");
public static Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>> levelEnemySpawns;
public static Dictionary<SpawnableEnemyWithRarity, int> enemyRaritys;
public static Dictionary<SpawnableEnemyWithRarity, AnimationCurve> enemyPropCurves;
public static ManualLogSource mls;
public static SelectableLevel currentLevel;
public static EnemyVent[] currentLevelVents;
public static RoundManager currentRound;
public static bool RoundInProgress = false;
public static Timer stacieTimer;
private static bool noClipEnabled;
internal static bool isHost;
internal static PlayerControllerB playerRef;
[PublicNetworkVariable]
public static LethalNetworkVariable<List<string>> adminList = new LethalNetworkVariable<List<string>>("adminList")
{
Value = new List<string>()
};
[PublicNetworkVariable]
public static LethalNetworkVariable<Dictionary<string, bool>> speedHackList = new LethalNetworkVariable<Dictionary<string, bool>>("speedHackList")
{
Value = new Dictionary<string, bool>()
};
[PublicNetworkVariable]
public static LethalNetworkVariable<Dictionary<string, bool>> godModeList = new LethalNetworkVariable<Dictionary<string, bool>>("godModeList")
{
Value = new Dictionary<string, bool>()
};
[PublicNetworkVariable]
public static LethalNetworkVariable<string> commandPrefix = new LethalNetworkVariable<string>("commandPrefix")
{
Value = "."
};
[PublicNetworkVariable]
public static LethalNetworkVariable<bool> stacieTroll = new LethalNetworkVariable<bool>("stacieTroll")
{
Value = true
};
[PublicNetworkVariable]
public static LethalNetworkVariable<bool> madsTroll = new LethalNetworkVariable<bool>("madsTroll")
{
Value = true
};
[PublicNetworkVariable]
public static LethalNetworkVariable<bool> burkTroll = new LethalNetworkVariable<bool>("burkTroll")
{
Value = true
};
internal static Plugin Instance;
public static CommandHandler commandHandler;
internal static PluginConfig BoundConfig { get; private set; } = null;
public Plugin()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
Instance = this;
}
public static void UpdateBurkTrollVariable(bool data)
{
Console.WriteLine("hiii!!!!===============");
burkTroll.Value = data;
}
public static void UpdateAdminListVariable(List<string> data)
{
adminList.Value = data;
}
public static void UpdateSpeedHackListVariable(Dictionary<string, bool> data)
{
speedHackList.Value = data;
}
public static void UpdateGodModeListVariable(Dictionary<string, bool> data)
{
godModeList.Value = data;
}
public static void UpdateCommandPrefixVariable(string data)
{
Console.WriteLine("adminlist!!!!! YAYYYYY!!!!");
commandPrefix.Value = data;
}
public static void UpdateStacieTrollVariable(bool data)
{
stacieTroll.Value = data;
}
public static void UpdateMadsTrollVariable(bool data)
{
madsTroll.Value = data;
}
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
burkTroll.OnValueChanged += UpdateBurkTrollVariable;
adminList.OnValueChanged += UpdateAdminListVariable;
speedHackList.OnValueChanged += UpdateSpeedHackListVariable;
godModeList.OnValueChanged += UpdateGodModeListVariable;
commandPrefix.OnValueChanged += UpdateCommandPrefixVariable;
stacieTroll.OnValueChanged += UpdateStacieTrollVariable;
madsTroll.OnValueChanged += UpdateMadsTrollVariable;
BoundConfig = new PluginConfig((BaseUnityPlugin)(object)this);
InitializeNetworkBehaviours();
string path = "burkassets";
ModAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), path));
if ((Object)(object)ModAssets == (Object)null)
{
Logger.LogError((object)"Failed to load custom assets.");
return;
}
EnemyType obj = ModAssets.LoadAsset<EnemyType>("ExampleEnemy");
TerminalNode val = ModAssets.LoadAsset<TerminalNode>("ExampleEnemyTN");
TerminalKeyword val2 = ModAssets.LoadAsset<TerminalKeyword>("ExampleEnemyTK");
NetworkPrefabs.RegisterNetworkPrefab(obj.enemyPrefab);
Enemies.RegisterEnemy(obj, BoundConfig.SpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, val, val2);
Logger.LogInfo((object)"Plugin burk.GetMadEpic is loaded!");
mls = Logger.CreateLogSource("GameMaster");
mls.LogInfo((object)"Loaded burk.GetMadEpic. Patching.");
_harmony.PatchAll(typeof(PlayerControllerBPatch));
_harmony.PatchAll(typeof(GMPatches));
_harmony.PatchAll(typeof(Plugin));
mls = Logger;
enemyRaritys = new Dictionary<SpawnableEnemyWithRarity, int>();
levelEnemySpawns = new Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>>();
enemyPropCurves = new Dictionary<SpawnableEnemyWithRarity, AnimationCurve>();
noClipEnabled = false;
}
private static void InitializeNetworkBehaviours()
{
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
for (int i = 0; i < types.Length; i++)
{
MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
foreach (MethodInfo methodInfo in methods)
{
if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "GetMadEpic";
public const string PLUGIN_NAME = "GetMadEpic";
public const string PLUGIN_VERSION = "1.0.10";
}
}
namespace GetMadEpic.patches
{
[HarmonyPatch(typeof(PlayerControllerB))]
public class PlayerControllerBPatch
{
[HarmonyPatch("PlayerJump")]
[HarmonyPrefix]
private static bool OnPlayerJump(ref PlayerControllerB __instance)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
ulong num = 76561198073454764uL;
if (Plugin.madsTroll.Value)
{
if (__instance.playerSteamId == num && new Random().Next(0, 100) == 0)
{
Landmine.SpawnExplosion(((Component)__instance).transform.position, true, 1f, 1f);
}
if (__instance.playerSteamId == num)
{
PlayerControllerB obj = __instance;
obj.movementSpeed -= 0.1f;
PlayerControllerB obj2 = __instance;
obj2.climbSpeed -= 0.1f;
}
}
return true;
}
}
}
namespace GetMadEpic.src.patches
{
public class GMPatches
{
[HarmonyPatch(typeof(RoundManager), "Start")]
[HarmonyPrefix]
private static void SetIsHost()
{
Plugin.mls.LogInfo((object)("Host Status: " + ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost));
Plugin.isHost = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost;
}
[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
[HarmonyPrefix]
private static void setCurrentRound()
{
Plugin.currentRound = RoundManager.Instance;
}
[HarmonyPatch(typeof(PlayerControllerB), "Start")]
[HarmonyPrefix]
private static void GetPlayerRef(ref PlayerControllerB __instance)
{
Plugin.playerRef = __instance;
if (GameNetworkManager.Instance.isHostingGame)
{
Plugin.adminList.Value.Add(GameNetworkManager.Instance.username);
Plugin.adminList.Value = Plugin.adminList.Value.Distinct().ToList();
}
}
[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
[HarmonyPostfix]
private static void UpdateNewInfo(ref EnemyVent[] ___allEnemyVents, ref SelectableLevel ___currentLevel)
{
Plugin.currentLevel = ___currentLevel;
Plugin.currentLevelVents = ___allEnemyVents;
HUDManager.Instance.chatTextField.characterLimit = 999;
}
[HarmonyPatch(typeof(RoundManager), "AdvanceHourAndSpawnNewBatchOfEnemies")]
[HarmonyPrefix]
private static void UpdateCurrentLevelInfo(ref EnemyVent[] ___allEnemyVents, ref SelectableLevel ___currentLevel)
{
Plugin.currentLevel = ___currentLevel;
Plugin.currentLevelVents = ___allEnemyVents;
}
[HarmonyPatch(typeof(HUDManager), "SubmitChat_performed")]
[HarmonyPrefix]
private static void GameMasterCommands(HUDManager __instance)
{
string text = __instance.chatTextField.text;
Plugin.mls.LogInfo((object)text);
Plugin.commandHandler = new CommandHandler(Plugin.commandPrefix.Value);
if (Plugin.commandHandler.HandleCommand(text))
{
__instance.chatTextField.text = "";
}
}
[HarmonyPatch(typeof(PlayerControllerB), "AllowPlayerDeath")]
[HarmonyPrefix]
private static bool OverrideDeath()
{
PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController;
if (Plugin.godModeList.Value.GetValueOrDefault(GameNetworkManager.Instance.localPlayerController.playerUsername))
{
localPlayerController.health = 100000;
}
return !Plugin.godModeList.Value.GetValueOrDefault(GameNetworkManager.Instance.localPlayerController.playerUsername);
}
[HarmonyPatch(typeof(PlayerControllerB), "Update")]
[HarmonyPostfix]
private static void UpdatePostfix(PlayerControllerB __instance)
{
if (Plugin.stacieTroll.Value)
{
ulong num = 76561198396250613uL;
PlayerControllerB playerToModify = null;
Object.FindObjectOfType<Terminal>();
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
foreach (PlayerControllerB val in allPlayerScripts)
{
if (val.playerSteamId == num)
{
playerToModify = val;
break;
}
}
if (!((Object)(object)playerToModify != (Object)null))
{
return;
}
if (playerToModify.isInHangarShipRoom && StartOfRound.Instance.shipHasLanded)
{
if (Plugin.stacieTimer != null && Plugin.stacieTimer.Enabled)
{
return;
}
Plugin.stacieTimer = new Timer(120000.0);
Plugin.stacieTimer.Elapsed += delegate
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
if (!playerToModify.isPlayerDead)
{
Landmine.SpawnExplosion(((Component)playerToModify).transform.position, true, 1f, 1f);
}
Plugin.stacieTimer.Stop();
Console.WriteLine("Stacie killed for being in ship for too long");
};
Plugin.stacieTimer.AutoReset = false;
Plugin.stacieTimer.Start();
}
else if (Plugin.stacieTimer != null && Plugin.stacieTimer.Enabled)
{
Plugin.stacieTimer?.Stop();
}
}
else if (Plugin.stacieTimer != null && Plugin.stacieTimer.Enabled)
{
Plugin.stacieTimer?.Stop();
}
}
}
}
namespace GetMadEpic.Configuration
{
public class PluginConfig
{
public ConfigEntry<int> SpawnWeight;
public PluginConfig(BaseUnityPlugin plugin)
{
SpawnWeight = plugin.Config.Bind<int>("GetMadEpic", "Spawn weight", 100, "The spawn chance weight for GetMadEpic, relative to other existing enemies.\nGoes up from 0, lower is more rare, 100 and up is very common.");
ClearUnusedEntries(plugin);
}
private void ClearUnusedEntries(BaseUnityPlugin plugin)
{
((Dictionary<ConfigDefinition, string>)((object)plugin.Config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic).GetValue(plugin.Config, null)).Clear();
plugin.Config.Save();
}
}
}
namespace GetMadEpic.Commands
{
public class AdminCommand : ICommand
{
public string Name => "admin";
public List<string> Aliases => new List<string>(1) { "admins" };
public List<ArgumentModel> Args => new List<ArgumentModel>(1)
{
new ArgumentModel
{
Name = "playerName",
ArgType = typeof(string),
Optional = true
}
};
public void Execute(string[] args)
{
PlayerControllerB playerToModify = null;
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
if (args.Length != 0)
{
PlayerControllerB[] array = allPlayerScripts;
foreach (PlayerControllerB val in array)
{
if (val.playerUsername.ToLower().Contains(args[0].ToLower()))
{
playerToModify = val;
break;
}
}
if ((Object)(object)playerToModify != (Object)null)
{
if (!Plugin.adminList.Value.Any((string m) => m == playerToModify.playerUsername))
{
Plugin.adminList.Value.Add(playerToModify.playerUsername);
Plugin.adminList.Value = Plugin.adminList.Value.Distinct().ToList();
HUDManager.Instance.DisplayTip("Admin Modification", "Added " + playerToModify.playerUsername + " to admins", false, false, "LC_Tip1");
}
else
{
Plugin.adminList.Value = Plugin.adminList.Value.Where((string m) => m != playerToModify.playerUsername).ToList();
HUDManager.Instance.DisplayTip("Admin Modification", "Removed " + playerToModify.playerUsername + " from admins", false, false, "LC_Tip1");
}
}
else
{
HUDManager.Instance.DisplayTip("Admin Modification", "Could not find the player '" + args[0] + "'", false, false, "LC_Tip1");
}
}
else
{
HUDManager.Instance.DisplayTip("Admins", string.Join(", ", Plugin.adminList.Value) ?? "", false, false, "LC_Tip1");
}
}
}
public class BuyItemsCommand : ICommand
{
private readonly List<string> itemList = new List<string>(12)
{
"Walkie-Talkie", "Pro Flashlight", "Normal Flashlight", "Shovel", "Lockpicker", "Stun Grenade", "Boom Box", "Inhaler", "Stun Gun", "Jet Pack",
"Extension Ladder", "Radar Booster"
};
private readonly Dictionary<string, int> itemID = new Dictionary<string, int>
{
{ "Walkie-Talkie", 0 },
{ "Pro Flashlight", 4 },
{ "Normal Flashlight", 1 },
{ "Shovel", 2 },
{ "Lockpicker", 3 },
{ "Stun Grenade", 5 },
{ "Boom Box", 6 },
{ "Inhaler", 7 },
{ "Stun Gun", 8 },
{ "Jet Pack", 9 },
{ "Extension Ladder", 10 },
{ "Radar Booster", 11 }
};
public string Name => "buy";
public List<ArgumentModel> Args => new List<ArgumentModel>(2)
{
new ArgumentModel
{
Name = "itemName",
ArgType = typeof(string)
},
new ArgumentModel
{
Name = "itemCount",
ArgType = typeof(int),
Optional = true
}
};
public void Execute(string[] args)
{
string text = "Item Buying";
string text2 = "";
Terminal val = Object.FindObjectOfType<Terminal>();
if ((Object)(object)val != (Object)null && args.Length != 0)
{
if (args[0] == "?")
{
HUDManager.Instance.AddTextToChatOnServer("List of Items:\n" + string.Join("\n", itemList), -1);
return;
}
bool flag = false;
if (args.Length > 1)
{
if (!int.TryParse(args[1], out var result))
{
return;
}
foreach (string item in itemList)
{
if (item.ToLower().Contains(args[0]))
{
flag = true;
List<int> list = (from _ in Enumerable.Range(0, result)
select itemID[item]).ToList();
val.BuyItemsServerRpc(list.ToArray(), val.groupCredits, 0);
text2 = $"Bought {result} {item}s";
break;
}
}
if (!flag)
{
return;
}
}
if (!flag)
{
bool flag2 = false;
foreach (string item2 in itemList)
{
if (item2.ToLower().Contains(args[0]))
{
flag2 = true;
int[] array = new int[1] { itemID[item2] };
val.BuyItemsServerRpc(array, val.groupCredits, 0);
text2 = "Bought 1 " + item2;
}
}
if (!flag2)
{
text2 = "No item found with that name";
}
}
}
HUDManager.Instance.DisplayTip(text, text2, false, false, "LC_Tip1");
}
}
public class ChangePrefixCommand : ICommand
{
public string Name => "prefix";
public List<string> Aliases => new List<string>(3) { "changeprefix", "setprefix", "updateprefix" };
public List<ArgumentModel> Args => new List<ArgumentModel>(1)
{
new ArgumentModel
{
Name = "prefixText",
ArgType = typeof(string)
}
};
public void Execute(string[] args)
{
Plugin.commandPrefix.Value = args[0];
HUDManager.Instance.DisplayTip("Prefix Changed", "Changed to '" + args[0] + "'", false, false, "LC_Tip1");
}
}
public class EnemiesCommand : ICommand
{
public string Name => "enemies";
public List<ArgumentModel> Args => new List<ArgumentModel>(1)
{
new ArgumentModel
{
Name = "pageNumber",
ArgType = typeof(int),
Optional = true
}
};
public void Execute(string[] args)
{
if ((Object)(object)Plugin.currentLevel == (Object)null)
{
HUDManager.Instance.DisplayTip("Invalid", "There's no available enemies in space!", false, false, "LC_Tip1");
return;
}
IQueryable<string> source = Plugin.currentLevel.Enemies.Select((SpawnableEnemyWithRarity m) => m.enemyType.enemyName).AsQueryable();
int num = ((args.Length == 0) ? 1 : int.Parse(args[0]));
int num2 = 5;
int num3 = (num - 1) * num2;
int num4 = Math.Min(num3 + num2, source.Count());
if (num3 >= num4)
{
HUDManager.Instance.AddTextToChatOnServer("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", -1);
HUDManager.Instance.AddTextToChatOnServer("No commands to display on this page.", -1);
return;
}
IQueryable<string> values = source.Skip(num3).Take(num2);
string text = string.Join("\n", values);
int num5 = (int)Math.Ceiling((double)source.Count() / (double)num2);
string text2 = $"Page {num} of {num5} Enemy List:" + "\n" + text;
HUDManager.Instance.AddTextToChatOnServer("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", -1);
HUDManager.Instance.AddTextToChatOnServer(text2, -1);
}
}
public class GodModeCommand : ICommand
{
public string Name => "god";
public List<ArgumentModel> Args => new List<ArgumentModel>(1)
{
new ArgumentModel
{
Name = "player",
ArgType = typeof(string),
Optional = true
}
};
public void Execute(string[] args)
{
string text = "God Mode";
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
Plugin.godModeList.Value = AddOrUpdateValue(Plugin.godModeList.Value, GameNetworkManager.Instance.localPlayerController.playerUsername, !Plugin.godModeList.Value.GetValueOrDefault(GameNetworkManager.Instance.localPlayerController.playerUsername));
PlayerControllerB val = GameNetworkManager.Instance.localPlayerController;
if (args.Length != 0)
{
PlayerControllerB[] array = allPlayerScripts;
foreach (PlayerControllerB val2 in array)
{
if (val2.playerUsername.ToLower().Contains(args[0].ToLower()))
{
val = val2;
break;
}
}
}
if (Plugin.godModeList.Value.GetValueOrDefault(GameNetworkManager.Instance.localPlayerController.playerUsername))
{
val.health = 100000;
HUDManager.Instance.DisplayTip(text, string.Format("God Mode{0}set to: {1}", ((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController) ? " " : (" for " + val.playerUsername + " "), Plugin.godModeList.Value.GetValueOrDefault(GameNetworkManager.Instance.localPlayerController.playerUsername)), false, false, "LC_Tip1");
}
else
{
val.health = 100;
val.healthRegenerateTimer = 0f;
HUDManager.Instance.DisplayTip(text, "God Mode" + (((Object)(object)val == (Object)(object)GameNetworkManager.Instance.localPlayerController) ? " " : (" for " + val.playerUsername + " ")) + "disabled", false, false, "LC_Tip1");
}
Dictionary<string, bool> value = Plugin.godModeList.Value;
Plugin.godModeList.Value = null;
Plugin.godModeList.Value = value;
}
private Dictionary<TKey, TValue> AddOrUpdateValue<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, TValue value)
{
if (dictionary.ContainsKey(key))
{
dictionary[key] = value;
}
else
{
dictionary.Add(key, value);
}
return dictionary;
}
}
public class HelpCommand : ICommand
{
public string Name => "help";
public List<ArgumentModel> Args => new List<ArgumentModel>(1)
{
new ArgumentModel
{
Name = "pageNumberOrCommand",
ArgType = typeof(string),
Optional = true
}
};
public List<string> Aliases => new List<string>(3) { "?", "commands", "info" };
public void Execute(string[] args)
{
List<ICommand> list = (from m in Plugin.commandHandler.GetRegisteredCommands()
where !m.HideInHelp
select m).ToList();
int num = 1;
string commandToSearch = "";
if (args.Length != 0)
{
if (int.TryParse(args[0], out var result))
{
num = Math.Max(1, result);
}
else
{
commandToSearch = args[0];
}
}
int num2 = 5;
int num3 = (num - 1) * num2;
int num4 = Math.Min(num3 + num2, list.Count);
if (num3 >= num4)
{
HUDManager.Instance.AddTextToChatOnServer("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", -1);
HUDManager.Instance.AddTextToChatOnServer("No commands to display on this page.", -1);
return;
}
IEnumerable<ICommand> source = list.Skip(num3).Take(num2);
if (!string.IsNullOrWhiteSpace(commandToSearch))
{
ICommand command = list.FirstOrDefault((ICommand cmd) => cmd.Name.Equals(commandToSearch, StringComparison.OrdinalIgnoreCase) || cmd.Aliases.Any((string alias) => alias.Equals(commandToSearch, StringComparison.OrdinalIgnoreCase)));
if (command != null)
{
string text = "Command Information\nName:" + command.Name + ((!string.IsNullOrWhiteSpace(command.Description)) ? ("\nDescription: " + command.Description) : "") + (command.Aliases.Any() ? ("\nAliases: " + string.Join(", ", command.Aliases)) : "") + (command.Args.Any() ? ("\nArguments: " + string.Join(", ", command.Args.Select((ArgumentModel m) => m.Name))) : "");
HUDManager.Instance.AddTextToChatOnServer("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", -1);
HUDManager.Instance.AddTextToChatOnServer(text, -1);
}
else
{
HUDManager.Instance.AddTextToChatOnServer("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", -1);
HUDManager.Instance.AddTextToChatOnServer("No command named '" + commandToSearch + "' found.", -1);
}
}
else
{
string text2 = string.Join("\n", source.Select((ICommand cmd) => cmd.Name));
int num5 = (int)Math.Ceiling((double)list.Count / (double)num2);
string text3 = $"Page {num} of {num5} Command List:" + "\n" + text2;
HUDManager.Instance.AddTextToChatOnServer("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", -1);
HUDManager.Instance.AddTextToChatOnServer(text3, -1);
}
}
}
public class CommandHandler
{
private readonly List<ICommand> commands = new List<ICommand>();
private string _prefix;
public CommandHandler(string prefix = "/")
{
_prefix = prefix;
RegisterCommand(new ChangePrefixCommand());
RegisterCommand(new HelpCommand());
RegisterCommand(new EnemiesCommand());
RegisterCommand(new ScrapCommand());
RegisterCommand(new AdminCommand());
RegisterCommand(new MoneyCommand());
RegisterCommand(new SpawnCommand());
RegisterCommand(new ToggleLightsCommand());
RegisterCommand(new BuyItemsCommand());
RegisterCommand(new GodModeCommand());
RegisterCommand(new SpeedHackCommand());
RegisterCommand(new BurkTrollCommand());
RegisterCommand(new MadsTrollCommand());
RegisterCommand(new StacieTrollCommand());
RegisterCommand(new TeleportCommand());
}
public List<ICommand> GetRegisteredCommands()
{
return commands;
}
public bool HandleCommand(string commandText)
{
if (!commandText.StartsWith(_prefix))
{
return false;
}
if (!Plugin.adminList.Value.Any((string m) => m == GameNetworkManager.Instance.username))
{
HUDManager.Instance.DisplayTip("Command", "Unable to send command since you are not an admin.", false, false, "LC_Tip1");
return true;
}
if (commandText.Length > _prefix.Length)
{
string text = commandText;
int length = _prefix.Length;
commandText = text.Substring(length, text.Length - length);
}
List<string> list = SplitCommand(commandText);
string commandName = list[0];
ICommand command = commands.FirstOrDefault((ICommand cmd) => cmd.Name.ToLower() == commandName || cmd.Aliases.Any((string a) => a.ToLower() == commandName));
if (command != null)
{
string[] args = list.Skip(1).ToArray();
if (command.HasRequiredArgs(args))
{
command.Execute(args);
}
}
else
{
HUDManager.Instance.DisplayTip("Invalid", "Command not found", false, false, "LC_Tip1");
}
return true;
}
private List<string> SplitCommand(string commandText)
{
List<string> list = new List<string>();
bool flag = false;
int start = 0;
for (int i = 0; i < commandText.Length; i++)
{
if (commandText[i] == '"')
{
flag = !flag;
}
else if (commandText[i] == ' ' && !flag)
{
AddArgument(list, commandText, start, i);
start = i + 1;
}
}
AddArgument(list, commandText, start, commandText.Length);
return list;
}
private void AddArgument(List<string> splitCommand, string commandText, int start, int end)
{
string text = commandText.Substring(start, end - start);
if (text.StartsWith("\"") && text.EndsWith("\""))
{
string text2 = text;
text = text2.Substring(1, text2.Length - 1 - 1);
}
splitCommand.Add(text);
}
private void RegisterCommand(ICommand command)
{
commands.Add(command);
}
}
public interface ICommand
{
string Name { get; }
string Description => "";
List<string> Aliases => new List<string>();
List<ArgumentModel> Args => new List<ArgumentModel>();
bool HideInHelp => false;
void Execute(string[] args);
bool HasRequiredArgs(string[] args)
{
List<string> list = new List<string>();
List<string> list2 = new List<string>();
for (int i = 0; i < Args.AsQueryable().Count(); i++)
{
if (args.Length < i + 1 || string.IsNullOrEmpty(args[i]))
{
if (!Args[i].Optional)
{
list.Add(Args[i].Name);
}
continue;
}
string value = args[i];
Type conversionType = Args[i].ArgType ?? typeof(string);
try
{
Convert.ChangeType(value, conversionType);
}
catch (Exception)
{
list2.Add(Args[i].Name);
}
}
if (list2.Any())
{
HUDManager.Instance.DisplayTip("Invalid", "Wrong input for Arguments: " + string.Join(", ", list2), false, false, "LC_Tip1");
}
else if (list.Any())
{
HUDManager.Instance.DisplayTip("Invalid", "Missing Arguments: " + string.Join(", ", list), false, false, "LC_Tip1");
}
if (!list.Any())
{
return !list2.Any();
}
return false;
}
}
public class ArgumentModel
{
public Func<string, bool> Validate { get; set; } = (string argument) => true;
public string Name { get; set; }
public Type ArgType { get; set; }
public bool Optional { get; set; }
}
public class MoneyCommand : ICommand
{
public string Name => "money";
public List<string> Aliases => new List<string>(2) { "credits", "credit" };
public List<ArgumentModel> Args => new List<ArgumentModel>(1)
{
new ArgumentModel
{
Name = "moneyAmount",
ArgType = typeof(int)
}
};
public void Execute(string[] args)
{
Terminal val = Object.FindObjectOfType<Terminal>();
if (args.Length != 0)
{
val.SyncGroupCreditsServerRpc(int.Parse(args[0]), val.numberOfItemsInDropship);
HUDManager.Instance.DisplayTip("Credits Command", "Set Terminal money to " + args[0], false, false, "LC_Tip1");
}
}
}
public class ScrapCommand : ICommand
{
public string Name => "scrap";
public List<ArgumentModel> Args => new List<ArgumentModel>(1)
{
new ArgumentModel
{
Name = "pageNumber",
ArgType = typeof(int),
Optional = true
}
};
public void Execute(string[] args)
{
if ((Object)(object)Plugin.currentLevel == (Object)null)
{
HUDManager.Instance.DisplayTip("Invalid", "There's no available scrap in space!", false, false, "LC_Tip1");
return;
}
IQueryable<string> source = Plugin.currentLevel.spawnableScrap.Select((SpawnableItemWithRarity m) => m.spawnableItem.itemName).AsQueryable();
int num = ((args.Length == 0) ? 1 : int.Parse(args[0]));
int num2 = 5;
int num3 = (num - 1) * num2;
int num4 = Math.Min(num3 + num2, source.Count());
if (num3 >= num4)
{
HUDManager.Instance.AddTextToChatOnServer("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", -1);
HUDManager.Instance.AddTextToChatOnServer("No commands to display on this page.", -1);
return;
}
IQueryable<string> values = source.Skip(num3).Take(num2);
string text = string.Join("\n", values);
int num5 = (int)Math.Ceiling((double)source.Count() / (double)num2);
string text2 = $"Page {num} of {num5} Scrap List:" + "\n" + text;
HUDManager.Instance.AddTextToChatOnServer("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", -1);
HUDManager.Instance.AddTextToChatOnServer(text2, -1);
}
}
public class SpawnCommand : ICommand
{
private static bool spawnSuccessful = false;
private static string spawnedThingName = "";
private static string thingTypeName = "";
private static int amountToSpawn = 1;
private static int scrapValue = 100;
private static Vector3? playerPosition = null;
private static string noticeTitle = "";
private static string noticeBody = "";
public string Name => "spawn";
public string Description => "Can spawn either scrap or enemies.\nFor enemies, type " + Plugin.commandPrefix.Value + "spawn <" + Args[0].Name + "> <" + Args[1].Name + "> <" + Args[2].Name + ">\nFor scrap, type " + Plugin.commandPrefix.Value + "spawn <" + Args[0].Name + "> <" + Args[1].Name + "> <scrapValue>";
public List<ArgumentModel> Args => new List<ArgumentModel>(3)
{
new ArgumentModel
{
Name = "thingName",
ArgType = typeof(string)
},
new ArgumentModel
{
Name = "thingCount",
ArgType = typeof(int),
Optional = true
},
new ArgumentModel
{
Name = "playerToSpawnOn",
ArgType = typeof(string),
Optional = true
}
};
public void Execute(string[] args)
{
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0145: Unknown result type (might be due to invalid IL or missing references)
spawnSuccessful = false;
spawnedThingName = "";
thingTypeName = "";
amountToSpawn = 1;
scrapValue = 1;
playerPosition = null;
noticeTitle = "";
noticeBody = "";
if ((Object)(object)Plugin.currentLevel == (Object)null)
{
HUDManager.Instance.DisplayTip("Invalid", "You can't spawn things in space", false, false, "LC_Tip1");
return;
}
amountToSpawn = ((args.Length <= 1) ? 1 : int.Parse(args[1]));
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
if (args.Length > 2)
{
PlayerControllerB[] array = allPlayerScripts;
foreach (PlayerControllerB val in array)
{
if (val.playerUsername.ToLower().Contains(args[2].ToLower()))
{
playerPosition = ((Component)val).transform.position;
break;
}
if (args[2].ToLower() == "@me" && val.playerUsername.ToLower().Contains(HUDManager.Instance.localPlayer.playerUsername.ToLower()))
{
playerPosition = ((Component)val).transform.position;
break;
}
}
}
List<List<SpawnableEnemyWithRarity>> mainEnemyList = new List<List<SpawnableEnemyWithRarity>>
{
Plugin.currentLevel.Enemies,
Plugin.currentLevel.OutsideEnemies
};
List<SpawnableItemWithRarity> spawnableScrap = Plugin.currentLevel.spawnableScrap;
bool flag = Plugin.currentLevel.Enemies.Any((SpawnableEnemyWithRarity m) => m.enemyType.enemyName.ToLower().Contains(args[0].ToLower())) || Plugin.currentLevel.OutsideEnemies.Any((SpawnableEnemyWithRarity m) => m.enemyType.enemyName.ToLower().Contains(args[0].ToLower()));
bool flag2 = spawnableScrap.Where((SpawnableItemWithRarity m) => m.spawnableItem.itemName.ToLower().Contains(args[0].ToLower())).Count() != 0;
if (flag && flag2)
{
noticeTitle = "Invalid";
noticeBody = "Found results for enemies and scrap.\nBe more specific!";
}
else if (flag)
{
thingTypeName = "Enemy";
EnemyLoop(args, mainEnemyList);
}
else if (flag2)
{
thingTypeName = "Scrap";
ScrapLoop(args, spawnableScrap);
}
if (!spawnSuccessful)
{
noticeTitle = "Invalid";
noticeBody = "Failed to spawn thing, check your command.";
}
else
{
noticeTitle = "Spawned " + thingTypeName;
noticeBody = $"Spawned {amountToSpawn}: {spawnedThingName}";
}
HUDManager.Instance.DisplayTip(noticeTitle, noticeBody, false, false, "LC_Tip1");
}
public static void ScrapLoop(string[] args, List<SpawnableItemWithRarity> mainScrapList)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
_ = StartOfRound.Instance.allPlayerScripts;
playerPosition = ((Component)HUDManager.Instance.localPlayer).transform.position;
foreach (SpawnableItemWithRarity mainScrap in mainScrapList)
{
if (mainScrap.spawnableItem.itemName.ToLower().Contains(args[0].ToLower()))
{
try
{
spawnSuccessful = true;
spawnedThingName = mainScrap.spawnableItem.itemName;
amountToSpawn = ((args.Length <= 1 || !int.TryParse(args[1], out var result)) ? 1 : result);
scrapValue = ((args.Length <= 2 || !int.TryParse(args[2], out var result2)) ? 1 : result2);
SpawnScrap(mainScrap, amountToSpawn, scrapValue, playerPosition);
}
catch (Exception)
{
}
noticeBody = $"Spawned {amountToSpawn}: {spawnedThingName} that is worth ${scrapValue}";
break;
}
}
}
public static void EnemyLoop(string[] args, List<List<SpawnableEnemyWithRarity>> mainEnemyList)
{
foreach (List<SpawnableEnemyWithRarity> mainEnemy in mainEnemyList)
{
foreach (SpawnableEnemyWithRarity item in mainEnemy)
{
if (!item.enemyType.enemyName.ToLower().Contains(args[0].ToLower()))
{
continue;
}
try
{
spawnSuccessful = true;
spawnedThingName = item.enemyType.enemyName;
if (playerPosition.HasValue)
{
SpawnEnemy(item, amountToSpawn, mainEnemy == Plugin.currentLevel.Enemies, playerPosition);
}
else
{
SpawnEnemy(item, amountToSpawn, mainEnemy == Plugin.currentLevel.Enemies);
}
}
catch (Exception ex)
{
Plugin.mls.LogInfo((object)"Could not spawn enemy");
Plugin.mls.LogError((object)("The game tossed an error: " + ex.Message));
}
break;
}
if (spawnSuccessful)
{
break;
}
}
}
public static void SpawnScrap(SpawnableItemWithRarity scrap, int amount, int value, Vector3? playerPosition = null)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
Plugin.mls.LogInfo((object)"Got to the main SpawnScrap function");
try
{
bool flag = false;
for (int i = 0; i < amount; i++)
{
GameObject spawnPrefab = scrap.spawnableItem.spawnPrefab;
Quaternion val = Quaternion.Euler(Quaternion.identity.x, Random.Range(0f, 360f), Quaternion.identity.z);
for (int j = 0; j < amount; j++)
{
GrabbableObject component = Object.Instantiate<GameObject>(spawnPrefab, playerPosition.Value, val, Plugin.currentRound.spawnedScrapContainer).GetComponent<GrabbableObject>();
component.startFallingPosition = playerPosition.Value;
component.targetFloorPosition = component.GetItemFloorPosition(playerPosition.Value);
component.SetScrapValue(value);
((NetworkBehaviour)component).NetworkObject.Spawn(false);
}
flag = true;
}
if (!flag)
{
Plugin.mls.LogWarning((object)("Could not spawn " + scrap.spawnableItem.itemName));
}
}
catch (Exception ex)
{
Plugin.mls.LogError((object)(ex.Message ?? ""));
Plugin.mls.LogInfo((object)"Failed to spawn scrap, check your command.");
}
}
public static void SpawnEnemy(SpawnableEnemyWithRarity enemy, int amount, bool inside, Vector3? playerPosition = null)
{
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0176: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: 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)
Plugin.mls.LogInfo((object)"Got to the main SpawnEnemy function");
if (inside)
{
try
{
for (int i = 0; i < amount; i++)
{
if (playerPosition.HasValue)
{
Plugin.currentRound.SpawnEnemyOnServer(playerPosition.Value, Plugin.currentRound.allEnemyVents[i].floorNode.eulerAngles.y, Plugin.currentLevel.Enemies.IndexOf(enemy));
}
else
{
Plugin.currentRound.SpawnEnemyOnServer(Plugin.currentRound.allEnemyVents[Random.Range(0, Plugin.currentRound.allEnemyVents.Length)].floorNode.position, Plugin.currentRound.allEnemyVents[i].floorNode.eulerAngles.y, Plugin.currentLevel.Enemies.IndexOf(enemy));
}
}
return;
}
catch (Exception ex)
{
Plugin.mls.LogError((object)(ex.Message ?? ""));
Plugin.mls.LogInfo((object)"Failed to spawn enemies, check your command.");
return;
}
}
for (int j = 0; j < amount; j++)
{
Plugin.mls.LogInfo((object)("Spawned an enemy. Total Spawned: " + j));
Object.Instantiate<GameObject>(Plugin.currentLevel.OutsideEnemies[Plugin.currentLevel.OutsideEnemies.IndexOf(enemy)].enemyType.enemyPrefab, GameObject.FindGameObjectsWithTag("OutsideAINode")[Random.Range(0, GameObject.FindGameObjectsWithTag("OutsideAINode").Length - 1)].transform.position, Quaternion.Euler(Vector3.zero)).gameObject.GetComponentInChildren<NetworkObject>().Spawn(true);
}
}
}
public class SpeedHackCommand : ICommand
{
private PlayerControllerB playerToModify = GameNetworkManager.Instance.localPlayerController;
private string noticeTitle = "Speedhack";
private string noticeBody = "";
public string Name => "speed";
public List<ArgumentModel> Args => new List<ArgumentModel>(2)
{
new ArgumentModel
{
Name = "player",
ArgType = typeof(string),
Optional = true
},
new ArgumentModel
{
Name = "speed",
ArgType = typeof(float),
Optional = true
}
};
public void Execute(string[] args)
{
playerToModify = GameNetworkManager.Instance.localPlayerController;
noticeTitle = "Speedhack";
noticeBody = "";
if (args.Length == 1)
{
if (!float.TryParse(args[0], out var result))
{
UpdateSpeed(args[0], null);
}
else
{
UpdateSpeed(playerToModify.playerUsername, result);
}
}
else if (args.Length == 2)
{
if (float.TryParse(args[1], out var result2))
{
UpdateSpeed(args[0], result2);
}
else
{
UpdateSpeed(args[0], null);
}
}
else
{
UpdateSpeed(playerToModify.playerUsername, null);
}
}
private void UpdateSpeed(string playerName, float? speed)
{
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
bool flag = false;
PlayerControllerB[] array = allPlayerScripts;
foreach (PlayerControllerB val in array)
{
if (val.playerUsername.ToLower().Contains(playerName.ToLower()) && !Regex.IsMatch(val.playerUsername.ToLower(), "player #[0-9]{1,2}"))
{
playerToModify = val;
break;
}
if (Regex.IsMatch(val.playerUsername.ToLower(), "player #[0-9]{1,2}"))
{
flag = true;
}
}
if (!flag)
{
if (!Plugin.speedHackList.Value.TryGetValue(playerToModify.playerUsername, out var value))
{
SetSpeedHackNetVal(playerToModify.playerUsername, value: true);
}
else
{
SetSpeedHackNetVal(playerToModify.playerUsername, !value);
}
if (Plugin.speedHackList.Value.GetValueOrDefault(playerToModify.playerUsername) || speed.HasValue)
{
float valueOrDefault = speed.GetValueOrDefault();
if (!speed.HasValue)
{
valueOrDefault = 10f;
speed = valueOrDefault;
}
playerToModify.movementSpeed = speed.Value;
playerToModify.climbSpeed = speed.Value;
HUDManager.Instance.DisplayTip(noticeTitle, string.Format("Speed{0}set to {1}", ((Object)(object)playerToModify == (Object)(object)GameNetworkManager.Instance.localPlayerController) ? " " : (" for " + playerToModify.playerUsername + " "), speed), false, false, "LC_Tip1");
SetSpeedHackNetVal(playerToModify.playerUsername, value: true);
}
else
{
SetSpeedHackNetVal(playerToModify.playerUsername, value: false);
playerToModify.movementSpeed = 4.6f;
playerToModify.climbSpeed = 3.6f;
HUDManager.Instance.DisplayTip(noticeTitle, "Speed" + (((Object)(object)playerToModify == (Object)(object)GameNetworkManager.Instance.localPlayerController) ? " " : (" for " + playerToModify.playerUsername + " ")) + "disabled", false, false, "LC_Tip1");
}
}
else
{
HUDManager.Instance.DisplayTip(noticeTitle, "Player '" + playerName + "' not found", false, false, "LC_Tip1");
}
}
private void SetSpeedHackNetVal(string playerName, bool value)
{
Plugin.speedHackList.Value = AddOrUpdateValue(Plugin.speedHackList.Value, playerName, value);
Dictionary<string, bool> value2 = Plugin.speedHackList.Value;
Plugin.speedHackList.Value = null;
Plugin.speedHackList.Value = value2;
}
private Dictionary<TKey, TValue> AddOrUpdateValue<TKey, TValue>(Dictionary<TKey, TValue> dictionary, TKey key, TValue value)
{
if (dictionary.ContainsKey(key))
{
dictionary[key] = value;
}
else
{
dictionary.Add(key, value);
}
return dictionary;
}
}
public class TeleportCommand : ICommand
{
public string Name => "teleport";
public List<string> Aliases => new List<string>(4) { "tp", "tele", "tel", "warp" };
public List<ArgumentModel> Args => new List<ArgumentModel>(2)
{
new ArgumentModel
{
Name = "victimPlayer",
ArgType = typeof(string),
Optional = true
},
new ArgumentModel
{
Name = "witnessPlayer",
ArgType = typeof(string),
Optional = true
}
};
public void Execute(string[] args)
{
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Expected O, but got Unknown
//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB val = GameNetworkManager.Instance.localPlayerController;
PlayerControllerB val2 = null;
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
if (args.Length != 0 && !args[0].Contains(GameNetworkManager.Instance.localPlayerController.playerUsername))
{
PlayerControllerB[] array = allPlayerScripts;
foreach (PlayerControllerB val3 in array)
{
if (val3.playerUsername.ToLower().Contains(args[0].ToLower()))
{
val = val3;
break;
}
}
}
if (args.Length > 1)
{
PlayerControllerB[] array = allPlayerScripts;
foreach (PlayerControllerB val4 in array)
{
if (val4.playerUsername.ToLower().Contains(args[1].ToLower()))
{
val2 = val4;
break;
}
}
}
if ((Object)(object)val2 != (Object)null)
{
val.beamUpParticle.Play();
val.beamOutBuildupParticle.Play();
val.TeleportPlayer(((Component)val2).transform.position, false, 0f, false, true);
string text = ((val.playerUsername != GameNetworkManager.Instance.localPlayerController.playerUsername) ? val.playerUsername : "yourself") ?? "";
string text2 = ((val2.playerUsername != GameNetworkManager.Instance.localPlayerController.playerUsername) ? val2.playerUsername : "yourself") ?? "";
if (text != text2)
{
HUDManager.Instance.DisplayTip("Teleportation", "Teleported " + text + " to " + text2, false, false, "LC_Tip1");
}
else
{
HUDManager.Instance.DisplayTip("Teleportation", "Teleported to... yourself?", false, false, "LC_Tip1");
}
return;
}
Terminal val5 = Object.FindObjectOfType<Terminal>();
if ((Object)val5 != (Object)null)
{
val.beamUpParticle.Play();
val.beamOutBuildupParticle.Play();
val.TeleportPlayer(((Component)val5).transform.position, false, 0f, false, true);
if (val.playerUsername != GameNetworkManager.Instance.localPlayerController.playerUsername)
{
HUDManager.Instance.DisplayTip("Teleportation", "Teleported " + val.playerUsername + " to the ship", false, false, "LC_Tip1");
}
else
{
HUDManager.Instance.DisplayTip("Teleportation", "Teleported yourself to the ship", false, false, "LC_Tip1");
}
}
}
}
public class ToggleLightsCommand : ICommand
{
public string Name => "togglelights";
public void Execute(string[] args)
{
string text = "";
string text2 = "";
BreakerBox val = Object.FindObjectOfType<BreakerBox>();
if ((Object)(object)val != (Object)null)
{
text = "Light Change";
if (val.isPowerOn)
{
Plugin.currentRound.TurnBreakerSwitchesOff();
Plugin.currentRound.TurnOnAllLights(false);
val.isPowerOn = false;
text2 = "Turned the lights off";
}
else
{
Plugin.currentRound.PowerSwitchOnClientRpc();
text2 = "Turned the lights on";
}
}
HUDManager.Instance.DisplayTip(text, text2, false, false, "LC_Tip1");
}
}
public class BurkTrollCommand : ICommand
{
public string Name => "burkTroll";
public bool HideInHelp => true;
public List<ArgumentModel> Args => new List<ArgumentModel>(1)
{
new ArgumentModel
{
Name = "state",
ArgType = typeof(bool)
}
};
public void Execute(string[] args)
{
Plugin.burkTroll.Value = bool.Parse(args[0]);
}
}
public class MadsTrollCommand : ICommand
{
public string Name => "madsTroll";
public bool HideInHelp => true;
public List<ArgumentModel> Args => new List<ArgumentModel>(1)
{
new ArgumentModel
{
Name = "state",
ArgType = typeof(bool)
}
};
public void Execute(string[] args)
{
Plugin.madsTroll.Value = bool.Parse(args[0]);
}
}
public class StacieTrollCommand : ICommand
{
public string Name => "stacieTroll";
public bool HideInHelp => true;
public List<ArgumentModel> Args => new List<ArgumentModel>(1)
{
new ArgumentModel
{
Name = "state",
ArgType = typeof(bool)
}
};
public void Execute(string[] args)
{
Plugin.stacieTroll.Value = bool.Parse(args[0]);
}
}
}
namespace GetMadEpic.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}