using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Unity.Netcode;
using Unity.Netcode.Samples;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Audio;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("FreakySlugs")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FreakySlugs")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("4e836c88-01ed-424a-9715-a34e9d2ad154")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
internal class <Module>
{
static <Module>()
{
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace FreakySlugs
{
public class BocchiSlugItem : GrabbableObject, INoiseListener
{
[Space(3f)]
public Animator animator;
public AudioSource audioSource;
public SkinnedMeshRenderer skinnedMeshRenderer;
public Material[] materials;
[Space(3f)]
public Vector2 BarkInterval;
public Vector2 MoveInterval;
public float WalkingSpeed = 1f;
public float RunningSpeed = 8f;
private float timeBeforeNextMove = 1f;
private float timeBeforeStopFlee = -1f;
private float timeBeforeNextBark = 1f;
private bool isSitting;
private bool isFleeing;
private bool isShaking;
private float timeBeforeTryFlee = -1f;
[Space(3f)]
public float FieldOfView = 90f;
public int ViewRange = 5;
public Transform Eye;
private bool isSeeingPlayer;
public float TimeBeforeFleeFromPlayer = 1f;
[Space(3f)]
public AudioClip[] grabSFX;
public AudioClip[] dropSFX;
public AudioClip[] barkSFX;
public AudioClip[] shipBarkSFX;
public AudioClip[] alertSFX;
public AudioClip[] calmSFX;
public AudioClip[] fleeSFX;
public AudioClip[] restSFX;
public AudioSource audioSourceRock;
[Space(3f)]
public float noiseRange = 65f;
public float maxLoudness = 1f;
public float minLoudness = 0.95f;
public float minPitch = 0.9f;
public float maxPitch = 1f;
private float shakeNoiseInterval;
private float defaultVolume;
private NavMeshAgent agent;
private Random random;
private HoarderBugItem hoarderBugItem;
[Space(3f)]
public Vector3 destination;
private float velY;
private Vector3 previousPosition;
private Vector3 agentLocalVelocity;
private GameObject[] allAINodes;
private NavMeshPath navmeshPath;
private ClientNetworkTransform clientNetworkTransform;
private bool isBeingHoarded
{
get
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
if (hoarderBugItem != null)
{
return Vector3.Distance(((Component)this).transform.position, hoarderBugItem.itemNestPosition) < 2f;
}
return false;
}
}
public void Awake()
{
}
public override void Start()
{
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Expected O, but got Unknown
//IL_013f: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Expected O, but got Unknown
((GrabbableObject)this).Start();
try
{
if ((Object)(object)agent == (Object)null)
{
agent = ((Component)this).GetComponent<NavMeshAgent>();
}
if ((Object)(object)animator == (Object)null)
{
animator = ((Component)this).GetComponentInChildren<Animator>();
}
if ((Object)(object)skinnedMeshRenderer == (Object)null)
{
skinnedMeshRenderer = ((Component)this).GetComponentInChildren<SkinnedMeshRenderer>();
}
clientNetworkTransform = ((Component)this).GetComponent<ClientNetworkTransform>();
random = new Random(StartOfRound.Instance.randomMapSeed + 11082005);
GameObject[] first = GameObject.FindGameObjectsWithTag("AINode");
GameObject[] second = GameObject.FindGameObjectsWithTag("OutsideAINode");
allAINodes = first.Concat(second).ToArray();
agent.updatePosition = false;
destination = ((Component)this).transform.position;
navmeshPath = new NavMeshPath();
AudioMixer diageticMixer = SoundManager.Instance.diageticMixer;
audioSource.outputAudioMixerGroup = diageticMixer.FindMatchingGroups("SFX")[0];
audioSourceRock.outputAudioMixerGroup = diageticMixer.FindMatchingGroups("SFX")[0];
defaultVolume = audioSource.volume;
((NetworkBehaviour)this).NetworkManager.OnClientConnectedCallback += NetworkManager_OnClientConnectedCallback;
NetworkManager.Singleton.SceneManager.OnLoadComplete += new OnLoadCompleteDelegateHandler(SceneManager_OnLoadComplete);
}
catch (Exception arg)
{
Debug.LogError((object)$"Error when initializing variables for {((Object)((Component)this).gameObject).name} : {arg}");
}
}
public override void OnDestroy()
{
((NetworkBehaviour)this).NetworkManager.OnClientConnectedCallback -= NetworkManager_OnClientConnectedCallback;
((NetworkBehaviour)this).OnDestroy();
}
private void NetworkManager_OnClientConnectedCallback(ulong obj)
{
if (((NetworkBehaviour)this).IsServer && isSitting)
{
MakeSlugSitServerRpc(sit: true);
}
}
private void SceneManager_OnLoadComplete(ulong clientId, string sceneName, LoadSceneMode loadSceneMode)
{
GameObject[] first = GameObject.FindGameObjectsWithTag("AINode");
GameObject[] second = GameObject.FindGameObjectsWithTag("OutsideAINode");
allAINodes = first.Concat(second).ToArray();
}
public override void GrabItem()
{
animator.SetBool("move", false);
animator.SetFloat("vely", 0f);
animator.SetBool("held", true);
animator.ResetTrigger("sit");
isSitting = false;
isFleeing = false;
isSeeingPlayer = false;
StopSlugFleeServerRpc();
PlayBark(grabSFX, audible: false);
((GrabbableObject)this).GrabItem();
if (((NetworkBehaviour)this).IsOwner)
{
audioSource.spatialBlend = 0f;
HUDManager.Instance.DisplayTip("Bocchi Facts", "Too noisy? Rock your Bocchi to quiet her down for a bit!", false, true, "LC_FreakySlugsTip");
}
((Component)audioSourceRock).GetComponent<Collider>().enabled = true;
}
public override void DiscardItem()
{
DropBocchi();
audioSource.spatialBlend = 1f;
((GrabbableObject)this).DiscardItem();
}
public override void GrabItemFromEnemy(EnemyAI enemy)
{
base.isHeldByEnemy = true;
animator.SetBool("move", false);
animator.SetFloat("vely", 0f);
animator.SetBool("held", true);
animator.ResetTrigger("sit");
isSitting = false;
isFleeing = false;
isSeeingPlayer = false;
StopSlugFleeServerRpc();
PlayBark(grabSFX, audible: false);
((GrabbableObject)this).GrabItemFromEnemy(enemy);
if (((NetworkBehaviour)this).IsServer)
{
HoarderBugAI val = (HoarderBugAI)(object)((enemy is HoarderBugAI) ? enemy : null);
if (val != null)
{
hoarderBugItem = (((Object)(object)val.heldItem.itemGrabbableObject == (Object)(object)this) ? val.heldItem : null);
}
}
}
public override void DiscardItemFromEnemy()
{
base.isHeldByEnemy = false;
animator.SetBool("held", false);
((GrabbableObject)this).DiscardItemFromEnemy();
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (buttonDown)
{
base.playerHeldBy.playerBodyAnimator.SetInteger("RockBaby", 1);
animator.SetBool("shook", true);
audioSourceRock.Play();
timeBeforeNextBark = 1000f;
isShaking = true;
shakeNoiseInterval = 0f;
}
else
{
base.playerHeldBy.playerBodyAnimator.SetInteger("RockBaby", 0);
animator.SetBool("shook", false);
audioSourceRock.Stop();
float num = CalculateBarkInterval();
num += 15f;
timeBeforeNextBark = Random.Range(BarkInterval.x + num, BarkInterval.y + num);
isShaking = false;
}
}
private void DropBocchi()
{
if (base.playerHeldBy.playerBodyAnimator.GetInteger("RockBaby") == 1)
{
base.playerHeldBy.playerBodyAnimator.SetInteger("RockBaby", 0);
}
animator.SetBool("held", false);
animator.SetBool("shook", false);
if (audioSourceRock.isPlaying)
{
audioSourceRock.Stop();
}
if (isShaking)
{
float num = CalculateBarkInterval();
num += 15f;
timeBeforeNextBark = Random.Range(BarkInterval.x + num, BarkInterval.y + num);
isShaking = false;
}
}
public PlayerControllerB CheckLineOfSightForPlayer(float width = 45f, int range = 60, int proximityAwareness = -1)
{
//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)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: 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_0032: 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_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_0065: 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_0071: 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_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
{
Vector3 val = ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position + Vector3.up * 0.1f;
if (Vector3.Distance(val, Eye.position) < (float)range && !Physics.Linecast(Eye.position, val, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
{
Vector3 val2 = val - Eye.position;
if (Vector3.Angle(Eye.forward, val2) < width || (proximityAwareness != -1 && Vector3.Distance(Eye.position, val) < (float)proximityAwareness))
{
return StartOfRound.Instance.allPlayerScripts[i];
}
}
}
return null;
}
public override void Update()
{
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: 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_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_046b: Unknown result type (might be due to invalid IL or missing references)
//IL_047c: Unknown result type (might be due to invalid IL or missing references)
//IL_0481: Unknown result type (might be due to invalid IL or missing references)
//IL_0445: Unknown result type (might be due to invalid IL or missing references)
((Behaviour)clientNetworkTransform).enabled = !base.isHeld && !base.isHeldByEnemy;
if (((NetworkBehaviour)this).IsServer && !base.isHeld && !base.isHeldByEnemy && !((NetworkBehaviour)this).IsOwner)
{
((Component)this).GetComponent<NetworkObject>().RemoveOwnership();
}
if (!isFleeing && !base.isInElevator && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap)
{
((Behaviour)agent).enabled = !base.isHeld && !base.isHeldByEnemy && base.reachedFloorTarget && !(base.fallTime < 1f);
if (base.fallTime >= 1f && !base.reachedFloorTarget)
{
base.targetFloorPosition = ((Component)this).transform.position;
destination = ((Component)this).transform.position;
previousPosition = ((Component)this).transform.position;
((Behaviour)agent).enabled = true;
}
}
if (!base.isHeld && !base.isHeldByEnemy && base.fallTime >= 1f && !base.reachedFloorTarget && animator.GetBool("held"))
{
animator.SetBool("held", false);
}
if (isShaking)
{
if (shakeNoiseInterval <= 0f)
{
shakeNoiseInterval = audioSourceRock.clip.length;
float num = (base.isInElevator ? (noiseRange - 2.5f) : noiseRange);
float num2 = (float)random.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f;
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, num, num2, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 8881);
}
else
{
shakeNoiseInterval -= Time.deltaTime;
}
}
if (!isFleeing)
{
if (base.isHeld || base.isHeldByEnemy || !base.reachedFloorTarget || base.fallTime < 1f || base.isInElevator)
{
((GrabbableObject)this).Update();
}
if (((NetworkBehaviour)this).IsServer && !base.isHeld && !base.isHeldByEnemy && (base.isInElevator || isBeingHoarded) && !isSitting)
{
MakeSlugSitServerRpc(sit: true);
}
else if (((NetworkBehaviour)this).IsServer && !base.isHeld && !base.isHeldByEnemy && !base.isInElevator && !isBeingHoarded && isSitting && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap)
{
MakeSlugSitServerRpc(sit: false);
}
}
if (((NetworkBehaviour)this).IsServer)
{
if (!isSitting && !base.isHeld && base.reachedFloorTarget && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap)
{
PlayerControllerB val = CheckLineOfSightForPlayer(FieldOfView / 2f, ViewRange, 2);
if (Object.op_Implicit((Object)(object)val) && !isSeeingPlayer)
{
isSeeingPlayer = true;
isFleeing = true;
PlayerSpottedServerRpc();
}
}
if (timeBeforeTryFlee >= 0f)
{
timeBeforeTryFlee -= Time.deltaTime;
}
if (!isFleeing)
{
if (timeBeforeNextBark <= 0f)
{
BarkServerRpc();
float num3 = CalculateBarkInterval();
timeBeforeNextBark = Random.Range(BarkInterval.x + num3, BarkInterval.y + num3);
}
timeBeforeNextBark -= Time.deltaTime;
if (!base.isHeld && !base.isHeldByEnemy && !base.isInElevator && !isBeingHoarded && StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap)
{
if (timeBeforeNextMove <= 0f)
{
SetRandomDestination();
timeBeforeNextMove = Random.Range(MoveInterval.x, MoveInterval.y);
}
timeBeforeNextMove -= Time.deltaTime;
((Component)this).transform.position = agent.nextPosition;
}
}
else if (isFleeing)
{
((Component)this).transform.position = agent.nextPosition;
base.targetFloorPosition = ((Component)this).transform.position;
if (timeBeforeStopFlee > 0f)
{
timeBeforeStopFlee -= Time.deltaTime;
}
if (agent.hasPath && (agent.remainingDistance <= 0.05f || timeBeforeStopFlee <= 0f))
{
timeBeforeNextMove = Random.Range(MoveInterval.x, MoveInterval.y);
StopSlugFleeServerRpc();
}
}
}
if (!base.isHeld && !base.isHeldByEnemy)
{
SynchronizeAnimator();
}
}
private void SynchronizeAnimator(float maxSpeed = 4f)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_0027: 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_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
agentLocalVelocity = ((Component)animator).transform.InverseTransformDirection(Vector3.ClampMagnitude(((Component)this).transform.position - previousPosition, 1f) / (Time.deltaTime * 2f));
animator.SetBool("move", ((Vector3)(ref agentLocalVelocity)).magnitude > 0.05f);
velY = Mathf.Lerp(velY, agentLocalVelocity.z * 2f, 10f * Time.deltaTime);
animator.SetFloat("vely", Mathf.Clamp(velY, 0f - maxSpeed, maxSpeed));
previousPosition = ((Component)this).transform.position;
}
public float CalculateBarkInterval()
{
float num = 0f;
if (base.isInElevator)
{
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
foreach (PlayerControllerB val in allPlayerScripts)
{
if (val.isInElevator)
{
num += 15f;
break;
}
}
}
return num;
}
[ServerRpc(RequireOwnership = false)]
public void StopSlugFleeServerRpc()
{
//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)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(368065054u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 368065054u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
StopSlugFleeClientRpc();
isSeeingPlayer = false;
timeBeforeStopFlee = -1f;
agent.ResetPath();
}
}
}
[ClientRpc]
public void StopSlugFleeClientRpc()
{
//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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1924589638u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1924589638u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
isFleeing = false;
if (!base.isHeld)
{
PlayBark(calmSFX);
}
}
}
[ServerRpc]
public void MakeSlugSitServerRpc(bool sit)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Invalid comparison between Unknown and I4
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00c9: 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_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(59308589u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref sit, default(ForPrimitives));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 59308589u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
MakeSlugSitClientRpc(sit);
}
}
[ClientRpc]
public void MakeSlugSitClientRpc(bool sit)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4074308177u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref sit, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4074308177u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
animator.SetBool("sit", sit);
isSitting = sit;
}
}
}
[ServerRpc(RequireOwnership = false)]
public void BarkServerRpc()
{
//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)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3013987970u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3013987970u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
BarkClientRpc();
}
}
}
[ClientRpc]
public void BarkClientRpc()
{
//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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4228274978u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4228274978u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
if (base.isInElevator)
{
PlayBark(shipBarkSFX, audible: false, 0.5f);
}
else
{
PlayBark(barkSFX);
}
}
}
[ServerRpc]
public void PlayerSpottedServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: 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)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Invalid comparison between Unknown and I4
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
if (((NetworkBehaviour)this).OwnerClientId != networkManager.LocalClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
return;
}
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3872518474u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3872518474u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
PlayerSpottedClientRpc();
agent.ResetPath();
timeBeforeStopFlee = Random.Range(MoveInterval.y - 1f, MoveInterval.y + 2f) + TimeBeforeFleeFromPlayer;
}
}
[ClientRpc]
public void PlayerSpottedClientRpc()
{
//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)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(439399333u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 439399333u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
PlayBark(alertSFX);
animator.SetBool("react", true);
((MonoBehaviour)this).StartCoroutine("PlayerSpottedFlee");
}
}
}
private IEnumerator PlayerSpottedFlee()
{
yield return (object)new WaitForSeconds(TimeBeforeFleeFromPlayer);
animator.SetBool("react", false);
PlayBark(fleeSFX);
if (((NetworkBehaviour)this).IsServer)
{
Vector3 val = ((Component)this).transform.position + ((Component)this).transform.forward * 1f;
Vector3 val2 = val - ((Component)this).transform.position;
Vector3 position = ((Component)this).transform.position - ((Vector3)(ref val2)).normalized * 20f;
GameObject[] array = allAINodes.OrderBy((GameObject x) => Vector3.Distance(position, x.transform.position)).ToArray();
SetDestinationToPosition(array[0].transform.position);
agent.speed = RunningSpeed;
}
}
private void PlayBark(AudioClip[] array, bool audible = true, float volumeScale = 1f)
{
//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
int num = random.Next(0, array.Length);
float num2 = (float)random.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f * volumeScale;
float pitch = (float)random.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f;
audioSource.pitch = pitch;
audioSource.PlayOneShot(array[num], num2);
WalkieTalkie.TransmitOneShotAudio(audioSource, array[num], num2 - 0.4f);
if (audible)
{
float num3 = (base.isInElevator ? (noiseRange - 2.5f) : noiseRange);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, num3, num2, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 8881);
}
}
public void SetDestinationToPosition(Vector3 position, bool checkForPath = false)
{
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
if (checkForPath)
{
position = RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, 1.75f, -1);
navmeshPath = new NavMeshPath();
if (!agent.CalculatePath(position, navmeshPath))
{
Debug.Log((object)(((Object)((Component)this).gameObject).name + " calculatepath returned false."));
return;
}
if (Vector3.Distance(navmeshPath.corners[navmeshPath.corners.Length - 1], RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, 2.7f, -1)) > 1.55f)
{
Debug.Log((object)(((Object)((Component)this).gameObject).name + " path calculation went wrong."));
return;
}
}
destination = RoundManager.Instance.GetNavMeshPosition(position, RoundManager.Instance.navHit, -1f, -1);
agent.SetDestination(destination);
}
public void SetRandomDestination()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: 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)
Vector3 position = ((Component)this).transform.position + Random.insideUnitSphere * 5f;
agent.speed = WalkingSpeed;
SetDestinationToPosition(position);
}
public void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot, int noiseID)
{
//IL_003f: 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_0097: 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_00a8: 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_00dd: Unknown result type (might be due to invalid IL or missing references)
if (base.isHeld || base.isHeldByEnemy || noiseID == 9991 || noiseID == 75 || noiseID == 94 || base.isInShipRoom || !StartOfRound.Instance.currentLevel.spawnEnemiesAndScrap)
{
return;
}
Vector3 val = noisePosition - ((Component)this).transform.position;
if (!(((Vector3)(ref val)).magnitude < 5f) || !(noiseLoudness > 0.8f))
{
return;
}
PlayBark(fleeSFX);
if (((NetworkBehaviour)this).IsServer)
{
Vector3 position = ((Component)this).transform.position - ((Vector3)(ref val)).normalized * 20f;
GameObject[] array = allAINodes.OrderBy((GameObject x) => Vector3.Distance(position, x.transform.position)).ToArray();
SetDestinationToPosition(array[0].transform.position);
agent.speed = RunningSpeed;
timeBeforeNextMove = Random.Range(MoveInterval.x + 1f, MoveInterval.y + 2f);
}
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_BocchiSlugItem()
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Expected O, but got Unknown
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Expected O, but got Unknown
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Expected O, but got Unknown
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(368065054u, new RpcReceiveHandler(__rpc_handler_368065054));
NetworkManager.__rpc_func_table.Add(1924589638u, new RpcReceiveHandler(__rpc_handler_1924589638));
NetworkManager.__rpc_func_table.Add(59308589u, new RpcReceiveHandler(__rpc_handler_59308589));
NetworkManager.__rpc_func_table.Add(4074308177u, new RpcReceiveHandler(__rpc_handler_4074308177));
NetworkManager.__rpc_func_table.Add(3013987970u, new RpcReceiveHandler(__rpc_handler_3013987970));
NetworkManager.__rpc_func_table.Add(4228274978u, new RpcReceiveHandler(__rpc_handler_4228274978));
NetworkManager.__rpc_func_table.Add(3872518474u, new RpcReceiveHandler(__rpc_handler_3872518474));
NetworkManager.__rpc_func_table.Add(439399333u, new RpcReceiveHandler(__rpc_handler_439399333));
}
private static void __rpc_handler_368065054(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)1;
((BocchiSlugItem)(object)target).StopSlugFleeServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1924589638(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;
((BocchiSlugItem)(object)target).StopSlugFleeClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_59308589(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: 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_00ab: 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_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
bool sit = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref sit, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((BocchiSlugItem)(object)target).MakeSlugSitServerRpc(sit);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4074308177(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool sit = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref sit, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)2;
((BocchiSlugItem)(object)target).MakeSlugSitClientRpc(sit);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3013987970(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)1;
((BocchiSlugItem)(object)target).BarkServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4228274978(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;
((BocchiSlugItem)(object)target).BarkClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3872518474(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: 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_0055: Invalid comparison between Unknown and I4
NetworkManager networkManager = target.NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if (rpcParams.Server.Receive.SenderClientId != target.OwnerClientId)
{
if ((int)networkManager.LogLevel <= 1)
{
Debug.LogError((object)"Only the owner can invoke a ServerRpc that requires ownership!");
}
}
else
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((BocchiSlugItem)(object)target).PlayerSpottedServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_439399333(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;
((BocchiSlugItem)(object)target).PlayerSpottedClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "BocchiSlugItem";
}
}
[BepInPlugin("Mordeca1007.FreakySlugs", "Freaky Slugs", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class FreakySlugsBase : BaseUnityPlugin
{
public static class Assets
{
public static string mainAssetBundleName = "freakyslugs";
public static AssetBundle MainAssetBundle = null;
private static string GetAssemblyName()
{
return Assembly.GetExecutingAssembly().FullName.Split(new char[1] { ',' })[0];
}
public static void PopulateAssets()
{
if ((Object)(object)MainAssetBundle == (Object)null)
{
using (Stream stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetAssemblyName() + "." + mainAssetBundleName))
{
MainAssetBundle = AssetBundle.LoadFromStream(stream);
}
}
}
}
private const string modGUID = "Mordeca1007.FreakySlugs";
private const string modName = "Freaky Slugs";
private const string modVersion = "1.0.0";
private static ConfigEntry<int> spawnRate;
private readonly Harmony harmony = new Harmony("Mordeca1007.FreakySlugs");
public static FreakySlugsBase Instance;
internal static ManualLogSource mls;
private void Awake()
{
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
mls = Logger.CreateLogSource("Mordeca1007.FreakySlugs");
PatchNetcode();
Assets.PopulateAssets();
spawnRate = ((BaseUnityPlugin)this).Config.Bind<int>("FreakySlugs", "Spawn rate", 20, "[Server-side] Sets the slug's spawn rate (This affects all moons).");
harmony.PatchAll(typeof(FreakySlugsBase));
mls.LogInfo((object)"Initialized Freaky Slugs");
}
private void PatchNetcode()
{
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);
}
}
}
}
[HarmonyPatch(typeof(GameNetworkManager), "Start")]
[HarmonyPostfix]
private static void AddFreakySlugsToNetworkManager(GameNetworkManager __instance)
{
GameObject[] array = Assets.MainAssetBundle.LoadAllAssets<GameObject>();
foreach (GameObject val in array)
{
if ((Object)(object)val.GetComponent<NetworkObject>() != (Object)null)
{
((Component)__instance).GetComponent<NetworkManager>().AddNetworkPrefab(val);
}
}
mls.LogInfo((object)"Added FreakySlugs prefabs to Network Manager.");
}
[HarmonyPatch(typeof(StartOfRound), "Awake")]
[HarmonyPostfix]
private static void AddFreakySlugsToItems(StartOfRound __instance)
{
Item val = Assets.MainAssetBundle.LoadAsset<Item>("BocchiSlugItem");
Item[] array = Assets.MainAssetBundle.LoadAllAssets<Item>();
foreach (Item item in array)
{
if (!__instance.allItemsList.itemsList.Contains(item))
{
__instance.allItemsList.itemsList.Add(item);
}
}
mls.LogInfo((object)"Added FreakySlugs items to items list.");
}
[HarmonyPatch(typeof(RoundManager), "Start")]
[HarmonyPostfix]
private static void AddFreakySlugsToAllLevels(RoundManager __instance)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
Item item = Assets.MainAssetBundle.LoadAsset<Item>("BocchiSlugItem");
SpawnableItemWithRarity val = new SpawnableItemWithRarity();
val.rarity = spawnRate.Value;
val.spawnableItem = item;
SelectableLevel[] levels = StartOfRound.Instance.levels;
foreach (SelectableLevel val2 in levels)
{
if (!val2.spawnableScrap.Any((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)item))
{
val2.spawnableScrap.Add(val);
}
}
mls.LogInfo((object)"Added FreakySlugs to all levels.");
}
[HarmonyPatch(typeof(WalkieTalkie), "GetAllAudioSourcesToReplay")]
[HarmonyPrefix]
private static bool GetAllAudioSourcesToReplay(WalkieTalkie __instance)
{
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null || !((GrabbableObject)__instance).playerHeldBy.speakingToWalkieTalkie || !((GrabbableObject)__instance).isBeingUsed)
{
return false;
}
int num = Physics.OverlapSphereNonAlloc(((Component)__instance).transform.position, __instance.recordingRange, __instance.collidersInRange, 11010632, (QueryTriggerInteraction)2);
for (int i = 0; i < num; i++)
{
Debug.Log((object)((Object)((Component)__instance.collidersInRange[i]).gameObject).name);
if (!Object.op_Implicit((Object)(object)((Component)__instance.collidersInRange[i]).gameObject.GetComponent<WalkieTalkie>()))
{
AudioSource component = ((Component)__instance.collidersInRange[i]).GetComponent<AudioSource>();
if ((Object)(object)component != (Object)null && component.isPlaying && (Object)(object)component.clip != (Object)null && component.time > 0f && !__instance.audioSourcesToReplay.Contains(component) && ((Component)component).gameObject.activeInHierarchy)
{
__instance.audioSourcesToReplay.Add(component);
}
}
}
return false;
}
[HarmonyPatch(typeof(HoarderBugAI), "GrabTargetItemIfClose")]
[HarmonyPrefix]
private static bool GrabTargetItemIfClose(HoarderBugAI __instance)
{
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: 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_0081: 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)
float num = ((__instance.targetItem is BocchiSlugItem) ? 1f : 0.75f);
if ((Object)(object)__instance.targetItem != (Object)null && __instance.heldItem == null && Vector3.Distance(((Component)__instance).transform.position, ((Component)__instance.targetItem).transform.position) < num)
{
if (!((EnemyAI)__instance).SetDestinationToPosition(__instance.nestPosition, true))
{
__instance.nestPosition = ((EnemyAI)__instance).ChooseClosestNodeToPosition(((Component)__instance).transform.position, false, 0).position;
((EnemyAI)__instance).SetDestinationToPosition(__instance.nestPosition, false);
}
NetworkObject component = ((Component)__instance.targetItem).GetComponent<NetworkObject>();
((EnemyAI)__instance).SwitchToBehaviourStateOnLocalClient(1);
__instance.GrabItem(component);
__instance.sendingGrabOrDropRPC = true;
__instance.GrabItemServerRpc(NetworkObjectReference.op_Implicit(component));
return true;
}
return false;
}
}
public class NoiseListenerRedirect : MonoBehaviour, INoiseListener
{
private INoiseListener target;
public void Awake()
{
target = ((Component)((Component)this).transform.parent).GetComponent<INoiseListener>();
}
public void DetectNoise(Vector3 noisePosition, float noiseLoudness, int timesPlayedInOneSpot, int noiseID)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
INoiseListener obj = target;
if (obj != null)
{
obj.DetectNoise(noisePosition, noiseLoudness, timesPlayedInOneSpot, noiseID);
}
}
}
}