Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of gnome plush v3.1.0
BepInEx/plugins/inoyu.GnomePlush.dll
Decompiled 3 days agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Serialization; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using CSync.Extensions; using CSync.Lib; using GameNetcodeStuff; using GnomePlush.Behaviours; using HarmonyLib; using LethalLib.Modules; using LethalNetworkAPI; using Microsoft.CodeAnalysis; 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("inoyu.GnomePlush")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("3.0.1.0")] [assembly: AssemblyInformationalVersion("3.0.1+a7e425403b1582c64b5601e062f52ee564a58041")] [assembly: AssemblyProduct("GnomePlush")] [assembly: AssemblyTitle("inoyu.GnomePlush")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("3.0.1.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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] [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] [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 GnomePlush { [DataContract] internal class GnomeConfig : SyncedConfig2<GnomeConfig> { internal ConfigEntry<int> GNOME_NOISE_BASE_VOLUME; internal SyncedEntry<bool> IS_GNOME_PITCH_AFFECTED_BY_SIZE; [SyncedEntryField] internal SyncedEntry<int> GNOME_SCRAP_SPAWN_CHANCE; [SyncedEntryField] internal SyncedEntry<bool> IS_GNOME_NOISE_ENABLED; [SyncedEntryField] internal SyncedEntry<bool> CAN_GNOME_ANGER_DOGS; [SyncedEntryField] internal SyncedEntry<bool> CAN_GNOME_ANGER_DOGS_IN_SHIP; [SyncedEntryField] internal SyncedEntry<int> GNOME_REVERB_CHANCE; [SyncedEntryField] internal SyncedEntry<int> GNOME_NOISES_FREQUENCY; [SyncedEntryField] internal SyncedEntry<int> GNOME_NOISE_PITCH_RANGE; [SyncedEntryField] internal SyncedEntry<int> TINY_GNOME_SIZE_SPAWN_CHANCE; [SyncedEntryField] internal SyncedEntry<int> DEFAULT_GNOME_SIZE_SPAWN_CHANCE; [SyncedEntryField] internal SyncedEntry<int> BIG_GNOME_SIZE_SPAWN_CHANCE; [SyncedEntryField] internal SyncedEntry<float> EXPERIMENTAL_SIZE_MULTIPLIER; [SyncedEntryField] internal SyncedEntry<bool> IS_EXPERIMENTAL_SIZE_ENABLED; private const int gnomeSpawnChance_DV = 65; private const int gnomeSoundsFrequency_DV = 25; private const int gnomeReverbSoundChance_DV = 3; private const int gnomeNoiseBaseVolume_DV = 50; private const int gnomeNoisePitchRange_DV = 15; private const int tinySizeSpawnChance_DV = 8; private const int defaultSizeSpawnChance_DV = 85; private const int bigSizeSpawnChance_DV = 7; private const float experimentalSizeMultiplier_DV = 1f; public GnomeConfig(ConfigFile cfg) : base("inoyu.GnomePlush") { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Expected O, but got Unknown //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Expected O, but got Unknown //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Expected O, but got Unknown //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Expected O, but got Unknown GNOME_SCRAP_SPAWN_CHANCE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "Gnome", "gnomeSpawnChance", 65, new ConfigDescription("Sets the overall spawn chance of the gnome plushs. Higher values increase the chance of spawning.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 1000), Array.Empty<object>())); CAN_GNOME_ANGER_DOGS = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "GnomeBehaviour", "canGnomeAngerDogs", true, "Should the gnome-noises be able to trigger eyeless dogs or other monsters?"); CAN_GNOME_ANGER_DOGS_IN_SHIP = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "GnomeBehaviour", "canGnomeAngerDogsInShip", false, "Should the gnome-noises be able to trigger eyeless dogs or other monsters in the ship? This setting only applies when 'Can Gnome Anger Dogs' is enabled."); IS_GNOME_NOISE_ENABLED = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "GnomeNoises", "isGnomeNoiseEnabled", true, "Should the gnome make gnome-noises?"); GNOME_NOISE_BASE_VOLUME = cfg.Bind<int>("GnomeNoises", "gnomeNoiseBaseVolume", 50, new ConfigDescription("The base volume of gnome-noises.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); GNOME_REVERB_CHANCE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "GnomeNoises", "gnomeReverbNoiseChance", 3, new ConfigDescription("Sets the chance of a reverb gnome noise happening (in percent).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); GNOME_NOISES_FREQUENCY = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "GnomeNoises", "gnomeNoisesFrequency", 25, new ConfigDescription("The higher the value, the more frequent the gnome noises.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>())); GNOME_NOISE_PITCH_RANGE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "GnomeNoises", "RandomPitchRange", 15, new ConfigDescription("Higher values will make the gnome noises vary more in pitch (in percent). \n (each gnome-noise's pitch is randomized).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); IS_GNOME_PITCH_AFFECTED_BY_SIZE = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "GnomeNoises", "isGnomePitchAffectedBySize", true, "Should the gnome-noises pitch be affected by the size of the gnome? (bigger gnomes = lower pitch, smaller gnomes = higher pitch)"); TINY_GNOME_SIZE_SPAWN_CHANCE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "GnomeSize", "tinySizeSpawnChance", 8, new ConfigDescription("Rarity of tiny gnomes (relative to the values of the other gnome sizes). LOWER VALUE = RARER", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); DEFAULT_GNOME_SIZE_SPAWN_CHANCE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "GnomeSize", "defaultSizeSpawnChance", 85, new ConfigDescription("Rarity of default gnomes (relative to the values of the other gnome sizes). LOWER VALUE = RARER", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); BIG_GNOME_SIZE_SPAWN_CHANCE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "GnomeSize", "bigSizeSpawnChance", 7, new ConfigDescription("Rarity of tiny gnomes (relative to the values of the other gnome sizes). LOWER VALUE = RARER", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); EXPERIMENTAL_SIZE_MULTIPLIER = SyncedBindingExtensions.BindSyncedEntry<float>(cfg, "GnomeExperimental", "experimentalSizeMultiplier", 1f, new ConfigDescription("Increases or decreases the size of ALL gnomes (by a lot)! High values might lead to unforseen bugs/glitches!!!", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 20f), Array.Empty<object>())); IS_EXPERIMENTAL_SIZE_ENABLED = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "GnomeExperimental", "isExperimentalSizeEnabled", false, "Should the experimental size multiplier be applied to all gnomes? High values might lead to unforseen bugs/glitches!!!"); ConfigManager.Register<GnomeConfig>((SyncedConfig2<GnomeConfig>)(object)this); } } [BepInPlugin("inoyu.GnomePlush", "GnomePlush", "3.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class GnomePlush : BaseUnityPlugin { internal static GnomeConfig gnomeConfig = null; internal static Random randomSize = new Random(303); internal static Random randomNoise = new Random(404); internal static int randomSeed = 0; private const string gnomeAssetbundleName = "gnomeassets"; private const string gnomeItemPropertiesLocation = "Assets/Scrap/Gnome/GnomePlush.asset"; internal static bool areGnomeAsstesValid = true; public static GnomePlush Instance { get; private set; } = null; internal static ManualLogSource Logger { get; private set; } = null; internal static Harmony? Harmony { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; gnomeConfig = new GnomeConfig(((BaseUnityPlugin)this).Config); Logger.LogInfo((object)"GnomePlush awake"); string path = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location) ?? string.Empty; string text = Path.Combine(path, "gnomeassets"); AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { Logger.LogError((object)"Gnome assetbundle missing."); areGnomeAsstesValid = false; } else { Logger.LogDebug((object)"GnomeBundle okay"); } Item val2 = val.LoadAsset<Item>("Assets/Scrap/Gnome/GnomePlush.asset"); if ((Object)(object)val2 == (Object)null) { Logger.LogError((object)"Gnome item could't be loaded from asset bundle."); areGnomeAsstesValid = false; } else { Logger.LogDebug((object)"GnomeItem okay"); } if ((Object)(object)val2.spawnPrefab == (Object)null) { Logger.LogError((object)"Gnome prefab could't be loaded from item."); areGnomeAsstesValid = false; } else { Logger.LogDebug((object)"GnomePrefab okay"); } List<AudioClip> list = val.LoadAllAssets<AudioClip>().ToList(); AudioSource component = val2.spawnPrefab.GetComponent<AudioSource>(); GnomeScript gnomeScript = val2.spawnPrefab.AddComponent<GnomeScript>(); ((GrabbableObject)gnomeScript).grabbable = true; ((GrabbableObject)gnomeScript).grabbableToEnemies = true; ((GrabbableObject)gnomeScript).itemProperties = val2; gnomeScript.gnomeAudioSource = component; foreach (AudioClip item in list) { string name = ((Object)item).name; string text2 = name; if (!(text2 == "whoo")) { if (text2 == "whoo with reverb") { gnomeScript.gnomeSoundReverb = item; } } else { gnomeScript.gnomeSound = item; } } if (areGnomeAsstesValid) { NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab); Utilities.FixMixerGroups(val2.spawnPrefab); Items.RegisterScrap(val2, SyncedEntry<int>.op_Implicit(gnomeConfig.GNOME_SCRAP_SPAWN_CHANCE), (LevelTypes)(-1)); Patch(); Logger.LogInfo((object)"Gnomes await you in the dungeons..."); } else { Logger.LogError((object)"Something went wrong, gnome mod broke. Now the gnomes are unhappy and won't spawn. >:c"); } } 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("inoyu.GnomePlush"); } 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!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "inoyu.GnomePlush"; public const string PLUGIN_NAME = "GnomePlush"; public const string PLUGIN_VERSION = "3.0.1"; } } namespace GnomePlush.Patches { [HarmonyPatch] public class RoundManagerRandomSeedPatch { [HarmonyPatch(typeof(RoundManager), "GenerateNewLevelClientRpc")] [HarmonyPostfix] private static void OnNewRandomSeed(int randomSeed) { InitRandoms(randomSeed); } [HarmonyPostfix] [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] public static void InitializeClientRandoms() { InitRandoms(StartOfRound.Instance.randomMapSeed); } private static void InitRandoms(int randomSeed) { GnomePlush.randomSize = new Random(randomSeed); GnomePlush.randomSeed = randomSeed; } } } namespace GnomePlush.Behaviours { public class GnomeScript : GrabbableObject { private static int gnomeCount; public AudioClip gnomeSound; public AudioClip gnomeSoundReverb; public AudioSource gnomeAudioSource; private const float PITCH_MULTIPLIER = 0.85f; private const float GNOME_NOISE_WALKIE_VOLUME_OFFSET = 0.25f; private const float GNOME_NOISE_BASE_PITCH = 1f; private const float GNOME_NOISE_RANGE = 8f; public readonly float BIG_GNOME_WIDTH = 1.53f; public readonly float BIG_GNOME_THRESHOLD = 2.2f; private float pitchChange; private float gnomeSoundInterval; private bool isGnomeSoundIntervalSet = false; private Random randomNoise = new Random(400); private bool sizeLoadedFromSave = false; private float gnomeSizeFloatValue = 1f; private int gnomeSizeIntValue = 1; private int randomIndexRoll; private List<(int, int)> tinySizeChances = new List<(int, int)> { (2, 5), (3, 10), (5, 30), (6, 40), (7, 15) }; private List<(int, int)> defaultSizeChances = new List<(int, int)> { (10, 40), (11, 10), (12, 15), (13, 25), (14, 10) }; private List<(int, int)> bigSizeChances = new List<(int, int)> { (18, 40), (22, 30), (25, 15), (28, 10), (34, 4), (65, 1) }; private LNetworkMessage<(bool, float)> netMsg_PlaySound; private LNetworkVariable<int> netVar_GnomeSize; public override void OnNetworkSpawn() { netMsg_PlaySound = LNetworkMessage<(bool, float)>.Connect($"PlayGnomeSound_{((NetworkBehaviour)this).NetworkObjectId}", (Action<(bool, float), ulong>)null, (Action<(bool, float)>)null, (Action<(bool, float), ulong>)null); netMsg_PlaySound.ClearSubscriptions(); netMsg_PlaySound.OnClientReceived += PlayGnomeSoundClient; netVar_GnomeSize = LNetworkVariable<int>.Connect($"GnomeSize_{((NetworkBehaviour)this).NetworkObjectId}", 0, (LNetworkVariableWritePerms)0, (Action<int, int>)OnGnomeSizeChanged); if (NetworkManager.Singleton.IsServer) { if (!sizeLoadedFromSave) { gnomeSizeIntValue = RollGnomeSize(); } netVar_GnomeSize.Value = gnomeSizeIntValue; } if (netVar_GnomeSize.Value != 0) { OnGnomeSizeChanged(0, netVar_GnomeSize.Value); } } private int RollGnomeSize() { int num = GnomePlush.gnomeConfig.TINY_GNOME_SIZE_SPAWN_CHANCE.Value + GnomePlush.gnomeConfig.DEFAULT_GNOME_SIZE_SPAWN_CHANCE.Value + GnomePlush.gnomeConfig.BIG_GNOME_SIZE_SPAWN_CHANCE.Value; float num2 = (float)GnomePlush.gnomeConfig.TINY_GNOME_SIZE_SPAWN_CHANCE.Value / (float)num * 100f; float num3 = (float)GnomePlush.gnomeConfig.DEFAULT_GNOME_SIZE_SPAWN_CHANCE.Value / (float)num * 100f; int num4 = GnomePlush.randomSize.Next(1, 101); int randomChanceRoll = GnomePlush.randomSize.Next(1, 101); if ((float)num4 <= num2) { return RollGnomeSizeFromDictionary(tinySizeChances, randomChanceRoll); } if ((float)num4 <= num2 + num3) { return RollGnomeSizeFromDictionary(defaultSizeChances, randomChanceRoll); } return RollGnomeSizeFromDictionary(bigSizeChances, randomChanceRoll); } private int RollGnomeSizeFromDictionary(List<(int, int)> sizeChances, int randomChanceRoll) { float num = 0f; for (int i = 0; i < sizeChances.Count; i++) { num += (float)sizeChances[i].Item2; if ((float)randomChanceRoll < num) { return sizeChances[i].Item1; } } GnomePlush.Logger.LogWarning((object)$"[Gnome {((NetworkBehaviour)this).NetworkObjectId}] RollGnomeSizeFromDictionary: Random chance roll ({randomChanceRoll}) did not match any size chance. Returning default size."); return sizeChances[0].Item1; } private void OnGnomeSizeChanged(int oldVal, int newVal) { gnomeSizeIntValue = newVal; if (SyncedEntry<bool>.op_Implicit(GnomePlush.gnomeConfig.IS_EXPERIMENTAL_SIZE_ENABLED)) { gnomeSizeFloatValue = (float)gnomeSizeIntValue * SyncedEntry<float>.op_Implicit(GnomePlush.gnomeConfig.EXPERIMENTAL_SIZE_MULTIPLIER); } else { gnomeSizeFloatValue = gnomeSizeIntValue; } gnomeSizeFloatValue /= 10f; SetGnomeSize(gnomeSizeFloatValue); } public override void Start() { gnomeCount++; randomNoise = new Random(400 + gnomeCount); ((GrabbableObject)this).Start(); } private void SetGnomeSize(float gnomeSize) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: 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_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.one * gnomeSize; if (gnomeSize > BIG_GNOME_THRESHOLD) { ((Vector3)(ref val))..ctor(gnomeSize * BIG_GNOME_WIDTH, gnomeSize, gnomeSize * BIG_GNOME_WIDTH); } ((Component)this).transform.localScale = val; base.originalScale = val; } public override void Update() { ((GrabbableObject)this).Update(); if (((NetworkBehaviour)this).IsSpawned && NetworkManager.Singleton.IsServer && netMsg_PlaySound != null) { if (!isGnomeSoundIntervalSet) { int num = (int)(0.5f * (float)(104 - GnomePlush.gnomeConfig.GNOME_NOISES_FREQUENCY.Value)); int num2 = Math.Max(num + 1, (int)(1.3f * (float)(104 - GnomePlush.gnomeConfig.GNOME_NOISES_FREQUENCY.Value))); num *= 100; num2 *= 100; gnomeSoundInterval = (float)randomNoise.Next(num, num2) / 100f; isGnomeSoundIntervalSet = true; } gnomeSoundInterval -= Time.deltaTime; if (gnomeSoundInterval < 0f) { PlayGnomeSound(CalcRandomGnomePitch()); isGnomeSoundIntervalSet = false; } } } private float CalcRandomGnomePitch() { float num = 1f; float num2 = GnomePlush.gnomeConfig.GNOME_NOISE_PITCH_RANGE.Value; float num3 = Math.Clamp(100 - (int)(num2 * 0.85f), 1, 100); float num4 = 100f + num2; float num5 = Mathf.Pow(1f / gnomeSizeFloatValue, 0.5f); if (GnomePlush.gnomeConfig.IS_GNOME_PITCH_AFFECTED_BY_SIZE.Value) { num *= num5; } pitchChange = randomNoise.Next((int)num3, (int)num4) / 100; return num * pitchChange; } private void PlayGnomeSound(float randomPitch) { int num = randomNoise.Next(0, 100); bool item = num < GnomePlush.gnomeConfig.GNOME_REVERB_CHANCE.Value; if (netMsg_PlaySound == null) { GnomePlush.Logger.LogError((object)$"[Gnome {((NetworkBehaviour)this).NetworkObjectId}] netMsg_PlaySound is null! Cannot send sound."); } else { netMsg_PlaySound.SendClients((item, randomPitch)); } } public void PlayGnomeSoundClient((bool, float) soundData) { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)gnomeAudioSource == (Object)null) { GnomePlush.Logger.LogError((object)$"[Gnome {((NetworkBehaviour)this).NetworkObjectId}] gnomeAudioSource is null! Cannot play sound."); return; } float volume = (float)GnomePlush.gnomeConfig.GNOME_NOISE_BASE_VOLUME.Value / 100f; bool item = soundData.Item1; float item2 = soundData.Item2; AudioClip val = (item ? gnomeSoundReverb : gnomeSound); gnomeAudioSource.volume = volume; ChangePitch(item2); gnomeAudioSource.PlayOneShot(val); WalkieTalkie.TransmitOneShotAudio(gnomeAudioSource, val, 1f); if (GnomePlush.gnomeConfig.CAN_GNOME_ANGER_DOGS.Value && (!base.isInElevator || (base.isInElevator && GnomePlush.gnomeConfig.CAN_GNOME_ANGER_DOGS_IN_SHIP.Value))) { RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 8f, 0.5f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 941); } } private void ChangePitch(float targetPitch) { gnomeAudioSource.dopplerLevel = 1f; gnomeAudioSource.pitch = targetPitch; } public override void OnNetworkDespawn() { Cleanup(); ((NetworkBehaviour)this).OnNetworkDespawn(); } public override void OnDestroy() { Cleanup(); ((GrabbableObject)this).OnDestroy(); } private void Cleanup() { if (netMsg_PlaySound != null) { netMsg_PlaySound.OnClientReceived -= PlayGnomeSoundClient; netMsg_PlaySound.ClearSubscriptions(); netMsg_PlaySound = null; } netVar_GnomeSize?.Dispose(); netVar_GnomeSize = null; } public override int GetItemDataToSave() { return gnomeSizeIntValue; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); gnomeSizeIntValue = saveData; sizeLoadedFromSave = true; } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); } public override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } public override string __getTypeName() { return "GnomeItem"; } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }