using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using PikMoons.Compatibility;
using PikMoons.NetcodePatcher;
using PikMoons.Patches;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering.HighDefinition;
using WeatherRegistry;
using WeatherRegistry.Networking;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("PikMoons")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Plugin for PF1MIL's PikMoons.")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0+01b38e4ba77689dd860d1bc35f723ad142373a30")]
[assembly: AssemblyProduct("PikMoons")]
[assembly: AssemblyTitle("PikMoons")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
static <Module>()
{
NetworkVariableSerializationTypes.InitializeSerializer_UnmanagedByMemcpy<float>();
NetworkVariableSerializationTypes.InitializeEqualityChecker_UnmanagedIEquatable<float>();
}
}
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 PikMoons
{
public class Config
{
public ConfigEntry<bool> PIKMIN_MUSIC { get; private set; }
public Config(ConfigFile cfg)
{
cfg.SaveOnConfigSet = false;
PIKMIN_MUSIC = cfg.Bind<bool>("Audio", "PikminMusic", true, "Enable Pikmin music and ambience.");
ClearOrphanedEntries(cfg);
cfg.SaveOnConfigSet = true;
cfg.Save();
}
private void ClearOrphanedEntries(ConfigFile config)
{
PropertyInfo propertyInfo = AccessTools.Property(typeof(ConfigFile), "OrphanedEntries");
((Dictionary<ConfigDefinition, string>)propertyInfo.GetValue(config))?.Clear();
}
}
[BepInDependency("imabatby.lethallevelloader", "1.4.0")]
[BepInDependency("JacobG5.JLL", "1.8.0")]
[BepInPlugin("PF1MIL.Bozoros", "PikMoons", "1.1.0")]
public class Plugin : BaseUnityPlugin
{
internal const string GUID = "PF1MIL.Bozoros";
internal const string PLUGIN_NAME = "PikMoons";
internal const string VERSION = "1.1.0";
internal static ManualLogSource? StaticLogger { get; private set; }
internal static Harmony? Harmony { get; private set; }
public static Config? Settings { get; private set; }
private void Awake()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Expected O, but got Unknown
StaticLogger = ((BaseUnityPlugin)this).Logger;
try
{
Settings = new Config(((BaseUnityPlugin)this).Config);
Harmony = new Harmony("PF1MIL.Bozoros");
NetcodePatcher();
Harmony.PatchAll(typeof(LoadPatch));
if (WeatherRegistryCompatibility.Enabled)
{
Harmony.PatchAll(typeof(WeatherRegistryCompatibility));
}
ManualLogSource? staticLogger = StaticLogger;
if (staticLogger != null)
{
staticLogger.LogInfo((object)"'PikMoons' loaded!");
}
}
catch (Exception arg)
{
StaticLogger.LogError((object)string.Format("Error while initializing '{0}': {1}", "PikMoons", arg));
}
}
private static void NetcodePatcher()
{
Type[] array;
try
{
array = Assembly.GetExecutingAssembly().GetTypes();
}
catch (ReflectionTypeLoadException ex)
{
List<Type> list = new List<Type>();
list.AddRange(ex.Types.Where((Type type) => type != null));
array = list.ToArray();
}
Type[] array2 = array;
foreach (Type type2 in array2)
{
MethodInfo[] methods = type2.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
foreach (MethodInfo methodInfo in methods)
{
if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
}
}
}
namespace PikMoons.Patches
{
[HarmonyPatch]
internal class LoadPatch
{
public static event Action? OnFinishGeneratingLevelPost;
[HarmonyPatch(typeof(RoundManager), "FinishGeneratingLevel")]
[HarmonyPostfix]
private static void FinishGeneratingLevelPost()
{
LoadPatch.OnFinishGeneratingLevelPost?.Invoke();
}
}
}
namespace PikMoons.Compatibility
{
[HarmonyPatch]
internal class WeatherRegistryCompatibility
{
private static bool? _enabled;
public static bool Enabled
{
get
{
bool valueOrDefault = _enabled.GetValueOrDefault();
if (!_enabled.HasValue)
{
valueOrDefault = Chainloader.PluginInfos.ContainsKey("mrov.WeatherRegistry");
_enabled = valueOrDefault;
}
return _enabled.Value;
}
}
public static event Action<LevelWeatherType>? OnWeatherEffectsApply;
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
[HarmonyPatch(typeof(WeatherEffectData), "ApplyWeatherEffects")]
[HarmonyPostfix]
internal static void ApplyWeatherEffectsPost(LevelWeatherType weatherType)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
WeatherRegistryCompatibility.OnWeatherEffectsApply?.Invoke(weatherType);
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
internal static bool ApplyWeatherOverrides(Action<LevelWeatherType> weatherAction)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Invalid comparison between Unknown and I4
if ((int)WeatherManager.GetCurrentLevelWeather().Type == 0)
{
return false;
}
OnWeatherEffectsApply += weatherAction;
return true;
}
}
}
namespace PikMoons.Behaviours
{
[Serializable]
public class ChangeSettings : NetworkBehaviour
{
public GameObject? musicController;
public LevelAmbienceLibrary? vanillaAmbience;
private void Awake()
{
if (Plugin.Settings == null)
{
return;
}
Config? settings = Plugin.Settings;
if (settings != null && !settings.PIKMIN_MUSIC.Value)
{
GameObject? obj = musicController;
if (obj != null)
{
obj.SetActive(false);
}
RoundManager.Instance.currentLevel.levelAmbienceClips = vanillaAmbience;
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string? __getTypeName()
{
return "ChangeSettings";
}
}
public class GrabbableObjectWithEvents : GrabbableObject
{
[Header("Events")]
public UnityEvent<PlayerControllerB>? onActivate;
public UnityEvent<PlayerControllerB>? onEquip;
public UnityEvent<PlayerControllerB>? onPocket;
public UnityEvent<PlayerControllerB>? onDrop;
public UnityEvent<EnemyAI>? onGrabEnemy;
public UnityEvent<EnemyAI>? onDropEnemy;
public override void ItemActivate(bool used, bool buttonDown = true)
{
((GrabbableObject)this).ItemActivate(used, buttonDown);
onActivate?.Invoke(base.playerHeldBy);
}
public override void GrabItem()
{
((GrabbableObject)this).GrabItem();
onEquip?.Invoke(base.playerHeldBy);
}
public override void PocketItem()
{
((GrabbableObject)this).PocketItem();
onPocket?.Invoke(base.playerHeldBy);
}
public override void DiscardItem()
{
((GrabbableObject)this).DiscardItem();
onDrop?.Invoke(base.playerHeldBy);
}
public override void GrabItemFromEnemy(EnemyAI enemy)
{
((GrabbableObject)this).GrabItemFromEnemy(enemy);
onGrabEnemy?.Invoke(enemy);
}
public override void DiscardItemFromEnemy()
{
Transform parentObject = base.parentObject;
EnemyAI val = default(EnemyAI);
if (parentObject != null && ((Component)parentObject).TryGetComponent<EnemyAI>(ref val))
{
onDropEnemy?.Invoke(val);
}
((GrabbableObject)this).DiscardItemFromEnemy();
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "GrabbableObjectWithEvents";
}
}
[Serializable]
public class GrabbablePlatform : NetworkBehaviour
{
[Tooltip("Animator instance of the platform, used to play an animation once a player grabs the platform. Optional if already playing an animation, or the platform is stationary.")]
public Animator? platformAnimator;
[Tooltip("Name of the animation state to play once a player grabs the platform. Make sure to leave out any numbers at the end if using animation variants. Optional if already playing an animation, or the platform is stationary.")]
public string stateName = "";
[Tooltip("Value for the animation variant to play when the player attaches, which is appended to 'stateName'. Should only be updated in the editor, or in-game before spawning the platform. Leaving it at '-1' disables animation variants.")]
public int stateVariant = -1;
[Tooltip("An offset to apply to the player's position while grabbing on to the platform.")]
public Vector3 playerOffset = Vector3.zero;
[Header("Controls")]
[Tooltip("Key required to be held for the player to hang on to the platform. See 'UnityEngine.InputSystem.Key' for number values. Leaving it at '-1' allows players to remain attached without holding anything, until being detached through other means (e.g. 'detachTimer').")]
public int keyToHold = -1;
[Tooltip("Allow players to carry two-handed items while grabbing on to the platform.")]
public bool allowTwoHanded = false;
[Header("Detach")]
[Tooltip("Name of the animation state to play immediately after the player detaches. Can also be used to reset the platform's position. Optional if not playing a detach animation.")]
public string detachState = "";
[Tooltip("Delay in seconds until the player is forcibly detached from the platform. Can be left at '0' to allow the player to hang on to the platform for an indefinite amount of time.")]
public float detachTimer = 0f;
[Tooltip("Detach the player if an enemy collides with the platform.")]
public bool detachOnEnemyCollision = false;
[Tooltip("Destroy and despawn platform after the player detaches.")]
public bool despawnOnDetach = false;
[Tooltip("Delay in seconds until the platform despawns after detaching the player, to allow effects to play.")]
public float despawnTimer = 0f;
[Header("Audio")]
[Tooltip("AudioSource instance of the platform, used to play sound effects at various points. Optional.")]
public AudioSource? platformSource;
[Tooltip("Sound effect to play when the platform spawns. Optional if not playing a spawning sound effect.")]
public AudioClip? spawnSFX;
[Tooltip("Sound effect to play when a player grabs on to the platform. Optional if not playing an attaching sound effect.")]
public AudioClip? attachSFX;
[Tooltip("Sound effect to play when the platform despawns and is destroyed. Optional if not playing a despawn sound effect.")]
public AudioClip? destroySFX;
[Tooltip("Lowest pitch that platform sound effects can have. Both can be set to the same value to disable pitch variation.")]
[Range(-3f, 3f)]
public float minPitch = 1f;
[Tooltip("Highest pitch that platform sound effects can have. Both can be set to the same value to disable pitch variation.")]
[Range(-3f, 3f)]
public float maxPitch = 1f;
public static Random Random { get; private set; } = new Random();
public PlayerControllerB? AttachedPlayer { get; private set; }
public bool LocalPlayerAttached { get; private set; } = false;
public NetworkVariable<int> SyncedStateVariant { get; private set; } = new NetworkVariable<int>(-1, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
public NetworkVariable<float> SyncedPitch { get; private set; } = new NetworkVariable<float>(1f, (NetworkVariableReadPermission)0, (NetworkVariableWritePermission)0);
private void Awake()
{
if ((Object)(object)platformAnimator != (Object)null)
{
((Behaviour)platformAnimator).enabled = true;
platformAnimator.updateMode = (AnimatorUpdateMode)1;
}
}
public override void OnNetworkSpawn()
{
((NetworkBehaviour)this).OnNetworkSpawn();
if ((Object)(object)platformSource != (Object)null && ((Behaviour)platformSource).enabled)
{
platformSource.pitch = SyncedPitch.Value;
NetworkVariable<float> syncedPitch = SyncedPitch;
syncedPitch.OnValueChanged = (OnValueChangedDelegate<float>)(object)Delegate.Combine((Delegate?)(object)syncedPitch.OnValueChanged, (Delegate?)(object)(OnValueChangedDelegate<float>)delegate(float _, float current)
{
platformSource.pitch = current;
});
}
if (((NetworkBehaviour)this).IsHost)
{
if (minPitch < maxPitch)
{
SyncedPitch.Value = (float)Random.NextDouble() * (maxPitch - minPitch) + minPitch;
}
if (stateVariant >= 0)
{
SyncedStateVariant.Value = stateVariant;
}
}
if ((Object)(object)spawnSFX != (Object)null)
{
AudioSource? obj = platformSource;
if (obj != null)
{
obj.PlayOneShot(spawnSFX, 1f);
}
}
}
private void OnTriggerEnter(Collider collider)
{
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
EnemyAI val = default(EnemyAI);
PlayerControllerB val2 = default(PlayerControllerB);
if (detachOnEnemyCollision && AttachedPlayer?.actualClientId == GameNetworkManager.Instance.localPlayerController.actualClientId && ((Component)collider).TryGetComponent<EnemyAI>(ref val))
{
DetachPlayerLocal();
DetachPlayerServerRpc();
}
else if (!((Object)(object)AttachedPlayer != (Object)null) && ((Component)collider).TryGetComponent<PlayerControllerB>(ref val2) && val2.actualClientId == GameNetworkManager.Instance.localPlayerController.actualClientId && (allowTwoHanded || !val2.twoHanded) && (keyToHold <= 0 || ((ButtonControl)Keyboard.current[(Key)keyToHold]).isPressed))
{
AttachPlayerServerRpc(NetworkObjectReference.op_Implicit(((Component)val2).GetComponent<NetworkObject>()));
LocalPlayerAttached = true;
if (detachTimer > 0f)
{
((MonoBehaviour)this).StartCoroutine(DetachPlayerDelayed());
}
}
}
private void Update()
{
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)AttachedPlayer == (Object)null))
{
((Component)AttachedPlayer).transform.position = ((Component)this).transform.position + playerOffset;
AttachedPlayer.ResetFallGravity();
if (LocalPlayerAttached && ((keyToHold > 0 && !((ButtonControl)Keyboard.current[(Key)keyToHold]).isPressed) || AttachedPlayer.isPlayerDead || Object.op_Implicit((Object)(object)AttachedPlayer.inAnimationWithEnemy) || AttachedPlayer.inSpecialInteractAnimation))
{
DetachPlayerLocal();
DetachPlayerServerRpc();
}
}
}
public void AttachPlayerLocal(PlayerControllerB player)
{
AttachedPlayer = player;
if ((Object)(object)attachSFX != (Object)null && (Object)(object)platformSource != (Object)null)
{
platformSource.PlayOneShot(attachSFX, 1f);
}
if (stateName.Length > 0 && (Object)(object)platformAnimator != (Object)null)
{
platformAnimator.Play(string.Format("{0}{1}", stateName, (SyncedStateVariant.Value >= 0) ? ((object)SyncedStateVariant.Value) : ""));
}
}
public void DetachPlayerLocal()
{
if ((Object)(object)destroySFX != (Object)null && (Object)(object)platformSource != (Object)null)
{
platformSource.Stop();
platformSource.PlayOneShot(destroySFX, 1f);
}
if (detachState.Length > 0)
{
Animator? obj = platformAnimator;
if (obj != null)
{
obj.Play(detachState);
}
}
AttachedPlayer = null;
LocalPlayerAttached = false;
}
public void SwitchVariant(int variant)
{
stateVariant = variant;
}
[ServerRpc(RequireOwnership = false)]
public void AttachPlayerServerRpc(NetworkObjectReference playerReference)
{
//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_00eb: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1724249978u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerReference, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1724249978u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && !((Object)(object)AttachedPlayer != (Object)null))
{
AttachPlayerClientRpc(playerReference);
}
}
}
[ClientRpc]
public void AttachPlayerClientRpc(NetworkObjectReference playerReference)
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(375761853u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerReference, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 375761853u, val, (RpcDelivery)0);
}
NetworkObject val3 = default(NetworkObject);
PlayerControllerB player = default(PlayerControllerB);
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref playerReference)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent<PlayerControllerB>(ref player))
{
AttachPlayerLocal(player);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void DetachPlayerServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: 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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2278333390u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2278333390u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
DetachPlayerClientRpc();
NetworkObject networkObject = default(NetworkObject);
if (despawnOnDetach && ((NetworkBehaviour)this).IsSpawned && ((Component)this).TryGetComponent<NetworkObject>(ref networkObject))
{
((MonoBehaviour)this).StartCoroutine(DespawnPlatform(networkObject));
}
}
}
[ClientRpc]
public void DetachPlayerClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2120360328u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2120360328u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((Object)(object)AttachedPlayer == (Object)null))
{
DetachPlayerLocal();
}
}
}
private IEnumerator DetachPlayerDelayed()
{
if (LocalPlayerAttached)
{
yield return (object)new WaitForSeconds(detachTimer);
DetachPlayerLocal();
DetachPlayerServerRpc();
}
}
private IEnumerator DespawnPlatform(NetworkObject networkObject)
{
yield return (object)new WaitForSeconds(despawnTimer);
networkObject.Despawn(true);
}
protected override void __initializeVariables()
{
if (SyncedStateVariant == null)
{
throw new Exception("GrabbablePlatform.<SyncedStateVariant>k__BackingField cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)SyncedStateVariant).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SyncedStateVariant, "SyncedStateVariant");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)SyncedStateVariant);
if (SyncedPitch == null)
{
throw new Exception("GrabbablePlatform.<SyncedPitch>k__BackingField cannot be null. All NetworkVariableBase instances must be initialized.");
}
((NetworkVariableBase)SyncedPitch).Initialize((NetworkBehaviour)(object)this);
((NetworkBehaviour)this).__nameNetworkVariable((NetworkVariableBase)(object)SyncedPitch, "SyncedPitch");
base.NetworkVariableFields.Add((NetworkVariableBase)(object)SyncedPitch);
((NetworkBehaviour)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_GrabbablePlatform()
{
//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
NetworkManager.__rpc_func_table.Add(1724249978u, new RpcReceiveHandler(__rpc_handler_1724249978));
NetworkManager.__rpc_func_table.Add(375761853u, new RpcReceiveHandler(__rpc_handler_375761853));
NetworkManager.__rpc_func_table.Add(2278333390u, new RpcReceiveHandler(__rpc_handler_2278333390));
NetworkManager.__rpc_func_table.Add(2120360328u, new RpcReceiveHandler(__rpc_handler_2120360328));
}
private static void __rpc_handler_1724249978(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_0044: 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)
{
NetworkObjectReference playerReference = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref playerReference, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)1;
((GrabbablePlatform)(object)target).AttachPlayerServerRpc(playerReference);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_375761853(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_0044: 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)
{
NetworkObjectReference playerReference = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref playerReference, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)2;
((GrabbablePlatform)(object)target).AttachPlayerClientRpc(playerReference);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2278333390(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((GrabbablePlatform)(object)target).DetachPlayerServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2120360328(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)2;
((GrabbablePlatform)(object)target).DetachPlayerClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "GrabbablePlatform";
}
}
[Serializable]
public class SuperLadder : InteractTrigger
{
[Header("Ladder")]
[Tooltip("The climbing speed to set when using this specific ladder.")]
public float climbSpeed = 15f;
[HideInInspector]
private float normalClimbSpeed = 3f;
private void Reset()
{
base.hoverTip = "Climb : [LMB]";
base.animationWaitTime = 0.5f;
base.animationString = "SA_PullLever";
base.lockPlayerPosition = true;
base.isLadder = true;
}
private void Awake()
{
normalClimbSpeed = GameNetworkManager.Instance.localPlayerController.climbSpeed;
((UnityEvent<PlayerControllerB>)(object)base.onInteractEarly).AddListener((UnityAction<PlayerControllerB>)delegate
{
GameNetworkManager.Instance.localPlayerController.climbSpeed = climbSpeed;
});
((UnityEvent<PlayerControllerB>)(object)base.onInteract).AddListener((UnityAction<PlayerControllerB>)resetClimbSpeed);
((UnityEvent<PlayerControllerB>)(object)base.onCancelAnimation).AddListener((UnityAction<PlayerControllerB>)resetClimbSpeed);
void resetClimbSpeed(PlayerControllerB _)
{
GameNetworkManager.Instance.localPlayerController.climbSpeed = normalClimbSpeed;
}
}
protected override void __initializeVariables()
{
((InteractTrigger)this).__initializeVariables();
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "SuperLadder";
}
}
[Serializable]
public class TimedEvent : MonoBehaviour
{
public UnityEvent? onTimedEvent;
public bool HasRun { get; private set; } = false;
private void Awake()
{
((Behaviour)this).enabled = false;
}
private void OnEnable()
{
if (!HasRun)
{
UnityEvent? obj = onTimedEvent;
if (obj != null)
{
obj.Invoke();
}
HasRun = true;
}
}
}
[Serializable]
public class UnstablePlatform : NetworkBehaviour
{
[Tooltip("")]
public float collapseChanceInterval = 5f;
[Tooltip("")]
public float collapseTimer = 0f;
[Tooltip("")]
[Range(0f, 100f)]
public int baseCollapseChance = 0;
[Tooltip("")]
[Range(0f, 1f)]
public float weightMultiplier = 0f;
[Tooltip("")]
public bool respawnPlatform = false;
[Tooltip("")]
public float respawnTimer = 0f;
[Tooltip("")]
public bool shakePlayerScreen = false;
[Tooltip("")]
[Range(0f, 3f)]
public int shakeAmount = 0;
[Tooltip("")]
[Range(0f, 3f)]
public int collapseShakeAmount = 0;
[Tooltip("")]
public GameObject? platformContainer;
[Tooltip("")]
public Animator? platformAnimator;
[Tooltip("")]
public string shakeState = "";
[Tooltip("")]
public string collapseState = "";
[Tooltip("")]
public string respawnState = "";
[Tooltip("")]
public AudioSource? platformSource;
[Tooltip("")]
public AudioClip? shakeSFX;
[Tooltip("")]
public AudioClip? collapseSFX;
[Tooltip("")]
public AudioClip? respawnSFX;
public static Random? Random { get; private set; }
public bool PlatformCollapsed { get; private set; } = false;
public bool LocalPlayerOnPlatform { get; private set; } = false;
public int CollapseChance { get; private set; } = 0;
public float TimeSinceLastCheck { get; private set; } = 0f;
private void Awake()
{
Random = new Random(StartOfRound.Instance.randomMapSeed + (int)GameNetworkManager.Instance.localPlayerController.actualClientId);
}
private void OnTriggerEnter(Collider collider)
{
if (PlatformCollapsed)
{
return;
}
VehicleCollisionTrigger val = default(VehicleCollisionTrigger);
PlayerControllerB val2 = default(PlayerControllerB);
if (((Component)collider).TryGetComponent<VehicleCollisionTrigger>(ref val))
{
PlatformCollapsed = true;
if ((Object)(object)collapseSFX != (Object)null)
{
AudioSource? obj = platformSource;
if (obj != null)
{
obj.PlayOneShot(collapseSFX);
}
}
if (collapseState.Length > 0)
{
Animator? obj2 = platformAnimator;
if (obj2 != null)
{
obj2.Play(collapseState);
}
}
((MonoBehaviour)this).StartCoroutine(CollapsePlatform());
}
else if (((Component)collider).CompareTag("Player") && ((Component)collider).TryGetComponent<PlayerControllerB>(ref val2) && val2.actualClientId == GameNetworkManager.Instance.localPlayerController.actualClientId)
{
LocalPlayerOnPlatform = true;
CollapseChance = baseCollapseChance + (int)((val2.carryWeight - 1f) * weightMultiplier * 105f);
}
}
private void OnTriggerStay(Collider collider)
{
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
if (!PlatformCollapsed && LocalPlayerOnPlatform)
{
if (TimeSinceLastCheck <= collapseChanceInterval)
{
TimeSinceLastCheck += Time.deltaTime;
}
else if (Random?.Next(0, 100) < CollapseChance)
{
CollapsePlatformLocal();
CollapsePlatformServerRpc();
}
else
{
ShakePlatformLocal();
ShakePlatformServerRpc(NetworkObjectReference.op_Implicit(((Component)GameNetworkManager.Instance.localPlayerController).GetComponent<NetworkObject>()));
TimeSinceLastCheck = 0f;
}
}
}
private void OnTriggerLeave(Collider collider)
{
PlayerControllerB val = default(PlayerControllerB);
if (!PlatformCollapsed && LocalPlayerOnPlatform && ((Component)collider).CompareTag("Player") && ((Component)collider).TryGetComponent<PlayerControllerB>(ref val) && val.actualClientId == GameNetworkManager.Instance.localPlayerController.actualClientId)
{
LocalPlayerOnPlatform = false;
TimeSinceLastCheck = 0f;
CollapseChance = 0;
}
}
public void ShakePlatformLocal()
{
if (shakePlayerScreen && LocalPlayerOnPlatform)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)shakeAmount);
}
if ((Object)(object)shakeSFX != (Object)null)
{
AudioSource? obj = platformSource;
if (obj != null)
{
obj.PlayOneShot(shakeSFX);
}
}
if (shakeState.Length > 0)
{
Animator? obj2 = platformAnimator;
if (obj2 != null)
{
obj2.Play(shakeState);
}
}
}
public void CollapsePlatformLocal()
{
PlatformCollapsed = true;
if (shakePlayerScreen && LocalPlayerOnPlatform)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)collapseShakeAmount);
}
if ((Object)(object)collapseSFX != (Object)null)
{
AudioSource? obj = platformSource;
if (obj != null)
{
obj.PlayOneShot(collapseSFX);
}
}
if (collapseState.Length > 0)
{
Animator? obj2 = platformAnimator;
if (obj2 != null)
{
obj2.Play(collapseState);
}
}
((MonoBehaviour)this).StartCoroutine(CollapsePlatform());
}
private IEnumerator CollapsePlatform()
{
yield return (object)new WaitForSeconds(collapseTimer);
GameObject? obj = platformContainer;
if (obj != null)
{
obj.SetActive(false);
}
if (!respawnPlatform)
{
((Behaviour)this).enabled = false;
((Component)this).gameObject.SetActive(false);
yield break;
}
yield return (object)new WaitForSeconds(respawnTimer);
GameObject? obj2 = platformContainer;
if (obj2 != null)
{
obj2.SetActive(true);
}
if (respawnState.Length > 0)
{
Animator? obj3 = platformAnimator;
if (obj3 != null)
{
obj3.Play(respawnState);
}
}
if ((Object)(object)respawnSFX != (Object)null)
{
AudioSource? obj4 = platformSource;
if (obj4 != null)
{
obj4.PlayOneShot(respawnSFX);
}
}
LocalPlayerOnPlatform = false;
TimeSinceLastCheck = 0f;
CollapseChance = 0;
PlatformCollapsed = false;
}
[ServerRpc(RequireOwnership = false)]
public void ShakePlatformServerRpc(NetworkObjectReference playerWhoTriggered)
{
//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_00d8: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1951932149u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerWhoTriggered, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1951932149u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
ShakePlatformClientRpc(playerWhoTriggered);
}
}
}
[ClientRpc]
public void ShakePlatformClientRpc(NetworkObjectReference playerWhoTriggered)
{
//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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3985547476u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref playerWhoTriggered, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3985547476u, val, (RpcDelivery)0);
}
NetworkObject val3 = default(NetworkObject);
PlayerControllerB val4 = default(PlayerControllerB);
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref playerWhoTriggered)).TryGet(ref val3, (NetworkManager)null) && ((Component)val3).TryGetComponent<PlayerControllerB>(ref val4) && val4.actualClientId != GameNetworkManager.Instance.localPlayerController.actualClientId)
{
ShakePlatformLocal();
}
}
}
[ServerRpc(RequireOwnership = false)]
public void CollapsePlatformServerRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2190888902u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2190888902u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
CollapsePlatformClientRpc();
}
}
}
[ClientRpc]
public void CollapsePlatformClientRpc()
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0096: 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_007c: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2808601506u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2808601506u, val, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !PlatformCollapsed)
{
CollapsePlatformLocal();
}
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_UnstablePlatform()
{
//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
NetworkManager.__rpc_func_table.Add(1951932149u, new RpcReceiveHandler(__rpc_handler_1951932149));
NetworkManager.__rpc_func_table.Add(3985547476u, new RpcReceiveHandler(__rpc_handler_3985547476));
NetworkManager.__rpc_func_table.Add(2190888902u, new RpcReceiveHandler(__rpc_handler_2190888902));
NetworkManager.__rpc_func_table.Add(2808601506u, new RpcReceiveHandler(__rpc_handler_2808601506));
}
private static void __rpc_handler_1951932149(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_0044: 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)
{
NetworkObjectReference playerWhoTriggered = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref playerWhoTriggered, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)1;
((UnstablePlatform)(object)target).ShakePlatformServerRpc(playerWhoTriggered);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3985547476(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_0044: 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)
{
NetworkObjectReference playerWhoTriggered = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref playerWhoTriggered, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)2;
((UnstablePlatform)(object)target).ShakePlatformClientRpc(playerWhoTriggered);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2190888902(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)1;
((UnstablePlatform)(object)target).CollapsePlatformServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2808601506(NetworkBehaviour? target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0029: 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)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
target.__rpc_exec_stage = (__RpcExecStage)2;
((UnstablePlatform)(object)target).CollapsePlatformClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string? __getTypeName()
{
return "UnstablePlatform";
}
}
[Serializable]
public struct WeatherOverride
{
public string weatherName;
public List<string> alsoAppliesTo;
public UnityEvent? onWeatherChange;
public List<GameObject> effectsToEnable;
public List<GameObject> effectsToDisable;
public WeatherOverride()
{
onWeatherChange = null;
weatherName = "";
alsoAppliesTo = new List<string>();
effectsToEnable = new List<GameObject>();
effectsToDisable = new List<GameObject>();
}
public readonly void Apply(bool undo = false)
{
effectsToEnable?.ForEach(delegate(GameObject weatherEffect)
{
if (weatherEffect != null)
{
weatherEffect.SetActive(!undo);
}
});
effectsToDisable?.ForEach(delegate(GameObject weatherEffect)
{
if (weatherEffect != null)
{
weatherEffect.SetActive(undo);
}
});
UnityEvent? obj = onWeatherChange;
if (obj != null)
{
obj.Invoke();
}
}
}
[Serializable]
public class WeatherControl : MonoBehaviour
{
public List<WeatherOverride> weatherOverrides = new List<WeatherOverride>();
[Header("Rainy")]
[Tooltip("")]
public bool disableRainDuringRainy = false;
[Tooltip("")]
public bool disableRainAmbienceDuringRainy = false;
[Header("Stormy")]
[Tooltip("")]
public bool disableRainDuringStormy = false;
[Tooltip("")]
public bool disableRainAmbienceDuringStormy = false;
[Header("Foggy")]
[Tooltip("")]
public bool disableFogDuringFoggy = false;
[Tooltip("")]
public float overrideFogDensity = 4f;
[Header("Flooded")]
[Tooltip("")]
public bool disableRainDuringFlooded = false;
[Tooltip("")]
public bool disableRainAmbienceDuringFlooded = false;
[Tooltip("")]
public bool disableWaterDuringFlooded = false;
[Tooltip("")]
public bool disableWaterAmbienceDuringFlooded = false;
[Header("Eclipsed")]
[Tooltip("")]
public bool disableMusicDuringEclipsed = false;
private void Awake()
{
ModifyVanillaEffects();
if (!WeatherRegistryCompatibility.Enabled || !WeatherRegistryCompatibility.ApplyWeatherOverrides(ModifyWeather))
{
LoadPatch.OnFinishGeneratingLevelPost += ModifyWeather;
}
}
public void ModifyWeather()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
ModifyWeather(TimeOfDay.Instance.currentLevelWeather);
}
public void ModifyWeather(LevelWeatherType weatherType)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
string text = $"{weatherType}";
foreach (WeatherOverride weatherOverride in weatherOverrides)
{
if (string.CompareOrdinal(text, weatherOverride.weatherName) == 0 || (weatherOverride.alsoAppliesTo.Count > 0 && weatherOverride.alsoAppliesTo.Contains(text)))
{
weatherOverride.Apply();
return;
}
}
ManualLogSource? staticLogger = Plugin.StaticLogger;
if (staticLogger != null)
{
staticLogger.LogWarning((object)("Unknown weather '" + text + "' found, there will be weird stuff going on!"));
}
}
public void ModifyVanillaEffects()
{
Transform transform = ((Component)TimeOfDay.Instance).transform;
Transform val = transform.Find("RainParticleContainer");
if (val != null)
{
Transform child = val.GetChild(0);
if (child != null)
{
((Component)child).gameObject.SetActive(!disableRainDuringRainy);
}
}
if (val != null)
{
Transform child2 = val.GetChild(1);
if (child2 != null)
{
((Component)child2).gameObject.SetActive(!disableRainAmbienceDuringRainy);
}
}
Transform val2 = transform.Find("StormyRainParticleContainer");
if (val2 != null)
{
Transform child3 = val2.GetChild(0);
if (child3 != null)
{
((Component)child3).gameObject.SetActive(!disableRainDuringStormy);
}
}
if (val2 != null)
{
Transform child4 = val2.GetChild(1);
if (child4 != null)
{
((Component)child4).gameObject.SetActive(!disableRainAmbienceDuringStormy);
}
}
Transform obj = transform.Find("Foggy");
LocalVolumetricFog val3 = default(LocalVolumetricFog);
if (obj != null && ((Component)obj).TryGetComponent<LocalVolumetricFog>(ref val3))
{
((Behaviour)val3).enabled = !disableFogDuringFoggy;
if (overrideFogDensity >= 0f)
{
val3.parameters.meanFreePath = overrideFogDensity;
}
}
Transform val4 = transform.Find("Flooding");
FloodWeather val5 = default(FloodWeather);
if (((Component)val4).TryGetComponent<FloodWeather>(ref val5))
{
((Behaviour)val5).enabled = !disableWaterDuringFlooded && !disableWaterAmbienceDuringFlooded;
}
if (val4 != null)
{
Transform child5 = val4.GetChild(0);
if (child5 != null)
{
((Component)child5).gameObject.SetActive(!disableWaterDuringFlooded);
}
}
if (val4 != null)
{
Transform child6 = val4.GetChild(1);
if (child6 != null)
{
((Component)child6).gameObject.SetActive(!disableWaterDuringFlooded);
}
}
if (val4 != null)
{
Transform child7 = val4.GetChild(2);
if (child7 != null)
{
((Component)child7).gameObject.SetActive(!disableWaterAmbienceDuringFlooded);
}
}
Transform val6 = transform.Find("RainParticleContainer");
if (val6 != null)
{
Transform child8 = val6.GetChild(0);
if (child8 != null)
{
((Component)child8).gameObject.SetActive(!disableRainDuringFlooded);
}
}
if (val6 != null)
{
Transform child9 = val6.GetChild(1);
if (child9 != null)
{
((Component)child9).gameObject.SetActive(!disableRainAmbienceDuringFlooded);
}
}
Transform obj2 = ((Component)TimeOfDay.Instance).transform.Find("Eclipse");
if (obj2 != null)
{
Transform child10 = obj2.GetChild(0);
if (child10 != null)
{
((Component)child10).gameObject.SetActive(!disableMusicDuringEclipsed);
}
}
}
private void OnDestroy()
{
WeatherRegistryCompatibility.OnWeatherEffectsApply -= ModifyWeather;
LoadPatch.OnFinishGeneratingLevelPost -= ModifyWeather;
if ((Object)(object)TimeOfDay.Instance == (Object)null)
{
return;
}
Transform transform = ((Component)TimeOfDay.Instance).transform;
Transform val = transform.Find("RainParticleContainer");
for (int i = 0; i < 2; i++)
{
if (val != null)
{
Transform child = val.GetChild(i);
if (child != null)
{
((Component)child).gameObject.SetActive(true);
}
}
}
Transform val2 = transform.Find("StormyRainParticleContainer");
for (int j = 0; j < 2; j++)
{
if (val2 != null)
{
Transform child2 = val2.GetChild(j);
if (child2 != null)
{
((Component)child2).gameObject.SetActive(true);
}
}
}
Transform obj = transform.Find("Foggy");
LocalVolumetricFog val3 = default(LocalVolumetricFog);
if (obj != null && ((Component)obj).TryGetComponent<LocalVolumetricFog>(ref val3))
{
((Behaviour)val3).enabled = true;
val3.parameters.meanFreePath = 4f;
}
Transform val4 = transform.Find("Flooding");
for (int k = 0; k < 3; k++)
{
if (val4 != null)
{
Transform child3 = val4.GetChild(k);
if (child3 != null)
{
((Component)child3).gameObject.SetActive(true);
}
}
}
Transform obj2 = transform.Find("Eclipse");
if (obj2 != null)
{
Transform child4 = obj2.GetChild(0);
if (child4 != null)
{
((Component)child4).gameObject.SetActive(true);
}
}
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace PikMoons.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}