using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using MopatorAI.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyVersion("0.0.0.0")]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
}
public class MopatorAI : EnemyAI
{
private enum State
{
SearchingForPlayer,
ChasingPlayer
}
[CompilerGenerated]
private sealed class <DisableAndEnableBlobSpawningAfterDelay>d__14 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public int Random;
public global::MopatorAI <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DisableAndEnableBlobSpawningAfterDelay>d__14(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>4__this.IsAbleToSpawnBlob = false;
<>2__current = (object)new WaitForSeconds((float)Random);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.IsAbleToSpawnBlob = true;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[Header("Mopator")]
public GameObject Blob;
public GameObject BlobDisposal;
public AudioClip VentAudio;
public AudioClip Sniff1;
public AudioClip Sniff2;
private bool IsAbleToSpawnBlob = true;
public override void Start()
{
((EnemyAI)this).Start();
if (NetworkManager.Singleton.IsServer)
{
PlayAnimationForEveryPlayerClientRpc(2);
}
}
public override void Update()
{
((EnemyAI)this).Update();
if (!base.isEnemyDead)
{
}
}
public void LateUpdate()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: 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_0062: 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)
if ((Object)(object)base.targetPlayer != (Object)null)
{
Vector3 val = ((Component)base.targetPlayer.gameplayCamera).transform.position - ((Component)this).transform.position;
val.y = 0f;
Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref val)).normalized);
((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, val2, 5f * Time.deltaTime);
}
if (IsAbleToSpawnBlob && base.timeSinceSpawn >= 1f && NetworkManager.Singleton.IsServer)
{
int random = Random.Range(4, 10);
SpawnBlobObject();
((MonoBehaviour)this).StartCoroutine(DisableAndEnableBlobSpawningAfterDelay(random));
}
}
public override void DoAIInterval()
{
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_011c: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: 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 = 2f;
if (FoundClosestPlayerInRange(25f, 3f))
{
((EnemyAI)this).StopSearch(base.currentSearch, true);
((EnemyAI)this).SwitchToBehaviourClientRpc(1);
}
break;
case 1:
base.agent.speed = 0.8f;
if (!TargetClosestPlayerInAnyCase() || (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 20f && !((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null)))
{
((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null);
((EnemyAI)this).SwitchToBehaviourClientRpc(0);
}
else
{
((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
}
break;
}
}
[ClientRpc]
public void PlayAnimationForEveryPlayerClientRpc(int AnimID)
{
//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_0071: 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)
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(3727974393u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, AnimID);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3727974393u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
if (AnimID == 1)
{
base.creatureAnimator.SetTrigger("Sniff");
if (!NetworkManager.Singleton.IsServer)
{
return;
}
int num = Random.Range(1, 2);
if (num == 1)
{
PlaySoundOnEveryClientRpc(1);
}
if (num == 2)
{
PlaySoundOnEveryClientRpc(2);
}
}
if (AnimID == 2)
{
base.creatureAnimator.Play("Move", 0, 0f);
base.creatureSFX.PlayOneShot(VentAudio);
}
}
[ClientRpc]
public void PlaySoundOnEveryClientRpc(int SoundID)
{
//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_0071: 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)
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(4213689269u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, SoundID);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4213689269u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
if (SoundID == 1)
{
base.creatureSFX.PlayOneShot(Sniff1);
}
if (SoundID == 2)
{
base.creatureSFX.PlayOneShot(Sniff2);
}
}
}
public void SpawnBlobObject()
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: 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_005c: 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)
PlayAnimationForEveryPlayerClientRpc(1);
Ray val = default(Ray);
((Ray)(ref val))..ctor(BlobDisposal.transform.position, Vector3.down);
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(val, ref val2, 2f))
{
GameObject val3 = Object.Instantiate<GameObject>(Blob, ((RaycastHit)(ref val2)).point, Quaternion.identity);
val3.transform.rotation = Quaternion.FromToRotation(Vector3.up, ((RaycastHit)(ref val2)).normal);
val3.GetComponent<NetworkObject>().Spawn(false);
}
}
[IteratorStateMachine(typeof(<DisableAndEnableBlobSpawningAfterDelay>d__14))]
public IEnumerator DisableAndEnableBlobSpawningAfterDelay(int Random)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DisableAndEnableBlobSpawningAfterDelay>d__14(0)
{
<>4__this = this,
Random = Random
};
}
public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
{
((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
}
public override void OnCollideWithPlayer(Collider other)
{
((EnemyAI)this).OnCollideWithPlayer(other);
}
private bool FoundClosestPlayerInRange(float range, float senseRange)
{
//IL_004e: 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)
((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f);
if ((Object)(object)base.targetPlayer == (Object)null)
{
((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f);
range = senseRange;
}
return (Object)(object)base.targetPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) < range;
}
private bool TargetClosestPlayerInAnyCase()
{
//IL_001f: 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)
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;
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_MopatorAI()
{
//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(3727974393u, new RpcReceiveHandler(__rpc_handler_3727974393));
NetworkManager.__rpc_func_table.Add(4213689269u, new RpcReceiveHandler(__rpc_handler_4213689269));
}
private static void __rpc_handler_3727974393(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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)
{
int animID = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref animID);
target.__rpc_exec_stage = (__RpcExecStage)2;
((global::MopatorAI)(object)target).PlayAnimationForEveryPlayerClientRpc(animID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4213689269(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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)
{
int soundID = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref soundID);
target.__rpc_exec_stage = (__RpcExecStage)2;
((global::MopatorAI)(object)target).PlaySoundOnEveryClientRpc(soundID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "MopatorAI";
}
}
public class MopatorBlob : NetworkBehaviour
{
[CompilerGenerated]
private sealed class <>c__DisplayClass23_0
{
public PlayerControllerB playerScript;
public float startTime;
internal bool <eatPlayerBody>b__0()
{
return (Object)(object)playerScript.deadBody != (Object)null || Time.realtimeSinceStartup - startTime > 2f;
}
}
[CompilerGenerated]
private sealed class <BlobDisappear>d__14 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public MopatorBlob <>4__this;
private int <i>5__1;
private int <random>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <BlobDisappear>d__14(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>4__this.PlayBlobAnimationClientRpc(1);
<i>5__1 = 0;
break;
case 1:
<>1__state = -1;
<i>5__1++;
break;
}
if (<i>5__1 < 30)
{
<random>5__2 = Random.Range(1, 6);
<>4__this.PlayBubblePopClientRpc(<random>5__2);
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
}
<>4__this.DestroyBlobObjectClientRpc();
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <BlobSweeping>d__19 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public MopatorBlob <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <BlobSweeping>d__19(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>4__this.PlayBlobAnimationClientRpc(2);
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.DestroyBlobObjectClientRpc();
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <DisableAndEnableDamagingPlayer>d__20 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public MopatorBlob <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DisableAndEnableDamagingPlayer>d__20(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>4__this.IsAbleToDealDamage = false;
<>2__current = (object)new WaitForSeconds(0.5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.IsAbleToDealDamage = true;
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <eatPlayerBody>d__23 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public int playerKilled;
public MopatorBlob <>4__this;
private <>c__DisplayClass23_0 <>8__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <eatPlayerBody>d__23(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>8__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Expected O, but got Unknown
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>8__1 = new <>c__DisplayClass23_0();
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>8__1.playerScript = StartOfRound.Instance.allPlayerScripts[playerKilled];
<>8__1.startTime = Time.realtimeSinceStartup;
<>2__current = (object)new WaitUntil((Func<bool>)(() => (Object)(object)<>8__1.playerScript.deadBody != (Object)null || Time.realtimeSinceStartup - <>8__1.startTime > 2f));
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
if ((Object)(object)<>8__1.playerScript.deadBody == (Object)null)
{
Debug.Log((object)"Blob: Player body was not spawned or found within 2 seconds.");
return false;
}
<>8__1.playerScript.deadBody.attachedLimb = <>8__1.playerScript.deadBody.bodyParts[6];
<>8__1.playerScript.deadBody.attachedTo = ((Component)<>4__this).transform;
<>8__1.playerScript.deadBody.matchPositionExactly = false;
<>2__current = (object)new WaitForSeconds(2f);
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
<>8__1.playerScript.deadBody.attachedTo = null;
<>8__1.playerScript.deadBody.ChangeMesh(<>4__this.emptySuitMesh, (Material)null);
return false;
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
public Mesh emptySuitMesh;
public Animator BlobAnimator;
public AudioSource BlobAudio;
[Header("BubblePops")]
public AudioClip BubblePop1;
public AudioClip BubblePop2;
public AudioClip BubblePop3;
public AudioClip BubblePop4;
public AudioClip BubblePop5;
public AudioClip BubblePop6;
[Header("BlobSpawn")]
public AudioClip BlobSpawn;
private bool IsAbleToDealDamage = true;
private bool IsAbleToSweepBlob = true;
public void Start()
{
if (NetworkManager.Singleton.IsServer)
{
((MonoBehaviour)this).StartCoroutine(BlobDisappear());
Debug.Log((object)"StartedMopatorBlob");
}
}
public void Update()
{
if (StartOfRound.Instance.inShipPhase)
{
Debug.Log((object)"Removing BlobObject");
DestroyBlobObjectClientRpc();
}
}
[IteratorStateMachine(typeof(<BlobDisappear>d__14))]
public IEnumerator BlobDisappear()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <BlobDisappear>d__14(0)
{
<>4__this = this
};
}
[ClientRpc]
public void DestroyBlobObjectClientRpc()
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(139965179u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 139965179u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
Debug.Log((object)"Destroying blob");
if (NetworkManager.Singleton.IsServer)
{
((Component)this).gameObject.GetComponent<NetworkObject>().Despawn(true);
}
}
}
[ClientRpc]
public void PlayBubblePopClientRpc(int SoundID)
{
//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_0071: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3382356338u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, SoundID);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3382356338u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
if (SoundID == 1)
{
BlobAudio.PlayOneShot(BubblePop1);
}
if (SoundID == 2)
{
BlobAudio.PlayOneShot(BubblePop2);
}
if (SoundID == 3)
{
BlobAudio.PlayOneShot(BubblePop3);
}
if (SoundID == 4)
{
BlobAudio.PlayOneShot(BubblePop4);
}
if (SoundID == 5)
{
BlobAudio.PlayOneShot(BubblePop5);
}
if (SoundID == 6)
{
BlobAudio.PlayOneShot(BubblePop6);
}
}
}
[ClientRpc]
public void PlayBlobAnimationClientRpc(int AnimID)
{
//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_0071: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3195782775u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, AnimID);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3195782775u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
if (AnimID == 1)
{
BlobAnimator.SetTrigger("Disappear");
BlobAudio.PlayOneShot(BlobSpawn);
}
if (AnimID == 2)
{
BlobAnimator.SetTrigger("Sweep");
}
}
}
public void OnTriggerStay(Collider other)
{
//IL_005e: 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)
if (Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent<PlayerControllerB>()) && IsAbleToDealDamage)
{
Debug.Log((object)"Damaging Player");
Debug.Log((object)$"IsAbleToDamagePlayer: {IsAbleToDealDamage}");
((Component)other).gameObject.GetComponent<PlayerControllerB>().DamagePlayer(20, true, true, (CauseOfDeath)5, 0, false, default(Vector3));
((MonoBehaviour)this).StartCoroutine(DisableAndEnableDamagingPlayer());
if (((Component)other).gameObject.GetComponent<PlayerControllerB>().isPlayerDead)
{
SlimeKillPlayerEffectServerRpc((int)((Component)other).gameObject.GetComponent<PlayerControllerB>().playerClientId);
}
Debug.Log((object)$"IsAbleToDamagePlayer: {IsAbleToDealDamage}");
}
else if (Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent<EnemyAICollisionDetect>()) && NetworkManager.Singleton.IsServer && Object.op_Implicit((Object)(object)((Component)((Component)((Component)other).gameObject.GetComponent<EnemyAICollisionDetect>()).transform.parent).GetComponent<ButlerEnemyAI>()) && ((EnemyAI)((Component)((Component)((Component)other).gameObject.GetComponent<EnemyAICollisionDetect>()).transform.parent).GetComponent<ButlerEnemyAI>()).creatureAnimator.GetBool("Sweeping") && IsAbleToSweepBlob)
{
((MonoBehaviour)this).StartCoroutine(BlobSweeping());
IsAbleToSweepBlob = false;
}
}
[IteratorStateMachine(typeof(<BlobSweeping>d__19))]
public IEnumerator BlobSweeping()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <BlobSweeping>d__19(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<DisableAndEnableDamagingPlayer>d__20))]
public IEnumerator DisableAndEnableDamagingPlayer()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DisableAndEnableDamagingPlayer>d__20(0)
{
<>4__this = this
};
}
[ServerRpc(RequireOwnership = false)]
public void SlimeKillPlayerEffectServerRpc(int playerKilled)
{
//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_0071: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2252436678u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerKilled);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2252436678u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
SlimeKillPlayerEffectClientRpc(playerKilled);
}
}
}
[ClientRpc]
public void SlimeKillPlayerEffectClientRpc(int playerKilled)
{
//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_0071: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4170238549u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerKilled);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4170238549u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
((MonoBehaviour)this).StartCoroutine(eatPlayerBody(playerKilled));
}
}
}
[IteratorStateMachine(typeof(<eatPlayerBody>d__23))]
private IEnumerator eatPlayerBody(int playerKilled)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <eatPlayerBody>d__23(0)
{
<>4__this = this,
playerKilled = playerKilled
};
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_MopatorBlob()
{
//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
NetworkManager.__rpc_func_table.Add(139965179u, new RpcReceiveHandler(__rpc_handler_139965179));
NetworkManager.__rpc_func_table.Add(3382356338u, new RpcReceiveHandler(__rpc_handler_3382356338));
NetworkManager.__rpc_func_table.Add(3195782775u, new RpcReceiveHandler(__rpc_handler_3195782775));
NetworkManager.__rpc_func_table.Add(2252436678u, new RpcReceiveHandler(__rpc_handler_2252436678));
NetworkManager.__rpc_func_table.Add(4170238549u, new RpcReceiveHandler(__rpc_handler_4170238549));
}
private static void __rpc_handler_139965179(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;
((MopatorBlob)(object)target).DestroyBlobObjectClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3382356338(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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)
{
int soundID = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref soundID);
target.__rpc_exec_stage = (__RpcExecStage)2;
((MopatorBlob)(object)target).PlayBubblePopClientRpc(soundID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3195782775(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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)
{
int animID = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref animID);
target.__rpc_exec_stage = (__RpcExecStage)2;
((MopatorBlob)(object)target).PlayBlobAnimationClientRpc(animID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2252436678(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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)
{
int playerKilled = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerKilled);
target.__rpc_exec_stage = (__RpcExecStage)1;
((MopatorBlob)(object)target).SlimeKillPlayerEffectServerRpc(playerKilled);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4170238549(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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)
{
int playerKilled = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerKilled);
target.__rpc_exec_stage = (__RpcExecStage)2;
((MopatorBlob)(object)target).SlimeKillPlayerEffectClientRpc(playerKilled);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "MopatorBlob";
}
}
[BepInPlugin("WaterGun.Mopator", "MopatorEnemy", "1.2.1")]
public class Plugin : BaseUnityPlugin
{
private const string GUID = "WaterGun.Mopator";
private const string NAME = "MopatorEnemy";
private const string VER = "1.2.1";
private static AssetBundle bundle;
private static ConfigEntry<float> Powerlevel;
private static ConfigEntry<int> SpawnCap;
private static ConfigEntry<int> Rarity;
private void Awake()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Expected O, but got Unknown
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Expected O, but got Unknown
Rarity = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn", "Rarity", 70, new ConfigDescription("What is the rarity for mopator", (AcceptableValueBase)null, Array.Empty<object>()));
SpawnCap = ((BaseUnityPlugin)this).Config.Bind<int>("Spawn", "SpawnCap", 2, new ConfigDescription("What is the maximum amount of mopators that can spawn?", (AcceptableValueBase)null, Array.Empty<object>()));
Powerlevel = ((BaseUnityPlugin)this).Config.Bind<float>("Spawn", "PowerLevel", 1f, new ConfigDescription("What is the mopator PowerLevel?", (AcceptableValueBase)null, Array.Empty<object>()));
Type[] types = Assembly.GetExecutingAssembly().GetTypes();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "mopator");
bundle = AssetBundle.LoadFromFile(text);
TerminalNode val = ScriptableObject.CreateInstance<TerminalNode>();
val.creatureName = "Mopator";
val.displayText = "Mopator\r\n\r\nScientific name: 57-MP\r\n\r\nThere are various hypotheses about the origin of this curious creature, ranging from fictional ones that say it was created by aliens to take over human brains to more plausible ones that it is simply a mutated mop. \r\nThe most likely theory is that it was created during an accident at the secret facility 57-Harbringer, but it was there that it was first observed by expeditions.\r\n\r\nMopator is not aggressive, driven by curiosity follows people, but what is fascinating is that it absorbs dirt from the floor, even though it is a food source that should not be nutritious for it at all.\r\nAs it moves, it leaves behind toxic, deadly feces.\r\nThe most likely and logical explanation for the formation of such large puddles is that Mopator collects moisture from the environment, mixes it with his feces, and defecates frequently, but according to research, only 1.67% of his feces are found in a single puddle, which mainly serves to deter hostile creatures.\n\n";
val.clearPreviousText = true;
EnemyType val2 = bundle.LoadAsset<EnemyType>("Assets/LethalCompany/Mods/Mopator/MopatorEnemy.asset");
val2.PowerLevel = Powerlevel.Value;
val2.MaxCount = SpawnCap.Value;
NetworkPrefabs.RegisterNetworkPrefab(val2.enemyPrefab.GetComponent<global::MopatorAI>().Blob);
NetworkPrefabs.RegisterNetworkPrefab(val2.enemyPrefab);
Utilities.FixMixerGroups(val2.enemyPrefab.GetComponent<global::MopatorAI>().Blob);
Utilities.FixMixerGroups(val2.enemyPrefab);
Enemies.RegisterEnemy(val2, Rarity.Value, (LevelTypes)(-1), val, (TerminalKeyword)null);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Mopator");
}
}
namespace MopatorAI.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}