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 HarmonyLib;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using WaterGunLib.Modules;
using WaterGunLib.Modules.Prefabs;
[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")]
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__13 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public int Random;
public MopatorAI <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DisableAndEnableBlobSpawningAfterDelay>d__13(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 List<AudioClip> SniffClips;
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)
{
if (AnimID == 1)
{
base.creatureAnimator.SetTrigger("Sniff");
}
if (AnimID == 2)
{
base.creatureAnimator.Play("Move", 0, 0f);
base.creatureSFX.PlayOneShot(VentAudio);
}
}
[ClientRpc]
public void PlaySniffOnEveryPlayerClientRpc(int SoundID)
{
base.creatureSFX.PlayOneShot(SniffClips[SoundID]);
}
public void SpawnBlobObject()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: 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_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
Ray val = default(Ray);
((Ray)(ref val))..ctor(BlobDisposal.transform.position, Vector3.down);
RaycastHit val2 = default(RaycastHit);
if (Physics.Raycast(val, ref val2, 2f) && !Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref val2)).collider).gameObject.GetComponent<MopatorBlob>()))
{
int soundID = Random.Range(1, SniffClips.Count);
PlaySniffOnEveryPlayerClientRpc(soundID);
PlayAnimationForEveryPlayerClientRpc(1);
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__13))]
public IEnumerator DisableAndEnableBlobSpawningAfterDelay(int Random)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DisableAndEnableBlobSpawningAfterDelay>d__13(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);
}
private bool FoundClosestPlayerInRange(float range, float senseRange)
{
//IL_0054: 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)
((EnemyAI)this).TargetClosestPlayer(1.5f, true, 70f, false, false, true);
if ((Object)(object)base.targetPlayer == (Object)null)
{
((EnemyAI)this).TargetClosestPlayer(1.5f, false, 70f, false, false, true);
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;
}
}
public class MopatorBlob : NetworkBehaviour
{
[CompilerGenerated]
private sealed class <>c__DisplayClass18_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__9 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public MopatorBlob <>4__this;
private int <i>5__1;
private int <randomPop>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <BlobDisappear>d__9(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: 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)
{
<randomPop>5__2 = Random.Range(1, <>4__this.BubblePops.Count);
<>4__this.PlayBubblePopClientRpc(<randomPop>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__14 : 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__14(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__15 : 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__15(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__18 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public int playerKilled;
public MopatorBlob <>4__this;
private <>c__DisplayClass18_0 <>8__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <eatPlayerBody>d__18(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__DisplayClass18_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)"MopatorBlob: 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;
if ((Object)(object)<>8__1.playerScript.deadBody == (Object)null)
{
Debug.Log((object)"MopatorBlob: Player body was not spawned or found within 2 seconds.");
return false;
}
<>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;
public List<AudioClip> BubblePops;
[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__9))]
public IEnumerator BlobDisappear()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <BlobDisappear>d__9(0)
{
<>4__this = this
};
}
[ClientRpc]
public void DestroyBlobObjectClientRpc()
{
Debug.Log((object)"Destroying blob");
if (NetworkManager.Singleton.IsServer)
{
((Component)this).gameObject.GetComponent<NetworkObject>().Despawn(true);
}
}
[ClientRpc]
public void PlayBubblePopClientRpc(int SoundID)
{
BlobAudio.PlayOneShot(BubblePops[SoundID]);
}
[ClientRpc]
public void PlayBlobAnimationClientRpc(int AnimID)
{
if (AnimID == 1)
{
BlobAnimator.SetTrigger("Disappear");
BlobAudio.PlayOneShot(BlobSpawn);
}
if (AnimID == 2)
{
BlobAnimator.SetTrigger("Sweep");
}
}
public void OnTriggerStay(Collider other)
{
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
if (Object.op_Implicit((Object)(object)((Component)other).gameObject.GetComponent<PlayerControllerB>()) && IsAbleToDealDamage && !((Component)other).gameObject.GetComponent<PlayerControllerB>().isPlayerDead)
{
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__14))]
public IEnumerator BlobSweeping()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <BlobSweeping>d__14(0)
{
<>4__this = this
};
}
[IteratorStateMachine(typeof(<DisableAndEnableDamagingPlayer>d__15))]
public IEnumerator DisableAndEnableDamagingPlayer()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DisableAndEnableDamagingPlayer>d__15(0)
{
<>4__this = this
};
}
[ServerRpc(RequireOwnership = false)]
public void SlimeKillPlayerEffectServerRpc(int playerKilled)
{
SlimeKillPlayerEffectClientRpc(playerKilled);
}
[ClientRpc]
public void SlimeKillPlayerEffectClientRpc(int playerKilled)
{
((MonoBehaviour)this).StartCoroutine(eatPlayerBody(playerKilled));
}
[IteratorStateMachine(typeof(<eatPlayerBody>d__18))]
private IEnumerator eatPlayerBody(int playerKilled)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <eatPlayerBody>d__18(0)
{
<>4__this = this,
playerKilled = playerKilled
};
}
}
public class MopatorPlushItem : GrabbableObject
{
public Animator PlushAnimator;
public List<AudioClip> PlushAudioClips;
public override void ItemActivate(bool used, bool buttonDown = true)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
PlushAnimator.SetTrigger("Activate");
int index = 1;
if (NetworkManager.Singleton.IsServer)
{
int num = Random.Range(1, PlushAudioClips.Count);
index = num;
}
((Component)this).GetComponent<AudioSource>().PlayOneShot(PlushAudioClips[index]);
}
}
[BepInPlugin("WaterGun.Mopator", "MopatorEnemy", "1.6.0")]
public class Plugin : BaseUnityPlugin
{
private const string GUID = "WaterGun.Mopator";
private const string NAME = "MopatorEnemy";
private const string VER = "1.6.0";
public static Plugin Instance;
private static AssetBundle bundle;
private static EnemyType MopatorEnemy;
public static Dictionary<string, int> spawnValues;
private static ConfigEntry<bool> MopatorPlushEnable;
private static ConfigEntry<int> MopatorPlushRarity;
private static ConfigEntry<float> Powerlevel;
private static ConfigEntry<int> SpawnCap;
private static ConfigEntry<int> Rarity;
private void Awake()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Expected O, but got Unknown
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Expected O, but got Unknown
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Expected O, but got Unknown
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Expected O, but got Unknown
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Expected O, but got Unknown
//IL_0236: Unknown result type (might be due to invalid IL or missing references)
//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
Instance = this;
MopatorPlushEnable = ((BaseUnityPlugin)this).Config.Bind<bool>("MopatorPlushie", "Enable", true, new ConfigDescription("Should the plushie be enabled?", (AcceptableValueBase)null, Array.Empty<object>()));
MopatorPlushRarity = ((BaseUnityPlugin)this).Config.Bind<int>("MopatorPlushie", "Rarity", 20, new ConfigDescription("Rarity of the plushie to be spawned on the moon", (AcceptableValueBase)null, Array.Empty<object>()));
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>()));
Harmony val = new Harmony("WaterGun.Mopator");
val.PatchAll(typeof(Plugin));
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 val2 = ScriptableObject.CreateInstance<TerminalNode>();
val2.creatureName = "Mopator";
val2.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.57% of his feces are found in a single puddle, which mainly serves to deter hostile creatures.\n\n";
val2.clearPreviousText = true;
MopatorEnemy = bundle.LoadAsset<EnemyType>("Assets/LethalCompany/Mods/Enemies/Mopator/MopatorEnemy.asset");
MopatorEnemy.PowerLevel = Powerlevel.Value;
MopatorEnemy.MaxCount = SpawnCap.Value;
EnemyTypeRef val3 = ScriptableObject.CreateInstance<EnemyTypeRef>();
val3.rarity = Rarity.Value;
val3.enemyType = MopatorEnemy;
val3.infoNode = val2;
val3.spawnType = (SpawnType)1;
val3.PlanetNames = new List<string> { "All" };
val3.networkPrefab = false;
NetworkPrefabs.RegisterNetworkPrefab(val3.enemyType.enemyPrefab.GetComponent<MopatorAI>().Blob);
NetworkPrefabs.RegisterNetworkPrefab(val3.enemyType.enemyPrefab);
Enemies.RegisterEnemy(val3, "WaterGun.Mopator");
if (MopatorPlushEnable.Value)
{
Item item = bundle.LoadAsset<Item>("Assets/LethalCompany/Mods/Enemies/Mopator/MopatorPlushieItem.asset");
ItemRef val4 = ScriptableObject.CreateInstance<ItemRef>();
val4.item = item;
val4.rarity = MopatorPlushRarity.Value;
val4.networkPrefab = false;
val3.spawnType = (SpawnType)1;
val3.PlanetNames = new List<string> { "All" };
NetworkPrefabs.RegisterNetworkPrefab(val4.item.spawnPrefab);
Items.RegisterItem(val4, "WaterGun.Mopator");
Debug.Log((object)val4.PlanetNames);
}
((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded Mopator v1.6.0");
}
}