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 LethalLib.Modules;
using LobbyCompatibility.Enums;
using LobbyCompatibility.Features;
using Microsoft.CodeAnalysis;
using PolishedPlushiesAndSillyScrap.Patches;
using SelfSortingStorage.Cupboard;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ScienceBird.PolishedPlushiesAndSillyScrap")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1+9831b51528afde8b8dcb60f423dbac0c1bff600b")]
[assembly: AssemblyProduct("PolishedPlushiesAndSillyScrap")]
[assembly: AssemblyTitle("ScienceBird.PolishedPlushiesAndSillyScrap")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 PolishedPlushiesAndSillyScrap
{
public class IdleAnimatingProp : GrabbableObject
{
public AudioClip[] randomClips = Array.Empty<AudioClip>();
public AudioClip[] randomClipsFar = Array.Empty<AudioClip>();
public Animator triggerAnimator;
public string[] animatorTriggers = Array.Empty<string>();
public bool holdingAnimation = false;
public AudioSource animAudio;
public AudioSource animAudioFar;
public float loudness = 1f;
public float noiseRange;
public float minInterval;
public float maxInterval;
public float animChancePercent;
public bool fixedAssignment = false;
public bool isNuko = false;
public AudioClip specialNukoClip;
public bool playedFallAudio = false;
public float currentInterval;
public float lastIntervalTime;
public Random animationRandom;
public float correctVertical = 0.5f;
public override void Start()
{
((GrabbableObject)this).Start();
NetworkObject component = ((Component)this).gameObject.GetComponent<NetworkObject>();
if ((Object)(object)component != (Object)null)
{
animationRandom = new Random(StartOfRound.Instance.randomMapSeed + 85 + (int)component.NetworkObjectId);
}
else
{
animationRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
}
if (isNuko)
{
maxInterval = PolishedPlushiesAndSillyScrap.nukoAnimFrequency.Value;
animChancePercent = PolishedPlushiesAndSillyScrap.nukoAnimConsistency.Value;
correctVertical = 0.26f;
base.itemProperties.verticalOffset = 0.26f;
}
else if (base.itemProperties.itemName == "Seal")
{
maxInterval = PolishedPlushiesAndSillyScrap.sealAnimFrequency.Value;
animChancePercent = PolishedPlushiesAndSillyScrap.sealAnimConsistency.Value;
correctVertical = 0.5f;
base.itemProperties.verticalOffset = 0.5f;
}
}
public override void Update()
{
//IL_0349: Unknown result type (might be due to invalid IL or missing references)
//IL_0244: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).Update();
if (!(Time.realtimeSinceStartup - lastIntervalTime > currentInterval))
{
return;
}
lastIntervalTime = Time.realtimeSinceStartup;
if (animationRandom == null)
{
NetworkObject component = ((Component)this).gameObject.GetComponent<NetworkObject>();
if ((Object)(object)component != (Object)null)
{
animationRandom = new Random(StartOfRound.Instance.randomMapSeed + 85 + (int)component.NetworkObjectId);
}
else
{
animationRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
}
}
currentInterval = (float)animationRandom.NextDouble() * (maxInterval - minInterval) + minInterval;
if (!((float)animationRandom.NextDouble() * 100f < animChancePercent) || base.isHeld)
{
return;
}
int num = animationRandom.Next(0, animatorTriggers.Length);
if (animatorTriggers.Length != 0)
{
triggerAnimator.SetTrigger(animatorTriggers[num]);
}
bool flag = SomeWalkiesAreActive();
if (isNuko && !flag && !base.isInShipRoom && !base.isInElevator)
{
return;
}
if (fixedAssignment)
{
if (!((Object)(object)animAudio != (Object)null) || num >= randomClips.Length)
{
return;
}
if (isNuko)
{
if (base.isInElevator || base.isInShipRoom)
{
StartOfRound.Instance.speakerAudioSource.PlayOneShot(randomClips[num]);
}
if (flag)
{
PlayOnActiveWalkies(randomClips[num]);
}
return;
}
animAudio.PlayOneShot(randomClips[num], loudness);
WalkieTalkie.TransmitOneShotAudio(animAudio, randomClips[num], loudness);
if (PolishedPlushiesAndSillyScrap.sealAttractDogs.Value)
{
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, loudness, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
}
if ((Object)(object)animAudioFar != (Object)null && num < randomClipsFar.Length)
{
animAudioFar.PlayOneShot(randomClipsFar[num], loudness);
}
return;
}
int num2 = animationRandom.Next(0, randomClips.Length);
if ((Object)(object)animAudio != (Object)null && randomClips.Length != 0)
{
animAudio.PlayOneShot(randomClips[num2], loudness);
WalkieTalkie.TransmitOneShotAudio(animAudio, randomClips[num2], loudness);
if (PolishedPlushiesAndSillyScrap.sealAttractDogs.Value)
{
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, loudness, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
}
}
if ((Object)(object)animAudioFar != (Object)null && num2 < randomClipsFar.Length)
{
animAudioFar.PlayOneShot(randomClipsFar[num2], loudness);
}
}
public override void GrabItem()
{
//IL_0189: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).GrabItem();
if (animationRandom == null)
{
NetworkObject component = ((Component)this).gameObject.GetComponent<NetworkObject>();
if ((Object)(object)component != (Object)null)
{
animationRandom = new Random(StartOfRound.Instance.randomMapSeed + 85 + (int)component.NetworkObjectId);
}
else
{
animationRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
}
}
if (holdingAnimation && (Object)(object)triggerAnimator != (Object)null)
{
triggerAnimator.SetTrigger("playHold");
}
if (!((Object)(object)animAudio != (Object)null) || randomClips.Length == 0)
{
return;
}
int num = animationRandom.Next(0, randomClips.Length);
if (isNuko)
{
if (base.isInElevator || base.isInShipRoom)
{
StartOfRound.Instance.speakerAudioSource.PlayOneShot(randomClips[num]);
}
if (PolishedPlushiesAndSillyScrap.nukoTransmitMore.Value && SomeWalkiesAreActive())
{
PlayOnActiveWalkies(randomClips[num]);
}
}
else
{
animAudio.PlayOneShot(randomClips[num], loudness);
WalkieTalkie.TransmitOneShotAudio(animAudio, randomClips[num], loudness);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, loudness, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
if ((Object)(object)animAudioFar != (Object)null && num < randomClipsFar.Length)
{
animAudioFar.PlayOneShot(randomClipsFar[num], loudness);
}
}
}
public override void DiscardItem()
{
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).DiscardItem();
if (base.itemProperties.verticalOffset != correctVertical)
{
base.itemProperties.verticalOffset = correctVertical;
}
if (holdingAnimation && (Object)(object)triggerAnimator != (Object)null)
{
triggerAnimator.SetTrigger("stopHold");
}
if (!((Object)(object)animAudio != (Object)null) || randomClips.Length == 0)
{
return;
}
int num = animationRandom.Next(0, randomClips.Length);
if (isNuko)
{
if (base.isInElevator || base.isInShipRoom)
{
StartOfRound.Instance.speakerAudioSource.PlayOneShot(randomClips[num]);
}
if (PolishedPlushiesAndSillyScrap.nukoTransmitMore.Value && SomeWalkiesAreActive())
{
PlayOnActiveWalkies(randomClips[num]);
}
}
else
{
animAudio.PlayOneShot(randomClips[num], loudness);
WalkieTalkie.TransmitOneShotAudio(animAudio, randomClips[num], loudness);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, loudness, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
if ((Object)(object)animAudioFar != (Object)null && num < randomClipsFar.Length)
{
animAudioFar.PlayOneShot(randomClipsFar[num], loudness);
}
}
}
public bool SomeWalkiesAreActive()
{
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
foreach (WalkieTalkie allWalkieTalky in WalkieTalkie.allWalkieTalkies)
{
if ((((Behaviour)allWalkieTalky.walkieTalkieLight).enabled || ((GrabbableObject)allWalkieTalky).isBeingUsed) && Vector3.Distance(((Component)allWalkieTalky).gameObject.transform.position, ((Component)this).gameObject.transform.position) < 25f)
{
return true;
}
}
return false;
}
public void PlayOnActiveWalkies(AudioClip clip)
{
foreach (WalkieTalkie allWalkieTalky in WalkieTalkie.allWalkieTalkies)
{
if (((GrabbableObject)allWalkieTalky).isBeingUsed)
{
allWalkieTalky.target.PlayOneShot(clip, 1f);
}
else if (((Behaviour)allWalkieTalky.walkieTalkieLight).enabled)
{
if (allWalkieTalky.PlayerIsHoldingAnotherWalkieTalkie(allWalkieTalky))
{
break;
}
allWalkieTalky.thisAudio.PlayOneShot(clip);
}
}
}
public override void OnHitGround()
{
((GrabbableObject)this).OnHitGround();
if (isNuko)
{
playedFallAudio = false;
}
}
}
public class LoadScrap
{
public static AssetBundle PlushAssets;
public static Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>();
public static void RegisterScrap()
{
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Expected O, but got Unknown
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Expected O, but got Unknown
//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Expected O, but got Unknown
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0121: Expected O, but got Unknown
//IL_0155: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Expected O, but got Unknown
//IL_0193: Unknown result type (might be due to invalid IL or missing references)
//IL_019d: Expected O, but got Unknown
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01db: Expected O, but got Unknown
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Expected O, but got Unknown
//IL_024d: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Expected O, but got Unknown
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_0297: Expected O, but got Unknown
//IL_02cd: Unknown result type (might be due to invalid IL or missing references)
//IL_02d7: Expected O, but got Unknown
//IL_030d: Unknown result type (might be due to invalid IL or missing references)
//IL_0317: Expected O, but got Unknown
//IL_034d: Unknown result type (might be due to invalid IL or missing references)
//IL_0357: Expected O, but got Unknown
//IL_038d: Unknown result type (might be due to invalid IL or missing references)
//IL_0397: Expected O, but got Unknown
//IL_03cd: Unknown result type (might be due to invalid IL or missing references)
//IL_03d7: Expected O, but got Unknown
//IL_0434: Unknown result type (might be due to invalid IL or missing references)
//IL_043b: Expected O, but got Unknown
PlushAssets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "ppassitems"));
List<CustomContent> list = new List<CustomContent>();
list.Add((CustomContent)new ScrapItem("Frieren", "Assets/LethalCompany/Mods/PolishedPlushiesAndSillyScrap/Frieren/Frieren.asset", PolishedPlushiesAndSillyScrap.plushiesSpawn[0].Value, (LevelTypes)((!PolishedPlushiesAndSillyScrap.enablePlushies[0].Value) ? 1 : (-1)), (string[])null, (Action<Item>)null));
list.Add((CustomContent)new ScrapItem("Pomni", "Assets/LethalCompany/Mods/PolishedPlushiesAndSillyScrap/Pomni/Pomni.asset", PolishedPlushiesAndSillyScrap.plushiesSpawn[1].Value, (LevelTypes)((!PolishedPlushiesAndSillyScrap.enablePlushies[1].Value) ? 1 : (-1)), (string[])null, (Action<Item>)null));
list.Add((CustomContent)new ScrapItem("Freddy", "Assets/LethalCompany/Mods/PolishedPlushiesAndSillyScrap/Freddy/Freddy.asset", PolishedPlushiesAndSillyScrap.plushiesSpawn[2].Value, (LevelTypes)((!PolishedPlushiesAndSillyScrap.enablePlushies[2].Value) ? 1 : (-1)), (string[])null, (Action<Item>)null));
list.Add((CustomContent)new ScrapItem("Reimu", "Assets/LethalCompany/Mods/PolishedPlushiesAndSillyScrap/Reimu/Reimu.asset", PolishedPlushiesAndSillyScrap.plushiesSpawn[3].Value, (LevelTypes)((!PolishedPlushiesAndSillyScrap.enablePlushies[3].Value) ? 1 : (-1)), (string[])null, (Action<Item>)null));
list.Add((CustomContent)new ScrapItem("Blahaj", "Assets/LethalCompany/Mods/PolishedPlushiesAndSillyScrap/Blahaj/Blahaj.asset", PolishedPlushiesAndSillyScrap.plushiesSpawn[4].Value, (LevelTypes)((!PolishedPlushiesAndSillyScrap.enablePlushies[4].Value) ? 1 : (-1)), (string[])null, (Action<Item>)null));
list.Add((CustomContent)new ScrapItem("Pou", "Assets/LethalCompany/Mods/PolishedPlushiesAndSillyScrap/Pou/Pou.asset", PolishedPlushiesAndSillyScrap.plushiesSpawn[5].Value, (LevelTypes)((!PolishedPlushiesAndSillyScrap.enablePlushies[5].Value) ? 1 : (-1)), (string[])null, (Action<Item>)null));
list.Add((CustomContent)new ScrapItem("Rei", "Assets/LethalCompany/Mods/PolishedPlushiesAndSillyScrap/Rei/Rei.asset", PolishedPlushiesAndSillyScrap.plushiesSpawn[6].Value, (LevelTypes)((!PolishedPlushiesAndSillyScrap.enablePlushies[6].Value) ? 1 : (-1)), (string[])null, (Action<Item>)null));
list.Add((CustomContent)new ScrapItem("NecoArc", "Assets/LethalCompany/Mods/PolishedPlushiesAndSillyScrap/Neco-Arc/NecoArc.asset", PolishedPlushiesAndSillyScrap.plushiesSpawn[7].Value, (LevelTypes)((!PolishedPlushiesAndSillyScrap.enablePlushies[7].Value) ? 1 : (-1)), (string[])null, (Action<Item>)null));
list.Add((CustomContent)new ScrapItem("Bocchi", "Assets/LethalCompany/Mods/PolishedPlushiesAndSillyScrap/Bocchi/Bocchi.asset", PolishedPlushiesAndSillyScrap.plushiesSpawn[8].Value, (LevelTypes)((!PolishedPlushiesAndSillyScrap.enablePlushies[8].Value) ? 1 : (-1)), (string[])null, (Action<Item>)null));
list.Add((CustomContent)new ScrapItem("Miku", "Assets/LethalCompany/Mods/PolishedPlushiesAndSillyScrap/MikuTeto/Miku.asset", PolishedPlushiesAndSillyScrap.plushiesSpawn[9].Value, (LevelTypes)((!PolishedPlushiesAndSillyScrap.enablePlushies[9].Value) ? 1 : (-1)), (string[])null, (Action<Item>)null));
list.Add((CustomContent)new ScrapItem("Teto", "Assets/LethalCompany/Mods/PolishedPlushiesAndSillyScrap/MikuTeto/Teto.asset", PolishedPlushiesAndSillyScrap.plushiesSpawn[10].Value, (LevelTypes)((!PolishedPlushiesAndSillyScrap.enablePlushies[10].Value) ? 1 : (-1)), (string[])null, (Action<Item>)null));
list.Add((CustomContent)new ScrapItem("Pukeko", "Assets/LethalCompany/Mods/PolishedPlushiesAndSillyScrap/Pukeko/Pukeko.asset", PolishedPlushiesAndSillyScrap.plushiesSpawn[11].Value, (LevelTypes)((!PolishedPlushiesAndSillyScrap.enablePlushies[11].Value) ? 1 : (-1)), (string[])null, (Action<Item>)null));
list.Add((CustomContent)new ScrapItem("Niko", "Assets/LethalCompany/Mods/PolishedPlushiesAndSillyScrap/Niko/Niko.asset", PolishedPlushiesAndSillyScrap.plushiesSpawn[12].Value, (LevelTypes)((!PolishedPlushiesAndSillyScrap.enablePlushies[12].Value) ? 1 : (-1)), (string[])null, (Action<Item>)null));
list.Add((CustomContent)new ScrapItem("Nuko", "Assets/LethalCompany/Mods/PolishedPlushiesAndSillyScrap/Nuko/Nuko.asset", PolishedPlushiesAndSillyScrap.plushiesSpawn[13].Value, (LevelTypes)((!PolishedPlushiesAndSillyScrap.enablePlushies[13].Value) ? 1 : (-1)), (string[])null, (Action<Item>)null));
list.Add((CustomContent)new ScrapItem("Seal", "Assets/LethalCompany/Mods/PolishedPlushiesAndSillyScrap/Seal/Seal.asset", PolishedPlushiesAndSillyScrap.plushiesSpawn[14].Value, (LevelTypes)((!PolishedPlushiesAndSillyScrap.enablePlushies[14].Value) ? 1 : (-1)), (string[])null, (Action<Item>)null));
if (PolishedPlushiesAndSillyScrap.onlyLoadEnabled.Value)
{
for (int i = 0; i < list.Count; i++)
{
if (!PolishedPlushiesAndSillyScrap.enablePlushies[i].Value)
{
list.RemoveAt(i);
}
}
}
foreach (ScrapItem item in list)
{
ScrapItem val = item;
Item val2 = PlushAssets.LoadAsset<Item>(((CustomItem)val).contentPath);
NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
Items.RegisterScrap(val2, val.levelRarities, val.customLevelRarities);
}
}
}
public class LobbyCompatibility
{
public static void RegisterCompatibility()
{
PluginHelper.RegisterPlugin("ScienceBird.PolishedPlushiesAndSillyScrap", Version.Parse("1.0.1"), (CompatibilityLevel)2, (VersionStrictness)0);
}
}
[BepInPlugin("ScienceBird.PolishedPlushiesAndSillyScrap", "PolishedPlushiesAndSillyScrap", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class PolishedPlushiesAndSillyScrap : BaseUnityPlugin
{
public static ConfigEntry<int> frierenSFX1;
public static ConfigEntry<int> frierenSFX2;
public static ConfigEntry<int> pomniSFX1;
public static ConfigEntry<int> pomniSFX2;
public static ConfigEntry<int> freddySFX1;
public static ConfigEntry<int> freddySFX2;
public static ConfigEntry<int> freddySFX3;
public static ConfigEntry<int> reimuSFX1;
public static ConfigEntry<int> reimuSFX2;
public static ConfigEntry<int> blahajSFX1;
public static ConfigEntry<int> blahajSFX2;
public static ConfigEntry<int> pouSFX;
public static ConfigEntry<int> reiSFX;
public static ConfigEntry<int> necoSFX1;
public static ConfigEntry<int> necoSFX2;
public static ConfigEntry<int> necoSFX3;
public static ConfigEntry<int> necoSFX4;
public static ConfigEntry<int> necoSFX5;
public static ConfigEntry<int> necoSFX6;
public static ConfigEntry<int> necoSFX7;
public static ConfigEntry<int> necoSFX8;
public static ConfigEntry<int> necoSFX9;
public static ConfigEntry<int> bocchiSFX;
public static ConfigEntry<int> mikuSFX1;
public static ConfigEntry<int> mikuSFX2;
public static ConfigEntry<int> mikuSFX3;
public static ConfigEntry<int> tetoSFX1;
public static ConfigEntry<int> tetoSFX2;
public static ConfigEntry<int> pukekoSFX;
public static ConfigEntry<int> nikoSFX1;
public static ConfigEntry<int> nikoSFX2;
public static ConfigEntry<int> nikoSFX3;
public static ConfigEntry<bool> nukoTransmitMore;
public static ConfigEntry<float> nukoAnimFrequency;
public static ConfigEntry<float> nukoAnimConsistency;
public static ConfigEntry<bool> sealAttractDogs;
public static ConfigEntry<float> sealAnimFrequency;
public static ConfigEntry<float> sealAnimConsistency;
public static ConfigEntry<bool> onlyLoadEnabled;
public static List<ConfigEntry<bool>> enablePlushies = new List<ConfigEntry<bool>>();
public static List<ConfigEntry<int>> plushiesSpawn = new List<ConfigEntry<int>>();
public static (string, int)[] plushList = new(string, int)[13]
{
("Frieren", 6),
("Pomni", 6),
("Freddy", 6),
("Reimu", 5),
("Blahaj", 6),
("Pou", 4),
("Rei", 4),
("Neco-Arc", 4),
("Mendako Bocchi", 5),
("Miku", 5),
("Teto", 5),
("Pukeko chick", 3),
("Niko", 1)
};
public static Dictionary<string, int[]> plushDict = new Dictionary<string, int[]>();
public static PluginInfo pluginInfo;
public static PolishedPlushiesAndSillyScrap Instance { get; private set; } = null;
internal static ManualLogSource Logger { get; private set; } = null;
internal static Harmony? Harmony { get; set; }
private void Awake()
{
//IL_011b: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Expected O, but got Unknown
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Expected O, but got Unknown
//IL_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Expected O, but got Unknown
//IL_0226: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Expected O, but got Unknown
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Expected O, but got Unknown
//IL_028a: Unknown result type (might be due to invalid IL or missing references)
//IL_0294: Expected O, but got Unknown
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02c6: Expected O, but got Unknown
//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
//IL_02f8: Expected O, but got Unknown
//IL_0320: Unknown result type (might be due to invalid IL or missing references)
//IL_032a: Expected O, but got Unknown
//IL_0352: Unknown result type (might be due to invalid IL or missing references)
//IL_035c: Expected O, but got Unknown
//IL_0384: Unknown result type (might be due to invalid IL or missing references)
//IL_038e: Expected O, but got Unknown
//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
//IL_03c0: Expected O, but got Unknown
//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
//IL_03f3: Expected O, but got Unknown
//IL_041c: Unknown result type (might be due to invalid IL or missing references)
//IL_0426: Expected O, but got Unknown
//IL_044f: Unknown result type (might be due to invalid IL or missing references)
//IL_0459: Expected O, but got Unknown
//IL_0481: Unknown result type (might be due to invalid IL or missing references)
//IL_048b: Expected O, but got Unknown
//IL_04b4: Unknown result type (might be due to invalid IL or missing references)
//IL_04be: Expected O, but got Unknown
//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
//IL_04f1: Expected O, but got Unknown
//IL_051a: Unknown result type (might be due to invalid IL or missing references)
//IL_0524: Expected O, but got Unknown
//IL_054d: Unknown result type (might be due to invalid IL or missing references)
//IL_0557: Expected O, but got Unknown
//IL_057f: Unknown result type (might be due to invalid IL or missing references)
//IL_0589: Expected O, but got Unknown
//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
//IL_05bb: Expected O, but got Unknown
//IL_05e3: Unknown result type (might be due to invalid IL or missing references)
//IL_05ed: Expected O, but got Unknown
//IL_0615: Unknown result type (might be due to invalid IL or missing references)
//IL_061f: Expected O, but got Unknown
//IL_0647: Unknown result type (might be due to invalid IL or missing references)
//IL_0651: Expected O, but got Unknown
//IL_067a: Unknown result type (might be due to invalid IL or missing references)
//IL_0684: Expected O, but got Unknown
//IL_06ac: Unknown result type (might be due to invalid IL or missing references)
//IL_06b6: Expected O, but got Unknown
//IL_06de: Unknown result type (might be due to invalid IL or missing references)
//IL_06e8: Expected O, but got Unknown
//IL_0710: Unknown result type (might be due to invalid IL or missing references)
//IL_071a: Expected O, but got Unknown
//IL_0743: Unknown result type (might be due to invalid IL or missing references)
//IL_074d: Expected O, but got Unknown
//IL_0775: Unknown result type (might be due to invalid IL or missing references)
//IL_077f: Expected O, but got Unknown
//IL_07a8: Unknown result type (might be due to invalid IL or missing references)
//IL_07b2: Expected O, but got Unknown
//IL_07db: Unknown result type (might be due to invalid IL or missing references)
//IL_07e5: Expected O, but got Unknown
//IL_080e: Unknown result type (might be due to invalid IL or missing references)
//IL_0818: Expected O, but got Unknown
//IL_0841: Unknown result type (might be due to invalid IL or missing references)
//IL_084b: Expected O, but got Unknown
//IL_089e: Unknown result type (might be due to invalid IL or missing references)
//IL_08a8: Expected O, but got Unknown
//IL_08db: Unknown result type (might be due to invalid IL or missing references)
//IL_08e5: Expected O, but got Unknown
//IL_0938: Unknown result type (might be due to invalid IL or missing references)
//IL_0942: Expected O, but got Unknown
//IL_0975: Unknown result type (might be due to invalid IL or missing references)
//IL_097f: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
pluginInfo = ((BaseUnityPlugin)this).Info;
onlyLoadEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("!General", "Only Load Enabled", false, "By default, disabling a plushie only sets it to not spawn on any moons, rather than removing it entirely (to prevent ID shifting or other issues when changing mod config). If you need to remove an item entirely by never loading it in the first place (e.g. for a name conflict), enable this setting.");
for (int i = 0; i < plushList.Length; i++)
{
enablePlushies.Add(((BaseUnityPlugin)this).Config.Bind<bool>(plushList[i].Item1, "Enable " + plushList[i].Item1, true, "Spawn the " + plushList[i].Item1 + " plush"));
plushiesSpawn.Add(((BaseUnityPlugin)this).Config.Bind<int>(plushList[i].Item1, plushList[i].Item1 + " Rarity", plushList[i].Item2, new ConfigDescription("How rare " + plushList[i].Item1 + " should be (lower number means more rare). A common vanilla item will have a value ~15-30.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), Array.Empty<object>())));
}
enablePlushies.Add(((BaseUnityPlugin)this).Config.Bind<bool>("Nuko", "Enable Nuko", true, "Spawn Nuko"));
plushiesSpawn.Add(((BaseUnityPlugin)this).Config.Bind<int>("Nuko", "Nuko Rarity", 2, new ConfigDescription("How rare Nuko should be (lower number means more rare). A common vanilla item will have a value ~15-30.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), Array.Empty<object>())));
enablePlushies.Add(((BaseUnityPlugin)this).Config.Bind<bool>("Seal", "Enable Seal", true, "Spawn the Seal"));
plushiesSpawn.Add(((BaseUnityPlugin)this).Config.Bind<int>("Seal", "Seal Rarity", 3, new ConfigDescription("How rare the Seal should be (lower number means more rare). A common vanilla item will have a value ~15-30.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), Array.Empty<object>())));
frierenSFX1 = ((BaseUnityPlugin)this).Config.Bind<int>("Frieren", "Sound 1 Chance", 5, new ConfigDescription("Percent chance of triggering Frieren's sound effect 1 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
frierenSFX2 = ((BaseUnityPlugin)this).Config.Bind<int>("Frieren", "Sound 2 Chance", 5, new ConfigDescription("Percent chance of triggering Frieren's sound effect 2 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
pomniSFX1 = ((BaseUnityPlugin)this).Config.Bind<int>("Pomni", "Sound 1 Chance", 7, new ConfigDescription("Percent chance of triggering Pomni's sound effect 1 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
pomniSFX2 = ((BaseUnityPlugin)this).Config.Bind<int>("Pomni", "Sound 2 Chance", 3, new ConfigDescription("Percent chance of triggering Pomni's sound effect 2 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
freddySFX1 = ((BaseUnityPlugin)this).Config.Bind<int>("Freddy", "Sound 1 Chance", 7, new ConfigDescription("Percent chance of triggering Freddy's sound effect 1 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
freddySFX2 = ((BaseUnityPlugin)this).Config.Bind<int>("Freddy", "Sound 2 Chance", 7, new ConfigDescription("Percent chance of triggering Freddy's sound effect 2 when squeezed (slight variant of sound effect 1).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
freddySFX3 = ((BaseUnityPlugin)this).Config.Bind<int>("Freddy", "Sound 3 Chance", 3, new ConfigDescription("Percent chance of triggering Freddy's sound effect 3 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
reimuSFX1 = ((BaseUnityPlugin)this).Config.Bind<int>("Reimu", "Sound 1 Chance", 4, new ConfigDescription("Percent chance of triggering Reimu's sound effect 1 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
reimuSFX2 = ((BaseUnityPlugin)this).Config.Bind<int>("Reimu", "Sound 2 Chance", 4, new ConfigDescription("Percent chance of triggering Reimu's sound effect 2 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
blahajSFX1 = ((BaseUnityPlugin)this).Config.Bind<int>("Blahaj", "Sound 1 Chance", 25, new ConfigDescription("Percent chance of triggering Blahaj's sound effect 1 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
blahajSFX2 = ((BaseUnityPlugin)this).Config.Bind<int>("Blahaj", "Sound 2 Chance", 25, new ConfigDescription("Percent chance of triggering Blahaj's sound effect 2 when squeezed (slight variant of sound effect 1).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
pouSFX = ((BaseUnityPlugin)this).Config.Bind<int>("Pou", "Sound Chance", 20, new ConfigDescription("Percent chance of triggering Pou's sound effect when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
reiSFX = ((BaseUnityPlugin)this).Config.Bind<int>("Rei", "Sound Chance", 5, new ConfigDescription("Percent chance of triggering Rei's sound effect when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
necoSFX1 = ((BaseUnityPlugin)this).Config.Bind<int>("Neco-Arc", "Sound 1 Chance", 25, new ConfigDescription("Percent chance of triggering Neco-Arc's sound effect 1 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
necoSFX2 = ((BaseUnityPlugin)this).Config.Bind<int>("Neco-Arc", "Sound 2 Chance", 25, new ConfigDescription("Percent chance of triggering Neco-Arc's sound effect 2 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
necoSFX3 = ((BaseUnityPlugin)this).Config.Bind<int>("Neco-Arc", "Sound 3 Chance", 14, new ConfigDescription("Percent chance of triggering Neco-Arc's sound effect 3 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
necoSFX4 = ((BaseUnityPlugin)this).Config.Bind<int>("Neco-Arc", "Sound 4 Chance", 9, new ConfigDescription("Percent chance of triggering Neco-Arc's sound effect 4 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
necoSFX5 = ((BaseUnityPlugin)this).Config.Bind<int>("Neco-Arc", "Sound 5 Chance", 7, new ConfigDescription("Percent chance of triggering Neco-Arc's sound effect 5 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
necoSFX6 = ((BaseUnityPlugin)this).Config.Bind<int>("Neco-Arc", "Sound 6 Chance", 7, new ConfigDescription("Percent chance of triggering Neco-Arc's sound effect 6 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
necoSFX7 = ((BaseUnityPlugin)this).Config.Bind<int>("Neco-Arc", "Sound 7 Chance", 7, new ConfigDescription("Percent chance of triggering Neco-Arc's sound effect 7 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
necoSFX8 = ((BaseUnityPlugin)this).Config.Bind<int>("Neco-Arc", "Sound 8 Chance", 3, new ConfigDescription("Percent chance of triggering Neco-Arc's sound effect 8 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
necoSFX9 = ((BaseUnityPlugin)this).Config.Bind<int>("Neco-Arc", "Sound 9 Chance", 3, new ConfigDescription("Percent chance of triggering Neco-Arc's sound effect 9 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
bocchiSFX = ((BaseUnityPlugin)this).Config.Bind<int>("Mendako Bocchi", "Sound Chance", 20, new ConfigDescription("Percent chance of triggering Mendako Bocchi's sound effect when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
mikuSFX1 = ((BaseUnityPlugin)this).Config.Bind<int>("Miku", "Sound 1 Chance", 7, new ConfigDescription("Percent chance of triggering Miku's sound effect 1 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
mikuSFX2 = ((BaseUnityPlugin)this).Config.Bind<int>("Miku", "Sound 2 Chance", 7, new ConfigDescription("Percent chance of triggering Miku's sound effect 2 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
mikuSFX3 = ((BaseUnityPlugin)this).Config.Bind<int>("Miku", "Sound 3 Chance", 7, new ConfigDescription("Percent chance of triggering Miku's sound effect 3 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
tetoSFX1 = ((BaseUnityPlugin)this).Config.Bind<int>("Teto", "Sound 1 Chance", 15, new ConfigDescription("Percent chance of triggering Teto's sound effect 1 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
tetoSFX2 = ((BaseUnityPlugin)this).Config.Bind<int>("Teto", "Sound 2 Chance", 1, new ConfigDescription("Percent chance of triggering Teto's sound effect 2 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
pukekoSFX = ((BaseUnityPlugin)this).Config.Bind<int>("Pukeko chick", "Sound Chance", 10, new ConfigDescription("Percent chance of triggering Pukeko chick's sound effect when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
nikoSFX1 = ((BaseUnityPlugin)this).Config.Bind<int>("Niko", "Sound 1 Chance", 10, new ConfigDescription("Percent chance of triggering Niko's sound effect 1 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
nikoSFX2 = ((BaseUnityPlugin)this).Config.Bind<int>("Niko", "Sound 2 Chance", 10, new ConfigDescription("Percent chance of triggering Niko's sound effect 2 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
nikoSFX3 = ((BaseUnityPlugin)this).Config.Bind<int>("Niko", "Sound 3 Chance", 10, new ConfigDescription("Percent chance of triggering Niko's sound effect 3 when squeezed.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
nukoTransmitMore = ((BaseUnityPlugin)this).Config.Bind<bool>("Nuko", "Transmit More Sounds", false, "Transmit sounds over walkie-talkies when Nuko is dropped or grabbed. By default, drop/grab sounds are only played on the ship speaker to avoid checking the map for walkie-talkies every time the scrap is interacted with.");
nukoAnimFrequency = ((BaseUnityPlugin)this).Config.Bind<float>("Nuko", "Animation Frequency", 25f, new ConfigDescription("Maximum time (in seconds) between random idle animations. The interval is rolled randomly, so this just sets the longest possible random interval.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 200f), Array.Empty<object>()));
nukoAnimConsistency = ((BaseUnityPlugin)this).Config.Bind<float>("Nuko", "Animation Consistency", 50f, new ConfigDescription("As a percent, how often animations will actually occur on the random interval. The lower this is, animations will be less frequent and more variable.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
sealAttractDogs = ((BaseUnityPlugin)this).Config.Bind<bool>("Seal", "Heard By Dogs", true, "Eyeless dogs can hear the random noises made by seals. This is similar to mask laughing, and should only have a small effect when the dogs are very close. Grabbing and dropping sounds will always attract dogs regardless of this setting.");
sealAnimFrequency = ((BaseUnityPlugin)this).Config.Bind<float>("Seal", "Animation Frequency", 35f, new ConfigDescription("Maximum time (in seconds) between random idle animations. The interval is rolled randomly, so this just sets the longest possible random interval.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 200f), Array.Empty<object>()));
sealAnimConsistency = ((BaseUnityPlugin)this).Config.Bind<float>("Seal", "Animation Consistency", 50f, new ConfigDescription("As a percent, how often animations will actually occur on the random interval. The lower this is, animations will be less frequent and more variable.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>()));
plushDict.TryAdd("Frieren", new int[2] { frierenSFX1.Value, frierenSFX2.Value });
plushDict.TryAdd("Pomni", new int[2] { pomniSFX1.Value, pomniSFX2.Value });
plushDict.TryAdd("Freddy", new int[3] { freddySFX1.Value, freddySFX2.Value, freddySFX3.Value });
plushDict.TryAdd("Reimu", new int[2] { reimuSFX1.Value, reimuSFX2.Value });
plushDict.TryAdd("Blahaj", new int[2] { blahajSFX1.Value, blahajSFX2.Value });
plushDict.TryAdd("Pou", new int[1] { pouSFX.Value });
plushDict.TryAdd("Rei", new int[1] { reiSFX.Value });
plushDict.TryAdd("Neco-Arc", new int[9] { necoSFX1.Value, necoSFX2.Value, necoSFX3.Value, necoSFX4.Value, necoSFX5.Value, necoSFX6.Value, necoSFX7.Value, necoSFX8.Value, necoSFX9.Value });
plushDict.TryAdd("Mendako Bocchi", new int[1] { bocchiSFX.Value });
plushDict.TryAdd("Miku", new int[3] { mikuSFX1.Value, mikuSFX2.Value, mikuSFX3.Value });
plushDict.TryAdd("Teto", new int[2] { tetoSFX1.Value, tetoSFX2.Value });
plushDict.TryAdd("Pukeko chick", new int[1] { pukekoSFX.Value });
plushDict.TryAdd("Niko", new int[3] { nikoSFX1.Value, nikoSFX2.Value, nikoSFX3.Value });
LoadScrap.RegisterScrap();
Patch();
Logger.LogInfo((object)"ScienceBird.PolishedPlushiesAndSillyScrap v1.0.1 has loaded!");
}
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("ScienceBird.PolishedPlushiesAndSillyScrap");
}
Logger.LogDebug((object)"Patching...");
bool flag = false;
bool flag2 = false;
Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies();
foreach (Assembly assembly in assemblies)
{
if (assembly.GetName().Name == "BMX.LobbyCompatibility")
{
Logger.LogDebug((object)"Found BMX!");
flag = true;
}
if (assembly.GetName().Name == "SelfSortingStorage")
{
Logger.LogDebug((object)"Found zigzag!");
flag2 = true;
}
if (flag && flag2)
{
break;
}
}
if (flag)
{
LobbyCompatibility.RegisterCompatibility();
}
if (flag2)
{
SSSBlacklist.AddBlacklistTrigger();
}
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!");
}
}
public class WeightedNoisemakerProp : GrabbableObject
{
public AudioSource noiseAudio;
public AudioSource noiseAudioFar;
[Space(3f)]
public AudioClip fixedNoiseSFX;
public AudioClip fixedNoiseSFXFar;
public AudioClip[] noiseSFX;
public AudioClip[] noiseSFXFar;
[Space(3f)]
public float noiseRange;
public float maxLoudness;
public float minLoudness;
public float minPitch;
public float maxPitch;
public float loudness = 1f;
public Random noisemakerRandom;
public Animator triggerAnimator;
public Mesh[] altMeshVariants = Array.Empty<Mesh>();
public Material[] altMaterialVariants = Array.Empty<Material>();
public MeshFilter targetFilter;
public MeshRenderer targetRenderer;
private List<int> noiseWeights;
private bool isPlaying = false;
private float lastTime;
private float sfxLength;
public override void Start()
{
((GrabbableObject)this).Start();
NetworkObject component = ((Component)this).gameObject.GetComponent<NetworkObject>();
if ((Object)(object)component != (Object)null)
{
noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85 + (int)component.NetworkObjectId);
}
else
{
noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
}
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_04b4: 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 || (Object)(object)noiseAudio == (Object)null || (Object)(object)fixedNoiseSFX == (Object)null)
{
return;
}
if (noisemakerRandom == null)
{
NetworkObject component = ((Component)this).gameObject.GetComponent<NetworkObject>();
if ((Object)(object)component != (Object)null)
{
noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85 + (int)component.NetworkObjectId);
}
else
{
noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
}
}
float num = (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(fixedNoiseSFX, num);
if ((Object)(object)noiseAudioFar != (Object)null && (Object)(object)fixedNoiseSFXFar != (Object)null)
{
noiseAudioFar.pitch = pitch;
noiseAudioFar.PlayOneShot(fixedNoiseSFXFar, num);
}
if ((Object)(object)triggerAnimator != (Object)null)
{
triggerAnimator.SetTrigger("playAnim");
}
WalkieTalkie.TransmitOneShotAudio(noiseAudio, fixedNoiseSFX, num);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, num, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
if (num >= 0.6f && (Object)(object)base.playerHeldBy != (Object)null)
{
base.playerHeldBy.timeSinceMakingLoudNoise = 0f;
}
if (PolishedPlushiesAndSillyScrap.plushDict.TryGetValue(base.itemProperties.itemName, out int[] value))
{
noiseWeights = new List<int>();
noiseWeights = value.ToList();
}
else
{
PolishedPlushiesAndSillyScrap.Logger.LogError((object)"Failed to retrieve SFX config! Reverting to default.");
}
if (noiseSFX.Length != noiseWeights.Count)
{
PolishedPlushiesAndSillyScrap.Logger.LogError((object)"Invalid weighted noisemaker! Rejecting item activation.");
}
else
{
if (isPlaying || noiseWeights.Sum() <= 0)
{
return;
}
int[] array = noiseWeights.ToArray();
int num2 = noisemakerRandom.Next(0, noiseSFX.Length);
bool flag = false;
if (noiseWeights.Count > 0 && noiseWeights.Sum() <= 100)
{
int num3 = noisemakerRandom.Next(0, 100);
for (int i = 0; i < noiseWeights.Count; i++)
{
int num4 = noiseWeights[i];
if (num3 < num4)
{
num2 = i;
flag = true;
break;
}
if (i < noiseWeights.Count - 1)
{
noiseWeights[i + 1] += num4;
}
}
}
else
{
if (noiseWeights.Count <= 0)
{
PolishedPlushiesAndSillyScrap.Logger.LogError((object)"No weights found! Rejecting item activation.");
return;
}
flag = true;
}
if (flag)
{
noiseAudio.pitch = 1f;
noiseAudio.PlayOneShot(noiseSFX[num2], loudness);
sfxLength = noiseSFX[num2].length;
lastTime = Time.realtimeSinceStartup;
isPlaying = true;
if ((Object)(object)noiseAudioFar != (Object)null && noiseSFXFar.Length == noiseSFX.Length)
{
noiseAudioFar.pitch = 1f;
noiseAudioFar.PlayOneShot(noiseSFXFar[num2], loudness);
}
WalkieTalkie.TransmitOneShotAudio(noiseAudio, noiseSFX[num2], loudness);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, noiseRange, loudness, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
if (loudness >= 0.6f && (Object)(object)base.playerHeldBy != (Object)null)
{
base.playerHeldBy.timeSinceMakingLoudNoise = 0f;
}
if ((Object)(object)triggerAnimator != (Object)null && ((((Object)base.itemProperties).name == "Freddy" && num2 == 2) || ((Object)base.itemProperties).name == "Bocchi" || ((Object)base.itemProperties).name == "Niko"))
{
triggerAnimator.SetTrigger("playSpecial");
}
}
}
}
public override void Update()
{
((GrabbableObject)this).Update();
if (isPlaying && Time.realtimeSinceStartup - lastTime > sfxLength)
{
isPlaying = false;
}
}
public override void LateUpdate()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).LateUpdate();
if ((Object)(object)base.radarIcon != (Object)null)
{
Transform radarIcon = base.radarIcon;
radarIcon.position += new Vector3(0f, 0.1f, 0f);
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "ScienceBird.PolishedPlushiesAndSillyScrap";
public const string PLUGIN_NAME = "PolishedPlushiesAndSillyScrap";
public const string PLUGIN_VERSION = "1.0.1";
}
}
namespace PolishedPlushiesAndSillyScrap.Patches
{
[HarmonyPatch]
public class FallPatches
{
[HarmonyPatch(typeof(GrabbableObject), "FallWithCurve")]
[HarmonyPostfix]
private static void DetectLongFall(GrabbableObject __instance)
{
if ((Object)(object)__instance == (Object)null || (Object)(object)__instance.itemProperties == (Object)null || !(((Object)__instance.itemProperties).name == "Nuko"))
{
return;
}
IdleAnimatingProp component = ((Component)__instance).gameObject.GetComponent<IdleAnimatingProp>();
if ((Object)(object)component != (Object)null && !component.playedFallAudio && __instance.startFallingPosition.y - __instance.targetFloorPosition.y > 5f)
{
component.playedFallAudio = true;
if (component.SomeWalkiesAreActive())
{
component.PlayOnActiveWalkies(component.specialNukoClip);
}
if (__instance.isInElevator || __instance.isInShipRoom)
{
StartOfRound.Instance.speakerAudioSource.PlayOneShot(component.specialNukoClip);
}
}
}
[HarmonyPatch(typeof(GrabbableObject), "GetPhysicsRegionOfDroppedObject")]
[HarmonyPrefix]
private static void RaycastFix(GrabbableObject __instance, PlayerControllerB playerDropping)
{
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: 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_01ec: Unknown result type (might be due to invalid IL or missing references)
//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_022b: Unknown result type (might be due to invalid IL or missing references)
//IL_0237: Unknown result type (might be due to invalid IL or missing references)
//IL_0247: Unknown result type (might be due to invalid IL or missing references)
//IL_025d: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: 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_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0126: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
if (!Object.op_Implicit((Object)(object)((Component)__instance).gameObject.GetComponent<IdleAnimatingProp>()))
{
return;
}
if (__instance.itemProperties.verticalOffset != ((Component)__instance).gameObject.GetComponent<IdleAnimatingProp>().correctVertical)
{
__instance.itemProperties.verticalOffset = ((Component)__instance).gameObject.GetComponent<IdleAnimatingProp>().correctVertical;
}
Transform val = null;
RaycastHit val3 = default(RaycastHit);
if ((Object)(object)playerDropping != (Object)null && __instance.itemProperties.allowDroppingAheadOfPlayer)
{
Ray val2 = default(Ray);
((Ray)(ref val2))..ctor(((Component)playerDropping).transform.position + Vector3.up * 0.4f, ((Component)playerDropping.gameplayCamera).transform.forward);
Vector3 val4 = ((!Physics.Raycast(val2, ref val3, 1.7f, 1342179585, (QueryTriggerInteraction)1)) ? ((Ray)(ref val2)).GetPoint(1.7f) : ((Ray)(ref val2)).GetPoint(Mathf.Clamp(((RaycastHit)(ref val3)).distance - 0.3f, 0.01f, 2f)));
if (Physics.Raycast(val4, -Vector3.up, ref val3, 80f, 1342179585, (QueryTriggerInteraction)1) && ((RaycastHit)(ref val3)).point.y > ((Component)__instance).transform.position.y)
{
PolishedPlushiesAndSillyScrap.Logger.LogDebug((object)"Detected bad raycast! Resolving...");
Transform transform = ((Component)__instance).gameObject.transform;
transform.position += new Vector3(0f, ((RaycastHit)(ref val3)).point.y - ((Component)__instance).transform.position.y + 0.2f, 0f);
}
}
else
{
Ray val5 = default(Ray);
((Ray)(ref val5))..ctor(((Component)__instance).transform.position, -Vector3.up);
if (Physics.Raycast(val5, ref val3, 80f, 1342179585, (QueryTriggerInteraction)1) && ((RaycastHit)(ref val3)).point.y > ((Component)__instance).transform.position.y)
{
PolishedPlushiesAndSillyScrap.Logger.LogDebug((object)"Detected bad raycast! Resolving...");
Transform transform2 = ((Component)__instance).gameObject.transform;
transform2.position += new Vector3(0f, ((RaycastHit)(ref val3)).point.y - ((Component)__instance).transform.position.y + 0.2f, 0f);
}
}
}
}
[HarmonyPatch]
public class MeshVariantsPatch
{
public static Random AltMeshRandom;
[HarmonyPatch(typeof(RoundManager), "SyncScrapValuesClientRpc")]
[HarmonyPostfix]
public static void AlternateMeshHandling(RoundManager __instance, NetworkObjectReference[] spawnedScrap)
{
AltMeshRandom = new Random(StartOfRound.Instance.randomMapSeed + 210);
WeightedNoisemakerProp[] array = Object.FindObjectsOfType<WeightedNoisemakerProp>();
WeightedNoisemakerProp[] array2 = array;
foreach (WeightedNoisemakerProp weightedNoisemakerProp in array2)
{
if (weightedNoisemakerProp.altMeshVariants.Length != 0 && (Object)(object)weightedNoisemakerProp.targetFilter != (Object)null && !((GrabbableObject)weightedNoisemakerProp).scrapPersistedThroughRounds && !((GrabbableObject)weightedNoisemakerProp).isInShipRoom && !((GrabbableObject)weightedNoisemakerProp).isInElevator && !((GrabbableObject)weightedNoisemakerProp).isHeld && ((GrabbableObject)weightedNoisemakerProp).isInFactory)
{
int num = AltMeshRandom.Next(0, weightedNoisemakerProp.altMeshVariants.Length);
weightedNoisemakerProp.targetFilter.mesh = weightedNoisemakerProp.altMeshVariants[num];
if (num < weightedNoisemakerProp.altMaterialVariants.Length && (Object)(object)weightedNoisemakerProp.targetRenderer != (Object)null)
{
((Renderer)weightedNoisemakerProp.targetRenderer).sharedMaterial = weightedNoisemakerProp.altMaterialVariants[num];
}
}
}
}
}
[HarmonyPatch]
public class RandomResetPatch
{
public static bool initialCheck;
public static void ResetRandoms(int seed)
{
IdleAnimatingProp[] array = Object.FindObjectsOfType<IdleAnimatingProp>();
WeightedNoisemakerProp[] array2 = Object.FindObjectsOfType<WeightedNoisemakerProp>();
IdleAnimatingProp[] array3 = array;
foreach (IdleAnimatingProp idleAnimatingProp in array3)
{
NetworkObject component = ((Component)idleAnimatingProp).gameObject.GetComponent<NetworkObject>();
if ((Object)(object)component != (Object)null)
{
idleAnimatingProp.animationRandom = new Random(StartOfRound.Instance.randomMapSeed + 85 + (int)component.NetworkObjectId);
}
else
{
idleAnimatingProp.animationRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
}
idleAnimatingProp.currentInterval = 0f;
idleAnimatingProp.lastIntervalTime = 0f;
}
WeightedNoisemakerProp[] array4 = array2;
foreach (WeightedNoisemakerProp weightedNoisemakerProp in array4)
{
NetworkObject component2 = ((Component)weightedNoisemakerProp).gameObject.GetComponent<NetworkObject>();
if ((Object)(object)component2 != (Object)null)
{
weightedNoisemakerProp.noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85 + (int)component2.NetworkObjectId);
}
else
{
weightedNoisemakerProp.noisemakerRandom = new Random(StartOfRound.Instance.randomMapSeed + 85);
}
}
}
[HarmonyPatch(typeof(RoundManager), "SyncScrapValuesClientRpc")]
[HarmonyPostfix]
public static void OnScrapSync(RoundManager __instance)
{
ResetRandoms(StartOfRound.Instance.randomMapSeed);
}
[HarmonyPatch(typeof(StartOfRound), "OnPlayerConnectedClientRpc")]
[HarmonyPostfix]
public static void OnConnect(StartOfRound __instance)
{
initialCheck = true;
}
[HarmonyPatch(typeof(StartOfRound), "Update")]
[HarmonyPostfix]
public static void OnUpdate(StartOfRound __instance)
{
if (initialCheck)
{
ResetRandoms(__instance.randomMapSeed);
initialCheck = false;
}
}
}
[HarmonyPatch]
public class ScrapHUDPatch
{
public static Dictionary<string, float> overrides = new Dictionary<string, float>
{
{ "Frieren", -0.09f },
{ "Freddy", -0.05f },
{ "Pou", -0.04f },
{ "Pukeko", -0.03f },
{ "Miku", -0.06f },
{ "Teto", -0.06f },
{ "Neco-Arc", -0.06f },
{ "Pomni", -0.05f },
{ "Rei", -0.06f },
{ "Reimu", -0.06f },
{ "Seal", 0.09f },
{ "Nuko", 0.08f }
};
public static bool[] checkArray = new bool[3] { true, true, true };
public static bool flag;
public static string passedName;
public static int passedIndex;
[HarmonyPatch(typeof(HUDManager), "DisplayNewScrapFound")]
[HarmonyPrefix]
public static void ScrapDisplaySetup(HUDManager __instance)
{
if (__instance.itemsToBeDisplayed.Count <= 0 || (Object)(object)__instance.itemsToBeDisplayed[0] == (Object)null || (Object)(object)__instance.itemsToBeDisplayed[0].itemProperties.spawnPrefab == (Object)null)
{
return;
}
passedIndex = __instance.nextBoxIndex;
if (Object.op_Implicit((Object)(object)((Component)__instance.itemsToBeDisplayed[0]).gameObject.GetComponent<WeightedNoisemakerProp>()) || Object.op_Implicit((Object)(object)((Component)__instance.itemsToBeDisplayed[0]).gameObject.GetComponent<IdleAnimatingProp>()))
{
flag = true;
if ((Object)(object)__instance.itemsToBeDisplayed[0].itemProperties != (Object)null)
{
passedName = ((Object)__instance.itemsToBeDisplayed[0].itemProperties.spawnPrefab).name;
}
}
}
[HarmonyPatch(typeof(HUDManager), "DisplayNewScrapFound")]
[HarmonyPostfix]
public static void ScrapDisplayPatch(HUDManager __instance)
{
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
if (!flag || passedName == null || !overrides.ContainsKey(passedName))
{
checkArray[passedIndex] = false;
return;
}
GameObject gameObject = ((Component)__instance.ScrapItemBoxes[passedIndex].itemObjectContainer).gameObject;
GameObject val = GameObject.Find(((Object)gameObject).name + "/" + passedName + "(Clone)");
if ((Object)(object)val != (Object)null && overrides.TryGetValue(passedName, out var value))
{
if (checkArray[passedIndex])
{
Transform transform = val.transform;
transform.position += new Vector3(0f, value, 0f);
}
else
{
Transform transform2 = val.transform;
transform2.position += new Vector3(0f, value / 10f, 0f);
}
checkArray[passedIndex] = false;
}
}
}
public class SSSBlacklist
{
public static void AddBlacklistTrigger()
{
SmartCupboard.AddTriggerValidation((Func<PlayerControllerB, bool>)NukoBlacklist, "[Nuko can't fit]");
}
private static bool NukoBlacklist(PlayerControllerB player)
{
GrabbableObject currentlyHeldObjectServer = player.currentlyHeldObjectServer;
if ((Object)(object)currentlyHeldObjectServer != (Object)null && currentlyHeldObjectServer.itemProperties.itemName == "Nuko")
{
return false;
}
return true;
}
}
}