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 OctolarPlush v1.5.0
com.github.zehsteam.OctolarPlush.dll
Decompiled 2 years agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using LethalConfig; using LethalConfig.ConfigItems; using LethalConfig.ConfigItems.Options; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using com.github.zehsteam.OctolarPlush.Data; using com.github.zehsteam.OctolarPlush.Dependencies; using com.github.zehsteam.OctolarPlush.NetcodePatcher; [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("com.github.zehsteam.OctolarPlush")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Adds a customizable Octolar plushie scrap item.")] [assembly: AssemblyFileVersion("1.5.0.0")] [assembly: AssemblyInformationalVersion("1.5.0+ea1c3a5979cc24b78d5ac24406dc72e7c5b2eaaa")] [assembly: AssemblyProduct("OctolarPlush")] [assembly: AssemblyTitle("com.github.zehsteam.OctolarPlush")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.5.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 com.github.zehsteam.OctolarPlush { internal static class ConfigHelper { public static void SetModIcon(Sprite sprite) { if (LethalConfigProxy.Enabled) { LethalConfigProxy.SetModIcon(sprite); } } public static void SetModDescription(string description) { if (LethalConfigProxy.Enabled) { LethalConfigProxy.SetModDescription(description); } } public static void SkipAutoGen() { if (LethalConfigProxy.Enabled) { LethalConfigProxy.SkipAutoGen(); } } public static ConfigEntry<T> Bind<T>(string section, string key, T defaultValue, bool requiresRestart, string description, AcceptableValueBase acceptableValues = null, Action<T> settingChanged = null, ConfigFile configFile = null) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown if (configFile == null) { configFile = ((BaseUnityPlugin)Plugin.Instance).Config; } ConfigEntry<T> configEntry = ((acceptableValues == null) ? configFile.Bind<T>(section, key, defaultValue, description) : configFile.Bind<T>(section, key, defaultValue, new ConfigDescription(description, acceptableValues, Array.Empty<object>()))); if (settingChanged != null) { configEntry.SettingChanged += delegate { settingChanged?.Invoke(configEntry.Value); }; } if (LethalConfigProxy.Enabled) { if (acceptableValues == null) { LethalConfigProxy.AddConfig<T>(configEntry, requiresRestart); } else { LethalConfigProxy.AddConfigSlider<T>(configEntry, requiresRestart); } } return configEntry; } public static void AddButton(string section, string name, string description, string buttonText, Action callback) { if (LethalConfigProxy.Enabled) { LethalConfigProxy.AddButton(section, name, description, buttonText, callback); } } } internal class ConfigManager { public ConfigEntry<bool> ExtendedLogging { get; private set; } public ConfigEntry<int> OctolarPlushie_SpawnWeight { get; private set; } public ConfigEntry<bool> OctolarPlushie_TwoHanded { get; private set; } public ConfigEntry<int> OctolarPlushie_CarryWeight { get; private set; } public ConfigEntry<int> OctolarPlushie_MinValue { get; private set; } public ConfigEntry<int> OctolarPlushie_MaxValue { get; private set; } public ConfigManager() { BindConfigs(); SetupChangedEvents(); ClearUnusedEntries(); } private void BindConfigs() { ConfigHelper.SkipAutoGen(); ExtendedLogging = ConfigHelper.Bind("General Settings", "ExtendedLogging", defaultValue: false, requiresRestart: false, "Enable extended logging."); OctolarPlushie_SpawnWeight = ConfigHelper.Bind("Octolar Plushie Settings", "SpawnWeight", 10, requiresRestart: false, "Octolar plushie spawn chance weight."); OctolarPlushie_TwoHanded = ConfigHelper.Bind("Octolar Plushie Settings", "TwoHanded", defaultValue: false, requiresRestart: false, "If enabled, the Octolar plushie will be two-handed."); OctolarPlushie_CarryWeight = ConfigHelper.Bind("Octolar Plushie Settings", "CarryWeight", 6, requiresRestart: false, "Octolar plushie carry weight in pounds."); OctolarPlushie_MinValue = ConfigHelper.Bind("Octolar Plushie Settings", "MinValue", 80, requiresRestart: false, "Octolar plushie min scrap value."); OctolarPlushie_MaxValue = ConfigHelper.Bind("Octolar Plushie Settings", "MaxValue", 250, requiresRestart: false, "Octolar plushie max scrap value."); } private void SetupChangedEvents() { OctolarPlushie_SpawnWeight.SettingChanged += OctolarPlushie_SpawnWeight_SettingChanged; OctolarPlushie_TwoHanded.SettingChanged += OctolarPlushie_Properties_SettingChanged; OctolarPlushie_CarryWeight.SettingChanged += OctolarPlushie_Properties_SettingChanged; OctolarPlushie_MinValue.SettingChanged += OctolarPlushie_Properties_SettingChanged; OctolarPlushie_MaxValue.SettingChanged += OctolarPlushie_Properties_SettingChanged; } private void OctolarPlushie_SpawnWeight_SettingChanged(object sender, EventArgs e) { ScrapHelper.UpdateScrapRarity(Content.OctolarPlush, OctolarPlushie_SpawnWeight.Value); } private void OctolarPlushie_Properties_SettingChanged(object sender, EventArgs e) { ScrapHelper.UpdateScrapProperties(Content.OctolarPlush, OctolarPlushie_TwoHanded.Value, OctolarPlushie_CarryWeight.Value, OctolarPlushie_MinValue.Value, OctolarPlushie_MaxValue.Value); } private void ClearUnusedEntries() { ConfigFile config = ((BaseUnityPlugin)Plugin.Instance).Config; PropertyInfo property = ((object)config).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic); Dictionary<ConfigDefinition, string> dictionary = (Dictionary<ConfigDefinition, string>)property.GetValue(config, null); dictionary.Clear(); config.Save(); } } internal static class Content { public static Item OctolarPlush; public static Sprite ModIcon; public static void Load() { LoadAssetsFromAssetBundle(); } private static void LoadAssetsFromAssetBundle() { try { string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)Plugin.Instance).Info.Location); string text = Path.Combine(directoryName, "octolarplush_assets"); AssetBundle val = AssetBundle.LoadFromFile(text); OctolarPlush = val.LoadAsset<Item>("OctolarPlush"); ModIcon = val.LoadAsset<Sprite>("ModIcon"); Plugin.logger.LogInfo((object)"Successfully loaded assets from AssetBundle!"); } catch (Exception arg) { Plugin.logger.LogError((object)$"Failed to load assets from AssetBundle.\n\n{arg}"); } } } internal static class NetworkUtils { public static bool IsServer { get { if ((Object)(object)NetworkManager.Singleton == (Object)null) { return false; } return NetworkManager.Singleton.IsServer; } } public static bool IsHost { get { if ((Object)(object)NetworkManager.Singleton == (Object)null) { return false; } return NetworkManager.Singleton.IsHost; } } public static ulong GetLocalClientId() { return NetworkManager.Singleton.LocalClientId; } public static bool IsLocalClientId(ulong clientId) { return clientId == GetLocalClientId(); } } internal static class PlayerUtils { public static PlayerControllerB GetLocalPlayerScript() { if ((Object)(object)GameNetworkManager.Instance == (Object)null) { return null; } return GameNetworkManager.Instance.localPlayerController; } public static bool IsLocalPlayer(PlayerControllerB playerScript) { return (Object)(object)playerScript == (Object)(object)GetLocalPlayerScript(); } public static PlayerControllerB GetPlayerScriptByClientId(ulong clientId) { PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (val.actualClientId == clientId) { return val; } } return null; } } [BepInPlugin("com.github.zehsteam.OctolarPlush", "OctolarPlush", "1.5.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BaseUnityPlugin { internal static Plugin Instance; internal static ManualLogSource logger; internal static ConfigManager ConfigManager; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } logger = Logger.CreateLogSource("com.github.zehsteam.OctolarPlush"); logger.LogInfo((object)"OctolarPlush has awoken!"); ConfigManager = new ConfigManager(); Content.Load(); ConfigHelper.SetModIcon(Content.ModIcon); ConfigHelper.SetModDescription("Adds a customizable Octolar plushie scrap item."); RegisterScrapItems(); NetcodePatcherAwake(); } private void NetcodePatcherAwake() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } private void RegisterScrapItems() { ScrapHelper.RegisterScrap(Content.OctolarPlush, ConfigManager.OctolarPlushie_SpawnWeight.Value, ConfigManager.OctolarPlushie_TwoHanded.Value, ConfigManager.OctolarPlushie_CarryWeight.Value, ConfigManager.OctolarPlushie_MinValue.Value, ConfigManager.OctolarPlushie_MaxValue.Value); } public void LogInfoExtended(object data) { if (ConfigManager.ExtendedLogging.Value) { logger.LogInfo(data); } } } internal static class SaveSystem { public static void SaveData<T>(string key, T data) { ES3.Save<T>(GetBaseKey() + "." + key, data, GetCurrentSaveFilePath()); } public static T LoadData<T>(string key, T defaultValue = default(T)) { return ES3.Load<T>(GetBaseKey() + "." + key, GetCurrentSaveFilePath(), defaultValue); } private static string GetBaseKey() { return MethodBase.GetCurrentMethod().DeclaringType.Namespace; } private static string GetCurrentSaveFilePath() { return GameNetworkManager.Instance.currentSaveFileName; } } internal static class ScrapHelper { public static void RegisterScrap(Item item, int rarity, bool twoHanded, int carryWeight, int minValue, int maxValue) { item.twoHanded = twoHanded; item.weight = (float)carryWeight / 105f + 1f; item.minValue = minValue; item.maxValue = maxValue; Utilities.FixMixerGroups(item.spawnPrefab); NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab); Items.RegisterScrap(item, rarity, (LevelTypes)(-1)); Plugin.logger.LogInfo((object)$"Registered \"{item.itemName}\" scrap item with {rarity} rarity."); } public static void UpdateScrapRarity(Item item, int rarity) { if ((Object)(object)item == (Object)null || (Object)(object)StartOfRound.Instance == (Object)null) { return; } SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val in levels) { foreach (SpawnableItemWithRarity item2 in val.spawnableScrap) { if (!((Object)(object)item2.spawnableItem != (Object)(object)item)) { item2.rarity = rarity; Plugin.logger.LogInfo((object)$"Updated \"{val.PlanetName}\" \"{item.itemName}\" scrap item rarity to {rarity}."); } } } } public static void UpdateScrapProperties(Item item, bool twoHanded, int carryWeight, int minValue, int maxValue) { if (!((Object)(object)item == (Object)null)) { item.twoHanded = twoHanded; item.weight = (float)carryWeight / 105f + 1f; item.minValue = minValue; item.maxValue = maxValue; Plugin.logger.LogInfo((object)$"Updated \"{item.itemName}\" scrap item properties. (TwoHanded: {twoHanded}, CarryWeight: {carryWeight}, MinValue: {minValue}, MaxValue: {maxValue})"); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "com.github.zehsteam.OctolarPlush"; public const string PLUGIN_NAME = "OctolarPlush"; public const string PLUGIN_VERSION = "1.5.0"; } } namespace com.github.zehsteam.OctolarPlush.MonoBehaviours { public class AdvancedNoisemakerProp : GrabbableObject { [Space(20f)] [Header("Advanced Noisemaker Prop")] [Space(5f)] public AudioSourceGroup NoiseAudio; public AudioClipGroup[] NoiseSFX; [Space(10f)] public float NoiseRange = 65f; public float MaxLoudness = 1f; public float MinLoudness = 0.95f; public float MinPitch = 1f; public float MaxPitch = 1f; [Space(10f)] public bool UseDynamicCooldown; public bool CancelActiveSFXOnItemActivate; public int UniqueId { get; private set; } public string SaveKey => string.Format("{0}_{1}", "AdvancedNoisemakerProp", UniqueId); public virtual void Awake() { if (NetworkUtils.IsServer) { UniqueId = Random.Range(0, 1000000); } } public override int GetItemDataToSave() { return UniqueId; } public override void LoadItemSaveData(int saveData) { ((GrabbableObject)this).LoadItemSaveData(saveData); UniqueId = saveData; } public override void ItemActivate(bool used, bool buttonDown = true) { if (NoiseSFX.Length != 0) { int index = Random.Range(0, NoiseSFX.Length); PlaySound(index); } } public void PlaySound(int index) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (NoiseSFX.Length != 0) { PlaySoundServerRpc(index); PlaySoundOnLocalClient(index); } } [ServerRpc(RequireOwnership = false)] protected void PlaySoundServerRpc(int index, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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 != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3088783810u, serverRpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, index); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3088783810u, serverRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId)) { PlaySoundClientRpc(index, senderClientId); } } } [ClientRpc] protected void PlaySoundClientRpc(int index, ulong senderClientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) 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(432211126u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); BytePacker.WriteValueBitPacked(val2, senderClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 432211126u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !NetworkUtils.IsLocalClientId(senderClientId)) { PlaySoundOnLocalClient(index); } } } public void PlaySoundOnLocalClient(int index) { AudioClipGroup audioClipGroup = ((index >= 0 && index < NoiseSFX.Length) ? NoiseSFX[index] : null); PlaySoundOnLocalClient(audioClipGroup); } public float PlaySoundOnLocalClient(AudioClip audioClip, AudioClip audioClipFar) { return PlaySoundOnLocalClient(new AudioClipGroup(audioClip, audioClipFar)); } public float PlaySoundOnLocalClient(AudioClipGroup audioClipGroup) { //IL_00f5: Unknown result type (might be due to invalid IL or missing references) if (audioClipGroup == null || (Object)(object)audioClipGroup.AudioClip == (Object)null) { return 0f; } float num = (float)Random.Range((int)(MinLoudness * 100f), (int)(MaxLoudness * 100f)) / 100f; float pitch = (float)Random.Range((int)(MinPitch * 100f), (int)(MaxPitch * 100f)) / 100f; if (CancelActiveSFXOnItemActivate) { NoiseAudio.Stop(); } if (UseDynamicCooldown && !CancelActiveSFXOnItemActivate) { base.currentUseCooldown = audioClipGroup.AudioClip.length; } NoiseAudio.Pitch = pitch; NoiseAudio.PlayOneShot(audioClipGroup, num); WalkieTalkie.TransmitOneShotAudio(NoiseAudio.AudioSource, audioClipGroup.AudioClip, num); RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, NoiseRange, num, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0); if (MinLoudness >= 0.6f && (Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.timeSinceMakingLoudNoise = 0f; } return audioClipGroup.AudioClip.length; } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_AdvancedNoisemakerProp() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(3088783810u, new RpcReceiveHandler(__rpc_handler_3088783810)); NetworkManager.__rpc_func_table.Add(432211126u, new RpcReceiveHandler(__rpc_handler_432211126)); } private static void __rpc_handler_3088783810(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((AdvancedNoisemakerProp)(object)target).PlaySoundServerRpc(index, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_432211126(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); ulong senderClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref senderClientId); target.__rpc_exec_stage = (__RpcExecStage)2; ((AdvancedNoisemakerProp)(object)target).PlaySoundClientRpc(index, senderClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "AdvancedNoisemakerProp"; } } public class Octolar : RadioNoisemakerProp { [Space(20f)] [Header("Octolar")] [Space(5f)] public List<OctolarVariantData> Variants = new List<OctolarVariantData>(); public int VariantIndex { get; private set; } public override void Awake() { base.Awake(); if (NetworkUtils.IsServer) { VariantIndex = GetRandomVariantIndex(); } } public override void Start() { base.Start(); if (NetworkUtils.IsServer) { SetVariantIndex(VariantIndex); } } public override void OnClientConnected(ulong clientId) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (!NetworkUtils.IsLocalClientId(clientId)) { ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList<ulong>(clientId) }; ClientRpcParams clientRpcParams = val; SetDataClientRpc(VariantIndex, clientRpcParams); } } [ClientRpc] private void SetDataClientRpc(int variantIndex, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1015363358u, clientRpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, variantIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1015363358u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SetVariantIndexOnLocalClient(variantIndex); LogInfoExtended($"Received data. (VariantIndex: {variantIndex})"); } } } public override int GetItemDataToSave() { SaveSystem.SaveData(base.SaveKey + "_VariantIndex", VariantIndex); LogInfoExtended($"Saved item data. (VariantIndex: {VariantIndex})"); return base.GetItemDataToSave(); } public override void LoadItemSaveData(int saveData) { base.LoadItemSaveData(saveData); if (NetworkUtils.IsServer) { VariantIndex = SaveSystem.LoadData(base.SaveKey + "_VariantIndex", GetRandomVariantIndex()); LogInfoExtended($"Loaded item data. (VariantIndex: {VariantIndex})"); } } public override void GrabItem() { ((GrabbableObject)this).GrabItem(); UpdateModel(); } public override void EquipItem() { base.EquipItem(); UpdateModel(); } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); UpdateModel(); } public override void DiscardItem() { base.DiscardItem(); UpdateModel(); } private void SetVariantIndex(int index) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) SetVariantIndexServerRpc(index); SetVariantIndexOnLocalClient(index); } [ServerRpc(RequireOwnership = false)] private void SetVariantIndexServerRpc(int index, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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 != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(3980208065u, serverRpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, index); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 3980208065u, serverRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId)) { SetVariantIndexClientRpc(index, senderClientId); } } } [ClientRpc] private void SetVariantIndexClientRpc(int index, ulong senderClientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) 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(1814369989u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); BytePacker.WriteValueBitPacked(val2, senderClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1814369989u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !NetworkUtils.IsLocalClientId(senderClientId)) { SetVariantIndexOnLocalClient(index); } } } private void SetVariantIndexOnLocalClient(int index) { VariantIndex = index; UpdateModel(); } private int GetRandomVariantIndex() { return Random.Range(0, Variants.Count); } private void UpdateModel() { for (int i = 0; i < Variants.Count; i++) { bool flag = i == VariantIndex; Variants[i].ModelObject.SetActive(flag); Renderer[] componentsInChildren = Variants[i].ModelObject.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (((GrabbableObject)this).isPocketed) { val.enabled = false; } else { val.enabled = flag; } } } } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_Octolar() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(1015363358u, new RpcReceiveHandler(__rpc_handler_1015363358)); NetworkManager.__rpc_func_table.Add(3980208065u, new RpcReceiveHandler(__rpc_handler_3980208065)); NetworkManager.__rpc_func_table.Add(1814369989u, new RpcReceiveHandler(__rpc_handler_1814369989)); } private static void __rpc_handler_1015363358(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int variantIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref variantIndex); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)2; ((Octolar)(object)target).SetDataClientRpc(variantIndex, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3980208065(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((Octolar)(object)target).SetVariantIndexServerRpc(index, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1814369989(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); ulong senderClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref senderClientId); target.__rpc_exec_stage = (__RpcExecStage)2; ((Octolar)(object)target).SetVariantIndexClientRpc(index, senderClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "Octolar"; } } [Serializable] public class OctolarVariantData { public GameObject ModelObject; } public class RadioNoisemakerProp : AdvancedNoisemakerProp { public PlayerControllerB PreviousPlayerHeldBy { get; private set; } public bool IsRadioMode { get; private set; } public int ClipIndex { get; private set; } public override void Awake() { base.Awake(); if (NetworkUtils.IsServer) { IsRadioMode = false; ClipIndex = 0; } } public override void Start() { ((GrabbableObject)this).Start(); if (NetworkUtils.IsServer) { SetIsRadioMode(IsRadioMode); SetClipIndex(ClipIndex); } } public override void OnNetworkSpawn() { if (NetworkUtils.IsServer) { NetworkManager.Singleton.OnClientConnectedCallback += OnClientConnected; } } public override void OnNetworkDespawn() { if (NetworkUtils.IsServer) { NetworkManager.Singleton.OnClientConnectedCallback -= OnClientConnected; } } public virtual void OnClientConnected(ulong clientId) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!NetworkUtils.IsLocalClientId(clientId)) { ClientRpcParams val = default(ClientRpcParams); val.Send = new ClientRpcSendParams { TargetClientIds = new <>z__ReadOnlySingleElementList<ulong>(clientId) }; ClientRpcParams clientRpcParams = val; SetDataClientRpc(IsRadioMode, ClipIndex, clientRpcParams); } } [ClientRpc] private void SetDataClientRpc(bool isRadioMode, int clipIndex, ClientRpcParams clientRpcParams = default(ClientRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(646332222u, clientRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isRadioMode, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val, clipIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 646332222u, clientRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { SetIsRadioModeOnLocalClient(isRadioMode); SetClipIndexOnLocalClient(clipIndex); LogInfoExtended($"Received data. (IsRadioMode: {isRadioMode}, ClipIndex: {clipIndex})"); } } } public override int GetItemDataToSave() { SaveSystem.SaveData(base.SaveKey + "_IsRadioMode", IsRadioMode); SaveSystem.SaveData(base.SaveKey + "_ClipIndex", ClipIndex); LogInfoExtended($"Saved item data. (IsRadioMode: {IsRadioMode}, ClipIndex: {ClipIndex})"); return base.GetItemDataToSave(); } public override void LoadItemSaveData(int saveData) { base.LoadItemSaveData(saveData); if (NetworkUtils.IsServer) { IsRadioMode = SaveSystem.LoadData(base.SaveKey + "_IsRadioMode", defaultValue: false); ClipIndex = SaveSystem.LoadData(base.SaveKey + "_ClipIndex", 0); LogInfoExtended($"Loaded item data. (IsRadioMode: {IsRadioMode}, ClipIndex: {ClipIndex})"); } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); PreviousPlayerHeldBy = ((GrabbableObject)this).playerHeldBy; PreviousPlayerHeldBy.equippedUsableItemQE = true; } public override void ItemActivate(bool used, bool buttonDown = true) { if (!IsRadioMode) { base.ItemActivate(used, buttonDown); } else { PlaySound(ClipIndex); } } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if (right) { ItemInteractRight(); } else { ItemInteractLeft(); } } public override void DiscardItem() { if ((Object)(object)PreviousPlayerHeldBy != (Object)null) { PreviousPlayerHeldBy.equippedUsableItemQE = false; } ((GrabbableObject)this).isBeingUsed = false; ((GrabbableObject)this).DiscardItem(); } private void ItemInteractLeft() { SetIsRadioMode(!IsRadioMode); } private void ItemInteractRight() { if (IsRadioMode) { int num = ClipIndex + 1; if (num > NoiseSFX.Length - 1) { num = 0; } SetClipIndex(num); } } public override void SetControlTipsForItem() { string[] array = ((!IsRadioMode) ? new string[3] { "Squeeze : [LMB]", "Switch Mode : [Q]", "" } : new string[3] { $"Squeeze #{ClipIndex + 1} : [LMB]", "Switch Mode : [Q]", "Next Clip : [E]" }); HUDManager.Instance.ChangeControlTipMultiple(array, true, ((GrabbableObject)this).itemProperties); } private void SetIsRadioMode(bool value) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) SetIsRadioModeServerRpc(value); SetIsRadioModeOnLocalClient(value); } [ServerRpc(RequireOwnership = false)] private void SetIsRadioModeServerRpc(bool value, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: 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 != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2906670532u, serverRpcParams, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref value, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2906670532u, serverRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId)) { SetIsRadioModeClientRpc(value, senderClientId); } } } [ClientRpc] private void SetIsRadioModeClientRpc(bool value, ulong senderClientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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(3122876611u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref value, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, senderClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3122876611u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !NetworkUtils.IsLocalClientId(senderClientId)) { SetIsRadioModeOnLocalClient(value); } } } private void SetIsRadioModeOnLocalClient(bool value) { IsRadioMode = value; if (PlayerUtils.IsLocalPlayer(((GrabbableObject)this).playerHeldBy)) { ((GrabbableObject)this).SetControlTipsForItem(); } } private void SetClipIndex(int index) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) SetClipIndexServerRpc(index); SetClipIndexOnLocalClient(index); } [ServerRpc(RequireOwnership = false)] private void SetClipIndexServerRpc(int index, ServerRpcParams serverRpcParams = default(ServerRpcParams)) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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 != 1 && (networkManager.IsClient || networkManager.IsHost)) { FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(43914151u, serverRpcParams, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, index); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 43914151u, serverRpcParams, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ulong senderClientId = serverRpcParams.Receive.SenderClientId; if (((NetworkBehaviour)this).NetworkManager.ConnectedClients.ContainsKey(senderClientId)) { SetClipIndexClientRpc(index, senderClientId); } } } [ClientRpc] private void SetClipIndexClientRpc(int index, ulong senderClientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) 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(2780291265u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, index); BytePacker.WriteValueBitPacked(val2, senderClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2780291265u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !NetworkUtils.IsLocalClientId(senderClientId)) { SetClipIndexOnLocalClient(index); } } } private void SetClipIndexOnLocalClient(int index) { ClipIndex = index; if (PlayerUtils.IsLocalPlayer(((GrabbableObject)this).playerHeldBy)) { ((GrabbableObject)this).SetControlTipsForItem(); } } public void LogError(object data) { string text = ((base.UniqueId != 0) ? $" : {base.UniqueId}" : string.Empty); Plugin.logger.LogError((object)("[" + ((GrabbableObject)this).itemProperties.itemName + text + "] " + data)); } public void LogInfoExtended(object data) { string text = ((base.UniqueId != 0) ? $" : {base.UniqueId}" : string.Empty); Plugin.Instance.LogInfoExtended("[" + ((GrabbableObject)this).itemProperties.itemName + text + "] " + data); } protected override void __initializeVariables() { base.__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_RadioNoisemakerProp() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(646332222u, new RpcReceiveHandler(__rpc_handler_646332222)); NetworkManager.__rpc_func_table.Add(2906670532u, new RpcReceiveHandler(__rpc_handler_2906670532)); NetworkManager.__rpc_func_table.Add(3122876611u, new RpcReceiveHandler(__rpc_handler_3122876611)); NetworkManager.__rpc_func_table.Add(43914151u, new RpcReceiveHandler(__rpc_handler_43914151)); NetworkManager.__rpc_func_table.Add(2780291265u, new RpcReceiveHandler(__rpc_handler_2780291265)); } private static void __rpc_handler_646332222(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_004c: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool isRadioMode = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isRadioMode, default(ForPrimitives)); int clipIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex); ClientRpcParams client = rpcParams.Client; target.__rpc_exec_stage = (__RpcExecStage)2; ((RadioNoisemakerProp)(object)target).SetDataClientRpc(isRadioMode, clipIndex, client); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2906670532(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives)); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((RadioNoisemakerProp)(object)target).SetIsRadioModeServerRpc(value, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3122876611(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: 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_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool value = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives)); ulong senderClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref senderClientId); target.__rpc_exec_stage = (__RpcExecStage)2; ((RadioNoisemakerProp)(object)target).SetIsRadioModeClientRpc(value, senderClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_43914151(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); ServerRpcParams server = rpcParams.Server; target.__rpc_exec_stage = (__RpcExecStage)1; ((RadioNoisemakerProp)(object)target).SetClipIndexServerRpc(index, server); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2780291265(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int index = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref index); ulong senderClientId = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref senderClientId); target.__rpc_exec_stage = (__RpcExecStage)2; ((RadioNoisemakerProp)(object)target).SetClipIndexClientRpc(index, senderClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "RadioNoisemakerProp"; } } } namespace com.github.zehsteam.OctolarPlush.Dependencies { internal static class LethalConfigProxy { public const string PLUGIN_GUID = "ainavt.lc.lethalconfig"; public static bool Enabled => Chainloader.PluginInfos.ContainsKey("ainavt.lc.lethalconfig"); [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void SetModIcon(Sprite sprite) { LethalConfigManager.SetModIcon(sprite); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void SetModDescription(string description) { LethalConfigManager.SetModDescription(description); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void SkipAutoGen() { LethalConfigManager.SkipAutoGen(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfig<T>(ConfigEntry<T> configEntry, bool requiresRestart = false) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Expected O, but got Unknown if (!(configEntry is ConfigEntry<string> val)) { if (!(configEntry is ConfigEntry<bool> val2)) { if (!(configEntry is ConfigEntry<float> val3)) { if (!(configEntry is ConfigEntry<int> val4)) { throw new NotSupportedException($"Unsupported type: {typeof(T)}"); } LethalConfigManager.AddConfigItem((BaseConfigItem)new IntInputFieldConfigItem(val4, requiresRestart)); } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatInputFieldConfigItem(val3, requiresRestart)); } } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new BoolCheckBoxConfigItem(val2, requiresRestart)); } } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new TextInputFieldConfigItem(val, requiresRestart)); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddConfigSlider<T>(ConfigEntry<T> configEntry, bool requiresRestart = false) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown if (!(configEntry is ConfigEntry<float> val)) { if (!(configEntry is ConfigEntry<int> val2)) { throw new NotSupportedException($"Slider not supported for type: {typeof(T)}"); } LethalConfigManager.AddConfigItem((BaseConfigItem)new IntSliderConfigItem(val2, requiresRestart)); } else { LethalConfigManager.AddConfigItem((BaseConfigItem)new FloatSliderConfigItem(val, requiresRestart)); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] public static void AddButton(string section, string name, string description, string buttonText, Action callback) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown LethalConfigManager.AddConfigItem((BaseConfigItem)new GenericButtonConfigItem(section, name, description, buttonText, (GenericButtonHandler)delegate { callback?.Invoke(); })); } } } namespace com.github.zehsteam.OctolarPlush.Data { [Serializable] public class AudioClipGroup { public AudioClip AudioClip; public AudioClip AudioClipFar; public AudioClipGroup(AudioClip audioClip, AudioClip audioClipFar) { AudioClip = audioClip; AudioClipFar = audioClipFar; } } [Serializable] public class AudioSourceGroup { public AudioSource AudioSource; public AudioSource AudioSourceFar; public bool IsPlaying => AudioSource.isPlaying; public float Volume { get { return AudioSource.volume; } set { AudioSource.volume = value; AudioSourceFar.volume = value; } } public float Pitch { get { return AudioSource.pitch; } set { AudioSource.pitch = value; AudioSourceFar.pitch = value; } } public AudioSourceGroup(AudioSource audioSource, AudioSource audioSourceFar) { AudioSource = audioSource; AudioSourceFar = audioSourceFar; } public void Play() { AudioSource.Play(); AudioSourceFar.Play(); } public float PlayOneShot(AudioClipGroup audioClipGroup, float volumeScale = 1f) { if (audioClipGroup == null) { return 0f; } float result = 0f; if ((Object)(object)audioClipGroup.AudioClip != (Object)null) { result = audioClipGroup.AudioClip.length; AudioSource.PlayOneShot(audioClipGroup.AudioClip, volumeScale); } if ((Object)(object)audioClipGroup.AudioClipFar != (Object)null) { AudioSourceFar.PlayOneShot(audioClipGroup.AudioClipFar, volumeScale); } return result; } public void Pause() { AudioSource.Pause(); AudioSourceFar.Pause(); } public void Stop() { AudioSource.Stop(); AudioSourceFar.Stop(); } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } internal sealed class <>z__ReadOnlySingleElementList<T> : IEnumerable, ICollection, IList, IEnumerable<T>, IReadOnlyCollection<T>, IReadOnlyList<T>, ICollection<T>, IList<T> { private sealed class Enumerator : IDisposable, IEnumerator, IEnumerator<T> { object IEnumerator.Current => _item; T IEnumerator<T>.Current => _item; public Enumerator(T item) { _item = item; } bool IEnumerator.MoveNext() { return !_moveNextCalled && (_moveNextCalled = true); } void IEnumerator.Reset() { _moveNextCalled = false; } void IDisposable.Dispose() { } } int ICollection.Count => 1; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object IList.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection<T>.Count => 1; T IReadOnlyList<T>.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } } int ICollection<T>.Count => 1; bool ICollection<T>.IsReadOnly => true; T IList<T>.this[int index] { get { if (index != 0) { throw new IndexOutOfRangeException(); } return _item; } set { throw new NotSupportedException(); } } public <>z__ReadOnlySingleElementList(T item) { _item = item; } IEnumerator IEnumerable.GetEnumerator() { return new Enumerator(_item); } void ICollection.CopyTo(Array array, int index) { array.SetValue(_item, index); } int IList.Add(object value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object value) { return EqualityComparer<T>.Default.Equals(_item, (T)value); } int IList.IndexOf(object value) { return (!EqualityComparer<T>.Default.Equals(_item, (T)value)) ? (-1) : 0; } void IList.Insert(int index, object value) { throw new NotSupportedException(); } void IList.Remove(object value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator<T> IEnumerable<T>.GetEnumerator() { return new Enumerator(_item); } void ICollection<T>.Add(T item) { throw new NotSupportedException(); } void ICollection<T>.Clear() { throw new NotSupportedException(); } bool ICollection<T>.Contains(T item) { return EqualityComparer<T>.Default.Equals(_item, item); } void ICollection<T>.CopyTo(T[] array, int arrayIndex) { array[arrayIndex] = _item; } bool ICollection<T>.Remove(T item) { throw new NotSupportedException(); } int IList<T>.IndexOf(T item) { return (!EqualityComparer<T>.Default.Equals(_item, item)) ? (-1) : 0; } void IList<T>.Insert(int index, T item) { throw new NotSupportedException(); } void IList<T>.RemoveAt(int index) { throw new NotSupportedException(); } } namespace com.github.zehsteam.OctolarPlush.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }