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.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 GnomePlushV2.Behaviours;
using HarmonyLib;
using LethalLib.Modules;
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.0.0")]
[assembly: AssemblyInformationalVersion("3.0.0+5f8d24822a43bf82c78729d08af443b8aeb8b92f")]
[assembly: AssemblyProduct("GnomePlushV2")]
[assembly: AssemblyTitle("inoyu.GnomePlush")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("3.0.0.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 GnomePlushV2
{
[DataContract]
internal class GnomeConfig : SyncedConfig2<GnomeConfig>
{
internal ConfigEntry<int> GNOME_NOISE_BASE_VOLUME;
[SyncedEntryField]
internal SyncedEntry<int> GNOME_SCRAP_RARITY;
[SyncedEntryField]
internal SyncedEntry<bool> IS_GNOME_NOISE_ENABLED;
[SyncedEntryField]
internal SyncedEntry<bool> CAN_GNOME_ANGER_DOGS;
[SyncedEntryField]
internal SyncedEntry<int> GNOME_REVERB_CHANCE;
[SyncedEntryField]
internal SyncedEntry<int> GNOME_NOISES_FREQUENCY;
[SyncedEntryField]
internal SyncedEntry<int> GNOME_NOISE_PITCH_CHANGE_AMOUNT;
[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;
private const int gnomeRarity_DV = 85;
private const int gnomeSoundsFrequency_DV = 45;
private const int gnomeReverbSoundChance_DV = 10;
private const int gnomeNoiseBaseVolume_DV = 60;
private const int gnomeNoisePitchChangeAmount_DV = 14;
private const int tinySizeSpawnChance_DV = 15;
private const int defaultSizeSpawnChance_DV = 65;
private const int bigSizeSpawnChance_DV = 20;
private const float experimentalSizeMultiplier_DV = 1f;
private const bool isGnomeNoiseEnabled_DV = true;
private const bool canGnomeAngerDogs_DV = true;
public GnomeConfig(ConfigFile cfg)
: base("inoyu.GnomePlush")
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Expected O, but got Unknown
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Expected O, but got Unknown
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_00d0: Expected O, but got Unknown
//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ff: Expected O, but got Unknown
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Expected O, but got Unknown
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Expected O, but got Unknown
//IL_0182: Unknown result type (might be due to invalid IL or missing references)
//IL_018c: Expected O, but got Unknown
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Expected O, but got Unknown
//IL_01ea: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Expected O, but got Unknown
GNOME_NOISE_BASE_VOLUME = cfg.Bind<int>("GnomeNoises", "gnomeNoiseBaseVolume", 60, new ConfigDescription("The base volume of gnome-noises.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
GNOME_SCRAP_RARITY = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "Gnome", "gnomeRarity", 85, new ConfigDescription("Sets the rarity of the gnome plush.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 800), Array.Empty<object>()));
IS_GNOME_NOISE_ENABLED = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "GnomeBehaviour", "isGnomeNoiseEnabled", true, "Should the gnome make gnome-noises?");
CAN_GNOME_ANGER_DOGS = SyncedBindingExtensions.BindSyncedEntry<bool>(cfg, "GnomeBehaviour", "canGnomeAngerDogs", true, "Should the gnome-noises be able to trigger eyeless dogs or other monsters?");
GNOME_REVERB_CHANCE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "GnomeNoises", "gnomeReverbNoiseChance", 10, 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", 45, 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_CHANGE_AMOUNT = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "GnomeNoises", "RandomPitchChange_Amount", 14, 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>()));
TINY_GNOME_SIZE_SPAWN_CHANCE = SyncedBindingExtensions.BindSyncedEntry<int>(cfg, "GnomeSize", "tinySizeSpawnChance", 15, 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", 65, 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", 20, 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, "z_EXPERIMENTAL", "experimentalSizeMultiplier", 1f, new ConfigDescription("Increases the size of ALL gnomes (by a lot)! High values might lead to unforseen bugs/glitches!!!", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>()));
ConfigManager.Register<GnomeConfig>((SyncedConfig2<GnomeConfig>)(object)this);
}
}
[BepInPlugin("inoyu.GnomePlush", "GnomePlushV2", "3.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency("com.sigurd.csync", "5.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class GnomePlushV2 : BaseUnityPlugin
{
internal static GnomeConfig gnomeConfig;
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 GnomePlushV2 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");
GnomeScript.InitializeRPCS_GnomeScript();
string text = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "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;
Logger.LogDebug((object)"found whoo with reverb sfx");
}
}
else
{
gnomeScript.gnomeSound = item;
Logger.LogDebug((object)"found whoo sfx");
}
}
if (areGnomeAsstesValid)
{
NetworkPrefabs.RegisterNetworkPrefab(val2.spawnPrefab);
Utilities.FixMixerGroups(val2.spawnPrefab);
Items.RegisterScrap(val2, SyncedEntry<int>.op_Implicit(gnomeConfig.GNOME_SCRAP_RARITY), (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!");
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "inoyu.GnomePlush";
public const string PLUGIN_NAME = "GnomePlushV2";
public const string PLUGIN_VERSION = "3.0.0";
}
}
namespace GnomePlushV2.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)
{
GnomePlushV2.randomSize = new Random(randomSeed);
GnomePlushV2.randomSeed = randomSeed;
}
}
}
namespace GnomePlushV2.Behaviours
{
public class GnomeScript : GrabbableObject
{
[CompilerGenerated]
private static class <>O
{
public static RpcReceiveHandler <0>____rpc_handler_152346789;
public static RpcReceiveHandler <1>____rpc_handler_623146789;
public static RpcReceiveHandler <2>____rpc_handler_178238291;
}
private static int gnomeCount = 0;
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 randomNumberPitchChange;
private float gnomeSoundInterval;
private bool isGnomeSoundIntervalSet = false;
internal static Random randomNoise = new Random(400);
private float randomScale = 1f;
private int randomIndex;
private int[] tinySizes = new int[5] { 3, 5, 5, 6, 7 };
private int[] defaultSizes = new int[5] { 10, 10, 12, 13, 14 };
private int[] bigSizes = new int[5] { 18, 18, 20, 23, 33 };
public override void Start()
{
int num = 50;
int num2 = GnomePlushV2.gnomeConfig.TINY_GNOME_SIZE_SPAWN_CHANCE.Value + GnomePlushV2.gnomeConfig.DEFAULT_GNOME_SIZE_SPAWN_CHANCE.Value + GnomePlushV2.gnomeConfig.BIG_GNOME_SIZE_SPAWN_CHANCE.Value;
float num3 = (float)GnomePlushV2.gnomeConfig.TINY_GNOME_SIZE_SPAWN_CHANCE.Value / (float)num2 * 100f;
float num4 = (float)GnomePlushV2.gnomeConfig.DEFAULT_GNOME_SIZE_SPAWN_CHANCE.Value / (float)num2 * 100f;
gnomeCount++;
randomNoise = new Random(400 + gnomeCount);
if (((NetworkBehaviour)this).IsHost)
{
num = GnomePlushV2.randomSize.Next(1, 100);
randomIndex = GnomePlushV2.randomSize.Next(0, 5);
if ((float)num <= num3)
{
randomScale = tinySizes[randomIndex];
}
else if ((float)num <= num3 + num4)
{
randomScale = defaultSizes[randomIndex];
}
else
{
randomScale = bigSizes[randomIndex];
}
GnomePlushV2.Logger.LogInfo((object)("randomScale " + randomScale));
GnomePlushV2.Logger.LogInfo((object)"- - - - - - - - - - - -");
randomScale *= SyncedEntry<float>.op_Implicit(GnomePlushV2.gnomeConfig.EXPERIMENTAL_SIZE_MULTIPLIER);
randomScale /= 10f;
}
SetGnomeSizeClientRpc(randomScale);
((GrabbableObject)this).Start();
}
public override void Update()
{
((GrabbableObject)this).Update();
if (((NetworkBehaviour)this).IsSpawned && NetworkManager.Singleton.IsServer)
{
if (!isGnomeSoundIntervalSet)
{
int num = (int)(0.5f * (float)(104 - SyncedEntry<int>.op_Implicit(GnomePlushV2.gnomeConfig.GNOME_NOISES_FREQUENCY)));
int num2 = (int)(1.3f * (float)(104 - SyncedEntry<int>.op_Implicit(GnomePlushV2.gnomeConfig.GNOME_NOISES_FREQUENCY)));
gnomeSoundInterval = randomNoise.Next(num * 100, num2 * 100);
gnomeSoundInterval /= 100f;
isGnomeSoundIntervalSet = true;
}
gnomeSoundInterval -= Time.deltaTime;
if (gnomeSoundInterval < 0f)
{
PlayGnomeSound(CalcRandomGnomePitch());
isGnomeSoundIntervalSet = false;
}
}
}
private float CalcRandomGnomePitch()
{
float num = 1f;
float num2 = GnomePlushV2.gnomeConfig.GNOME_NOISE_PITCH_CHANGE_AMOUNT.Value;
float num3 = 100 - (int)(num2 * 0.85f);
float num4 = 100f + num2;
if (num3 < 0f)
{
num3 = 0f;
}
randomNumberPitchChange = randomNoise.Next((int)num3, (int)num4);
randomNumberPitchChange /= 100f;
num /= Math.Clamp(randomScale - 1f, 1f, 1.3f);
return num * randomNumberPitchChange;
}
private void PlayGnomeSound(float randomPitch)
{
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
int num = GnomePlushV2.gnomeConfig.GNOME_NOISE_BASE_VOLUME.Value / 100;
int num2 = randomNoise.Next(0, 100);
if (num2 < GnomePlushV2.gnomeConfig.GNOME_REVERB_CHANCE.Value)
{
PlayGnomeReverbSoundClientRpc(randomPitch);
WalkieTalkie.TransmitOneShotAudio(gnomeAudioSource, gnomeSoundReverb, (float)num - 0.25f);
}
else
{
PlayGnomeSoundClientRpc(randomPitch);
WalkieTalkie.TransmitOneShotAudio(gnomeAudioSource, gnomeSound, (float)num - 0.25f);
}
if (SyncedEntry<bool>.op_Implicit(GnomePlushV2.gnomeConfig.CAN_GNOME_ANGER_DOGS))
{
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 8f, (float)num, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 69420);
}
}
private void ChangePitch(float targetPitch)
{
gnomeAudioSource.dopplerLevel = 1f;
gnomeAudioSource.pitch = targetPitch;
}
[ClientRpc]
public void PlayGnomeSoundClientRpc(float gnomePitch)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Invalid comparison between Unknown and I4
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Invalid comparison between Unknown and I4
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(152346789u, val, (RpcDelivery)0);
BytePacker.WriteValuePacked(val2, gnomePitch);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 152346789u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
ChangePitch(gnomePitch);
gnomeAudioSource.PlayOneShot(gnomeSound);
}
}
}
[ClientRpc]
public void PlayGnomeReverbSoundClientRpc(float gnomePitch)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Invalid comparison between Unknown and I4
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Invalid comparison between Unknown and I4
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(623146789u, val, (RpcDelivery)0);
BytePacker.WriteValuePacked(val2, gnomePitch);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 623146789u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
ChangePitch(gnomePitch);
gnomeAudioSource.PlayOneShot(gnomeSoundReverb);
}
}
}
[ClientRpc]
public void SetGnomeSizeClientRpc(float gnomeSize)
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Invalid comparison between Unknown and I4
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Invalid comparison between Unknown and I4
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_00da: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(178238291u, val, (RpcDelivery)0);
BytePacker.WriteValuePacked(val2, gnomeSize);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 178238291u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
if (gnomeSize > BIG_GNOME_THRESHOLD)
{
((Component)this).transform.localScale = new Vector3(gnomeSize * BIG_GNOME_WIDTH, gnomeSize, gnomeSize * BIG_GNOME_WIDTH);
}
else
{
((Component)this).transform.localScale = Vector3.one * gnomeSize;
}
}
}
public static void __rpc_handler_152346789(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if ((Object)(object)networkManager != (Object)null && networkManager.IsListening)
{
float targetPitch = default(float);
ByteUnpacker.ReadValuePacked(reader, ref targetPitch);
((NetworkBehaviour)(GnomeScript)(object)target).__rpc_exec_stage = (__RpcExecStage)2;
((GnomeScript)(object)target).ChangePitch(targetPitch);
((GnomeScript)(object)target).gnomeAudioSource.PlayOneShot(((GnomeScript)(object)target).gnomeSound);
((NetworkBehaviour)(GnomeScript)(object)target).__rpc_exec_stage = (__RpcExecStage)0;
}
else
{
Debug.LogError((object)"NetworkManager is not listening or null in RPC handler");
}
}
public static void __rpc_handler_623146789(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if ((Object)(object)networkManager != (Object)null && networkManager.IsListening)
{
float targetPitch = default(float);
ByteUnpacker.ReadValuePacked(reader, ref targetPitch);
((NetworkBehaviour)(GnomeScript)(object)target).__rpc_exec_stage = (__RpcExecStage)2;
((GnomeScript)(object)target).ChangePitch(targetPitch);
((GnomeScript)(object)target).gnomeAudioSource.PlayOneShot(((GnomeScript)(object)target).gnomeSoundReverb);
((NetworkBehaviour)(GnomeScript)(object)target).__rpc_exec_stage = (__RpcExecStage)0;
}
else
{
Debug.LogError((object)"NetworkManager is not listening or null in RPC handler");
}
}
public static void __rpc_handler_178238291(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0022: 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_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if ((Object)(object)networkManager != (Object)null && networkManager.IsListening)
{
float num = default(float);
ByteUnpacker.ReadValuePacked(reader, ref num);
((NetworkBehaviour)(GnomeScript)(object)target).__rpc_exec_stage = (__RpcExecStage)2;
if (num > ((GnomeScript)(object)target).BIG_GNOME_THRESHOLD)
{
((Component)(GnomeScript)(object)target).transform.localScale = new Vector3(num * ((GnomeScript)(object)target).BIG_GNOME_WIDTH, num, num * ((GnomeScript)(object)target).BIG_GNOME_WIDTH);
}
else
{
((Component)(GnomeScript)(object)target).transform.localScale = Vector3.one * num;
}
((NetworkBehaviour)(GnomeScript)(object)target).__rpc_exec_stage = (__RpcExecStage)0;
}
else
{
Debug.LogError((object)"NetworkManager is not listening or null in RPC handler");
}
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_GnomeScript()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Expected O, but got Unknown
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Expected O, but got Unknown
Dictionary<uint, RpcReceiveHandler> _rpc_func_table = NetworkManager.__rpc_func_table;
object obj = <>O.<0>____rpc_handler_152346789;
if (obj == null)
{
RpcReceiveHandler val = __rpc_handler_152346789;
<>O.<0>____rpc_handler_152346789 = val;
obj = (object)val;
}
_rpc_func_table.Add(152346789u, (RpcReceiveHandler)obj);
Dictionary<uint, RpcReceiveHandler> _rpc_func_table2 = NetworkManager.__rpc_func_table;
object obj2 = <>O.<1>____rpc_handler_623146789;
if (obj2 == null)
{
RpcReceiveHandler val2 = __rpc_handler_623146789;
<>O.<1>____rpc_handler_623146789 = val2;
obj2 = (object)val2;
}
_rpc_func_table2.Add(623146789u, (RpcReceiveHandler)obj2);
Dictionary<uint, RpcReceiveHandler> _rpc_func_table3 = NetworkManager.__rpc_func_table;
object obj3 = <>O.<2>____rpc_handler_178238291;
if (obj3 == null)
{
RpcReceiveHandler val3 = __rpc_handler_178238291;
<>O.<2>____rpc_handler_178238291 = val3;
obj3 = (object)val3;
}
_rpc_func_table3.Add(178238291u, (RpcReceiveHandler)obj3);
}
public override void OnNetworkSpawn()
{
if (((NetworkBehaviour)this).IsClient)
{
Debug.Log((object)"Client has spawned and is ready.");
}
}
public override void EquipItem()
{
((GrabbableObject)this).EquipItem();
}
public override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
public override string __getTypeName()
{
return "GnomeItem";
}
}
}