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 HarmonyLib;
using LethalLib.Modules;
using LethalNetworkAPI;
using Microsoft.CodeAnalysis;
using ModelReplacement;
using ToonukiMadz.Commands;
using ToonukiMadz.Configuration;
using ToonukiMadz.NetcodePatcher;
using ToonukiMadz.src.BodyReplacements;
using ToonukiMadz.src.patches;
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("ToonukiMadz")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Very mysterious epic")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ToonukiMadz")]
[assembly: AssemblyTitle("ToonukiMadz")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.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 ToonukiMadz
{
internal class RenderCharacterAI : EnemyAI
{
private enum State
{
SearchingForPlayer,
StickingInFrontOfPlayer,
HeadSwingAttackInProgress
}
private enum CreatureSounds
{
Spawn,
Notice,
Chasing,
Death
}
public Transform turnCompass;
public Transform attackArea;
[SerializeField]
public AudioClip deathSound;
[SerializeField]
public AudioClip spawnSound;
[SerializeField]
public AudioClip noticeSound;
[SerializeField]
public AudioClip chasingSound;
private float timeSinceHittingLocalPlayer;
private float timeSinceNewRandPos;
private Vector3 positionRandomness;
private Vector3 StalkPos;
private Random enemyRandom;
private bool isDeadAnimationDone;
[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_0091: 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;
TryPlaySoundClientRpc(0);
base.enemyType.enemyPrefab.GetComponent<GameObject>();
base.currentBehaviourStateIndex = 0;
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
base.enemyType.canDie = true;
base.enemyType.destroyOnDeath = true;
base.creatureVoice.loop = true;
}
public override void Update()
{
//IL_0098: 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_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
if (base.isEnemyDead)
{
if (!isDeadAnimationDone)
{
TryStopSoundClientRpc(isCreatureVoice: true);
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_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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)
((EnemyAI)this).DoAIInterval();
if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
{
return;
}
switch (base.currentBehaviourStateIndex)
{
case 0:
base.agent.speed = 5f;
if (FoundClosestPlayerInRange(25f, 3f))
{
TryPlaySoundClientRpc(1);
base.creatureVoice.Play();
((EnemyAI)this).StopSearch(base.currentSearch, true);
((EnemyAI)this).SwitchToBehaviourClientRpc(1);
}
break;
case 1:
base.agent.speed = 6.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)))
{
TryStopSoundClientRpc(isCreatureVoice: true);
((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_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_0075: 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;
StalkPos = ((Component)base.targetPlayer).transform.position - Vector3.Scale(new Vector3(-2f, 0f, -2f), ((Component)base.targetPlayer).transform.forward);
((EnemyAI)this).SetDestinationToPosition(StalkPos, false);
}
}
[ClientRpc]
private void TryPlaySoundClientRpc(int soundToPlay, bool shouldLoop = false, bool interrupt = false)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: 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(3755047771u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, soundToPlay);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref shouldLoop, default(ForPrimitives));
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref interrupt, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3755047771u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
try
{
base.creatureSFX.loop = shouldLoop;
if (interrupt || !base.creatureVoice.isPlaying)
{
switch (soundToPlay)
{
case 0:
base.creatureSFX.PlayOneShot(spawnSound);
break;
case 1:
base.creatureSFX.PlayOneShot(noticeSound);
break;
case 2:
base.creatureVoice.Play();
break;
case 3:
base.creatureSFX.PlayOneShot(deathSound);
break;
}
}
}
catch (Exception ex)
{
Plugin.mls.LogError((object)("Failed to play sound: " + ex.Message));
}
}
[ClientRpc]
private void TryStopSoundClientRpc(bool isCreatureVoice)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
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(287724415u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isCreatureVoice, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 287724415u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
try
{
if (!isCreatureVoice)
{
if (base.creatureSFX.isPlaying)
{
base.creatureSFX.Stop();
}
}
else if (base.creatureVoice.isPlaying)
{
base.creatureVoice.Stop();
}
}
catch (Exception ex)
{
Plugin.mls.LogError((object)("Failed to play sound: " + ex.Message));
}
}
public override void OnCollideWithPlayer(Collider other)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).OnCollideWithPlayer(other);
if (!(timeSinceHittingLocalPlayer < 0.3f))
{
PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
if ((Object)(object)val != (Object)null)
{
ExplodeRpcServerRpc(((Component)val).transform.position);
timeSinceHittingLocalPlayer = 0f;
}
}
}
public bool IsAnimationPlaying(string animationName)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
Animator component = ((Component)this).GetComponent<Animator>();
if ((Object)(object)component == (Object)null)
{
return false;
}
AnimatorClipInfo[] currentAnimatorClipInfo = component.GetCurrentAnimatorClipInfo(0);
for (int i = 0; i < currentAnimatorClipInfo.Length; i++)
{
AnimatorClipInfo val = currentAnimatorClipInfo[i];
if (((Object)((AnimatorClipInfo)(ref val)).clip).name == animationName)
{
return true;
}
}
return false;
}
[ServerRpc(RequireOwnership = false)]
public void ExplodeRpcServerRpc(Vector3 playerPosition)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: 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_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(328391219u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref playerPosition);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 328391219u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((MonoBehaviour)this).StartCoroutine(ExplodeAfterDelay(playerPosition));
}
}
}
private IEnumerator ExplodeAfterDelay(Vector3 playerPosition)
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
if (!IsAnimationPlaying("die-Head"))
{
TryStopSoundClientRpc(isCreatureVoice: true);
TryPlaySoundClientRpc(3, shouldLoop: false, interrupt: true);
DoAnimationClientRpc("KillEnemy");
base.agent.speed = 0f;
yield return (object)new WaitForSeconds(1.07f);
SpawnExplosionServerRpc(playerPosition, spawnEffects: true, 2.4f, 5f);
((EnemyAI)this).KillEnemyServerRpc(true);
}
}
[ServerRpc(RequireOwnership = false)]
public void SpawnExplosionServerRpc(Vector3 explosionPos, bool spawnEffects, float killRange, float damageRange)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3659870034u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref explosionPos);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref spawnEffects, default(ForPrimitives));
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref killRange, default(ForPrimitives));
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref damageRange, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3659870034u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
SpawnExplosionClientRpc(explosionPos, spawnEffects, killRange, damageRange);
}
}
}
[ClientRpc]
public void SpawnExplosionClientRpc(Vector3 explosionPos, bool spawnEffects, float killRange, float damageRange)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: 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_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2400778082u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe(ref explosionPos);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref spawnEffects, default(ForPrimitives));
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref killRange, default(ForPrimitives));
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref damageRange, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2400778082u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
Landmine.SpawnExplosion(explosionPos, spawnEffects, killRange, damageRange);
Plugin.mls.LogInfo((object)"SpawnExplosionServerRpc SENT");
}
}
}
[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(595964035u, 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, 595964035u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
base.creatureAnimator.SetTrigger(animationName);
}
}
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(base.searchCoroutine);
}
}
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_RenderCharacterAI()
{
//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
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(3755047771u, new RpcReceiveHandler(__rpc_handler_3755047771));
NetworkManager.__rpc_func_table.Add(287724415u, new RpcReceiveHandler(__rpc_handler_287724415));
NetworkManager.__rpc_func_table.Add(328391219u, new RpcReceiveHandler(__rpc_handler_328391219));
NetworkManager.__rpc_func_table.Add(3659870034u, new RpcReceiveHandler(__rpc_handler_3659870034));
NetworkManager.__rpc_func_table.Add(2400778082u, new RpcReceiveHandler(__rpc_handler_2400778082));
NetworkManager.__rpc_func_table.Add(595964035u, new RpcReceiveHandler(__rpc_handler_595964035));
}
private static void __rpc_handler_3755047771(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_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_008e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int soundToPlay = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref soundToPlay);
bool shouldLoop = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref shouldLoop, default(ForPrimitives));
bool interrupt = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref interrupt, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((RenderCharacterAI)(object)target).TryPlaySoundClientRpc(soundToPlay, shouldLoop, interrupt);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_287724415(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_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool isCreatureVoice = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isCreatureVoice, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((RenderCharacterAI)(object)target).TryStopSoundClientRpc(isCreatureVoice);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_328391219(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0036: 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_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
Vector3 playerPosition = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref playerPosition);
target.__rpc_exec_stage = (__RpcExecStage)1;
((RenderCharacterAI)(object)target).ExplodeRpcServerRpc(playerPosition);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3659870034(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//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_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
Vector3 explosionPos = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref explosionPos);
bool spawnEffects = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref spawnEffects, default(ForPrimitives));
float killRange = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref killRange, default(ForPrimitives));
float damageRange = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref damageRange, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((RenderCharacterAI)(object)target).SpawnExplosionServerRpc(explosionPos, spawnEffects, killRange, damageRange);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2400778082(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//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_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
Vector3 explosionPos = default(Vector3);
((FastBufferReader)(ref reader)).ReadValueSafe(ref explosionPos);
bool spawnEffects = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref spawnEffects, default(ForPrimitives));
float killRange = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref killRange, default(ForPrimitives));
float damageRange = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref damageRange, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((RenderCharacterAI)(object)target).SpawnExplosionClientRpc(explosionPos, spawnEffects, killRange, damageRange);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_595964035(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;
((RenderCharacterAI)(object)target).DoAnimationClientRpc(animationName);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "RenderCharacterAI";
}
}
[BepInPlugin("burk.ToonukiMadz", "ToonukiMadz", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public const string ModGUID = "burk.ToonukiMadz";
internal static ManualLogSource Logger;
public static AssetBundle ModAssets;
private readonly Harmony _harmony = new Harmony("burk.ToonukiMadz");
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;
internal static bool isHost;
internal static PlayerControllerB playerRef;
internal static Dictionary<string, Type> suitNamesToReplace = new Dictionary<string, Type>
{
{
"madz",
typeof(BodyReplacementMadz)
},
{
"kappa",
typeof(BodyReplacementKappa)
},
{
"circle",
typeof(BodyReplacementCircle)
},
{
"ivan",
typeof(BodyReplacementIvan)
},
{
"celshock",
typeof(BodyReplacementCel)
}
};
[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<(string, string)> teleportVictims = new LethalNetworkVariable<(string, string)>("teleportVictims")
{
Value = ("", "")
};
[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;
}
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
burkTroll.OnValueChanged += BurkTrollCommand.UpdateBurkTrollVariable;
adminList.OnValueChanged += AdminCommand.UpdateAdminListVariable;
speedHackList.OnValueChanged += SpeedHackCommand.UpdateSpeedHackListVariable;
godModeList.OnValueChanged += GodModeCommand.UpdateGodModeListVariable;
commandPrefix.OnValueChanged += ChangePrefixCommand.UpdateCommandPrefixVariable;
stacieTroll.OnValueChanged += StacieTrollCommand.UpdateStacieTrollVariable;
madsTroll.OnValueChanged += MadsTrollCommand.UpdateMadsTrollVariable;
teleportVictims.OnValueChanged += TeleportCommand.TeleportVictimsVariable;
BoundConfig = new PluginConfig((BaseUnityPlugin)(object)this);
InitializeNetworkBehaviours();
string path = "rendercharassets";
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>("Render");
TerminalNode val = ModAssets.LoadAsset<TerminalNode>("RenderTN");
TerminalKeyword val2 = ModAssets.LoadAsset<TerminalKeyword>("RenderTK");
NetworkPrefabs.RegisterNetworkPrefab(obj.enemyPrefab);
Enemies.RegisterEnemy(obj, BoundConfig.SpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, val, val2);
Logger.LogInfo((object)"Plugin burk.ToonukiMadz is loaded!");
foreach (KeyValuePair<string, Type> item in suitNamesToReplace)
{
ModelReplacementAPI.RegisterSuitModelReplacement(item.Key, item.Value);
}
mls = Logger.CreateLogSource("ToonukiMadz");
mls.LogInfo((object)"Loaded burk.ToonukiMadz. Patching.");
_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>();
}
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 = "ToonukiMadz";
public const string PLUGIN_NAME = "ToonukiMadz";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace ToonukiMadz.Configuration
{
public class PluginConfig
{
public ConfigEntry<int> SpawnWeight;
public PluginConfig(BaseUnityPlugin plugin)
{
SpawnWeight = plugin.Config.Bind<int>("ToonukiMadz", "Spawn weight", 100, "The spawn chance weight for ToonukiMadz, 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 ToonukiMadz.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 static void UpdateAdminListVariable(List<string> data)
{
Plugin.adminList.Value = data;
}
}
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 static void UpdateCommandPrefixVariable(string data)
{
Plugin.commandPrefix.Value = data;
}
}
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;
}
public static void UpdateGodModeListVariable(Dictionary<string, bool> data)
{
Plugin.godModeList.Value = data;
}
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_013a: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0144: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: 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_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: 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)
Plugin.mls.LogInfo((object)"Got to the main SpawnEnemy function");
if (inside)
{
try
{
for (int i = 0; i < amount; i++)
{
int num = Random.Range(0, Plugin.currentRound.allEnemyVents.Length);
Vector3 val = (Vector3)(((??)playerPosition) ?? Plugin.currentRound.allEnemyVents[num].floorNode.position);
Plugin.currentRound.SpawnEnemyOnServer(val, Plugin.currentRound.allEnemyVents[num].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);
}
}
public static void UpdateSpeedHackListVariable(Dictionary<string, bool> data)
{
Plugin.speedHackList.Value = data;
}
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)
{
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;
}
}
}
Plugin.teleportVictims.Value = (val?.playerUsername, val2?.playerUsername);
if (HUDManager.Instance.localPlayer.playerUsername != val?.playerUsername)
{
val.beamUpParticle.Play();
val.beamOutBuildupParticle.Play();
}
if ((Object)(object)val2 != (Object)null)
{
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");
}
}
else 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 static void TeleportVictimsVariable((string, string) data)
{
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Expected O, but got Unknown
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
if (!(data.Item1 == HUDManager.Instance.localPlayer.playerUsername))
{
return;
}
HUDManager.Instance.localPlayer.beamUpParticle.Play();
HUDManager.Instance.localPlayer.beamOutBuildupParticle.Play();
if (data.Item2 != null)
{
PlayerControllerB val = null;
PlayerControllerB[] array = allPlayerScripts;
foreach (PlayerControllerB val2 in array)
{
if (val2.playerUsername.ToLower().Contains(data.Item2.ToLower()))
{
val = val2;
break;
}
}
HUDManager.Instance.localPlayer.TeleportPlayer(((Component)val).transform.position, false, 0f, false, true);
}
else
{
Terminal val3 = Object.FindObjectOfType<Terminal>();
if ((Object)val3 != (Object)null)
{
HUDManager.Instance.localPlayer.beamUpParticle.Play();
HUDManager.Instance.localPlayer.beamOutBuildupParticle.Play();
HUDManager.Instance.localPlayer.TeleportPlayer(((Component)val3).transform.position, false, 0f, false, true);
}
}
}
}
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 static void UpdateBurkTrollVariable(bool data)
{
Plugin.burkTroll.Value = data;
}
}
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 static void UpdateMadsTrollVariable(bool data)
{
Plugin.madsTroll.Value = data;
}
}
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]);
}
public static void UpdateStacieTrollVariable(bool data)
{
Plugin.stacieTroll.Value = data;
}
}
}
namespace ToonukiMadz.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 ToonukiMadzCommands(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);
}
}
}
namespace ToonukiMadz.src.BodyReplacements
{
public class BodyReplacementCel : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "ModelCel";
GameObject result = Plugin.ModAssets.LoadAsset<GameObject>(text);
_ = ((Component)this).GetComponent<PlayerControllerB>().currentSuitID;
StartOfRound.Instance.unlockablesList.unlockables.Where((UnlockableItem m) => m.unlockableName == "celshock").FirstOrDefault().unlockableName.ToLower().Replace(" ", "");
return result;
}
}
public class BodyReplacementCircle : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "ModelCircle";
GameObject result = Plugin.ModAssets.LoadAsset<GameObject>(text);
_ = ((Component)this).GetComponent<PlayerControllerB>().currentSuitID;
StartOfRound.Instance.unlockablesList.unlockables.Where((UnlockableItem m) => m.unlockableName == "circle").FirstOrDefault().unlockableName.ToLower().Replace(" ", "");
return result;
}
}
public class BodyReplacementIvan : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "ModelIvan";
GameObject result = Plugin.ModAssets.LoadAsset<GameObject>(text);
_ = ((Component)this).GetComponent<PlayerControllerB>().currentSuitID;
StartOfRound.Instance.unlockablesList.unlockables.Where((UnlockableItem m) => m.unlockableName == "ivan").FirstOrDefault().unlockableName.ToLower().Replace(" ", "");
return result;
}
}
public class BodyReplacementKappa : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "ModelKappa";
GameObject result = Plugin.ModAssets.LoadAsset<GameObject>(text);
_ = ((Component)this).GetComponent<PlayerControllerB>().currentSuitID;
StartOfRound.Instance.unlockablesList.unlockables.Where((UnlockableItem m) => m.unlockableName == "kappa").FirstOrDefault().unlockableName.ToLower().Replace(" ", "");
return result;
}
}
public class BodyReplacementMadz : BodyReplacementBase
{
protected override GameObject LoadAssetsAndReturnModel()
{
string text = "ModelMadz";
GameObject result = Plugin.ModAssets.LoadAsset<GameObject>(text);
_ = ((Component)this).GetComponent<PlayerControllerB>().currentSuitID;
StartOfRound.Instance.unlockablesList.unlockables.Where((UnlockableItem m) => m.unlockableName == "madz").FirstOrDefault().unlockableName.ToLower().Replace(" ", "");
return result;
}
}
}
namespace ToonukiMadz.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}