#define DEBUG
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using LethalLib.Modules;
using Menstalker_ybdkSKB.Configuration;
using Unity.Netcode;
using UnityEngine;
using menstalker_yaboiduckisnickerbar.NetcodePatcher;
[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 = "")]
[assembly: AssemblyCompany("menstalker_yaboiduckisnickerbar")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Example Enemy for Lethal Company.")]
[assembly: AssemblyFileVersion("1.2.2.0")]
[assembly: AssemblyInformationalVersion("1.2.2")]
[assembly: AssemblyProduct("menstalker_yaboiduckisnickerbar")]
[assembly: AssemblyTitle("menstalker_yaboiduckisnickerbar")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.2.0")]
[module: UnverifiableCode]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
}
}
namespace Menstalker_ybdkSKB
{
internal class Menstalker_ybdkSKB : EnemyAI
{
private enum State
{
IDLE,
STALK,
PRERUSH,
RUSH,
ROAM
}
private enum SubState
{
ADVANCE,
RETREAT,
WATCH
}
public Transform turnCompass;
public Transform attackArea;
public int subState = 0;
public Vector3 spawnPosition;
public AISearchRoutine roamMap;
public Vector3 mainEntrancePos;
private float defaultTimer_chaseDuration = -1f;
private float defaultTimer_targetLost = -1f;
private const float defaultTimer_stalkingScared = 30f;
private const float defaultTimer_stalkingDetected = 50f;
private const float defaultTimer_stalkWithLOS = 15f;
private const float defaultTimer_preRushTimeout = 15f;
private const float defaultTimer_roamTimeout = 120f;
private const float defaultTimer_stunTimeout = 1f;
public bool targetLost;
private bool isDeadAnimationDone;
private bool flag = false;
private bool is_stunned = false;
private bool can_seePlayer = false;
public int clawDamage = 20;
private const float longDistance = 14f;
public float timer_chaseDuration = -1f;
public float timer_targetLost = -1f;
public float timer_stalking = 50f;
public float timer_stalkWithLOS = 15f;
public float timer_preRushTimeout = 15f;
public float timer_roamTimeout = 120f;
public float timer_stun = 0f;
public float timeSinceHittingLocalPlayer = 0f;
[Conditional("DEBUG")]
private void LogIfDebugBuild(string text)
{
Plugin.Logger.LogInfo((object)text);
}
public override void Start()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Start();
spawnPosition = ((Component)this).transform.position;
mainEntrancePos = RoundManager.FindMainEntrancePosition(false, false);
isDeadAnimationDone = false;
targetLost = true;
base.targetPlayer = null;
defaultTimer_chaseDuration = 25 + StartOfRound.Instance.randomMapSeed % 11;
defaultTimer_targetLost = StartOfRound.Instance.randomMapSeed % 6 + 9;
timer_targetLost = defaultTimer_targetLost;
timer_chaseDuration = defaultTimer_chaseDuration;
base.currentBehaviourStateIndex = 0;
LogIfDebugBuild("Man-stalker spawned");
}
private void computing_death()
{
if (!isDeadAnimationDone)
{
base.creatureAnimator.SetBool("isAngry", false);
isDeadAnimationDone = true;
base.creatureVoice.Stop();
base.creatureVoice.PlayOneShot(base.dieSFX);
}
base.creatureAnimator.SetBool("isAngry", false);
}
private void computing_stun()
{
if (timer_stun > 0f)
{
timer_stun -= Time.deltaTime;
is_stunned = true;
}
else
{
is_stunned = false;
}
}
private void computing_timer()
{
switch (base.currentBehaviourStateIndex)
{
case 1:
if (targetLost)
{
timer_targetLost -= Time.deltaTime;
timer_stalking += Time.deltaTime * 1.5f;
}
else
{
timer_stalking -= Time.deltaTime;
}
if (can_seePlayer)
{
timer_stalkWithLOS -= Time.deltaTime;
}
break;
case 2:
timer_preRushTimeout -= Time.deltaTime;
break;
case 3:
timer_chaseDuration -= Time.deltaTime;
if ((double)timeSinceHittingLocalPlayer > 0.75)
{
base.creatureAnimator.SetBool("isAngry", true);
base.creatureAnimator.ResetTrigger("slash");
}
else
{
timeSinceHittingLocalPlayer += Time.deltaTime;
}
if (!is_stunned)
{
base.creatureAnimator.SetBool("isAngry", true);
base.creatureAnimator.ResetTrigger("stunned");
}
break;
case 4:
timer_roamTimeout -= Time.deltaTime;
break;
case 0:
break;
}
}
public override void Update()
{
//IL_006f: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Update();
if (base.isEnemyDead)
{
computing_death();
base.creatureAnimator.ResetTrigger("slash");
return;
}
computing_stun();
computing_timer();
int currentBehaviourStateIndex = base.currentBehaviourStateIndex;
if ((Object)(object)base.targetPlayer != (Object)null && (currentBehaviourStateIndex == 1 || currentBehaviourStateIndex == 3))
{
Vector3 val = ((Component)this).transform.position - (((Component)base.targetPlayer).transform.position - ((Component)this).transform.position);
turnCompass.LookAt(val);
((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, turnCompass.eulerAngles.y, 0f)), 1f);
}
}
private void animationManager()
{
switch (base.currentBehaviourStateIndex)
{
case 3:
if (!((double)timeSinceHittingLocalPlayer < 0.75) && !is_stunned)
{
base.creatureAnimator.speed = 1f;
base.creatureAnimator.SetBool("isAngry", true);
}
break;
case 1:
base.creatureAnimator.speed = 1f;
base.creatureAnimator.SetBool("isAngry", false);
switch (subState)
{
case 2:
base.creatureAnimator.SetBool("forwardWalk", false);
base.creatureAnimator.SetBool("backwardWalk", false);
break;
case 0:
base.creatureAnimator.SetBool("forwardWalk", true);
base.creatureAnimator.SetBool("backwardWalk", false);
break;
case 1:
base.creatureAnimator.SetBool("forwardWalk", false);
base.creatureAnimator.SetBool("backwardWalk", true);
break;
}
break;
case 2:
case 4:
base.creatureAnimator.SetBool("isAngry", false);
base.creatureAnimator.SetBool("forwardWalk", false);
base.creatureAnimator.SetBool("backwardWalk", false);
base.creatureAnimator.speed = 1f;
break;
case 0:
base.creatureAnimator.SetBool("isAngry", false);
base.creatureAnimator.SetBool("forwardWalk", true);
base.creatureAnimator.SetBool("backwardWalk", false);
break;
}
}
private void stop_movement()
{
//IL_0018: 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)
base.agent.speed = 0f;
Vector3 velocity = base.agent.velocity;
((Vector3)(ref velocity)).Set(0f, 0f, 0f);
}
private void reset_variables()
{
flag = false;
targetLost = true;
timer_chaseDuration = defaultTimer_chaseDuration;
timer_targetLost = -1f;
timer_stalking = 50f;
timer_stalkWithLOS = 15f;
timer_preRushTimeout = 15f;
timer_roamTimeout = 120f;
}
private void SwitchToBehaviourClientRpcAndReset(int nextState)
{
((EnemyAI)this).SwitchToBehaviourClientRpc(nextState);
reset_variables();
}
private void wander()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: 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_006e: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
base.creatureAnimator.ResetTrigger("slash");
base.creatureVoice.Stop();
if (Vector3.Distance(((Component)this).transform.position, mainEntrancePos) >= 42f)
{
stop_movement();
}
else
{
setup_moveAndOpen(10f, 1f);
}
_ = mainEntrancePos;
if (0 == 0 && !((Object)(object)((EnemyAI)this).ChooseFarthestNodeFromPosition(mainEntrancePos, false, 0, false, 50, false) == (Object)null))
{
((EnemyAI)this).SetDestinationToPosition(((Component)((EnemyAI)this).ChooseFarthestNodeFromPosition(mainEntrancePos, false, 0, false, 50, false)).transform.position, false);
SwitchToBehaviourClientRpcAndReset(0);
}
}
private void setup_moveAndOpen(float a, float b)
{
base.openDoorSpeedMultiplier = b;
base.agent.speed = a;
}
private void force_movingTowardsTarget(PlayerControllerB target_)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).SetMovingTowardsTargetPlayer(target_);
if (base.agent.velocity == new Vector3(0f, 0f, 0f) && !((EnemyAI)this).SetDestinationToPosition(((Component)target_).transform.position, false))
{
}
}
public override void DoAIInterval()
{
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0267: Unknown result type (might be due to invalid IL or missing references)
//IL_0272: Unknown result type (might be due to invalid IL or missing references)
//IL_02c3: Unknown result type (might be due to invalid IL or missing references)
//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
if (base.isEnemyDead || StartOfRound.Instance.allPlayersDead)
{
return;
}
((EnemyAI)this).DoAIInterval();
animationManager();
if (is_stunned)
{
stop_movement();
return;
}
PlayerControllerB closestPlayer = ((EnemyAI)this).GetClosestPlayer(false, false, false);
float num = -1f;
PlayerControllerB closestPlayer2 = ((EnemyAI)this).GetClosestPlayer(true, false, false);
float num2 = -1f;
if ((Object)(object)closestPlayer == (Object)null && base.currentBehaviourStateIndex != 1)
{
wander();
return;
}
if ((Object)(object)closestPlayer != (Object)null)
{
num = Vector3.Distance(((Component)closestPlayer).transform.position, ((Component)this).transform.position);
}
if ((Object)(object)closestPlayer2 != (Object)null)
{
num2 = Vector3.Distance(((Component)closestPlayer2).transform.position, ((Component)this).transform.position);
can_seePlayer = true;
}
else
{
num2 = -1f;
can_seePlayer = false;
}
switch (base.currentBehaviourStateIndex)
{
case 0:
base.creatureVoice.Stop();
setup_moveAndOpen(1.5f, 1f);
base.targetPlayer = null;
if ((Object)(object)closestPlayer != (Object)null && (closestPlayer.isCrouching || !closestPlayer.isSprinting) && Vector3.Distance(((Component)this).transform.position, ((Component)closestPlayer).transform.position) <= 14f)
{
SwitchToBehaviourClientRpcAndReset(1);
timer_stalking = 30f;
if (roamMap.inProgress)
{
((EnemyAI)this).StopSearch(roamMap, true);
}
}
else if ((Object)(object)closestPlayer != (Object)null && ((closestPlayer.isSprinting && (double)Vector3.Distance(((Component)this).transform.position, ((Component)closestPlayer).transform.position) <= 31.5) || (Object)(object)closestPlayer2 != (Object)null))
{
SwitchToBehaviourClientRpcAndReset(1);
timer_stalking = 50f;
if (roamMap.inProgress)
{
((EnemyAI)this).StopSearch(roamMap, true);
}
}
else if ((Object)(object)closestPlayer != (Object)null && Vector3.Distance(((Component)this).transform.position, ((Component)closestPlayer).transform.position) <= 56f)
{
setup_moveAndOpen(2f, 1f);
force_movingTowardsTarget(closestPlayer);
}
else if ((Object)(object)base.targetPlayer == (Object)null && base.agent.velocity == new Vector3(0f, 0f, 0f))
{
roamMap = null;
((EnemyAI)this).StartSearch(spawnPosition, roamMap);
}
break;
case 1:
subState = 1;
if ((num > 38.5f && (Object)(object)closestPlayer2 == (Object)null) || (Object)(object)closestPlayer == (Object)null)
{
targetLost = true;
if (timer_targetLost < 0f)
{
SwitchToBehaviourClientRpcAndReset(4);
break;
}
subState = 0;
setup_moveAndOpen(4f, 1f);
if ((Object)(object)closestPlayer != (Object)null)
{
force_movingTowardsTarget(closestPlayer);
}
break;
}
targetLost = false;
timer_targetLost = defaultTimer_targetLost;
if (timer_stalking < 0f)
{
if (timer_stalkWithLOS < 0f)
{
SwitchToBehaviourClientRpcAndReset(2);
}
else if ((double)num < 11.200000000000001)
{
setup_moveAndOpen(8f, 1f);
AvoidClosestPlayer(11.48f, avoidLOS: false, closestPlayer);
}
else if (num > 14f && (Object)(object)closestPlayer2 == (Object)null)
{
setup_moveAndOpen(5f, 1f);
if (!((Object)(object)closestPlayer == (Object)null))
{
force_movingTowardsTarget(closestPlayer);
}
}
else if ((Object)(object)closestPlayer2 != (Object)null || (double)num > 11.200000000000001)
{
stop_movement();
subState = 2;
}
}
else if (num <= 2f)
{
SwitchToBehaviourClientRpcAndReset(3);
}
else if ((Object)(object)closestPlayer2 != (Object)null && num2 < 28f)
{
subState = 1;
setup_moveAndOpen(12f, 1f);
AvoidClosestPlayer(28f, avoidLOS: true, closestPlayer);
}
else if (num < 14f)
{
subState = 1;
setup_moveAndOpen(11f, 1f);
AvoidClosestPlayer(14f, avoidLOS: true, closestPlayer);
}
else if (num < 19.6f)
{
subState = 1;
setup_moveAndOpen(5f, 0f);
AvoidClosestPlayer(14f, avoidLOS: true, closestPlayer);
}
else
{
subState = 2;
setup_moveAndOpen(0f, 1f);
stop_movement();
base.moveTowardsDestination = false;
base.movingTowardsTargetPlayer = false;
}
break;
case 2:
setup_moveAndOpen(8f, 1f);
if (timer_preRushTimeout < 0f || num < 2f)
{
SwitchToBehaviourClientRpcAndReset(3);
}
else if (num < 14f)
{
AvoidClosestPlayer(14f, avoidLOS: true, closestPlayer);
}
break;
case 3:
scareLocalPlayer();
setup_moveAndOpen(10.5f, 0.15f);
if (base.enemyHP <= 2)
{
base.openDoorSpeedMultiplier = 2f;
}
force_movingTowardsTarget(closestPlayer);
if (!flag && (Object)(object)closestPlayer2 == (Object)null)
{
timer_chaseDuration = defaultTimer_chaseDuration;
break;
}
flag = true;
if (timer_chaseDuration < 0f && (Object)(object)closestPlayer2 == (Object)null && num > 14f)
{
SwitchToBehaviourClientRpcAndReset(4);
}
break;
case 4:
base.creatureVoice.Stop();
if (num < 1.5f)
{
SwitchToBehaviourClientRpcAndReset(3);
}
setup_moveAndOpen(14f, 1f);
AvoidClosestPlayer(14f, avoidLOS: true, closestPlayer);
if (num > 28f && (Object)(object)closestPlayer2 == (Object)null && timer_roamTimeout < 0f)
{
SwitchToBehaviourClientRpcAndReset(0);
}
break;
default:
LogIfDebugBuild("Error : invalid behavior index");
break;
}
}
public void AvoidClosestPlayer(float optimalDistance, bool avoidLOS, PlayerControllerB closestPlayer)
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: 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_006c: Unknown result type (might be due to invalid IL or missing references)
Transform val = ((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)closestPlayer).transform.position, avoidLOS, 0, false, 50, false);
if ((Object)(object)val != (Object)null && base.mostOptimalDistance > optimalDistance && Physics.Linecast(((Component)val).transform.position, ((Component)closestPlayer.gameplayCamera).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
{
base.targetNode = val;
((EnemyAI)this).SetDestinationToPosition(base.targetNode.position, false);
}
}
public void scareLocalPlayer()
{
//IL_0007: 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)
if (Vector3.Distance(((Component)this).transform.position, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position) < 14f)
{
GameNetworkManager.Instance.localPlayerController.JumpToFearLevel(1f, true);
}
}
public override void OnCollideWithPlayer(Collider other)
{
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
if (!(timeSinceHittingLocalPlayer < 0.75f) && !(timer_stun > 0f) && !base.isEnemyDead && base.currentBehaviourStateIndex == 3)
{
PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
if ((Object)(object)val != (Object)null)
{
base.creatureAnimator.SetBool("isAngry", false);
DoAnimationClientRpc("slash");
base.creatureSFX.PlayOneShot(base.currentBehaviourState.SFXClip);
timeSinceHittingLocalPlayer = 0f;
val.DamagePlayer(clawDamage, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
LogIfDebugBuild("Player " + val.playerUsername + " hit by dust stalker");
}
}
}
public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
{
if (base.isEnemyDead || timer_stun > 0f)
{
return;
}
((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID = -1);
base.enemyHP -= force;
if (((NetworkBehaviour)this).IsOwner)
{
if (base.enemyHP <= 0 && !base.isEnemyDead)
{
((EnemyAI)this).KillEnemyOnOwnerClient(false);
return;
}
base.creatureAnimator.SetBool("isAngry", false);
DoAnimationClientRpc("stunned");
base.creatureVoice.PlayOneShot(base.dieSFX);
timer_stun = 1f;
((EnemyAI)this).SwitchToBehaviourClientRpc(3);
}
}
[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(3719444039u, 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, 3719444039u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
LogIfDebugBuild("Animation: " + animationName);
base.creatureAnimator.SetTrigger(animationName);
}
}
[ClientRpc]
public void SwingAttackHitClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: 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(121933789u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 121933789u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
LogIfDebugBuild("SwingAttackHitClientRPC");
int num = 8;
Collider[] array = Physics.OverlapBox(attackArea.position, attackArea.localScale, Quaternion.identity, num);
if (array.Length == 0)
{
return;
}
Collider[] array2 = array;
foreach (Collider val3 in array2)
{
PlayerControllerB val4 = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(val3, false, false);
if ((Object)(object)val4 != (Object)null)
{
LogIfDebugBuild("Swing attack hit player!");
timeSinceHittingLocalPlayer = 0f;
val4.DamagePlayer(40, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
}
}
}
protected override void __initializeVariables()
{
((EnemyAI)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_Menstalker_ybdkSKB()
{
//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(3719444039u, new RpcReceiveHandler(__rpc_handler_3719444039));
NetworkManager.__rpc_func_table.Add(121933789u, new RpcReceiveHandler(__rpc_handler_121933789));
}
private static void __rpc_handler_3719444039(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;
((Menstalker_ybdkSKB)(object)target).DoAnimationClientRpc(animationName);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_121933789(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;
((Menstalker_ybdkSKB)(object)target).SwingAttackHitClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "Menstalker_ybdkSKB";
}
}
[BepInPlugin("snickerbarYaboiDucki.menstalker_yaboiduckisnickerbar", "menstalker_yaboiduckisnickerbar", "1.2.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public const string pluginName = "Men stalker (Hostile entity)";
public const string ModGUID = "snickerbarYaboiDucki.menstalker_yaboiduckisnickerbar";
public const string pluginVersion = "1.2.2";
internal static ManualLogSource Logger;
public static AssetBundle ModAssets;
internal static PluginConfig BoundConfig { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
BoundConfig = new PluginConfig((BaseUnityPlugin)(object)this);
InitializeNetworkBehaviours();
string path = "yaboiduckimenstalkerassets";
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 val = ModAssets.LoadAsset<EnemyType>("Menstalker_type");
TerminalNode val2 = ModAssets.LoadAsset<TerminalNode>("duskStalkerTN");
TerminalKeyword val3 = ModAssets.LoadAsset<TerminalKeyword>("duskStalkerTK");
NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab);
Enemies.RegisterEnemy(val, BoundConfig.SpawnWeight.Value, (LevelTypes)(-1), (SpawnType)0, val2, val3);
Logger.LogInfo((object)"Plugin menstalker_yaboiduckisnickerbar is loaded!");
}
private static void InitializeNetworkBehaviours()
{
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);
}
}
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "menstalker_yaboiduckisnickerbar";
public const string PLUGIN_NAME = "menstalker_yaboiduckisnickerbar";
public const string PLUGIN_VERSION = "1.2.2";
}
}
namespace Menstalker_ybdkSKB.Configuration
{
public class PluginConfig
{
public ConfigEntry<int> SpawnWeight;
public PluginConfig(BaseUnityPlugin plugin)
{
SpawnWeight = plugin.Config.Bind<int>("Man stalker", "Spawn weight", 20, "The spawn chance weight for ExampleEnemy, 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)
{
PropertyInfo property = ((object)plugin.Config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic);
Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(plugin.Config, null);
dictionary.Clear();
plugin.Config.Save();
}
}
}
namespace menstalker_yaboiduckisnickerbar.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}