using System;
using System.Collections;
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.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using MysteryButton.NetcodePatcher;
using ScrapButton.ExtensionMethod;
using ScrapButton.MonoBehaviors;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Audio;
[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: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("UnityEngine")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: AssemblyCompany("MysteryButton")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A new type of scrap")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+7066983d0aadbe849e1650a74c65ccf6cb0a91ac")]
[assembly: AssemblyProduct("MysteryButton")]
[assembly: AssemblyTitle("MysteryButton")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.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 MysteryButton
{
public static class PluginInfo
{
public const string PLUGIN_GUID = "MysteryButton";
public const string PLUGIN_NAME = "MysteryButton";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace ScrapButton
{
[BepInPlugin("gloveman.ScrapButton", "ScrapButton", "1.0.6.0")]
[BepInProcess("Lethal Company.exe")]
public class Plugin : BaseUnityPlugin
{
private const string GUID = "gloveman.ScrapButton";
private AssetBundle assets;
public Item buttonItem;
public ConfigEntry<double> bombChance;
public ConfigEntry<double> floodChance;
private ConfigEntry<int> spawnRate;
public ConfigEntry<bool> leaveScrap;
private readonly Harmony harmony = new Harmony("gloveman.ScrapButton");
public ManualLogSource logger;
public static Plugin Instance;
public GameObject networkManagerObject;
public GameObject indoorFlooding;
private AudioClip waterRush;
private AudioClip burstSFX;
private static bool flag;
private void Awake()
{
logger = Logger.CreateLogSource("gloveman.ScrapButton");
logger.LogInfo((object)"ScrapButton is awake!");
if ((Object)(object)Instance == (Object)null)
{
Instance = this;
}
bombChance = ((BaseUnityPlugin)this).Config.Bind<double>("General", "Bomb_Chance", 0.3, "Chance that a button press will explode (out of 1)");
floodChance = ((BaseUnityPlugin)this).Config.Bind<double>("General", "Flood_Chance", 0.001, "Chance that a button press will flood the facility (out of 1)");
spawnRate = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Spawn Rate", 25, "How much the device will spawn as scrap. Higher is more common.");
leaveScrap = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Leave Scrap", false, "Should players drop scrap when teleporting with the device?");
assets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "assets"));
UnpackAssets(assets);
DoPatches();
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);
}
}
}
}
public void UnpackAssets(AssetBundle assetBundle)
{
this.buttonItem = assetBundle.LoadAsset<Item>("Assets/AssetBundles/Bundle/ButtonItem.asset");
Material blueGlow = assetBundle.LoadAsset<Material>("Assets/AssetBundles/Bundle/glow2.mat");
Material redGlow = assetBundle.LoadAsset<Material>("Assets/AssetBundles/Bundle/glow.mat");
AudioClip pressed = assetBundle.LoadAsset<AudioClip>("Assets/AssetBundles/Bundle/Press.ogg");
burstSFX = assetBundle.LoadAsset<AudioClip>("Assets/AssetBundles/Bundle/Burst2.ogg");
waterRush = assetBundle.LoadAsset<AudioClip>("Assets/AssetBundles/Bundle/WaterRush.ogg");
AudioClip beep = assetBundle.LoadAsset<AudioClip>("Assets/AssetBundles/Bundle/MineTrigger.ogg");
AudioClip detonate = assetBundle.LoadAsset<AudioClip>("Assets/AssetBundles/Bundle/MineDetonate.ogg");
AudioClip beamUpAudio = assetBundle.LoadAsset<AudioClip>("Assets/AssetBundles/Bundle/ShipTeleporterBeamPlayerBody.ogg");
AudioClip beamUpAudio2 = assetBundle.LoadAsset<AudioClip>("Assets/AssetBundles/Bundle/ShipTeleporterBeam.ogg");
AudioClip tpSFX = assetBundle.LoadAsset<AudioClip>("Assets/AssetBundles/Bundle/ShipTeleporterSpin.ogg");
AudioClip inverseSFX = assetBundle.LoadAsset<AudioClip>("Assets/AssetBundles/Bundle/ShipTeleporterSpinInverse.ogg");
ButtonItem buttonItem = this.buttonItem.spawnPrefab.AddComponent<ButtonItem>();
((GrabbableObject)buttonItem).grabbable = true;
((GrabbableObject)buttonItem).grabbableToEnemies = true;
((GrabbableObject)buttonItem).itemProperties = this.buttonItem;
buttonItem.redGlow = redGlow;
buttonItem.blueGlow = blueGlow;
buttonItem.mainAudio = this.buttonItem.spawnPrefab.GetComponent<AudioSource>();
buttonItem.pressed = pressed;
buttonItem.beep = beep;
buttonItem.detonate = detonate;
buttonItem.tpSFX = tpSFX;
buttonItem.inverseSFX = inverseSFX;
buttonItem.beamUpAudio = beamUpAudio;
buttonItem.beamUpAudio2 = beamUpAudio2;
AudioSource[] componentsInChildren = this.buttonItem.spawnPrefab.GetComponentsInChildren<AudioSource>();
AudioSource[] array = componentsInChildren;
foreach (AudioSource val in array)
{
AudioMixerGroup val2 = val.outputAudioMixerGroup.audioMixer.FindMatchingGroups(((Object)val.outputAudioMixerGroup).name)[0];
if ((Object)(object)val2 != (Object)null)
{
val.outputAudioMixerGroup = val2;
}
}
}
public void DoPatches()
{
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Expected O, but got Unknown
//IL_0174: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Expected O, but got Unknown
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Expected O, but got Unknown
//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01ba: Expected O, but got Unknown
//IL_01ba: Expected O, but got Unknown
//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Expected O, but got Unknown
//IL_01df: Unknown result type (might be due to invalid IL or missing references)
//IL_01ec: Expected O, but got Unknown
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0205: Expected O, but got Unknown
MethodInfo methodInfo = AccessTools.Method(typeof(Terminal), "Awake", (Type[])null, (Type[])null);
MethodInfo method = typeof(Plugin).GetMethod("TerminalAwake");
MethodInfo methodInfo2 = AccessTools.Method(typeof(StartOfRound), "openingDoorsSequence", (Type[])null, (Type[])null);
MethodInfo method2 = typeof(Plugin).GetMethod("OpenDoors");
MethodInfo methodInfo3 = AccessTools.Method(typeof(EntranceTeleport), "TeleportPlayer", (Type[])null, (Type[])null);
MethodInfo method3 = typeof(Plugin).GetMethod("TeleportPlayer");
MethodInfo method4 = typeof(Plugin).GetMethod("GrossHack1");
MethodInfo method5 = typeof(Plugin).GetMethod("GrossHack2");
MethodInfo methodInfo4 = AccessTools.Method(typeof(QuicksandTrigger), "OnTriggerStay", (Type[])null, (Type[])null);
MethodInfo methodInfo5 = AccessTools.Method(typeof(StartOfRound), "EndOfGameClientRpc", (Type[])null, (Type[])null);
MethodInfo method6 = typeof(Plugin).GetMethod("EndOfGame");
MethodInfo method7 = typeof(Plugin).GetMethod("PostTeleport");
MethodInfo methodInfo6 = AccessTools.Method(typeof(PlayerControllerB), "TeleportPlayer", (Type[])null, (Type[])null);
MethodInfo method8 = typeof(Plugin).GetMethod("NetworkSetup");
MethodInfo methodInfo7 = AccessTools.Method(typeof(GameNetworkManager), "Start", (Type[])null, (Type[])null);
harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
harmony.Patch((MethodBase)methodInfo2, new HarmonyMethod(method2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
harmony.Patch((MethodBase)methodInfo3, new HarmonyMethod(method3), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
harmony.Patch((MethodBase)methodInfo4, new HarmonyMethod(method4), new HarmonyMethod(method5), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
harmony.Patch((MethodBase)methodInfo5, (HarmonyMethod)null, new HarmonyMethod(method6), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
harmony.Patch((MethodBase)methodInfo6, (HarmonyMethod)null, new HarmonyMethod(method7), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
harmony.Patch((MethodBase)methodInfo7, new HarmonyMethod(method8), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
public static void TerminalAwake()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0044: Expected O, but got Unknown
StartOfRound instance = StartOfRound.Instance;
SelectableLevel[] levels = instance.levels;
foreach (SelectableLevel val in levels)
{
SpawnableItemWithRarity item = new SpawnableItemWithRarity
{
rarity = Instance.spawnRate.Value,
spawnableItem = Instance.buttonItem
};
if (val.spawnableScrap.TrueForAll((SpawnableItemWithRarity scrap) => (Object)(object)scrap.spawnableItem != (Object)(object)Instance.buttonItem))
{
val.spawnableScrap.Add(item);
}
}
Instance.logger.LogInfo((object)"Added scrap to pool.");
instance.allItemsList.itemsList.Add(Instance.buttonItem);
if ((Object)(object)Instance.indoorFlooding == (Object)null)
{
try
{
Instance.indoorFlooding = Object.Instantiate<GameObject>(GameObject.Find("Systems/GameSystems/TimeAndWeather/Flooding"));
Instance.indoorFlooding.SetActive(false);
Object.Destroy((Object)(object)Instance.indoorFlooding.GetComponent<FloodWeather>());
IndoorFlood indoorFlood = Instance.indoorFlooding.AddComponent<IndoorFlood>();
indoorFlood.waterAudio = Instance.indoorFlooding.GetComponentInChildren<AudioSource>();
indoorFlood.burstSFX = Instance.burstSFX;
indoorFlood.waterRush = Instance.waterRush;
}
catch (Exception ex)
{
Instance.logger.LogError((object)("Encountered error grabbing GameObject: " + ex.Message));
Instance.floodChance.Value = 0.0;
}
}
}
public static void OpenDoors()
{
ButtonItem.NewSeed();
}
public static bool TeleportPlayer(EntranceTeleport __instance)
{
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
if (!__instance.isEntranceToBuilding)
{
if (IndoorFlood.active)
{
SoundManager.Instance.ambienceAudio.loop = false;
SoundManager.Instance.ambienceAudio.Stop();
}
return true;
}
IndoorFlood[] array = Object.FindObjectsOfType<IndoorFlood>();
IndoorFlood[] array2 = array;
foreach (IndoorFlood indoorFlood in array2)
{
if (((Behaviour)indoorFlood).enabled && ((Component)indoorFlood).transform.position.y > RoundManager.FindMainEntrancePosition(false, false).y)
{
HUDManager.Instance.DisplayTip("???", "The entrance appears to be blocked.", false, false, "LC_Tip1");
return false;
}
if (IndoorFlood.active)
{
SoundManager.Instance.ambienceAudio.loop = true;
SoundManager.Instance.ambienceAudio.clip = Instance.waterRush;
SoundManager.Instance.ambienceAudio.Play();
}
}
return true;
}
public static void GrossHack1(QuicksandTrigger __instance)
{
if ((Object)(object)((Component)__instance).GetComponentInParent<IndoorFlood>() != (Object)null)
{
GameNetworkManager.Instance.localPlayerController.isInsideFactory = false;
flag = true;
}
}
public static void GrossHack2()
{
if (flag)
{
GameNetworkManager.Instance.localPlayerController.isInsideFactory = true;
}
}
public static void EndOfGame()
{
IndoorFlood[] array = Object.FindObjectsOfType<IndoorFlood>();
IndoorFlood[] array2 = array;
foreach (IndoorFlood indoorFlood in array2)
{
if (((Behaviour)indoorFlood).enabled)
{
Object.Destroy((Object)(object)((Component)indoorFlood).gameObject);
}
}
IndoorFlood.active = false;
}
public static void PostTeleport()
{
if (IndoorFlood.active)
{
if (GameNetworkManager.Instance.localPlayerController.isInsideFactory)
{
SoundManager.Instance.ambienceAudio.loop = true;
SoundManager.Instance.ambienceAudio.clip = Instance.waterRush;
SoundManager.Instance.ambienceAudio.Play();
}
else
{
SoundManager.Instance.ambienceAudio.loop = false;
SoundManager.Instance.ambienceAudio.Stop();
}
}
}
public static void NetworkSetup()
{
if (!NetworkManager.Singleton.NetworkConfig.Prefabs.Contains(Instance.buttonItem.spawnPrefab))
{
NetworkManager.Singleton.AddNetworkPrefab(Instance.buttonItem.spawnPrefab);
}
}
}
}
namespace ScrapButton.MonoBehaviors
{
internal class ButtonItem : PhysicsProp
{
private Random random;
private int bomb;
private int flood;
private float boomTimer = 0f;
public AudioSource mainAudio;
public AudioClip beep;
public AudioClip detonate;
public AudioClip pressed;
private Light light;
private MeshRenderer innerRenderer;
public Material redGlow;
public Material blueGlow;
public Material defMat;
private bool lastLit = true;
public bool exploding = false;
public PlayerControllerB playerLastHeldBy;
public AudioClip beamUpAudio;
public AudioClip beamUpAudio2;
public AudioClip tpSFX;
public AudioClip inverseSFX;
private static Random tpSeed;
public override void Start()
{
((GrabbableObject)this).Start();
random = new Random(StartOfRound.Instance.randomMapSeed);
bomb = (int)(Plugin.Instance.bombChance.Value * 10000.0);
flood = (int)(Plugin.Instance.floodChance.Value * 10000.0);
light = ((Component)this).GetComponentInChildren<Light>();
Transform child = ((Component)this).gameObject.transform.GetChild(0).GetChild(4);
innerRenderer = ((Component)child).GetComponent<MeshRenderer>();
defMat = ((Renderer)innerRenderer).GetMaterial();
mainAudio = ((Component)this).gameObject.GetComponent<AudioSource>();
}
public static void NewSeed()
{
tpSeed = new Random(StartOfRound.Instance.randomMapSeed + 17 + (int)GameNetworkManager.Instance.localPlayerController.playerClientId);
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).ItemActivate(used, buttonDown);
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening || (Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)
{
return;
}
((GrabbableObject)this).currentUseCooldown = 3.5f;
ulong playerClientId = ((GrabbableObject)this).playerHeldBy.playerClientId;
mainAudio.PlayOneShot(pressed);
if (!StartOfRound.Instance.inShipPhase)
{
if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
{
ExecuteButtonPressOnServer(playerClientId);
}
else
{
RequestButtonPressServerRpc();
}
}
}
public override void Update()
{
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).Update();
if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null)
{
playerLastHeldBy = ((GrabbableObject)this).playerHeldBy;
}
if (boomTimer > 0f)
{
boomTimer -= Time.deltaTime;
bool flag = Math.Sin(Math.PI * ((double)boomTimer + 0.1) / 0.2) > 0.0;
if (flag != lastLit)
{
if (flag)
{
((Renderer)innerRenderer).SetMaterial(redGlow);
light.color = Color.red;
((Behaviour)light).enabled = true;
}
else
{
((Renderer)innerRenderer).SetMaterial(defMat);
((Behaviour)light).enabled = false;
}
}
lastLit = flag;
}
else if (exploding)
{
Detonate();
if (((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
else
{
DestroyThisServerRpc();
}
}
}
[ServerRpc(RequireOwnership = false)]
public void DestroyThisServerRpc()
{
//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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
{
ServerRpcParams val = default(ServerRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1476883978u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1476883978u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && (Object)(object)((Component)this).gameObject != (Object)null)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
}
public override void OnDestroy()
{
((MonoBehaviour)this).StopAllCoroutines();
}
public void ExecuteButtonPressOnServer(ulong id)
{
((MonoBehaviour)this).StartCoroutine(DecideFunction(id));
}
public IEnumerator DecideFunction(ulong id)
{
yield return (object)new WaitForSeconds(1f);
int i = random.Next(10000);
if (i < flood)
{
ExecuteFloodOnServer();
}
else if (i < bomb + flood)
{
ExecuteBombTriggerOnServer();
}
else
{
ExecuteTeleportOnServer(id);
}
}
public void ExecuteTeleportOnServer(ulong id)
{
ExecuteTeleportClientRpc(Plugin.Instance.leaveScrap.Value, id);
}
public void ExecuteBombTriggerOnServer()
{
boomTimer = 1.7f;
exploding = true;
StartBlinkingClientRpc();
}
public void Detonate()
{
//IL_0039: 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_0043: Unknown result type (might be due to invalid IL or missing references)
mainAudio.pitch = Random.Range(0.93f, 1.07f);
mainAudio.PlayOneShot(detonate, 1f);
Landmine.SpawnExplosion(((Component)this).transform.position + Vector3.up, true, 1f, 4.4f);
}
public void ExecuteFloodOnServer()
{
if (!IndoorFlood.active)
{
if (IndoorFlood.CheckBounds())
{
StartFloodClientRpc();
}
else
{
ExecuteErrorOnServer();
}
}
}
public void ExecuteErrorOnServer()
{
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
Plugin.Instance.logger.LogError((object)$"Flood function can't find the level bounds on: ${((Object)RoundManager.Instance.currentLevel).name}. If this is a custom map, please fill out a bug report with a link to the map. For now, get a prize.");
PlayPrizeSoundClientRpc();
GameObject val = Object.Instantiate<GameObject>(GameObject.Find("GoldBar"), ((Component)this).transform.position, Quaternion.identity);
((GrabbableObject)val.GetComponent<PhysicsProp>()).SetScrapValue(210);
val.GetComponent<NetworkObject>().Spawn(false);
Object.Destroy((Object)(object)((Component)this).gameObject);
}
[ClientRpc]
public void PlayPrizeSoundClientRpc()
{
//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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4195487603u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4195487603u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
mainAudio.PlayOneShot(Object.FindObjectOfType<GiftBoxItem>().openGiftAudio);
}
}
}
[ClientRpc]
public void StartFloodClientRpc()
{
//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)
//IL_00d4: 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(3371106405u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3371106405u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
((Renderer)innerRenderer).SetMaterial(blueGlow);
light.color = Color.cyan;
((Behaviour)light).enabled = true;
GameObject val3 = Object.Instantiate<GameObject>(Plugin.Instance.indoorFlooding);
val3.SetActive(true);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void RequestButtonPressServerRpc(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_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)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: 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 != 1 && (networkManager.IsClient || networkManager.IsHost))
{
FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2960603227u, serverRpcParams, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val, 2960603227u, serverRpcParams, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
ulong senderClientId = serverRpcParams.Receive.SenderClientId;
ExecuteButtonPressOnServer(senderClientId);
}
}
}
[ClientRpc]
public void StartBlinkingClientRpc()
{
//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)
//IL_00f8: 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(1437691948u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1437691948u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
boomTimer = 1.7f;
exploding = true;
mainAudio.PlayOneShot(beep);
((Renderer)innerRenderer).SetMaterial(redGlow);
light.color = Color.red;
((Behaviour)light).enabled = true;
}
}
}
[ClientRpc]
public void ExecuteTeleportClientRpc(bool dropScrap, ulong id)
{
//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)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3055508373u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref dropScrap, default(ForPrimitives));
BytePacker.WriteValueBitPacked(val2, id);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3055508373u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
{
Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds;
if (((Bounds)(ref bounds)).Contains(((Component)this).transform.position))
{
((MonoBehaviour)this).StartCoroutine(BeamToFactory(dropScrap, id));
}
else
{
((MonoBehaviour)this).StartCoroutine(BeamToShip(dropScrap, id));
}
}
}
public IEnumerator BeamToFactory(bool dropScrap, ulong id)
{
PlayerControllerB playerToTp = ((GrabbableObject)this).playerHeldBy;
if ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)
{
playerToTp = StartOfRound.Instance.allPlayerObjects[(uint)id].GetComponent<PlayerControllerB>();
}
playerToTp.beamOutBuildupParticle.Play();
playerToTp.movementAudio.PlayOneShot(beamUpAudio);
mainAudio.PlayOneShot(inverseSFX, 0.6f);
yield return (object)new WaitForSeconds(5f);
if (!((Object)(object)playerToTp != (Object)null))
{
yield break;
}
Vector3 vector2 = RoundManager.Instance.insideAINodes[tpSeed.Next(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
vector2 = RoundManager.Instance.GetRandomNavMeshPositionInBoxPredictable(vector2, 10f, default(NavMeshHit), tpSeed, -1);
if ((Object)(object)playerToTp.deadBody != (Object)null)
{
DeadBodyInfo deadBody = playerToTp.deadBody;
if ((Object)(object)deadBody != (Object)null)
{
deadBody.attachedTo = null;
deadBody.attachedLimb = null;
deadBody.secondaryAttachedLimb = null;
deadBody.secondaryAttachedTo = null;
if ((Object)(object)deadBody.grabBodyObject != (Object)null && deadBody.grabBodyObject.isHeld && (Object)(object)deadBody.grabBodyObject.playerHeldBy != (Object)null)
{
deadBody.grabBodyObject.playerHeldBy.DropAllHeldItems(true, false);
}
deadBody.isInShip = false;
deadBody.parentedToShip = false;
((Component)deadBody).transform.SetParent((Transform)null, true);
deadBody.SetRagdollPositionSafely(vector2, true);
}
}
else
{
if (dropScrap)
{
playerToTp.DropAllHeldItemsExcept((GrabbableObject)(object)this);
}
playerToTp.isInElevator = false;
playerToTp.isInHangarShipRoom = false;
playerToTp.isInsideFactory = true;
playerToTp.averageVelocity = 0f;
playerToTp.velocityLastFrame = Vector3.zero;
playerToTp.TeleportPlayer(vector2, false, 0f, false, true);
playerToTp.beamOutParticle.Play();
playerToTp.movementAudio.PlayOneShot(beamUpAudio2);
if ((Object)(object)playerToTp == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
}
}
}
public IEnumerator BeamToShip(bool dropScrap, ulong id)
{
PlayerControllerB playerToTp = ((GrabbableObject)this).playerHeldBy;
if ((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)
{
playerToTp = StartOfRound.Instance.allPlayerObjects[(uint)id].GetComponent<PlayerControllerB>();
}
playerToTp.beamUpParticle.Play();
playerToTp.movementAudio.PlayOneShot(beamUpAudio);
mainAudio.PlayOneShot(tpSFX, 0.6f);
ShipTeleporter[] tpers = Object.FindObjectsOfType<ShipTeleporter>();
ShipTeleporter[] array = tpers;
foreach (ShipTeleporter tp2 in array)
{
if (!tp2.isInverseTeleporter)
{
tp2.shipTeleporterAudio.PlayOneShot(tp2.teleporterSpinSFX);
tp2.teleporterAnimator.SetTrigger("useTeleporter");
tp2.cooldownTime = tp2.cooldownAmount;
tp2.buttonTrigger.interactable = false;
break;
}
}
yield return (object)new WaitForSeconds(3f);
ShipTeleporter tpOptional = null;
ShipTeleporter[] tpOptionals = Object.FindObjectsOfType<ShipTeleporter>();
ShipTeleporter[] array2 = tpOptionals;
foreach (ShipTeleporter tp in array2)
{
if (!tp.isInverseTeleporter)
{
tpOptional = tp;
}
}
Vector3 shipPos = ((!((Object)(object)tpOptional != (Object)null)) ? StartOfRound.Instance.middleOfShipNode.position : tpOptional.teleporterPosition.position);
if (!((Object)(object)playerToTp != (Object)null))
{
yield break;
}
if ((Object)(object)playerToTp.deadBody != (Object)null)
{
if ((Object)(object)playerToTp.deadBody.grabBodyObject == (Object)null || !playerToTp.deadBody.grabBodyObject.isHeldByEnemy)
{
playerToTp.deadBody.attachedTo = null;
playerToTp.deadBody.attachedLimb = null;
playerToTp.deadBody.secondaryAttachedLimb = null;
playerToTp.deadBody.secondaryAttachedTo = null;
playerToTp.deadBody.SetRagdollPositionSafely(shipPos, true);
((Component)playerToTp.deadBody).transform.SetParent(StartOfRound.Instance.elevatorTransform, true);
if ((Object)(object)playerToTp.deadBody.grabBodyObject != (Object)null && playerToTp.deadBody.grabBodyObject.isHeld && (Object)(object)playerToTp.deadBody.grabBodyObject.playerHeldBy != (Object)null)
{
playerToTp.deadBody.grabBodyObject.playerHeldBy.DropAllHeldItems(true, false);
}
}
yield break;
}
if (dropScrap)
{
playerToTp.DropAllHeldItemsExcept((GrabbableObject)(object)this);
}
if (Object.op_Implicit((Object)(object)Object.FindObjectOfType<AudioReverbPresets>()))
{
Object.FindObjectOfType<AudioReverbPresets>().audioPresets[3].ChangeAudioReverbForPlayer(playerToTp);
}
playerToTp.isInElevator = true;
playerToTp.isInHangarShipRoom = true;
playerToTp.isInsideFactory = false;
playerToTp.averageVelocity = 0f;
playerToTp.velocityLastFrame = Vector3.zero;
playerToTp.TeleportPlayer(shipPos, true, 160f, false, true);
playerToTp.movementAudio.PlayOneShot(beamUpAudio2);
if (GameNetworkManager.Instance.localPlayerController.isInHangarShipRoom)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)1);
}
playerToTp.beamUpParticle.Stop();
}
protected override void __initializeVariables()
{
((PhysicsProp)this).__initializeVariables();
}
[RuntimeInitializeOnLoadMethod]
internal static void InitializeRPCS_ButtonItem()
{
//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
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
NetworkManager.__rpc_func_table.Add(1476883978u, new RpcReceiveHandler(__rpc_handler_1476883978));
NetworkManager.__rpc_func_table.Add(4195487603u, new RpcReceiveHandler(__rpc_handler_4195487603));
NetworkManager.__rpc_func_table.Add(3371106405u, new RpcReceiveHandler(__rpc_handler_3371106405));
NetworkManager.__rpc_func_table.Add(2960603227u, new RpcReceiveHandler(__rpc_handler_2960603227));
NetworkManager.__rpc_func_table.Add(1437691948u, new RpcReceiveHandler(__rpc_handler_1437691948));
NetworkManager.__rpc_func_table.Add(3055508373u, new RpcReceiveHandler(__rpc_handler_3055508373));
}
private static void __rpc_handler_1476883978(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;
((ButtonItem)(object)target).DestroyThisServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4195487603(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;
((ButtonItem)(object)target).PlayPrizeSoundClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3371106405(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;
((ButtonItem)(object)target).StartFloodClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2960603227(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
ServerRpcParams server = rpcParams.Server;
target.__rpc_exec_stage = (__RpcExecStage)1;
((ButtonItem)(object)target).RequestButtonPressServerRpc(server);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1437691948(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;
((ButtonItem)(object)target).StartBlinkingClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3055508373(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 dropScrap = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref dropScrap, default(ForPrimitives));
ulong id = default(ulong);
ByteUnpacker.ReadValueBitPacked(reader, ref id);
target.__rpc_exec_stage = (__RpcExecStage)2;
((ButtonItem)(object)target).ExecuteTeleportClientRpc(dropScrap, id);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "ButtonItem";
}
}
public class CustomQuicksand : QuicksandTrigger
{
public void OnTriggerStay(Collider other)
{
if (base.isWater)
{
if (!((Component)other).gameObject.CompareTag("Player"))
{
return;
}
PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
if ((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController && (Object)(object)component != (Object)null && (Object)(object)component.underwaterCollider != (Object)(object)this)
{
component.underwaterCollider = ((Component)this).gameObject.GetComponent<Collider>();
return;
}
}
if (!base.isWater && !((Component)other).gameObject.CompareTag("Player"))
{
return;
}
PlayerControllerB component2 = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
if ((Object)(object)component2 != (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
return;
}
if (base.isWater && !component2.isUnderwater)
{
component2.underwaterCollider = ((Component)this).gameObject.GetComponent<Collider>();
component2.isUnderwater = true;
}
component2.statusEffectAudioIndex = base.audioClipIndex;
if (component2.isSinking)
{
return;
}
if (base.sinkingLocalPlayer)
{
if (!component2.CheckConditionsForSinkingInQuicksand())
{
StopSinkingLocalPlayer(component2);
}
}
else if (component2.CheckConditionsForSinkingInQuicksand())
{
Debug.Log((object)"Set local player to sinking!");
base.sinkingLocalPlayer = true;
component2.sourcesCausingSinking++;
component2.isMovementHindered++;
component2.hinderedMultiplier *= base.movementHinderance;
if (base.isWater)
{
component2.sinkingSpeedMultiplier = 0f;
}
else
{
component2.sinkingSpeedMultiplier = base.sinkingSpeedMultiplier;
}
}
}
public void OnTriggerExit(Collider other)
{
OnExit(other);
}
public void OnExit(Collider other)
{
if (!base.sinkingLocalPlayer)
{
if (base.isWater && ((Component)other).CompareTag("Player") && !((Object)(object)((Component)other).gameObject.GetComponent<PlayerControllerB>() == (Object)(object)GameNetworkManager.Instance.localPlayerController))
{
((Component)other).gameObject.GetComponent<PlayerControllerB>().isUnderwater = false;
}
}
else if (((Component)other).CompareTag("Player"))
{
PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
if (!((Object)(object)component != (Object)(object)GameNetworkManager.Instance.localPlayerController))
{
StopSinkingLocalPlayer(component);
}
}
}
public void StopSinkingLocalPlayer(PlayerControllerB playerScript)
{
if (base.sinkingLocalPlayer)
{
base.sinkingLocalPlayer = false;
playerScript.sourcesCausingSinking = Mathf.Clamp(playerScript.sourcesCausingSinking - 1, 0, 100);
playerScript.isMovementHindered = Mathf.Clamp(playerScript.isMovementHindered - 1, 0, 100);
playerScript.hinderedMultiplier = Mathf.Clamp(playerScript.hinderedMultiplier / base.movementHinderance, 1f, 100f);
if (playerScript.isMovementHindered == 0 && base.isWater)
{
playerScript.isUnderwater = false;
}
}
}
}
public class IndoorFlood : MonoBehaviour
{
public AudioSource waterAudio;
public AudioClip burstSFX;
public AudioClip waterRush;
public AudioClip warningSFX;
public float entranceY;
public float factoryBoundsY;
public float surfaceBoundsY;
public float floodLevel;
public static bool active;
public GameObject extraCollider;
public void Awake()
{
//IL_0016: 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_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: Expected O, but got Unknown
((Component)this).transform.position = new Vector3(0f, 0f, 0f);
floodLevel = 0f;
extraCollider = Object.Instantiate<GameObject>(new GameObject("Collider"), ((Component)this).transform.position, Quaternion.identity);
extraCollider.SetActive(false);
CustomQuicksand customQuicksand = extraCollider.AddComponent<CustomQuicksand>();
((QuicksandTrigger)customQuicksand).audioClipIndex = 1;
((QuicksandTrigger)customQuicksand).isWater = true;
((QuicksandTrigger)customQuicksand).movementHinderance = 0.6f;
((QuicksandTrigger)customQuicksand).sinkingSpeedMultiplier = 0.08f;
BoxCollider val = extraCollider.AddComponent<BoxCollider>();
((Collider)val).isTrigger = true;
Rigidbody val2 = extraCollider.AddComponent<Rigidbody>();
val2.isKinematic = true;
val2.useGravity = false;
extraCollider.layer = LayerMask.NameToLayer("Triggers");
}
public static bool CheckBounds()
{
float[] array = FindBounds();
float num = array[0];
float num2 = array[1];
if (float.IsNaN(num) || float.IsNaN(num2) || num == num2)
{
return false;
}
return true;
}
public void OnEnable()
{
//IL_0035: 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_007c: Unknown result type (might be due to invalid IL or missing references)
float[] array = FindBounds();
factoryBoundsY = Mathf.Min(array);
surfaceBoundsY = Mathf.Max(array);
((Component)this).transform.position = new Vector3(0f, factoryBoundsY, 0f);
entranceY = RoundManager.FindMainEntrancePosition(false, false).y;
active = true;
extraCollider.SetActive(true);
extraCollider.transform.localScale = ((Component)this).transform.GetChild(0).localScale;
}
public void Start()
{
((MonoBehaviour)this).StartCoroutine(PlayEffects());
}
private static float[] FindBounds()
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
int num = 0;
float[] array = new float[2]
{
float.NaN,
float.NaN
};
OutOfBoundsTrigger[] array2 = Object.FindObjectsOfType<OutOfBoundsTrigger>();
OutOfBoundsTrigger[] array3 = array2;
foreach (OutOfBoundsTrigger val in array3)
{
if (((Behaviour)val).enabled)
{
array[num] = ((Component)val).transform.position.y;
num++;
if (num > 1)
{
break;
}
}
}
return array;
}
public void OnDisable()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
waterAudio.volume = 0f;
floodLevel = 0f;
((Component)this).transform.position = new Vector3(0f, -50f, 0f);
extraCollider.SetActive(false);
}
public void OnDestroy()
{
Object.Destroy((Object)(object)extraCollider);
}
public void Update()
{
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_014d: Unknown result type (might be due to invalid IL or missing references)
//IL_016b: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_019e: Unknown result type (might be due to invalid IL or missing references)
//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
//IL_01da: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_020f: Unknown result type (might be due to invalid IL or missing references)
//IL_022e: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_0257: Unknown result type (might be due to invalid IL or missing references)
//IL_0267: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: Unknown result type (might be due to invalid IL or missing references)
floodLevel += Time.deltaTime;
if (!GameNetworkManager.Instance.localPlayerController.isInsideFactory)
{
waterAudio.volume = 0f;
return;
}
if (floodLevel < 45f)
{
float num = floodLevel / 45f;
double d = (double)num * 1.718281828459045 + 1.0;
double num2 = Math.Log(d);
float num3 = (float)num2 * (entranceY - factoryBoundsY) + factoryBoundsY;
((Component)this).transform.position = new Vector3(0f, num3, 0f);
}
else if (floodLevel < 90f)
{
float num4 = (floodLevel - 45f) / 45f;
float num5 = num4 * 2f - 2f;
double num6 = Math.Exp(num5) - 0.13500000536441803;
float num7 = (float)num6 * (surfaceBoundsY - entranceY) + entranceY;
((Component)this).transform.position = new Vector3(0f, num7, 0f);
}
float num8 = (((Component)this).transform.position.y + factoryBoundsY) / 2f;
float num9 = ((Component)this).transform.position.y - factoryBoundsY;
Vector3 position = extraCollider.transform.position;
Vector3 localScale = extraCollider.transform.localScale;
extraCollider.transform.position = new Vector3(position.x, num8, position.z);
extraCollider.transform.localScale = new Vector3(localScale.x, num9, localScale.z);
((Component)waterAudio).transform.position = new Vector3(((Component)GameNetworkManager.Instance.localPlayerController).transform.position.x, ((Component)this).transform.position.y + 3f, ((Component)GameNetworkManager.Instance.localPlayerController).transform.position.z);
if (Physics.Linecast(((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).transform.position, ((Component)waterAudio).transform.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))
{
waterAudio.volume = Mathf.Lerp(waterAudio.volume, 0f, 0.5f * Time.deltaTime);
}
else
{
waterAudio.volume = Mathf.Lerp(waterAudio.volume, 1f, 0.5f * Time.deltaTime);
}
}
public IEnumerator PlayEffects()
{
if (GameNetworkManager.Instance.localPlayerController.isInsideFactory)
{
GameNetworkManager.Instance.localPlayerController.movementAudio.PlayOneShot(burstSFX, 1f);
}
else
{
GameNetworkManager.Instance.localPlayerController.movementAudio.PlayOneShot(burstSFX, 0.2f);
}
yield return (object)new WaitForSeconds(1f);
if (GameNetworkManager.Instance.localPlayerController.isInsideFactory)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
}
else
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)0);
}
yield return (object)new WaitForSeconds(2f);
HUDManager.Instance.DisplayFloodWarning();
if (GameNetworkManager.Instance.localPlayerController.isInsideFactory)
{
SoundManager.Instance.ambienceAudio.loop = true;
SoundManager.Instance.ambienceAudio.clip = waterRush;
SoundManager.Instance.ambienceAudio.Play();
}
}
}
}
namespace ScrapButton.ExtensionMethod
{
public static class PlayerControllerExtension
{
public static void DropAllHeldItemsExcept(this PlayerControllerB pcb, GrabbableObject except, bool itemsFall = true, bool disconnecting = false)
{
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Unknown result type (might be due to invalid IL or missing references)
for (int i = 0; i < pcb.ItemSlots.Length; i++)
{
GrabbableObject val = pcb.ItemSlots[i];
if (!((Object)(object)val != (Object)null) || (Object)(object)val == (Object)(object)except)
{
continue;
}
if (itemsFall)
{
val.parentObject = null;
val.heldByPlayerOnServer = false;
if (pcb.isInElevator)
{
((Component)val).transform.SetParent(pcb.playersManager.elevatorTransform, true);
}
else
{
((Component)val).transform.SetParent(pcb.playersManager.propsContainer, true);
}
pcb.SetItemInElevator(pcb.isInHangarShipRoom, pcb.isInElevator, val);
val.EnablePhysics(true);
val.EnableItemMeshes(true);
((Component)val).transform.localScale = val.originalScale;
val.isHeld = false;
val.isPocketed = false;
val.startFallingPosition = ((Component)val).transform.parent.InverseTransformPoint(((Component)val).transform.position);
val.FallToGround(true);
val.fallTime = Random.Range(-0.3f, 0.05f);
if (((NetworkBehaviour)pcb).IsOwner)
{
val.DiscardItemOnClient();
}
else if (!val.itemProperties.syncDiscardFunction)
{
val.playerHeldBy = null;
}
}
if (((NetworkBehaviour)pcb).IsOwner && !disconnecting)
{
((Behaviour)HUDManager.Instance.holdingTwoHandedItem).enabled = false;
((Behaviour)HUDManager.Instance.itemSlotIcons[i]).enabled = false;
HUDManager.Instance.ClearControlTips();
pcb.activatingItem = false;
}
pcb.ItemSlots[i] = null;
}
if (pcb.isHoldingObject)
{
pcb.isHoldingObject = false;
if ((Object)(object)pcb.currentlyHeldObjectServer != (Object)null)
{
pcb.SetSpecialGrabAnimationBool(false, pcb.currentlyHeldObjectServer);
}
pcb.playerBodyAnimator.SetBool("cancelHolding", true);
pcb.playerBodyAnimator.SetTrigger("Throw");
}
pcb.activatingItem = false;
pcb.twoHanded = false;
pcb.carryWeight = 1f;
pcb.currentlyHeldObjectServer = null;
}
}
public static class HUDManagerExtension
{
public static void DisplayFloodWarning(this HUDManager hm)
{
hm.DisplayTip("Facility is flooding.", "You have 45 seconds to evacuate.", true, false, "LC_Tip1");
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace MysteryButton.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}