using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
using UnityEngine.AI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("beast")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.5.0")]
[assembly: AssemblyInformationalVersion("1.0.5")]
[assembly: AssemblyProduct("scripts")]
[assembly: AssemblyTitle("scripts")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.5.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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;
}
}
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
public class SkibidiEnemy : MonoBehaviour
{
public enum State
{
Spawn,
Idle,
Roam,
Investigate,
TargetPlayer,
SeekPlayer,
Attack,
StuckAttack,
Stun,
Leave,
Despawn
}
[Header("References")]
internal Enemy enemy;
public State currentState;
private bool stateImpulse;
private float stateTimer;
internal PlayerAvatar targetPlayer;
private PhotonView photonView;
private float roamWaitTimer;
private Vector3 agentDestination;
private float overrideAgentLerp;
private Vector3 targetPosition;
internal bool isOnScreen;
internal bool attackImpulse;
internal bool deathImpulse;
[Header("Idle Break")]
public float idleBreakTimeMin = 45f;
public float idleBreakTimeMax = 90f;
private float idleBreakTimer;
internal bool idleBreakTrigger;
[Space]
public SpringQuaternion rotationSpring;
private Quaternion rotationTarget;
[Space]
private float grabAggroTimer;
private Vector3 stuckAttackTarget;
private void Awake()
{
enemy = ((Component)this).GetComponent<Enemy>();
photonView = ((Component)this).GetComponent<PhotonView>();
idleBreakTimer = Random.Range(idleBreakTimeMin, idleBreakTimeMax);
}
private void Update()
{
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Invalid comparison between Unknown and I4
if (!SemiFunc.IsMasterClientOrSingleplayer())
{
return;
}
if (idleBreakTimer >= 0f)
{
idleBreakTimer -= Time.deltaTime;
if (idleBreakTimer <= 0f && CanIdleBreak())
{
IdleBreak();
idleBreakTimer = Random.Range(idleBreakTimeMin, idleBreakTimeMax);
}
}
RotationLogic();
RigidbodyRotationSpeed();
if (enemy.IsStunned())
{
UpdateState(State.Stun);
}
else if ((int)enemy.CurrentState == 11)
{
UpdateState(State.Despawn);
}
switch (currentState)
{
case State.Idle:
StateIdle();
break;
case State.Roam:
StateRoam();
break;
case State.Investigate:
StateInvestigate();
break;
case State.TargetPlayer:
MoveTowardPlayer();
StateTargetPlayer();
break;
case State.SeekPlayer:
StateSeekPlayer();
break;
case State.Spawn:
StateSpawn();
break;
case State.Attack:
StateAttack();
break;
case State.StuckAttack:
StateStuckAttack();
break;
case State.Stun:
StateStun();
break;
case State.Leave:
StateLeave();
break;
case State.Despawn:
StateDespawn();
break;
}
if (currentState != State.TargetPlayer)
{
overrideAgentLerp = 0f;
}
if (currentState != State.TargetPlayer && isOnScreen)
{
isOnScreen = false;
if (GameManager.Multiplayer())
{
photonView.RPC("UpdateOnScreenRPC", (RpcTarget)1, new object[1] { isOnScreen });
}
}
if (isOnScreen && Object.op_Implicit((Object)(object)targetPlayer) && targetPlayer.isLocal)
{
SemiFunc.DoNotLookEffect(((Component)this).gameObject, true, true, true, true, true, true);
}
}
private void StateSpawn()
{
if (stateImpulse)
{
stateTimer = 3f;
stateImpulse = false;
}
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.Idle);
}
}
private void StateIdle()
{
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateImpulse = false;
stateTimer = Random.Range(2f, 5f);
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position);
enemy.NavMeshAgent.ResetPath();
}
if (!SemiFunc.EnemySpawnIdlePause())
{
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.Roam);
}
if (SemiFunc.EnemyForceLeave(enemy))
{
UpdateState(State.Leave);
}
}
}
private void StateRoam()
{
//IL_010a: 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_0058: 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)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
enemy.NavMeshAgent.ResetPath();
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position);
stateImpulse = false;
stateTimer = 5f;
LevelPoint val = SemiFunc.LevelPointGet(((Component)this).transform.position, 5f, 15f);
if (!Object.op_Implicit((Object)(object)val))
{
val = SemiFunc.LevelPointGet(((Component)this).transform.position, 0f, 999f);
}
NavMeshHit val2 = default(NavMeshHit);
if (Object.op_Implicit((Object)(object)val) && NavMesh.SamplePosition(((Component)val).transform.position + Random.insideUnitSphere * 3f, ref val2, 5f, -1) && Physics.Raycast(((NavMeshHit)(ref val2)).position, Vector3.down, 5f, LayerMask.GetMask(new string[1] { "Default" })))
{
agentDestination = ((NavMeshHit)(ref val2)).position;
}
}
enemy.NavMeshAgent.SetDestination(agentDestination);
if (enemy.Rigidbody.notMovingTimer > 1f)
{
stateTimer -= Time.deltaTime;
}
if (stateTimer <= 0f)
{
AttackNearestPhysObjectOrGoToIdle();
return;
}
if (Vector3.Distance(((Component)this).transform.position, agentDestination) < 2f)
{
UpdateState(State.Idle);
}
if (SemiFunc.EnemyForceLeave(enemy))
{
UpdateState(State.Leave);
}
}
private void StateInvestigate()
{
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateTimer = 5f;
enemy.Rigidbody.notMovingTimer = 0f;
stateImpulse = false;
}
else
{
enemy.NavMeshAgent.SetDestination(agentDestination);
if (enemy.Rigidbody.notMovingTimer > 2f)
{
stateTimer -= Time.deltaTime;
}
if (stateTimer <= 0f)
{
AttackNearestPhysObjectOrGoToIdle();
return;
}
if (Vector3.Distance(((Component)this).transform.position, agentDestination) < 2f)
{
UpdateState(State.Idle);
}
}
if (SemiFunc.EnemyForceLeave(enemy))
{
UpdateState(State.Leave);
}
}
private void StateTargetPlayer()
{
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateTimer = 2f;
stateImpulse = false;
}
enemy.Rigidbody.OverrideFollowPosition(0.2f, 5f, 30f);
if (Vector3.Distance(enemy.CenterTransform.position, ((Component)targetPlayer).transform.position) < 2f)
{
UpdateState(State.Attack);
return;
}
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.SeekPlayer);
}
else if (enemy.Rigidbody.notMovingTimer > 3f)
{
enemy.Vision.DisableVision(2f);
UpdateState(State.SeekPlayer);
}
}
private void StateSeekPlayer()
{
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_010a: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: 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)
if (stateImpulse)
{
stateTimer = 20f;
stateImpulse = false;
LevelPoint levelPointAhead = enemy.GetLevelPointAhead(targetPosition);
if (Object.op_Implicit((Object)(object)levelPointAhead))
{
targetPosition = ((Component)levelPointAhead).transform.position;
}
enemy.Rigidbody.notMovingTimer = 0f;
}
enemy.NavMeshAgent.OverrideAgent(3f, 3f, 0.2f);
enemy.Rigidbody.OverrideFollowPosition(0.2f, 3f, -1f);
if (Vector3.Distance(((Component)this).transform.position, targetPosition) < 2f)
{
LevelPoint levelPointAhead2 = enemy.GetLevelPointAhead(targetPosition);
if (Object.op_Implicit((Object)(object)levelPointAhead2))
{
targetPosition = ((Component)levelPointAhead2).transform.position;
}
}
if (enemy.Rigidbody.notMovingTimer >= 3f)
{
AttackNearestPhysObjectOrGoToIdle();
return;
}
enemy.NavMeshAgent.SetDestination(targetPosition);
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f || enemy.Rigidbody.notMovingTimer > 3f)
{
UpdateState(State.Roam);
}
}
private void StateAttack()
{
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
attackImpulse = true;
if (GameManager.Multiplayer())
{
photonView.RPC("AttackImpulseRPC", (RpcTarget)1, Array.Empty<object>());
}
enemy.NavMeshAgent.ResetPath();
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position);
stateTimer = 2f;
stateImpulse = false;
}
else
{
enemy.NavMeshAgent.Stop(0.2f);
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.SeekPlayer);
}
}
}
private void StateStuckAttack()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
enemy.NavMeshAgent.ResetPath();
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position);
stateTimer = 1.5f;
stateImpulse = false;
}
enemy.NavMeshAgent.Stop(0.2f);
stateTimer -= Time.deltaTime;
if (stateTimer <= 0f)
{
UpdateState(State.Attack);
}
}
private void StateStun()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
enemy.NavMeshAgent.ResetPath();
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position);
stateImpulse = false;
}
if (!enemy.IsStunned())
{
UpdateState(State.Idle);
}
}
private void StateLeave()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0102: Unknown result type (might be due to invalid IL or missing references)
//IL_0112: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
stateImpulse = false;
stateTimer = 5f;
bool flag = false;
LevelPoint val = SemiFunc.LevelPointGetPlayerDistance(((Component)this).transform.position, 30f, 50f, false);
if (!Object.op_Implicit((Object)(object)val))
{
val = SemiFunc.LevelPointGetFurthestFromPlayer(((Component)this).transform.position, 5f);
}
NavMeshHit val2 = default(NavMeshHit);
if (Object.op_Implicit((Object)(object)val) && NavMesh.SamplePosition(((Component)val).transform.position + Random.insideUnitSphere * 3f, ref val2, 5f, -1) && Physics.Raycast(((NavMeshHit)(ref val2)).position, Vector3.down, 5f, LayerMask.GetMask(new string[1] { "Default" })))
{
agentDestination = ((NavMeshHit)(ref val2)).position;
flag = true;
}
if (!flag)
{
return;
}
}
if (enemy.Rigidbody.notMovingTimer > 2f)
{
stateTimer -= Time.deltaTime;
}
enemy.NavMeshAgent.SetDestination(agentDestination);
if (Vector3.Distance(((Component)this).transform.position, agentDestination) < 1f || stateTimer <= 0f)
{
UpdateState(State.Idle);
}
}
private void StateDespawn()
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
if (stateImpulse)
{
enemy.NavMeshAgent.ResetPath();
enemy.NavMeshAgent.Warp(((Component)enemy.Rigidbody).transform.position);
stateImpulse = false;
}
}
private void IdleBreak()
{
if (!GameManager.Multiplayer())
{
IdleBreakRPC();
}
else
{
photonView.RPC("IdleBreakRPC", (RpcTarget)0, Array.Empty<object>());
}
}
internal void UpdateState(State _state)
{
if (SemiFunc.IsMasterClientOrSingleplayer() && currentState != _state)
{
currentState = _state;
stateImpulse = true;
stateTimer = 0f;
if (GameManager.Multiplayer())
{
photonView.RPC("UpdateStateRPC", (RpcTarget)0, new object[1] { currentState });
}
else
{
UpdateStateRPC(currentState);
}
}
}
public void OnSpawn()
{
if (SemiFunc.IsMasterClientOrSingleplayer() && SemiFunc.EnemySpawn(enemy))
{
UpdateState(State.Spawn);
}
}
public void OnHurt()
{
if (SemiFunc.IsMasterClientOrSingleplayer() && currentState == State.Leave)
{
UpdateState(State.Idle);
}
}
public void OnDeath()
{
deathImpulse = true;
if (SemiFunc.IsMasterClientOrSingleplayer())
{
enemy.EnemyParent.SpawnedTimerSet(0f);
}
}
public void OnVision()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Invalid comparison between Unknown and I4
if ((int)enemy.CurrentState == 11)
{
return;
}
if (currentState == State.Idle || currentState == State.Roam || currentState == State.Investigate || currentState == State.SeekPlayer)
{
targetPlayer = enemy.Vision.onVisionTriggeredPlayer;
UpdateState(State.TargetPlayer);
if (GameManager.Multiplayer())
{
photonView.RPC("TargetPlayerRPC", (RpcTarget)0, new object[1] { targetPlayer.photonView.ViewID });
}
}
else if (currentState == State.TargetPlayer && (Object)(object)targetPlayer == (Object)(object)enemy.Vision.onVisionTriggeredPlayer)
{
stateTimer = Mathf.Max(stateTimer, 1f);
}
}
public void OnInvestigate()
{
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
if (SemiFunc.IsMasterClientOrSingleplayer())
{
if (currentState == State.Idle || currentState == State.Roam || currentState == State.Investigate)
{
agentDestination = enemy.StateInvestigate.onInvestigateTriggeredPosition;
UpdateState(State.Investigate);
}
else if (currentState == State.SeekPlayer)
{
targetPosition = enemy.StateInvestigate.onInvestigateTriggeredPosition;
}
}
}
public void OnGrabbed()
{
if (SemiFunc.IsMasterClientOrSingleplayer() && !(grabAggroTimer > 0f) && currentState == State.Leave)
{
grabAggroTimer = 60f;
targetPlayer = enemy.Vision.onVisionTriggeredPlayer;
UpdateState(State.TargetPlayer);
if (GameManager.Multiplayer())
{
photonView.RPC("TargetPlayerRPC", (RpcTarget)0, new object[1] { targetPlayer.photonView.ViewID });
}
}
}
private bool CanIdleBreak()
{
if (currentState != State.Idle && currentState != State.Investigate)
{
return currentState == State.Roam;
}
return true;
}
private void MoveTowardPlayer()
{
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: Unknown result type (might be due to invalid IL or missing references)
bool flag = false;
flag = true;
overrideAgentLerp += Time.deltaTime / 4f;
if (flag != isOnScreen)
{
isOnScreen = flag;
if (GameManager.Multiplayer())
{
photonView.RPC("UpdateOnScreenRPC", (RpcTarget)1, new object[1] { isOnScreen });
}
}
overrideAgentLerp = Mathf.Clamp(overrideAgentLerp, 0f, 1f);
float num = 25f;
float num2 = 25f;
float num3 = Mathf.Lerp(enemy.NavMeshAgent.DefaultSpeed, num, overrideAgentLerp);
float num4 = Mathf.Lerp(enemy.Rigidbody.positionSpeedChase, num2, overrideAgentLerp);
enemy.NavMeshAgent.OverrideAgent(num3, enemy.NavMeshAgent.DefaultAcceleration, 0.2f);
enemy.Rigidbody.OverrideFollowPosition(1f, num4, -1f);
targetPosition = ((Component)targetPlayer).transform.position;
enemy.NavMeshAgent.SetDestination(targetPosition);
}
private void RotationLogic()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: Unknown result type (might be due to invalid IL or missing references)
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_018b: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
if (currentState == State.StuckAttack)
{
if (Vector3.Distance(stuckAttackTarget, ((Component)enemy.Rigidbody).transform.position) > 0.1f)
{
rotationTarget = Quaternion.LookRotation(stuckAttackTarget - ((Component)enemy.Rigidbody).transform.position);
((Quaternion)(ref rotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref rotationTarget)).eulerAngles.y, 0f);
}
}
else if (currentState == State.TargetPlayer || currentState == State.Attack)
{
if (Object.op_Implicit((Object)(object)targetPlayer) && Vector3.Distance(((Component)targetPlayer).transform.position, ((Component)this).transform.position) > 0.1f)
{
rotationTarget = Quaternion.LookRotation(((Component)targetPlayer).transform.position - ((Component)this).transform.position);
((Quaternion)(ref rotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref rotationTarget)).eulerAngles.y, 0f);
}
}
else
{
Vector3 normalized = ((Vector3)(ref enemy.NavMeshAgent.AgentVelocity)).normalized;
if (((Vector3)(ref normalized)).magnitude > 0.1f)
{
rotationTarget = Quaternion.LookRotation(((Vector3)(ref enemy.NavMeshAgent.AgentVelocity)).normalized);
((Quaternion)(ref rotationTarget)).eulerAngles = new Vector3(0f, ((Quaternion)(ref rotationTarget)).eulerAngles.y, 0f);
}
}
((Component)this).transform.rotation = SemiFunc.SpringQuaternionGet(rotationSpring, rotationTarget, -1f);
}
private void AttackNearestPhysObjectOrGoToIdle()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: 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)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
stuckAttackTarget = Vector3.zero;
if (enemy.Rigidbody.notMovingTimer > 3f)
{
stuckAttackTarget = SemiFunc.EnemyGetNearestPhysObject(enemy);
}
if (stuckAttackTarget != Vector3.zero)
{
UpdateState(State.StuckAttack);
}
else
{
UpdateState(State.Idle);
}
}
private void RigidbodyRotationSpeed()
{
if (currentState == State.Roam)
{
enemy.Rigidbody.rotationSpeedIdle = 1f;
enemy.Rigidbody.rotationSpeedChase = 1f;
}
else
{
enemy.Rigidbody.rotationSpeedIdle = 2f;
enemy.Rigidbody.rotationSpeedChase = 2f;
}
}
[PunRPC]
private void UpdateStateRPC(State _state)
{
currentState = _state;
stateImpulse = true;
}
[PunRPC]
private void TargetPlayerRPC(int _playerID)
{
foreach (PlayerAvatar player in GameDirector.instance.PlayerList)
{
if (player.photonView.ViewID == _playerID)
{
targetPlayer = player;
}
}
}
[PunRPC]
private void UpdateOnScreenRPC(bool _onScreen)
{
isOnScreen = _onScreen;
}
[PunRPC]
private void AttackImpulseRPC()
{
attackImpulse = true;
}
[PunRPC]
private void IdleBreakRPC()
{
idleBreakTrigger = true;
}
}
public class ValuableAcorn : MonoBehaviour
{
public enum States
{
Idle,
Active
}
private PhysGrabObject physGrabObject;
private PhotonView photonView;
internal States currentState;
private bool stateStart;
private int particleFocus;
private void StateActive()
{
if (stateStart)
{
stateStart = false;
}
Color val = default(Color);
((Color)(ref val))..ctor(0.5f, 0f, 1f);
foreach (PhysGrabber item in physGrabObject.playerGrabbing)
{
if (Object.op_Implicit((Object)(object)item) && !item.isLocal)
{
item.playerAvatar.voiceChat.OverridePitch(1.6f, 0f, 0f, 0.1f, true);
}
}
if (SemiFunc.IsMasterClientOrSingleplayer() && !physGrabObject.grabbed)
{
SetState(States.Idle);
}
if (physGrabObject.grabbedLocal)
{
PlayerAvatar instance = PlayerAvatar.instance;
if (Object.op_Implicit((Object)(object)instance.voiceChat))
{
instance.voiceChat.OverridePitch(1.6f, 0f, 0f, 0.1f, true);
}
}
}
private void StateIdle()
{
if (stateStart)
{
stateStart = false;
}
if (SemiFunc.IsMasterClientOrSingleplayer() && physGrabObject.grabbed)
{
SetState(States.Active);
}
Color val = default(Color);
((Color)(ref val))..ctor(0.5f, 0f, 1f);
}
[PunRPC]
public void SetStateRPC(States state)
{
currentState = state;
stateStart = true;
}
private void SetState(States state)
{
if (SemiFunc.IsMasterClientOrSingleplayer())
{
if (!SemiFunc.IsMultiplayer())
{
SetStateRPC(state);
return;
}
photonView.RPC("SetStateRPC", (RpcTarget)0, new object[1] { state });
}
}
private void Start()
{
physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
photonView = ((Component)this).GetComponent<PhotonView>();
}
private void Update()
{
switch (currentState)
{
case States.Active:
StateActive();
break;
case States.Idle:
StateIdle();
break;
}
}
}
namespace scripts
{
[HarmonyPatch(typeof(PlayerController))]
internal static class ExamplePlayerControllerPatch
{
[HarmonyPrefix]
[HarmonyPatch("Start")]
private static void Start_Prefix(PlayerController __instance)
{
scripts.Logger.LogDebug((object)$"{__instance} Start Prefix");
}
[HarmonyPostfix]
[HarmonyPatch("Start")]
private static void Start_Postfix(PlayerController __instance)
{
scripts.Logger.LogDebug((object)$"{__instance} Start Postfix");
}
}
[BepInPlugin("beast.scripts", "scripts", "1.0")]
public class scripts : BaseUnityPlugin
{
internal static scripts Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Expected O, but got Unknown
//IL_0025: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
}
}
}