using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
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 HarmonyLib;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("Nuclear_Fox.SmilingCritters")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("2.1.1.0")]
[assembly: AssemblyInformationalVersion("2.1.1")]
[assembly: AssemblyProduct("SmilingCritters")]
[assembly: AssemblyTitle("Nuclear_Fox.SmilingCritters")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.1.1.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;
}
}
}
namespace SmilingCritters
{
internal class CreatureConfig
{
private static LevelTypes chosenCreatureRegistrationMethod;
private static SmilingCritters.RarityAddTypes defaultCreatureRegistrationMethod;
private static int bobbyRuinedRarity;
private static int bubbaRuinedRarity;
private static int catnapRuinedRarity;
private static int craftyRuinedRarity;
private static int dogdayRuinedRarity;
private static int hoppyRuinedRarity;
private static int kickinRuinedRarity;
private static int pickyRuinedRarity;
internal static void RegisterAllCritters(SmilingCritters Instance)
{
string[] array = new string[8] { "Bobby", "Catnap", "Bubba", "Crafty", "Dogday", "Hoppy", "Kickin", "Picky" };
createConfigEntries(Instance);
ConfigureAndRegisterCritter(array[0], bobbyRuinedRarity);
ConfigureAndRegisterCritter(array[1], bubbaRuinedRarity);
ConfigureAndRegisterCritter(array[2], catnapRuinedRarity);
ConfigureAndRegisterCritter(array[3], craftyRuinedRarity);
ConfigureAndRegisterCritter(array[4], dogdayRuinedRarity);
ConfigureAndRegisterCritter(array[5], hoppyRuinedRarity);
ConfigureAndRegisterCritter(array[6], kickinRuinedRarity);
ConfigureAndRegisterCritter(array[7], pickyRuinedRarity);
}
internal static void createConfigEntries(SmilingCritters Instance)
{
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
ConfigEntry<SmilingCritters.RarityAddTypes> val = ((BaseUnityPlugin)Instance).Config.Bind<SmilingCritters.RarityAddTypes>("Creatures", "Registration Method", SmilingCritters.RarityAddTypes.All, "The method to add scrap to the level. \n Default = All \n Vanilla \n Modded \n List (Not yet implemented for creatures, defaults to All)");
EnumDropDownConfigItem<SmilingCritters.RarityAddTypes> val2 = new EnumDropDownConfigItem<SmilingCritters.RarityAddTypes>(val);
switch (val.Value)
{
case SmilingCritters.RarityAddTypes.All:
chosenCreatureRegistrationMethod = (LevelTypes)(-1);
break;
case SmilingCritters.RarityAddTypes.Vanilla:
chosenCreatureRegistrationMethod = (LevelTypes)15356;
break;
case SmilingCritters.RarityAddTypes.Modded:
chosenCreatureRegistrationMethod = (LevelTypes)1024;
break;
case SmilingCritters.RarityAddTypes.List:
chosenCreatureRegistrationMethod = (LevelTypes)(-1);
break;
}
ConfigEntry<int> val3 = Instance.CreateIntSliderConfig("Bobby Bearhug Critter", 10, "Adjust how often you see the enemy Bobby Bearhug as a ruined critter.", 0, 100, "Creatures");
bobbyRuinedRarity = val3.Value;
ConfigEntry<int> val4 = Instance.CreateIntSliderConfig("Bubba Bubbaphant Critter", 10, "Adjust how often you see the enemy Bubba Bubbaphant as a ruined critter.", 0, 100, "Creatures");
bubbaRuinedRarity = val3.Value;
ConfigEntry<int> val5 = Instance.CreateIntSliderConfig("Catnap Critter", 10, "Adjust how often you see the enemy Catnap as a ruined critter.", 0, 100, "Creatures");
catnapRuinedRarity = val3.Value;
ConfigEntry<int> val6 = Instance.CreateIntSliderConfig("Craftycorn Critter", 10, "Adjust how often you see the enemy Craftycorn as a ruined critter.", 0, 100, "Creatures");
craftyRuinedRarity = val3.Value;
ConfigEntry<int> val7 = Instance.CreateIntSliderConfig("Dogday Critter", 10, "Adjust how often you see the enemy Dogday as a ruined critter.", 0, 100, "Creatures");
dogdayRuinedRarity = val3.Value;
ConfigEntry<int> val8 = Instance.CreateIntSliderConfig("Hoppy Hopscotch Critter", 10, "Adjust how often you see the enemy Hoppy Hopscotch as a ruined critter.", 0, 100, "Creatures");
hoppyRuinedRarity = val3.Value;
ConfigEntry<int> val9 = Instance.CreateIntSliderConfig("Kickin Chicken Critter", 10, "Adjust how often you see the enemy Kickin Chicken as a ruined critter.", 0, 100, "Creatures");
kickinRuinedRarity = val3.Value;
ConfigEntry<int> val10 = Instance.CreateIntSliderConfig("Picky Piggy Critter", 10, "Adjust how often you see the enemy Picky Piggy as a ruined critter.", 0, 100, "Creatures");
pickyRuinedRarity = val3.Value;
}
private static void ConfigureAndRegisterCritter(string critterName, int rarity)
{
//IL_0426: Unknown result type (might be due to invalid IL or missing references)
string text = critterName + "RuinedEnemyType";
EnemyType val = SmilingCritters.assetBundle.LoadAsset<EnemyType>(text);
GameObject enemyPrefab = val.enemyPrefab;
RuinedCritterAI ruinedCritterAI = enemyPrefab.AddComponent<RuinedCritterAI>();
((EnemyAI)ruinedCritterAI).creatureVoice = enemyPrefab.GetComponent<AudioSource>();
((EnemyAI)ruinedCritterAI).creatureSFX = enemyPrefab.GetComponent<AudioSource>();
((EnemyAI)ruinedCritterAI).agent = enemyPrefab.GetComponent<NavMeshAgent>();
((EnemyAI)ruinedCritterAI).creatureAnimator = enemyPrefab.GetComponent<Animator>();
((EnemyAI)ruinedCritterAI).exitVentAnimationTime = 1f;
((EnemyAI)ruinedCritterAI).eye = enemyPrefab.transform.Find("Eye");
((EnemyAI)ruinedCritterAI).enemyType = val;
((EnemyAI)ruinedCritterAI).updatePositionThreshold = 0.25f;
((EnemyAI)ruinedCritterAI).syncMovementSpeed = 0.15f;
((EnemyAI)ruinedCritterAI).enemyBehaviourStates = (EnemyBehaviourState[])(object)new EnemyBehaviourState[4];
ruinedCritterAI.head = FindDeepChild(enemyPrefab.transform, "JNT_Head");
((EnemyAI)ruinedCritterAI).enemyHP = 5;
((EnemyAI)ruinedCritterAI).AIIntervalTime = 0.11f;
ruinedCritterAI.eyeComponentReference = ((Component)enemyPrefab.transform.Find(critterName + "Eyes")).GetComponent<SkinnedMeshRenderer>();
ruinedCritterAI.whiteEyeMaterial = SmilingCritters.assetBundle.LoadAsset<Material>("RuinedSmallEyeMaterial");
ruinedCritterAI.redEyeMaterial = SmilingCritters.assetBundle.LoadAsset<Material>("RedEyesCritters");
string text2 = critterName + "RuinedModelContainer";
((Component)enemyPrefab.transform.Find(text2)).GetComponent<EnemyAICollisionDetect>().mainScript = (EnemyAI)(object)ruinedCritterAI;
ruinedCritterAI.biteSFX = ((Component)enemyPrefab.transform.Find("BiteSFX")).GetComponent<AudioSource>();
ruinedCritterAI.creepySFX = ((Component)enemyPrefab.transform.Find("CreepySFX")).GetComponent<AudioSource>();
ruinedCritterAI.injuredSFX = ((Component)enemyPrefab.transform.Find("InjuredSFX")).GetComponent<AudioSource>();
ruinedCritterAI.growlSFX = ((Component)enemyPrefab.transform.Find("GrowlSFX")).GetComponent<AudioSource>();
ruinedCritterAI.footstepClips = (AudioClip[])(object)new AudioClip[8];
ruinedCritterAI.footstepClips[0] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterFootstep1");
ruinedCritterAI.footstepClips[1] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterFootstep2");
ruinedCritterAI.footstepClips[2] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterFootstep3");
ruinedCritterAI.footstepClips[3] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterFootstep4");
ruinedCritterAI.footstepClips[4] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterFootstep5");
ruinedCritterAI.footstepClips[5] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterFootstep6");
ruinedCritterAI.footstepClips[6] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterFootstep7");
ruinedCritterAI.footstepClips[7] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterFootstep8");
ruinedCritterAI.biteClips = (AudioClip[])(object)new AudioClip[7];
ruinedCritterAI.biteClips[0] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterBite1");
ruinedCritterAI.biteClips[1] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterBite2");
ruinedCritterAI.biteClips[2] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterBite3");
ruinedCritterAI.biteClips[3] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterBite4");
ruinedCritterAI.biteClips[4] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterBite5");
ruinedCritterAI.biteClips[5] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterBite6");
ruinedCritterAI.biteClips[6] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterBite7");
ruinedCritterAI.injuredClips = (AudioClip[])(object)new AudioClip[4];
ruinedCritterAI.injuredClips[0] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterInjured1");
ruinedCritterAI.injuredClips[1] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterInjured2");
ruinedCritterAI.injuredClips[2] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterInjured3");
ruinedCritterAI.injuredClips[3] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("CritterInjured4");
ruinedCritterAI.deathClips = (AudioClip[])(object)new AudioClip[3];
ruinedCritterAI.deathClips[0] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("SmilingCritterDeath1");
ruinedCritterAI.deathClips[1] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("SmilingCritterDeath2");
ruinedCritterAI.deathClips[2] = SmilingCritters.assetBundle.LoadAsset<AudioClip>("SmilingCritterDeath3");
NetworkPrefabs.RegisterNetworkPrefab(enemyPrefab);
string text3 = critterName + " Critter Node";
string text4 = critterName + " Critter Keyword";
TerminalNode val2 = SmilingCritters.assetBundle.LoadAsset<TerminalNode>(text3);
TerminalKeyword val3 = SmilingCritters.assetBundle.LoadAsset<TerminalKeyword>(text4);
if (rarity < 0 || rarity > 100)
{
rarity = 10;
}
Enemies.RegisterEnemy(val, rarity, chosenCreatureRegistrationMethod, val2, val3);
}
public static Transform FindDeepChild(Transform parent, string childName)
{
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Expected O, but got Unknown
foreach (Transform item in parent)
{
Transform val = item;
if (((Object)val).name == childName)
{
return val;
}
Transform val2 = FindDeepChild(val, childName);
if ((Object)(object)val2 != (Object)null)
{
return val2;
}
}
return null;
}
}
public class CymbalClashBunzoBunny : MonoBehaviour
{
public AudioClip soundClip;
public float noiseRange;
public float loudness;
public float minLoudness;
public float maxLoudness;
public float minPitch;
public float maxPitch;
public AudioSource audioSource;
private PlayerControllerB playerHeldBy;
private bool isInElevator;
private AnimatedItem animatedItemReference;
public void Start()
{
audioSource = ((Component)this).GetComponent<AudioSource>();
animatedItemReference = ((Component)this).GetComponent<AnimatedItem>();
noiseRange = 35f;
loudness = 1f;
minLoudness = 0.9f;
maxLoudness = 1f;
minPitch = 0.94f;
maxPitch = 1f;
}
public void CymbalClash()
{
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)audioSource != (Object)null && (Object)(object)soundClip != (Object)null)
{
if ((Object)(object)animatedItemReference != (Object)null)
{
playerHeldBy = ((GrabbableObject)animatedItemReference).playerHeldBy;
isInElevator = ((GrabbableObject)animatedItemReference).isInElevator;
}
float num = Random.Range(minLoudness, maxLoudness);
float pitch = Random.Range(minPitch, maxPitch);
audioSource.pitch = pitch;
audioSource.PlayOneShot(soundClip, num);
WalkieTalkie.TransmitOneShotAudio(audioSource, soundClip, num);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, num, 0, isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
if (minLoudness >= 0.6f && (Object)(object)playerHeldBy != (Object)null)
{
playerHeldBy.timeSinceMakingLoudNoise = 0f;
}
}
}
}
internal static class MonsterUtility
{
public static PlayerControllerB CheckLineOfSightForClosestPlayerOptimized(EnemyAI enemy, float width = 360f, int range = 60, int proximityAwareness = -1, float bufferDistance = 0f)
{
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: 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_0073: 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_0096: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: 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_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_00bb: 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_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
float num = 1000f;
float num2 = 1000f;
int num3 = -1;
PlayerControllerB result = null;
for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
{
PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i];
if ((Object)(object)val == (Object)null || val.isPlayerDead || !val.isInsideFactory)
{
continue;
}
Vector3 position = ((Component)val.gameplayCamera).transform.position;
if (!Physics.Linecast(enemy.eye.position, position, StartOfRound.Instance.collidersAndRoomMaskAndDefault))
{
Vector3 val2 = position - enemy.eye.position;
num = Vector3.Distance(enemy.eye.position, position);
if ((Vector3.Angle(enemy.eye.forward, val2) < width || (proximityAwareness != -1 && num < (float)proximityAwareness)) && num < num2)
{
num2 = num;
num3 = i;
}
}
}
if ((Object)(object)enemy.targetPlayer != (Object)null && num3 != -1 && (Object)(object)enemy.targetPlayer != (Object)(object)StartOfRound.Instance.allPlayerScripts[num3] && bufferDistance > 0f && Mathf.Abs(num2 - Vector3.Distance(((Component)enemy).transform.position, ((Component)enemy.targetPlayer).transform.position)) < bufferDistance)
{
return null;
}
if (num3 < 0)
{
return null;
}
enemy.mostOptimalDistance = num2;
if (num3 >= 0)
{
result = StartOfRound.Instance.allPlayerScripts[num3];
}
return result;
}
}
public class NoiseMakerCycle : GrabbableObject
{
public AudioSource noiseAudio;
public AudioSource noiseAudioFar;
[Space(3f)]
public AudioClip[] noiseSFX;
public AudioClip[] noiseSFXFar;
[Space(3f)]
public float noiseRange;
public float maxLoudness;
public float minLoudness;
public float minPitch;
public float maxPitch;
private Random noisemakerRandom;
public int currentSelectedSoundEffect;
public Animator triggerAnimator;
public override void Start()
{
((GrabbableObject)this).Start();
noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
currentSelectedSoundEffect = 0;
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).ItemActivate(used, buttonDown);
if (!((Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)null))
{
int num = currentSelectedSoundEffect;
float num2 = (float)noisemakerRandom.Next((int)(minLoudness * 100f), (int)(maxLoudness * 100f)) / 100f;
float pitch = (float)noisemakerRandom.Next((int)(minPitch * 100f), (int)(maxPitch * 100f)) / 100f;
noiseAudio.pitch = pitch;
noiseAudio.PlayOneShot(noiseSFX[num], num2);
if ((Object)(object)noiseAudioFar != (Object)null)
{
noiseAudioFar.pitch = pitch;
noiseAudioFar.PlayOneShot(noiseSFXFar[num], num2);
}
if ((Object)(object)triggerAnimator != (Object)null)
{
triggerAnimator.SetTrigger("playAnim");
}
WalkieTalkie.TransmitOneShotAudio(noiseAudio, noiseSFX[num], num2);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, num2, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
if (minLoudness >= 0.6f && (Object)(object)base.playerHeldBy != (Object)null)
{
base.playerHeldBy.timeSinceMakingLoudNoise = 0f;
}
currentSelectedSoundEffect++;
if (currentSelectedSoundEffect >= noiseSFX.Length)
{
currentSelectedSoundEffect = 0;
}
}
}
}
public class RuinedCritterAI : EnemyAI
{
public enum Personality
{
Hyperaggressive,
Aggressive,
Balanced
}
private enum BehaviorState
{
Observing,
Chasing,
Retreating,
Leaving
}
public AISearchRoutine searchForPlayers;
private static Random rngGenerator;
private static Vector3 mainEntrancePosition;
private static Vector3 furthestFromMainEntrancePosition;
public Transform head;
private bool rotatingHeadTowardsPlayer = true;
private Vector3 defaultHeadEulerAngles = new Vector3(10.782f, -2.204f, 80.168f);
private float maxYRotation = 35f;
private float minYRotation = -35f;
private float maxZRotation = 60f;
private float headRotationSpeed = 4f;
private bool rotatingTowardsTargetPlayer = true;
public float bodyRotationThreshold = 60f;
public float bodyRotationSpeed = 4f;
public Quaternion targetBodyRotation;
public bool rotatingBody = false;
public int rotateBodyDirection = 0;
private float reservedRotationSpeed;
private Vector3 initialHeadPosition = new Vector3(-0.001192911f, 0.00021f, 2.9E-05f);
private Vector3 targetHeadPosition = new Vector3(-0.001652f, -0.000247f, -7.6E-05f);
private float headZMaxYRot = 0.0008f;
private float headZMinYRot = -0.0008f;
private float defaultHeadZPos = 2.9E-05f;
public Personality personality;
private bool constantAggression = false;
private float agentMultiplier;
private float minTimeToGrowlScreech = 7f;
private float maxTimeToGrowlScreech = 14f;
private float currentTimeUntilNextGrowlScreech = 14f;
public bool fleeing = false;
public bool fleePositionFound = false;
private float fleeTime;
public float currentFleeTime = 0f;
public int timesToFlee = 2;
private float aggressionTime = 50f;
public float currentAggressionTime = 0f;
public PlayerControllerB targetObservedLast;
public Vector3 fleeDestination;
public Vector3 leaveDestination;
public bool leaveDestinationFound = false;
public bool leavingLOS = false;
private float leaveTimeLOS = 6f;
public float currentLeaveTimeLOS = 0f;
public float timeSinceHittingPlayer = 0f;
private float observationTime = 0f;
public float currentObservationTime = 0f;
public bool atObservationPost = false;
public AudioSource biteSFX;
public AudioSource injuredSFX;
public AudioSource creepySFX;
public AudioSource growlSFX;
public AudioClip[] footstepClips;
public AudioClip[] biteClips;
public AudioClip[] injuredClips;
public AudioClip[] creepyClips;
public AudioClip[] growlClips;
public AudioClip[] deathClips;
private bool delayingDamage = false;
private readonly float timeUntilDealingDamage = 0.4f;
private float currentTimeUntilDealingDamage = 0f;
private PlayerControllerB delayedDamageTarget;
private readonly float timeUntilTakingDamageSoundLimit = 2f;
private float currentTimeUntilTakingDamageSoundLimit = 0f;
private bool delayingDamageSoundEffects = false;
public SkinnedMeshRenderer eyeComponentReference;
public Material whiteEyeMaterial;
public Material redEyeMaterial;
public override void Start()
{
//IL_0030: 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_0045: 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_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).Start();
if (rngGenerator == null)
{
rngGenerator = new Random(StartOfRound.Instance.randomMapSeed + 1338);
}
_ = mainEntrancePosition;
if (false)
{
mainEntrancePosition = RoundManager.FindMainEntrancePosition(false, false);
furthestFromMainEntrancePosition = ((EnemyAI)this).ChooseFarthestNodeFromPosition(mainEntrancePosition, false, 0, false, 50, false).position;
}
personality = (Personality)rngGenerator.Next(2);
switch (personality)
{
case Personality.Hyperaggressive:
agentMultiplier = 2f;
base.agent.angularSpeed = base.agent.angularSpeed * agentMultiplier;
minTimeToGrowlScreech /= agentMultiplier;
maxTimeToGrowlScreech /= agentMultiplier;
timesToFlee = 2;
aggressionTime = 50f;
observationTime = 6f;
fleeTime = 20f;
break;
case Personality.Aggressive:
agentMultiplier = 1.3f;
base.agent.angularSpeed = base.agent.angularSpeed * agentMultiplier;
minTimeToGrowlScreech /= agentMultiplier;
maxTimeToGrowlScreech /= agentMultiplier;
aggressionTime = 45f;
observationTime = 12f;
fleeTime = 25f;
break;
case Personality.Balanced:
agentMultiplier = 1f;
observationTime = 18f;
aggressionTime = 45f;
fleeTime = 35f;
break;
}
reservedRotationSpeed = base.agent.angularSpeed;
if (base.creatureAnimator.layerCount == 2)
{
base.creatureAnimator.SetLayerWeight(1, 0f);
}
}
public override void DoAIInterval()
{
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_04d1: Unknown result type (might be due to invalid IL or missing references)
//IL_04e1: Unknown result type (might be due to invalid IL or missing references)
//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
//IL_04f4: Unknown result type (might be due to invalid IL or missing references)
//IL_051a: Unknown result type (might be due to invalid IL or missing references)
//IL_0578: Unknown result type (might be due to invalid IL or missing references)
//IL_057e: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_03f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0406: Unknown result type (might be due to invalid IL or missing references)
//IL_040b: Unknown result type (might be due to invalid IL or missing references)
//IL_040e: Unknown result type (might be due to invalid IL or missing references)
//IL_0410: Unknown result type (might be due to invalid IL or missing references)
//IL_0416: Unknown result type (might be due to invalid IL or missing references)
//IL_045d: Unknown result type (might be due to invalid IL or missing references)
//IL_043a: Unknown result type (might be due to invalid IL or missing references)
//IL_043f: 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)
//IL_0470: Unknown result type (might be due to invalid IL or missing references)
//IL_0476: Unknown result type (might be due to invalid IL or missing references)
((EnemyAI)this).DoAIInterval();
if (StartOfRound.Instance.allPlayersDead || base.enemyHP < 0)
{
return;
}
if (!((NetworkBehaviour)this).IsServer)
{
((EnemyAI)this).ChangeOwnershipOfEnemy(StartOfRound.Instance.allPlayerScripts[0].actualClientId);
}
bool flag = false;
for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
{
if (StartOfRound.Instance.allPlayerScripts[i].isInsideFactory)
{
if (searchForPlayers.inProgress)
{
((EnemyAI)this).StopSearch(searchForPlayers, true);
}
flag = true;
break;
}
}
if (!flag && (base.currentBehaviourStateIndex == 1 || base.currentBehaviourStateIndex == 0))
{
if (!searchForPlayers.inProgress)
{
((EnemyAI)this).StartSearch(((Component)this).transform.position, searchForPlayers);
}
return;
}
float distanceFromPlayer = GetDistanceFromPlayer(base.targetPlayer);
switch (base.currentBehaviourStateIndex)
{
case 0:
if (currentObservationTime >= observationTime)
{
SwitchFromObservingToFleeing();
break;
}
switch (personality)
{
case Personality.Hyperaggressive:
ChooseStalkTarget();
ObserveFromDistance(distanceFromPlayer, 4f);
break;
case Personality.Aggressive:
ChooseStalkTarget();
ObserveFromDistance(distanceFromPlayer, 5f);
break;
case Personality.Balanced:
ChooseStalkTarget();
ObserveFromDistance(distanceFromPlayer, 5f);
break;
}
break;
case 1:
if (currentAggressionTime > aggressionTime && timesToFlee > 0)
{
currentAggressionTime = 0f;
timesToFlee--;
if (timesToFlee <= 0)
{
((EnemyAI)this).SwitchToBehaviourState(3);
break;
}
fleeing = true;
((EnemyAI)this).SwitchToBehaviourState(2);
}
else if ((Object)(object)base.targetPlayer != (Object)null && !base.targetPlayer.isPlayerDead)
{
((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, false);
}
else if (flag)
{
((EnemyAI)this).TargetClosestPlayer(0f, false, 360f);
}
break;
case 2:
if (currentFleeTime > fleeTime)
{
fleeing = false;
currentFleeTime = 0f;
fleePositionFound = false;
if ((Object)(object)targetObservedLast != (Object)null && !targetObservedLast.isPlayerDead)
{
base.targetPlayer = targetObservedLast;
}
else
{
((EnemyAI)this).TargetClosestPlayer(0f, false, 360f);
}
base.moveTowardsDestination = false;
base.movingTowardsTargetPlayer = true;
CritterSendStringClientRcp("setEyeColorRed");
((Renderer)eyeComponentReference).SetMaterial(redEyeMaterial);
((EnemyAI)this).SwitchToBehaviourState(1);
break;
}
if ((Object)(object)((Renderer)eyeComponentReference).material != (Object)(object)whiteEyeMaterial)
{
((Renderer)eyeComponentReference).SetMaterial(whiteEyeMaterial);
CritterSendStringClientRcp("setEyeColorWhite");
}
if (base.agent.speed < 5f)
{
base.agent.speed = 6f;
}
rotatingBody = false;
rotatingTowardsTargetPlayer = false;
if ((Object)(object)base.targetPlayer != (Object)null && !fleePositionFound && !base.targetPlayer.isPlayerDead)
{
((EnemyAI)this).SetDestinationToPosition(fleeDestination = ((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, false, 0, false, 50, false).position, true);
fleePositionFound = true;
}
else if (!fleePositionFound)
{
fleeDestination = furthestFromMainEntrancePosition;
((EnemyAI)this).SetDestinationToPosition(furthestFromMainEntrancePosition, false);
fleePositionFound = true;
}
else
{
((EnemyAI)this).SetDestinationToPosition(furthestFromMainEntrancePosition, true);
}
if (Vector3.Distance(((Component)this).transform.position, fleeDestination) < 1f)
{
fleePositionFound = false;
}
break;
case 3:
{
if (currentLeaveTimeLOS > leaveTimeLOS)
{
((EnemyAI)this).KillEnemy(true);
}
if (!leaveDestinationFound)
{
leaveDestination = ((EnemyAI)this).ChooseFarthestNodeFromPosition(((Component)this).transform.position, true, 0, false, 50, false).position;
leaveDestinationFound = true;
((EnemyAI)this).SetDestinationToPosition(leaveDestination, true);
}
for (int j = 0; j < StartOfRound.Instance.allPlayerScripts.Length; j++)
{
if (StartOfRound.Instance.allPlayerScripts[j].HasLineOfSightToPosition(((Component)this).transform.position, 360f, 100, -1f))
{
currentLeaveTimeLOS = 0f;
leavingLOS = false;
}
else
{
leavingLOS = true;
}
}
if (Vector3.Distance(((Component)this).transform.position, leaveDestination) < 1f && leaveDestinationFound)
{
leaveDestinationFound = false;
}
break;
}
}
}
private void SwitchFromObservingToFleeing()
{
fleeing = true;
atObservationPost = false;
currentObservationTime = 0f;
rotatingTowardsTargetPlayer = false;
SetAnimationState("Forward");
if (base.creatureAnimator.GetCurrentStateName(0).Equals("Bobby_Ruined_Strafe_Left") || base.creatureAnimator.GetCurrentStateName(0).Equals("Bobby_Ruined_Strafe_Right"))
{
base.creatureAnimator.Play("setForward", 0);
}
base.creatureAnimator.speed = 2f;
base.agent.speed = 6f;
base.agent.angularSpeed = 135f;
((EnemyAI)this).SwitchToBehaviourState(2);
targetObservedLast = base.targetPlayer;
CritterSendStringClientRcp("setTransitionObserveToFleeing");
}
private void SwitchFromObservingToFleeingEarly()
{
fleeing = true;
atObservationPost = false;
currentObservationTime = 0f;
rotatingTowardsTargetPlayer = false;
SetAnimationState("Forward");
base.creatureAnimator.speed = 2f;
base.agent.speed = 6f;
base.agent.angularSpeed = 135f;
((EnemyAI)this).SwitchToBehaviourState(2);
targetObservedLast = base.targetPlayer;
CritterSendStringClientRcp("setTransitionObserveToFleeing");
}
private void SwitchFromChasingEarly()
{
currentAggressionTime = 0f;
timesToFlee--;
if (timesToFlee <= 0)
{
((EnemyAI)this).SwitchToBehaviourState(3);
return;
}
((Renderer)eyeComponentReference).SetMaterial(whiteEyeMaterial);
fleeing = true;
((EnemyAI)this).SwitchToBehaviourState(2);
}
private void ObserveFromDistance(float distanceFromPlayer, float targetObservationDistance)
{
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: 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_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)base.targetPlayer != (Object)null)
{
if (distanceFromPlayer > targetObservationDistance && !atObservationPost)
{
((EnemyAI)this).SetDestinationToPosition(((Component)base.targetPlayer).transform.position, true);
}
if (distanceFromPlayer <= targetObservationDistance && !atObservationPost && ((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer.playerEye).transform.position, 360f, 60, -1f, (Transform)null))
{
base.agent.velocity = Vector3.zero;
base.destination = ((Component)this).transform.position;
reservedRotationSpeed = base.agent.angularSpeed;
base.agent.angularSpeed = 0f;
SetAnimationState("Idling");
CritterSendStringClientRcp("setIdleObservation");
atObservationPost = true;
}
if (atObservationPost && ((double)distanceFromPlayer > (double)targetObservationDistance * 1.7 || !((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer.playerEye).transform.position, 360f, 60, -1f, (Transform)null)))
{
SetAnimationState("Forward");
base.agent.angularSpeed = reservedRotationSpeed;
atObservationPost = false;
CritterSendStringClientRcp("setForwardObservation");
}
}
}
private void ChooseStalkTarget()
{
PlayerControllerB closestPlayer = ((EnemyAI)this).GetClosestPlayer(false, false, false);
if (!((Object)(object)closestPlayer == (Object)(object)base.targetPlayer) && !((Object)(object)closestPlayer == (Object)null) && StartOfRound.Instance.livingPlayers != 0)
{
base.targetPlayer = closestPlayer;
}
}
public override void Update()
{
if (base.isEnemyDead)
{
return;
}
((EnemyAI)this).Update();
RotateTowardsPlayer(base.targetPlayer);
if (rotatingTowardsTargetPlayer && atObservationPost)
{
if (rotatingBody)
{
switch (rotateBodyDirection)
{
case 1:
if (!base.creatureAnimator.GetAnimatorStateName(0, true).Contains("Right"))
{
CritterSendStringClientRcp("setStrafeRight");
SetAnimationState("StrafeRight");
}
break;
case -1:
if (!base.creatureAnimator.GetAnimatorStateName(0, true).Contains("Left"))
{
CritterSendStringClientRcp("setStrafeLeft");
SetAnimationState("StrafeLeft");
}
break;
}
}
else if (!base.creatureAnimator.GetAnimatorStateName(0, true).Contains("Idle"))
{
CritterSendStringClientRcp("setIdle");
SetAnimationState("Idling");
}
}
if (fleeing)
{
currentFleeTime += Time.deltaTime;
}
if (atObservationPost)
{
currentObservationTime += Time.deltaTime;
}
if (base.currentBehaviourStateIndex == 1)
{
currentAggressionTime += Time.deltaTime;
}
if (leaveDestinationFound && leavingLOS)
{
currentLeaveTimeLOS += Time.deltaTime;
}
if (timeSinceHittingPlayer > 0f)
{
timeSinceHittingPlayer -= Time.deltaTime;
}
if (currentTimeUntilDealingDamage > 0f)
{
currentTimeUntilDealingDamage -= Time.deltaTime;
if (currentTimeUntilDealingDamage <= 0f && (Object)(object)delayedDamageTarget != (Object)null)
{
DealDamageAfterDelay(delayedDamageTarget);
delayedDamageTarget = null;
delayingDamage = false;
}
}
if (currentTimeUntilTakingDamageSoundLimit > 0f)
{
currentTimeUntilTakingDamageSoundLimit -= Time.deltaTime;
if (currentTimeUntilTakingDamageSoundLimit <= 0f)
{
delayingDamageSoundEffects = false;
}
}
}
public void LateUpdate()
{
if (rotatingHeadTowardsPlayer && !base.isEnemyDead)
{
RotateHeadTowardsNearestPlayer();
}
}
private float GetDistanceFromPlayer(PlayerControllerB player)
{
//IL_0013: 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)
if ((Object)(object)player != (Object)null)
{
return Vector3.Distance(((Component)this).transform.position, ((Component)player).transform.position);
}
return -1f;
}
private void RotateTowardsPlayer(PlayerControllerB player)
{
//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_00d1: 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)
//IL_0127: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: 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_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)
//IL_009f: 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_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)player == (Object)null || !atObservationPost || GetDistanceFromPlayer(player) < 0.5f || GetDistanceFromPlayer(player) > 15f)
{
return;
}
float rotationAngleTowardsTargetPlayer = GetRotationAngleTowardsTargetPlayer(player);
float num = Mathf.Abs(rotationAngleTowardsTargetPlayer);
if (num > bodyRotationThreshold)
{
if (rotationAngleTowardsTargetPlayer > 0f)
{
rotateBodyDirection = 1;
}
else
{
rotateBodyDirection = -1;
}
Vector3 val = ((Component)player).transform.position - ((Component)this).transform.position;
val.y = 0f;
targetBodyRotation = Quaternion.LookRotation(val);
rotatingBody = true;
}
Quaternion rotation = ((Component)this).transform.rotation;
if (Math.Abs(((Quaternion)(ref rotation)).eulerAngles.y - ((Quaternion)(ref targetBodyRotation)).eulerAngles.y) < 5f)
{
rotatingBody = false;
rotateBodyDirection = 0;
}
if (rotatingBody)
{
((Component)this).transform.rotation = Quaternion.Slerp(((Component)this).transform.rotation, targetBodyRotation, bodyRotationSpeed * Time.deltaTime);
}
}
private void ResetRotatingVariables()
{
rotatingBody = false;
rotateBodyDirection = 0;
}
private float GetRotationAngleTowardsTargetPlayer(PlayerControllerB player)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: 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_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)player != (Object)null)
{
Vector3 val = ((Component)player.playerEye).transform.position - ((Component)base.eye).transform.position;
val.y = 0f;
Vector3 forward = ((Component)this).transform.forward;
forward.y = 0f;
return Vector3.SignedAngle(forward, val, Vector3.up);
}
return 0f;
}
private PlayerControllerB GetClosestPlayerFixed(Vector3 toThisPosition)
{
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB result = null;
float num = 10000f;
for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++)
{
if (!StartOfRound.Instance.allPlayerScripts[i].isPlayerDead && StartOfRound.Instance.allPlayerScripts[i].isInsideFactory && !StartOfRound.Instance.allPlayerScripts[i].inSpecialInteractAnimation)
{
float num2 = Vector3.Distance(((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position, toThisPosition);
if (num2 < num)
{
result = StartOfRound.Instance.allPlayerScripts[i];
num = num2;
}
}
}
return result;
}
private void RotateHeadTowardsNearestPlayer()
{
//IL_0095: 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_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: 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_00b1: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
//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_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_016d: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01c5: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: 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_002e: 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_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: 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_007d: Unknown result type (might be due to invalid IL or missing references)
PlayerControllerB val = MonsterUtility.CheckLineOfSightForClosestPlayerOptimized((EnemyAI)(object)this, 360f, 25);
if ((Object)(object)val == (Object)null)
{
Quaternion val2 = Quaternion.Euler(defaultHeadEulerAngles);
head.localRotation = Quaternion.Slerp(head.localRotation, val2, Time.deltaTime * headRotationSpeed);
head.localPosition = Vector3.Lerp(head.localPosition, initialHeadPosition, Time.deltaTime * headRotationSpeed);
return;
}
Transform playerEye = val.playerEye;
Vector3 val3 = playerEye.position - ((Component)this).transform.position;
float num = Mathf.Atan2(val3.x, val3.z) * 57.29578f;
float y = ((Component)this).transform.eulerAngles.y;
float num2 = Mathf.DeltaAngle(y, num);
float num3 = Mathf.Clamp(num2, minYRotation, maxYRotation);
Vector2 val4 = new Vector2(val3.x, val3.z);
float magnitude = ((Vector2)(ref val4)).magnitude;
float num4 = Mathf.Atan2(val3.y, magnitude) * 57.29578f;
float num5 = Mathf.Clamp(num4, 0f, maxZRotation);
float num6 = (num3 + maxYRotation) / (2f * maxYRotation);
float z = Mathf.Lerp(headZMaxYRot, headZMinYRot, num6);
Vector3 val5 = Vector3.Lerp(initialHeadPosition, targetHeadPosition, num5 / maxZRotation);
val5.z = z;
Quaternion val6 = Quaternion.Euler(defaultHeadEulerAngles.x, defaultHeadEulerAngles.y - num3, defaultHeadEulerAngles.z + num5);
head.localRotation = Quaternion.Slerp(head.localRotation, val6, Time.deltaTime * headRotationSpeed);
head.localPosition = Vector3.Lerp(head.localPosition, val5, Time.deltaTime * headRotationSpeed);
}
public override void HitEnemy(int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
{
//IL_0031: 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_0056: 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_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: 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_007c: Unknown result type (might be due to invalid IL or missing references)
if (base.isEnemyDead)
{
return;
}
((EnemyAI)this).HitEnemy(force, playerWhoHit, playHitSFX, hitID);
base.enemyHP -= force;
Vector3 velocity = base.agent.velocity;
if (((Vector3)(ref velocity)).magnitude > 1f)
{
NavMeshAgent agent = base.agent;
velocity = base.agent.velocity;
Vector3 normalized = ((Vector3)(ref velocity)).normalized;
velocity = base.agent.velocity;
agent.velocity = normalized * (((Vector3)(ref velocity)).magnitude - 1f);
}
if (base.enemyHP <= 0)
{
if (base.creatureAnimator.layerCount == 2)
{
base.creatureAnimator.SetLayerWeight(0, 0f);
base.creatureAnimator.SetLayerWeight(1, 1f);
}
CritterSendStringClientRcp("setDying");
CritterSendStringClientRcp("setEyeColorWhite");
PlayRandomDeathSound();
((EnemyAI)this).KillEnemyOnOwnerClient(false);
return;
}
if (base.currentBehaviourStateIndex == 0 && (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer))
{
SwitchFromObservingToFleeingEarly();
}
if (base.currentBehaviourStateIndex == 1 && (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer))
{
SwitchFromChasingEarly();
CritterSendStringClientRcp("setEyeColorWhite");
}
if (currentTimeUntilTakingDamageSoundLimit <= 0f)
{
PlayRandomInjuredSound();
currentTimeUntilTakingDamageSoundLimit = timeUntilTakingDamageSoundLimit;
delayingDamageSoundEffects = true;
}
}
public override void KillEnemy(bool destroy = false)
{
((EnemyAI)this).KillEnemy(destroy);
base.creatureAnimator.SetLayerWeight(0, 0f);
base.creatureAnimator.SetLayerWeight(1, 1f);
((Behaviour)base.creatureSFX).enabled = false;
base.creatureAnimator.SetTrigger("KillEnemy");
}
public override void OnCollideWithPlayer(Collider other)
{
((EnemyAI)this).OnCollideWithPlayer(other);
if (base.currentBehaviourStateIndex == 1 && timeSinceHittingPlayer <= 0f)
{
PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false);
if ((Object)(object)val != (Object)null)
{
delayingDamage = true;
delayedDamageTarget = val;
currentTimeUntilDealingDamage = timeUntilDealingDamage;
timeSinceHittingPlayer = 1.3f;
PlayRandomBiteSound();
}
}
}
private void DealDamageAfterDelay(PlayerControllerB targetTakingDamage)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: 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)
if ((Object)(object)targetTakingDamage != (Object)null && !targetTakingDamage.isPlayerDead && targetTakingDamage.isInsideFactory)
{
targetTakingDamage.DamagePlayer(15, false, true, (CauseOfDeath)6, 0, false, default(Vector3));
targetTakingDamage.DropBlood(default(Vector3), true, false);
targetTakingDamage.JumpToFearLevel(0.75f, true);
}
}
public void PlayRandomBiteSound()
{
if (biteClips != null && (Object)(object)biteSFX != (Object)null)
{
biteSFX.pitch = 0.9f + (float)rngGenerator.Next(0, 101) / 1000f;
RoundManager.PlayRandomClip(biteSFX, biteClips, true, 1f, 0, 1000);
}
}
public void PlayRandomInjuredSound()
{
if (injuredClips != null && (Object)(object)injuredSFX != (Object)null)
{
injuredSFX.pitch = 0.9f + (float)rngGenerator.Next(0, 101) / 1000f;
RoundManager.PlayRandomClip(injuredSFX, injuredClips, true, 1f, 0, 1000);
}
}
public void PlayRandomCreepySound()
{
if (creepyClips != null && (Object)(object)creepySFX != (Object)null)
{
RoundManager.PlayRandomClip(creepySFX, creepyClips, true, 1f, 0, 1000);
}
}
public void PlayRandomGrowlSound()
{
if (growlClips != null && (Object)(object)growlSFX != (Object)null)
{
growlSFX.pitch = 0.9f + (float)rngGenerator.Next(0, 101) / 1000f;
RoundManager.PlayRandomClip(growlSFX, growlClips, true, 1f, 0, 1000);
}
}
public void PlayRandomFootStepSound()
{
if (footstepClips != null && (Object)(object)base.creatureSFX != (Object)null && !base.isEnemyDead)
{
RoundManager.PlayRandomClip(base.creatureSFX, footstepClips, true, 0.7f, 0, 1000);
}
}
public void PlayRandomDeathSound()
{
if (deathClips != null && (Object)(object)base.creatureSFX != (Object)null)
{
RoundManager.PlayRandomClip(creepySFX, deathClips, true, 1.5f, 0, 1000);
}
}
private void SetAnimationState(string animationName)
{
if (animationName != null)
{
switch (animationName)
{
case "Idling":
base.creatureAnimator.SetBool("Idling", true);
base.creatureAnimator.SetBool("Forward", false);
base.creatureAnimator.SetBool("StrafeLeft", false);
base.creatureAnimator.SetBool("StrafeRight", false);
break;
case "Forward":
base.creatureAnimator.SetBool("Idling", false);
base.creatureAnimator.SetBool("Forward", true);
base.creatureAnimator.SetBool("StrafeLeft", false);
base.creatureAnimator.SetBool("StrafeRight", false);
break;
case "StrafeLeft":
base.creatureAnimator.SetBool("Idling", false);
base.creatureAnimator.SetBool("Forward", false);
base.creatureAnimator.SetBool("StrafeLeft", true);
base.creatureAnimator.SetBool("StrafeRight", false);
break;
case "StrafeRight":
base.creatureAnimator.SetBool("Idling", false);
base.creatureAnimator.SetBool("Forward", false);
base.creatureAnimator.SetBool("StrafeLeft", false);
base.creatureAnimator.SetBool("StrafeRight", true);
break;
case "Dying":
base.creatureAnimator.SetBool("Idling", false);
base.creatureAnimator.SetBool("Forward", false);
base.creatureAnimator.SetBool("StrafeLeft", false);
base.creatureAnimator.SetBool("StrafeRight", false);
break;
}
}
}
private void InterpretRcpString(string rcpString)
{
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
if (!rcpString.StartsWith("set") || ((NetworkBehaviour)this).IsHost)
{
return;
}
if (rcpString == null)
{
return;
}
switch (rcpString.Length)
{
case 14:
switch (rcpString[3])
{
case 'S':
if (rcpString == "setStrafeRight")
{
SetAnimationState("StrafeRight");
rotatingBody = true;
}
break;
case 'E':
if (rcpString == "setEyeColorRed")
{
((Renderer)eyeComponentReference).SetMaterial(redEyeMaterial);
}
break;
}
break;
case 18:
if (rcpString == "setIdleObservation")
{
base.agent.velocity = Vector3.zero;
SetAnimationState("Idling");
atObservationPost = true;
}
break;
case 21:
if (rcpString == "setForwardObservation")
{
SetAnimationState("Forward");
atObservationPost = false;
}
break;
case 29:
if (rcpString == "setTransitionObserveToFleeing")
{
fleeing = true;
atObservationPost = false;
currentObservationTime = 0f;
rotatingTowardsTargetPlayer = false;
SetAnimationState("Forward");
if (base.creatureAnimator.GetCurrentStateName(0).Contains("Strafe_Left") || base.creatureAnimator.GetCurrentStateName(0).Contains("Strafe_Right"))
{
SetAnimationState("Forward");
}
Animator creatureAnimator = base.creatureAnimator;
creatureAnimator.speed *= 2f;
base.agent.speed = 6f;
targetObservedLast = base.targetPlayer;
}
break;
case 26:
if (rcpString == "setInitialAgentSpeedValue:")
{
}
break;
case 13:
if (rcpString == "setStrafeLeft")
{
SetAnimationState("StrafeLeft");
rotatingBody = true;
}
break;
case 7:
if (rcpString == "setIdle")
{
SetAnimationState("Idling");
rotatingBody = false;
}
break;
case 16:
if (rcpString == "setEyeColorWhite")
{
((Renderer)eyeComponentReference).SetMaterial(whiteEyeMaterial);
}
break;
case 8:
if (rcpString == "setDying")
{
SetAnimationState("Dying");
base.creatureAnimator.SetLayerWeight(0, 0f);
}
break;
}
}
[ClientRpc]
private void CritterSendStringClientRcp(string informationString)
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Invalid comparison between Unknown and I4
//IL_0053: 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_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: 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_009e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost || networkManager.IsClient))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2947718646u, val, (RpcDelivery)0);
bool flag = informationString != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(informationString, false);
}
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2947718646u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
InterpretRcpString(informationString);
}
}
private static void __rpc_handler_sendcritter_2947718646(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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)
NetworkManager networkManager = target.NetworkManager;
if ((Object)(object)networkManager != (Object)null && networkManager.IsListening)
{
bool flag = false;
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string informationString = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref informationString, false);
}
target.__rpc_exec_stage = (__RpcExecStage)2;
((RuinedCritterAI)(object)target).CritterSendStringClientRcp(informationString);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_Critters()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(2947718646u, new RpcReceiveHandler(__rpc_handler_sendcritter_2947718646));
}
}
internal class ScrapConfig
{
private static bool scrapEnabled;
internal static void RegisterAllScrap(SmilingCritters Instance)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Expected O, but got Unknown
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Expected O, but got Unknown
ConfigEntry<bool> val = ((BaseUnityPlugin)Instance).Config.Bind<bool>("Enabled", "Item Rarity", true, "Whether scrap is enabled or not. Will override everything and disable or enable scrap. \n True by default");
BoolCheckBoxConfigItem val2 = new BoolCheckBoxConfigItem(val, true);
scrapEnabled = val.Value;
ConfigEntry<SmilingCritters.RarityAddTypes> val3 = ((BaseUnityPlugin)Instance).Config.Bind<SmilingCritters.RarityAddTypes>("Where to register scrap.", "Registration Method", Instance.defaultScrapAddingMethod, "The method to add scrap to the level. \n Default = All \n Vanilla \n Modded \n List");
EnumDropDownConfigItem<SmilingCritters.RarityAddTypes> val4 = new EnumDropDownConfigItem<SmilingCritters.RarityAddTypes>(val3);
ConfigEntry<string> val5 = ((BaseUnityPlugin)Instance).Config.Bind<string>("Where to register scrap.", "Registration List", Instance.defaultMoonRegistrationList, "The list of moons to register scrap. Requires \"List\" to be selected in order to work.\n\nUse a comma seperated list like this:\n assurance, rend \n Note: Registration will try both what you enter and with the first letter capitalized. Assurance or assurance would work in your list for example. If you had a moon named Mare it would also work with mare or Mare.");
TextInputFieldConfigItem val6 = new TextInputFieldConfigItem(val5);
ConfigEntry<int> val7 = Instance.CreateIntSliderConfig("Bobby Bearhug", 20, "Adjust how often you see Bobby Bearhug.", 0, 100, "Item Rarity");
ConfigEntry<int> val8 = Instance.CreateIntSliderConfig("Bubba Bubbaphant", 20, "Adjust how often you see Bubba Bubbaphant.", 0, 100, "Item Rarity");
ConfigEntry<int> val9 = Instance.CreateIntSliderConfig("Catnap", 15, "Adjust how often you see Catnap.", 0, 100, "Item Rarity");
ConfigEntry<int> val10 = Instance.CreateIntSliderConfig("CraftyCorn", 20, "Adjust how often you see CraftyCorn.", 0, 100, "Item Rarity");
ConfigEntry<int> val11 = Instance.CreateIntSliderConfig("Dogday", 15, "Adjust how often you see Dogday.", 0, 100, "Item Rarity");
ConfigEntry<int> val12 = Instance.CreateIntSliderConfig("Hoppy Hopscotch", 20, "Adjust how often you see Hoppy Hopscotch.", 0, 100, "Item Rarity");
ConfigEntry<int> val13 = Instance.CreateIntSliderConfig("Kickin Chicken", 20, "Adjust how often you see Kickin Chicken.", 0, 100, "Item Rarity");
ConfigEntry<int> val14 = Instance.CreateIntSliderConfig("Picky Piggy", 20, "Adjust how often you see Picky Piggy.", 0, 100, "Item Rarity");
ConfigEntry<int> val15 = Instance.CreateIntSliderConfig("Empty Toybox Items", 6, "Adjust how often you see empty toyboxes or toys.", 0, 100, "Item Rarity");
ConfigEntry<int> val16 = Instance.CreateIntSliderConfig("Ruined Toybox Items", 6, "Adjust how often you see ruined toyboxes or toys.", 0, 100, "Item Rarity");
ConfigEntry<int> val17 = Instance.CreateIntSliderConfig("Damaged Toybox Items", 7, "Adjust how often you see damaged toyboxes or toys.", 0, 100, "Item Rarity");
ConfigEntry<int> val18 = Instance.CreateIntSliderConfig("Pristine Toybox Items", 20, "Adjust how often you see pristine toyboxes or toys.", 0, 100, "Item Rarity");
ConfigEntry<int> val19 = Instance.CreateIntSliderConfig("Other items", 20, "Adjust how often you see generic scrap items related to Poppy Playtime. Not related to toys. \nA misc. category for things that aren't smiling critters or toys.", 0, 100, "Item Rarity");
ConfigEntry<int> val20 = Instance.CreateIntSliderConfig("Golden Statue Items", 2, "Adjust how often you see golden statues.", 0, 100, "Item Rarity");
ConfigEntry<float> val21 = Instance.CreateFloatSliderConfig("Smiling Critter scrap values", 1f, "Adjust the scrap value of the main 8 smiling critters.", 0.25f, 2.5f, "Scrap Values");
ConfigEntry<float> val22 = Instance.CreateFloatSliderConfig("Empty toybox scrap values", 1f, "Adjust the scrap value of empty box items.", 0.25f, 2.5f, "Scrap Values");
ConfigEntry<float> val23 = Instance.CreateFloatSliderConfig("Ruined toybox values", 1f, "Adjust the scrap value of ruined box items.", 0.25f, 2.5f, "Scrap Values");
ConfigEntry<float> val24 = Instance.CreateFloatSliderConfig("Damaged toybox scrap values", 1f, "Adjust the scrap value of damaged box items.", 0.25f, 2.5f, "Scrap Values");
ConfigEntry<float> val25 = Instance.CreateFloatSliderConfig("Pristine toybox scrap values", 1f, "Adjust the scrap value of pristine box items.", 0.25f, 2.5f, "Scrap Values");
ConfigEntry<float> val26 = Instance.CreateFloatSliderConfig("Pristine standalone toy values", 1f, "Adjust the scrap value of fully intact toys.", 0.25f, 2.5f, "Scrap Values");
ConfigEntry<float> val27 = Instance.CreateFloatSliderConfig("Generic scrap values", 1f, "Adjust the scrap value of remaining generic misc items.", 0.25f, 2.5f, "Scrap Values");
ConfigEntry<float> val28 = Instance.CreateFloatSliderConfig("Golden Statue values", 1f, "Adjust the scrap value of golden statues.", 0.25f, 2.5f, "Scrap Values");
if (!scrapEnabled)
{
SmilingCritters.Logger.LogMessage((object)"Scrap not enabled, skipping scrap registration...");
return;
}
Item val29 = SmilingCritters.assetBundle.LoadAsset<Item>("BobbyBearhugPlushie");
NoiseMakerCycle noiseMakerCycle = val29.spawnPrefab.AddComponent<NoiseMakerCycle>();
Instance.ConfigureNoiseMakerCycle(val29, noiseMakerCycle, SmilingCritters.assetBundle);
Item val30 = SmilingCritters.assetBundle.LoadAsset<Item>("BubbaBubbaphantPlushie");
NoiseMakerCycle noiseMakerCycle2 = val30.spawnPrefab.AddComponent<NoiseMakerCycle>();
Instance.ConfigureNoiseMakerCycle(val30, noiseMakerCycle2, SmilingCritters.assetBundle);
Item val31 = SmilingCritters.assetBundle.LoadAsset<Item>("CatNapPlushie");
NoiseMakerCycle noiseMakerCycle3 = val31.spawnPrefab.AddComponent<NoiseMakerCycle>();
Instance.ConfigureNoiseMakerCycle(val31, noiseMakerCycle3, SmilingCritters.assetBundle);
Item val32 = SmilingCritters.assetBundle.LoadAsset<Item>("CraftyCornPlushie");
NoiseMakerCycle noiseMakerCycle4 = val32.spawnPrefab.AddComponent<NoiseMakerCycle>();
Instance.ConfigureNoiseMakerCycle(val32, noiseMakerCycle4, SmilingCritters.assetBundle);
Item val33 = SmilingCritters.assetBundle.LoadAsset<Item>("DogDayPlushie");
NoiseMakerCycle noiseMakerCycle5 = val33.spawnPrefab.AddComponent<NoiseMakerCycle>();
Instance.ConfigureNoiseMakerCycle(val33, noiseMakerCycle5, SmilingCritters.assetBundle);
Item val34 = SmilingCritters.assetBundle.LoadAsset<Item>("HoppyHopscotchPlushie");
NoiseMakerCycle noiseMakerCycle6 = val34.spawnPrefab.AddComponent<NoiseMakerCycle>();
Instance.ConfigureNoiseMakerCycle(val34, noiseMakerCycle6, SmilingCritters.assetBundle);
Item val35 = SmilingCritters.assetBundle.LoadAsset<Item>("KickinChickenPlushie");
NoiseMakerCycle noiseMakerCycle7 = val35.spawnPrefab.AddComponent<NoiseMakerCycle>();
Instance.ConfigureNoiseMakerCycle(val35, noiseMakerCycle7, SmilingCritters.assetBundle);
Item val36 = SmilingCritters.assetBundle.LoadAsset<Item>("PickyPiggyPlushie");
NoiseMakerCycle noiseMakerCycle8 = val36.spawnPrefab.AddComponent<NoiseMakerCycle>();
Instance.ConfigureNoiseMakerCycle(val36, noiseMakerCycle8, SmilingCritters.assetBundle);
Item key = SmilingCritters.assetBundle.LoadAsset<Item>("Playco Box Small");
Item key2 = SmilingCritters.assetBundle.LoadAsset<Item>("Playco Box Medium");
Item key3 = SmilingCritters.assetBundle.LoadAsset<Item>("Playco Box Large");
Item key4 = SmilingCritters.assetBundle.LoadAsset<Item>("Boogie Bot Box Empty");
Item key5 = SmilingCritters.assetBundle.LoadAsset<Item>("Bron Box Empty");
Item key6 = SmilingCritters.assetBundle.LoadAsset<Item>("Bunzo Bunny Box Empty");
Item key7 = SmilingCritters.assetBundle.LoadAsset<Item>("Candy Cat Box Empty");
Item key8 = SmilingCritters.assetBundle.LoadAsset<Item>("Cat Bee Box Empty");
Item key9 = SmilingCritters.assetBundle.LoadAsset<Item>("Huggy Wuggy Box Empty");
Item key10 = SmilingCritters.assetBundle.LoadAsset<Item>("Mommy Long Legs Box Empty");
Item key11 = SmilingCritters.assetBundle.LoadAsset<Item>("PJ Pug A Pillar Box Empty");
Item key12 = SmilingCritters.assetBundle.LoadAsset<Item>("Boogie Bot Box Ruined");
Item key13 = SmilingCritters.assetBundle.LoadAsset<Item>("Bron Box Ruined");
Item key14 = SmilingCritters.assetBundle.LoadAsset<Item>("Bunzo Bunny Box Ruined");
Item key15 = SmilingCritters.assetBundle.LoadAsset<Item>("Candy Cat Box Ruined");
Item key16 = SmilingCritters.assetBundle.LoadAsset<Item>("Cat Bee Box Ruined");
Item key17 = SmilingCritters.assetBundle.LoadAsset<Item>("Mommy Long Legs Box Ruined");
Item key18 = SmilingCritters.assetBundle.LoadAsset<Item>("PJ Pug A Pillar Box Ruined");
Item key19 = SmilingCritters.assetBundle.LoadAsset<Item>("Boogie Bot Box Damaged");
Item key20 = SmilingCritters.assetBundle.LoadAsset<Item>("Candy Cat Box Damaged");
Item key21 = SmilingCritters.assetBundle.LoadAsset<Item>("Mommy Long Legs Box Damaged");
Item key22 = SmilingCritters.assetBundle.LoadAsset<Item>("Boogie Bot Box Pristine");
Item key23 = SmilingCritters.assetBundle.LoadAsset<Item>("Bunzo Bunny Box Pristine");
Item key24 = SmilingCritters.assetBundle.LoadAsset<Item>("Candy Cat Box Pristine");
Item key25 = SmilingCritters.assetBundle.LoadAsset<Item>("Cat Bee Box Pristine");
Item key26 = SmilingCritters.assetBundle.LoadAsset<Item>("Huggy Wuggy Box Pristine");
Item key27 = SmilingCritters.assetBundle.LoadAsset<Item>("Boogie Bot Pristine");
Item key28 = SmilingCritters.assetBundle.LoadAsset<Item>("Bron Pristine");
Item val37 = SmilingCritters.assetBundle.LoadAsset<Item>("Bunzo Bunny Pristine");
CymbalClashBunzoBunny cymbalClashBunzoBunny = val37.spawnPrefab.AddComponent<CymbalClashBunzoBunny>();
cymbalClashBunzoBunny.soundClip = SmilingCritters.assetBundle.LoadAsset<AudioClip>("BunzoCymbalHit");
Item key29 = SmilingCritters.assetBundle.LoadAsset<Item>("Candy Cat Pristine");
Item key30 = SmilingCritters.assetBundle.LoadAsset<Item>("PJ Pug A Pillar Pristine");
Item key31 = SmilingCritters.assetBundle.LoadAsset<Item>("Golden Berry Statue");
Item key32 = SmilingCritters.assetBundle.LoadAsset<Item>("Golden Bunzo Statue");
Item key33 = SmilingCritters.assetBundle.LoadAsset<Item>("Golden Claw Statue");
Item key34 = SmilingCritters.assetBundle.LoadAsset<Item>("Golden Daisy Statue");
Item key35 = SmilingCritters.assetBundle.LoadAsset<Item>("Golden Hand Statue");
Item key36 = SmilingCritters.assetBundle.LoadAsset<Item>("Golden Kissy Statue");
Item key37 = SmilingCritters.assetBundle.LoadAsset<Item>("Golden Mommy Statue");
Item key38 = SmilingCritters.assetBundle.LoadAsset<Item>("Golden PJ Statue");
Item key39 = SmilingCritters.assetBundle.LoadAsset<Item>("Golden Train Statue");
Dictionary<Item, int> dictionary = new Dictionary<Item, int>
{
{ val29, val7.Value },
{ val30, val8.Value },
{ val31, val9.Value },
{ val32, val10.Value },
{ val33, val11.Value },
{ val34, val12.Value },
{ val35, val13.Value },
{ val36, val14.Value }
};
Dictionary<Item, int> dictionary2 = new Dictionary<Item, int>
{
{ key4, val15.Value },
{ key5, val15.Value },
{ key6, val15.Value },
{ key7, val15.Value },
{ key8, val15.Value },
{ key9, val15.Value },
{ key10, val15.Value },
{ key11, val15.Value }
};
Dictionary<Item, int> dictionary3 = new Dictionary<Item, int>
{
{ key12, val16.Value },
{ key13, val16.Value },
{ key14, val16.Value },
{ key15, val16.Value },
{ key16, val16.Value },
{ key17, val16.Value },
{ key18, val16.Value }
};
Dictionary<Item, int> dictionary4 = new Dictionary<Item, int>
{
{ key19, val17.Value },
{ key20, val17.Value },
{ key21, val17.Value }
};
Dictionary<Item, int> dictionary5 = new Dictionary<Item, int>
{
{ key22, val18.Value },
{ key23, val18.Value },
{ key24, val18.Value },
{ key25, val18.Value },
{ key26, val18.Value }
};
Dictionary<Item, int> dictionary6 = new Dictionary<Item, int>
{
{ key27, val18.Value },
{ key28, val18.Value },
{ val37, val18.Value },
{ key29, val18.Value },
{ key30, val18.Value }
};
Dictionary<Item, int> dictionary7 = new Dictionary<Item, int>
{
{ key, val19.Value },
{ key2, val19.Value },
{ key3, val19.Value }
};
Dictionary<Item, int> dictionary8 = new Dictionary<Item, int>
{
{ key31, val20.Value },
{ key32, val20.Value },
{ key33, val20.Value },
{ key34, val20.Value },
{ key35, val20.Value },
{ key36, val20.Value },
{ key37, val20.Value },
{ key38, val20.Value },
{ key39, val20.Value }
};
Instance.AdjustScrapValues(dictionary, val21.Value);
Instance.AdjustScrapValues(dictionary2, val22.Value);
Instance.AdjustScrapValues(dictionary3, val23.Value);
Instance.AdjustScrapValues(dictionary4, val24.Value);
Instance.AdjustScrapValues(dictionary5, val25.Value);
Instance.AdjustScrapValues(dictionary6, val26.Value);
Instance.AdjustScrapValues(dictionary7, val27.Value);
Instance.AdjustScrapValues(dictionary8, val28.Value);
Instance.RegisterItemsAsScrap(dictionary, val3.Value, val5.Value);
Instance.RegisterItemsAsScrap(dictionary2, val3.Value, val5.Value);
Instance.RegisterItemsAsScrap(dictionary3, val3.Value, val5.Value);
Instance.RegisterItemsAsScrap(dictionary4, val3.Value, val5.Value);
Instance.RegisterItemsAsScrap(dictionary5, val3.Value, val5.Value);
Instance.RegisterItemsAsScrap(dictionary6, val3.Value, val5.Value);
Instance.RegisterItemsAsScrap(dictionary7, val3.Value, val5.Value);
Instance.RegisterItemsAsScrap(dictionary8, val3.Value, val5.Value);
}
}
[BepInPlugin("Nuclear_Fox.SmilingCritters", "SmilingCritters", "2.1.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class SmilingCritters : BaseUnityPlugin
{
internal enum RarityAddTypes
{
All,
Modded,
Vanilla,
List
}
internal enum ScrapEnabled
{
True,
False
}
internal static AssetBundle assetBundle;
internal RarityAddTypes defaultScrapAddingMethod = RarityAddTypes.All;
internal string defaultMoonRegistrationList = "Experimentation, Assurance";
public static SmilingCritters Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
internal static Harmony? Harmony { get; set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
LoadAssetBundle();
ScrapConfig.RegisterAllScrap(Instance);
CreatureConfig.RegisterAllCritters(Instance);
NetcodePatcher();
Patch();
Logger.LogInfo((object)"Nuclear_Fox.SmilingCritters v2.1.1 has loaded!");
}
public void AdjustScrapValues(Dictionary<Item, int> itemDictionary, float adjustment)
{
if (AreEqual(adjustment, 1f))
{
return;
}
foreach (Item key in itemDictionary.Keys)
{
key.minValue = (int)((float)key.minValue * adjustment);
key.maxValue = (int)((float)key.maxValue * adjustment);
}
}
internal static void Patch()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
if (Harmony == null)
{
Harmony = new Harmony("Nuclear_Fox.SmilingCritters");
}
Logger.LogDebug((object)"Patching...");
Harmony.PatchAll();
Logger.LogDebug((object)"Finished patching!");
}
internal static void Unpatch()
{
Logger.LogDebug((object)"Unpatching...");
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
Logger.LogDebug((object)"Finished unpatching!");
}
private void NetcodePatcher()
{
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);
}
}
}
}
private void LoadAssetBundle()
{
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "smilingcritters");
assetBundle = AssetBundle.LoadFromFile(text);
if ((Object)(object)assetBundle != (Object)null)
{
Logger.LogMessage((object)"Loaded SmilingCritters Assets");
}
}
internal void RegisterItemsAsScrap(Dictionary<Item, int> items, RarityAddTypes enumScrapRegistration, string levelOverrides)
{
//IL_001e: 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)
//IL_0026: 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_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: 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_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
LevelTypes val = (LevelTypes)(enumScrapRegistration switch
{
RarityAddTypes.All => -1,
RarityAddTypes.Vanilla => 15356,
RarityAddTypes.Modded => 1024,
RarityAddTypes.List => 1,
_ => -1,
});
foreach (KeyValuePair<Item, int> item in items)
{
Item key = item.Key;
int value = item.Value;
LevelTypes val2 = (LevelTypes)1;
string[] array = new string[3] { "Adamance", "Embrion", "Artifice" };
if (!((Object)(object)key != (Object)null))
{
continue;
}
Utilities.FixMixerGroups(key.spawnPrefab);
NetworkPrefabs.RegisterNetworkPrefab(key.spawnPrefab);
switch (enumScrapRegistration)
{
case RarityAddTypes.List:
ExtractAndRegisterLevels(key, value, levelOverrides);
continue;
case RarityAddTypes.Vanilla:
val = (LevelTypes)15356;
Items.RegisterScrap(key, value, val, array);
Items.RegisterScrap(key, value, val2, array);
continue;
}
Items.RegisterScrap(key, value, val);
if (enumScrapRegistration == RarityAddTypes.Modded)
{
Items.RemoveScrapFromLevels(key, val2, array);
}
}
}
internal void ExtractAndRegisterLevels(Item item, int rarity, string allLevelOverrides)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
LevelTypes val = (LevelTypes)1;
string[] array = ParseLevelList(allLevelOverrides);
foreach (string text in array)
{
Logger.LogMessage((object)("Trying to register " + item.itemName + " on " + text));
switch (text.ToLower())
{
case "experimentation":
Items.RegisterScrap(item, rarity, (LevelTypes)4);
continue;
case "assurance":
Items.RegisterScrap(item, rarity, (LevelTypes)8);
continue;
case "offense":
Items.RegisterScrap(item, rarity, (LevelTypes)32);
continue;
case "dine":
Items.RegisterScrap(item, rarity, (LevelTypes)256);
continue;
case "titan":
Items.RegisterScrap(item, rarity, (LevelTypes)512);
continue;
case "march":
Items.RegisterScrap(item, rarity, (LevelTypes)64);
continue;
case "rend":
Items.RegisterScrap(item, rarity, (LevelTypes)128);
continue;
case "vow":
Items.RegisterScrap(item, rarity, (LevelTypes)16);
continue;
}
string text2 = char.ToUpper(text[0]) + text.Substring(1);
string text3 = text.ToLower();
Items.RegisterScrap(item, rarity, val, new string[1] { text2 });
Items.RegisterScrap(item, rarity, val, new string[1] { text3 });
}
}
internal string[] ParseLevelList(string levels)
{
return (from level in levels.Split(new char[1] { ',' }, StringSplitOptions.RemoveEmptyEntries)
select level.Trim()).ToArray();
}
internal void CheckAllItemsLoaded(Dictionary<Item, int> itemsToRegister)
{
bool flag = true;
foreach (Item key in itemsToRegister.Keys)
{
if ((Object)(object)key == (Object)null)
{
flag = false;
break;
}
}
if (flag)
{
Logger.LogMessage((object)"All the smiling critters and toys are here!");
}
else
{
Logger.LogMessage((object)"Some critters or toys are missing!");
}
}
internal ConfigEntry<int> CreateIntSliderConfig(string itemName, int defaultRarity, string description, int sliderMin, int sliderMax, string configCategory)
{
//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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
//IL_0071: Expected O, but got Unknown
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
ConfigEntry<int> val = ((BaseUnityPlugin)this).Config.Bind<int>(configCategory, itemName, defaultRarity, description + " [" + sliderMin + "-" + sliderMax + "]");
IntSliderOptions val2 = new IntSliderOptions
{
RequiresRestart = true
};
((BaseRangeOptions<int>)val2).Min = sliderMin;
((BaseRangeOptions<int>)val2).Max = sliderMax;
IntSliderConfigItem val3 = new IntSliderConfigItem(val, val2);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val3);
return val;
}
internal ConfigEntry<float> CreateFloatSliderConfig(string itemName, float defaultValue, string description, float sliderMin, float sliderMax, string configCategory)
{
//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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Expected O, but got Unknown
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Expected O, but got Unknown
//IL_0071: Expected O, but got Unknown
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Expected O, but got Unknown
ConfigEntry<float> val = ((BaseUnityPlugin)this).Config.Bind<float>(configCategory, itemName, defaultValue, description + " [" + sliderMin + "-" + sliderMax + "]");
FloatSliderOptions val2 = new FloatSliderOptions
{
RequiresRestart = true
};
((BaseRangeOptions<float>)val2).Min = sliderMin;
((BaseRangeOptions<float>)val2).Max = sliderMax;
FloatSliderConfigItem val3 = new FloatSliderConfigItem(val, val2);
LethalConfigManager.AddConfigItem((BaseConfigItem)(object)val3);
return val;
}
public bool AreEqual(float a, float b, float tolerance = 0.0001f)
{
return Math.Abs(a - b) < tolerance;
}
internal void ConfigureNoiseMakerCycle(Item item, NoiseMakerCycle noiseMakerCycle, AssetBundle assetBundle)
{
((GrabbableObject)noiseMakerCycle).grabbable = true;
((GrabbableObject)noiseMakerCycle).isInFactory = true;
((GrabbableObject)noiseMakerCycle).grabbableToEnemies = true;
((GrabbableObject)noiseMakerCycle).itemProperties = item;
noiseMakerCycle.noiseAudio = item.spawnPrefab.GetComponent<AudioSource>();
noiseMakerCycle.noiseAudioFar = ((Component)item.spawnPrefab.transform.Find("FarAudio")).GetComponent<AudioSource>();
((GrabbableObject)noiseMakerCycle).useCooldown = 7f;
noiseMakerCycle.noiseRange = 25f;
noiseMakerCycle.maxLoudness = 1f;
noiseMakerCycle.minLoudness = 0.7f;
noiseMakerCycle.minPitch = 0.94f;
noiseMakerCycle.maxPitch = 0.98f;
if (item.itemName.Equals("Bobby Bearhug"))
{
noiseMakerCycle.noiseSFX = (AudioClip[])(object)new AudioClip[6];
noiseMakerCycle.noiseSFX[0] = assetBundle.LoadAsset<AudioClip>("Bobby1");
noiseMakerCycle.noiseSFX[1] = assetBundle.LoadAsset<AudioClip>("Bobby2");
noiseMakerCycle.noiseSFX[2] = assetBundle.LoadAsset<AudioClip>("Bobby3");
noiseMakerCycle.noiseSFX[3] = assetBundle.LoadAsset<AudioClip>("Bobby4");
noiseMakerCycle.noiseSFX[4] = assetBundle.LoadAsset<AudioClip>("Bobby5");
noiseMakerCycle.noiseSFX[5] = assetBundle.LoadAsset<AudioClip>("Bobby6");
noiseMakerCycle.noiseSFXFar = (AudioClip[])(object)new AudioClip[6];
noiseMakerCycle.noiseSFXFar[0] = assetBundle.LoadAsset<AudioClip>("Bobby1Far");
noiseMakerCycle.noiseSFXFar[1] = assetBundle.LoadAsset<AudioClip>("Bobby2Far");
noiseMakerCycle.noiseSFXFar[2] = assetBundle.LoadAsset<AudioClip>("Bobby3Far");
noiseMakerCycle.noiseSFXFar[3] = assetBundle.LoadAsset<AudioClip>("Bobby4Far");
noiseMakerCycle.noiseSFXFar[4] = assetBundle.LoadAsset<AudioClip>("Bobby5Far");
noiseMakerCycle.noiseSFXFar[5] = assetBundle.LoadAsset<AudioClip>("Bobby6Far");
}
else if (item.itemName.Equals("Bubba Bubbaphant"))
{
noiseMakerCycle.noiseSFX = (AudioClip[])(object)new AudioClip[3];
noiseMakerCycle.noiseSFX[0] = assetBundle.LoadAsset<AudioClip>("Bubba1");
noiseMakerCycle.noiseSFX[1] = assetBundle.LoadAsset<AudioClip>("Bubba2");
noiseMakerCycle.noiseSFX[2] = assetBundle.LoadAsset<AudioClip>("Bubba3");
noiseMakerCycle.noiseSFXFar = (AudioClip[])(object)new AudioClip[3];
noiseMakerCycle.noiseSFXFar[0] = assetBundle.LoadAsset<AudioClip>("Bubba1Far");
noiseMakerCycle.noiseSFXFar[1] = assetBundle.LoadAsset<AudioClip>("Bubba2Far");
noiseMakerCycle.noiseSFXFar[2] = assetBundle.LoadAsset<AudioClip>("Bubba3Far");
}
else if (item.itemName.Equals("Catnap"))
{
noiseMakerCycle.noiseSFX = (AudioClip[])(object)new AudioClip[3];
noiseMakerCycle.noiseSFX[0] = assetBundle.LoadAsset<AudioClip>("Catnap1");
noiseMakerCycle.noiseSFX[1] = assetBundle.LoadAsset<AudioClip>("Catnap2");
noiseMakerCycle.noiseSFX[2] = assetBundle.LoadAsset<AudioClip>("Catnap3");
noiseMakerCycle.noiseSFXFar = (AudioClip[])(object)new AudioClip[3];
noiseMakerCycle.noiseSFXFar[0] = assetBundle.LoadAsset<AudioClip>("Catnap1Far");
noiseMakerCycle.noiseSFXFar[1] = assetBundle.LoadAsset<AudioClip>("Catnap2Far");
noiseMakerCycle.noiseSFXFar[2] = assetBundle.LoadAsset<AudioClip>("Catnap3Far");
}
else if (item.itemName.Equals("Craftycorn"))
{
((GrabbableObject)noiseMakerCycle).useCooldown = 8f;
noiseMakerCycle.noiseSFX = (AudioClip[])(object)new AudioClip[5];
noiseMakerCycle.noiseSFX[0] = assetBundle.LoadAsset<AudioClip>("Crafty1");
noiseMakerCycle.noiseSFX[1] = assetBundle.LoadAsset<AudioClip>("Crafty2");
noiseMakerCycle.noiseSFX[2] = assetBundle.LoadAsset<AudioClip>("Crafty3");
noiseMakerCycle.noiseSFX[3] = assetBundle.LoadAsset<AudioClip>("Crafty4");
noiseMakerCycle.noiseSFX[4] = assetBundle.LoadAsset<AudioClip>("Crafty5");
noiseMakerCycle.noiseSFXFar = (AudioClip[])(object)new AudioClip[5];
noiseMakerCycle.noiseSFXFar[0] = assetBundle.LoadAsset<AudioClip>("Crafty1Far");
noiseMakerCycle.noiseSFXFar[1] = assetBundle.LoadAsset<AudioClip>("Crafty2Far");
noiseMakerCycle.noiseSFXFar[2] = assetBundle.LoadAsset<AudioClip>("Crafty3Far");
noiseMakerCycle.noiseSFXFar[3] = assetBundle.LoadAsset<AudioClip>("Crafty4Far");
noiseMakerCycle.noiseSFXFar[4] = assetBundle.LoadAsset<AudioClip>("Crafty5Far");
}
else if (item.itemName.Equals("Dogday"))
{
noiseMakerCycle.noiseSFX = (AudioClip[])(object)new AudioClip[4];
noiseMakerCycle.noiseSFX[0] = assetBundle.LoadAsset<AudioClip>("Dogday1");
noiseMakerCycle.noiseSFX[1] = assetBundle.LoadAsset<AudioClip>("Dogday2");
noiseMakerCycle.noiseSFX[2] = assetBundle.LoadAsset<AudioClip>("Dogday3");
noiseMakerCycle.noiseSFX[3] = assetBundle.LoadAsset<AudioClip>("Dogday4");
noiseMakerCycle.noiseSFXFar = (AudioClip[])(object)new AudioClip[4];
noiseMakerCycle.noiseSFXFar[0] = assetBundle.LoadAsset<AudioClip>("Dogday1Far");
noiseMakerCycle.noiseSFXFar[1] = assetBundle.LoadAsset<AudioClip>("Dogday2Far");
noiseMakerCycle.noiseSFXFar[2] = assetBundle.LoadAsset<AudioClip>("Dogday3Far");
noiseMakerCycle.noiseSFXFar[3] = assetBundle.LoadAsset<AudioClip>("Dogday4Far");
}
else if (item.itemName.Equals("Hoppy Hopscotch"))
{
((GrabbableObject)noiseMakerCycle).useCooldown = 8f;
noiseMakerCycle.noiseSFX = (AudioClip[])(object)new AudioClip[5];
noiseMakerCycle.noiseSFX[0] = assetBundle.LoadAsset<AudioClip>("Hoppy1");
noiseMakerCycle.noiseSFX[1] = assetBundle.LoadAsset<AudioClip>("Hoppy2");
noiseMakerCycle.noiseSFX[2] = assetBundle.LoadAsset<AudioClip>("Hoppy3");
noiseMakerCycle.noiseSFX[3] = assetBundle.LoadAsset<AudioClip>("Hoppy4");
noiseMakerCycle.noiseSFX[4] = assetBundle.LoadAsset<AudioClip>("Hoppy5");
noiseMakerCycle.noiseSFXFar = (AudioClip[])(object)new AudioClip[5];
noiseMakerCycle.noiseSFXFar[0] = assetBundle.LoadAsset<AudioClip>("Hoppy1Far");
noiseMakerCycle.noiseSFXFar[1] = assetBundle.LoadAsset<AudioClip>("Hoppy2Far");
noiseMakerCycle.noiseSFXFar[2] = assetBundle.LoadAsset<AudioClip>("Hoppy3Far");
noiseMakerCycle.noiseSFXFar[3] = assetBundle.LoadAsset<AudioClip>("Hoppy4Far");
noiseMakerCycle.noiseSFXFar[4] = assetBundle.LoadAsset<AudioClip>("Hoppy5Far");
}
else if (item.itemName.Equals("Kickin Chicken"))
{
noiseMakerCycle.noiseSFX = (AudioClip[])(object)new AudioClip[5];
noiseMakerCycle.noiseSFX[0] = assetBundle.LoadAsset<AudioClip>("Kickin1");
noiseMakerCycle.noiseSFX[1] = assetBundle.LoadAsset<AudioClip>("Kickin2");
noiseMakerCycle.noiseSFX[2] = assetBundle.LoadAsset<AudioClip>("Kickin3");
noiseMakerCycle.noiseSFX[3] = assetBundle.LoadAsset<AudioClip>("Kickin4");
noiseMakerCycle.noiseSFX[4] = assetBundle.LoadAsset<AudioClip>("Kickin5");
noiseMakerCycle.noiseSFXFar = (AudioClip[])(object)new AudioClip[5];
noiseMakerCycle.noiseSFXFar[0] = assetBundle.LoadAsset<AudioClip>("Kickin1Far");
noiseMakerCycle.noiseSFXFar[1] = assetBundle.LoadAsset<AudioClip>("Kickin2Far");
noiseMakerCycle.noiseSFXFar[2] = assetBundle.LoadAsset<AudioClip>("Kickin3Far");
noiseMakerCycle.noiseSFXFar[3] = assetBundle.LoadAsset<AudioClip>("Kickin4Far");
noiseMakerCycle.noiseSFXFar[4] = assetBundle.LoadAsset<AudioClip>("Kickin5Far");
}
else if (item.itemName.Equals("Picky Piggy"))
{
noiseMakerCycle.noiseSFX = (AudioClip[])(object)new AudioClip[6];
noiseMakerCycle.noiseSFX[0] = assetBundle.LoadAsset<AudioClip>("Picky1");
noiseMakerCycle.noiseSFX[1] = assetBundle.LoadAsset<AudioClip>("Picky2");
noiseMakerCycle.noiseSFX[2] = assetBundle.LoadAsset<AudioClip>("Picky3");
noiseMakerCycle.noiseSFX[3] = assetBundle.LoadAsset<AudioClip>("Picky4");
noiseMakerCycle.noiseSFX[4] = assetBundle.LoadAsset<AudioClip>("Picky5");
noiseMakerCycle.noiseSFX[5] = assetBundle.LoadAsset<AudioClip>("Picky6");
noiseMakerCycle.noiseSFXFar = (AudioClip[])(object)new AudioClip[6];
noiseMakerCycle.noiseSFXFar[0] = assetBundle.LoadAsset<AudioClip>("Picky1Far");
noiseMakerCycle.noiseSFXFar[1] = assetBundle.LoadAsset<AudioClip>("Picky2Far");
noiseMakerCycle.noiseSFXFar[2] = assetBundle.LoadAsset<AudioClip>("Picky3Far");
noiseMakerCycle.noiseSFXFar[3] = assetBundle.LoadAsset<AudioClip>("Picky4Far");
noiseMakerCycle.noiseSFXFar[4] = assetBundle.LoadAsset<AudioClip>("Picky5Far");
noiseMakerCycle.noiseSFXFar[5] = assetBundle.LoadAsset<AudioClip>("Picky6Far");
}
else
{
Logger.LogError((object)("Item name not recognized for special NoiseMakerCycle configuration: " + item.itemName));
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "Nuclear_Fox.SmilingCritters";
public const string PLUGIN_NAME = "SmilingCritters";
public const string PLUGIN_VERSION = "2.1.1";
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}