using System;
using System.CodeDom.Compiler;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security.Permissions;
using System.Text.RegularExpressions;
using System.Xml.Serialization;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using DunGen;
using GameNetcodeStuff;
using HarmonyLib;
using HarmonyLib.Tools;
using LethalConfig;
using LethalConfig.ConfigItems;
using STSharedAudioLib;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.Events;
using UnityEngine.Rendering;
using UnityEngine.UI;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[CreateAssetMenu(menuName = "LCGoldScrapMod/ArtOfGoldMaterials", order = 1)]
public class ArtOfGoldMaterials : ScriptableObject
{
public List<Material> allArtwork;
public List<Material> allSillyArtwork;
}
public enum GoldScrapLevels
{
Experimentation,
Assurance,
Vow,
Offense,
March,
Rend,
Dine,
Titan,
Adamance,
Artifice,
Embrion
}
[CreateAssetMenu(menuName = "LCGoldScrapMod/ItemData", order = 0)]
public class ItemData : ScriptableObject
{
[Header("General")]
[Tooltip("The folder name used to access this item/furniture with for setting up all the mod's data.\nMust match exactly, and cannot contain spaces.")]
public string folderName = "FolderName";
[Tooltip("The display name to show on the Item's itemName and UnlockableItem's unlockableName.\nPrimarily used to reset to as a default value.")]
public string displayName = "Display Name";
[Tooltip("Determines what values for hostDateCase this item's prefab will be influenced by.\n\n0: More common on New Year's.\n2: More common on World Art Day.\n3: Does not appear on Freedom Day.\n5: More common on Halloween.")]
public int[] specialDateCases;
[Header("Item")]
[Tooltip("The LCGoldScrapMod itemProperties the game will read from on the host.")]
public Item itemProperties;
[Tooltip("If true, it will be registered to levels and its itemProperties' weight, max-, and minValues will be put through the configMultipliers.\nIf false, only weight will be multiplied by its configMultiplier.")]
public bool isScrap = true;
[Space(3f)]
[Header("Defaults")]
[Tooltip("The intended default weight not yet taking the default 1.5x weightMultiplier into account.\nUsually the weight of the original item, unless that has no weight.")]
public float defaultWeight = 1f;
[Tooltip("The intended default maxValue not yet taking the default 2x maxValueMultiplier into account.\nUsually the maxValue of the original item.")]
public int defaultMaxValue;
[Tooltip("The intended default minValue not yet taking the default 2.5x minValueMultiplier into account.\nUsually the minValue of the original item.")]
public int defaultMinValue;
[Tooltip("The intended default rarity not yet taking the custom plusGain and minusLoss into account.\nRefer to 'GoldScrap - Items' document.")]
public int defaultRarity = 3;
[Space(3f)]
[Header("Levels")]
[Tooltip("The vanilla levels where this gold scrap can appear.\nTakes a calculation of 'Default Rarity - 1' into account.")]
public GoldScrapLevels[] levelsToAddMinus;
[Tooltip("The vanilla levels where this gold scrap can appear.\nOnly takes Default Rarity into account.")]
public GoldScrapLevels[] levelsToAddDefault;
[Tooltip("The vanilla levels where this gold scrap can appear.\nTakes a calculation of 'Default Rarity + 2' into account.")]
public GoldScrapLevels[] levelsToAddPlus;
[Tooltip("A custom positive gain or negative loss that will influence the Default Rarity of gold scrap on levels selected in 'Levels To Add Custom'.\nWill have no effect if Default Rarity is 2 or smaller and Custom Change is -2 or lower.")]
public int customChange;
[Tooltip("The vanilla levels where this gold scrap can appear.\nTakes a calculation of 'Default Rarity + Custom Change' into account.")]
public GoldScrapLevels[] levelsToAddCustom;
[Space(3f)]
[Header("Store")]
[Tooltip("If true, its value will not be counted when collected in levels and when sold on the Company desk.")]
public bool isStoreItem;
[Tooltip("The intended default price not yet taking modifiers such as sales or configs into account.\nSet to -1 to not have this value be read during set-up.")]
public int storeDefaultPrice = 100;
[Tooltip("The cap that determines for how much this item or furniture can go be marked off during a Gold Fever sale.\nSet to -1 to have the Weather Multipliers take over.")]
public int maxFeverSalePercentage = 90;
[Tooltip("The text to display in case this item/furniture can no longer be bought, either thanks to already being unlocked in StartOfRound or having a negative price.")]
public string alreadyPurchasedText;
[Tooltip("The TerminalNodes for furniture containing the itemCost to modify in case of sales or configs.")]
public TerminalNode[] storeTerminalNodes = (TerminalNode[])(object)new TerminalNode[2];
[Tooltip("The UnlockableItem to be added to the list of StartOfRound unlockables.")]
public UnlockableItem unlockableProperties;
[Space(3f)]
[Header("Local host values")]
[HideInInspector]
public int localItemsListIndex = -1;
[HideInInspector]
public int localMaxValue;
[HideInInspector]
public int localMinValue;
[HideInInspector]
public int localStorePrice;
[HideInInspector]
public int localBuyItemIndex = -1;
[HideInInspector]
public int localUnlockableID = -1;
}
[CreateAssetMenu(menuName = "LCGoldScrapMod/List/AudioClipList")]
public class AudioClipList : ScriptableObject
{
public List<AudioClip> allClips = new List<AudioClip>();
}
[CreateAssetMenu(menuName = "LCGoldScrapMod/List/GameObjectList")]
public class GameObjectList : ScriptableObject
{
public GameObject[] allPrefabs;
}
[CreateAssetMenu(menuName = "LCGoldScrapMod/List/ItemDataList")]
public class ItemDataList : ScriptableObject
{
public ItemData[] allItemData;
}
[CreateAssetMenu(menuName = "LCGoldScrapMod/List/StringList")]
public class StringList : ScriptableObject
{
[TextArea(1, 20)]
public string[] allStrings;
}
public interface IGoldenGlassSecret
{
void BeginReveal();
void EndReveal();
}
public class GoldBirdScript : GrabbableObject
{
[HarmonyPatch(typeof(HUDManager), "RadiationWarningHUD")]
public class NewHUDManagerRadiationWarning
{
[HarmonyPostfix]
public static void AwakenGoldBirds()
{
if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null && GameNetworkManager.Instance.localPlayerController.isHostPlayerObject)
{
GoldBirdScript[] array = Object.FindObjectsByType<GoldBirdScript>((FindObjectsSortMode)0);
foreach (GoldBirdScript obj in array)
{
obj.AwakenClientRpc((int)((float)((GrabbableObject)obj).scrapValue * Random.Range(3f, 4f)));
}
}
}
}
private static ManualLogSource Logger = GoldScrapPlugin.Logger;
[Space(3f)]
[Header("Alarm")]
public AudioSource alarmSource;
public AudioClip alarmClip;
private float alarmTimer;
private bool canAlarmFire;
[Space(3f)]
[Header("Spotlight")]
public AudioSource spotlightAudio;
public AudioClip lightOnClip;
public AudioClip lightOffClip;
public Light headlight;
public Color normalColor;
public Color alarmColor;
[Space(3f)]
[Header("Dormancy")]
public AudioSource awakeSource;
public AudioClip awakeClip;
public AudioClip dieClip;
public bool dormant = true;
public ScanNodeProperties scanNode;
private bool canWakeThisRound = true;
public override void Start()
{
((GrabbableObject)this).Start();
alarmSource.clip = alarmClip;
if (base.isInShipRoom)
{
canWakeThisRound = false;
return;
}
ScanNodeProperties obj = scanNode;
obj.headerText += " (Dormant)";
}
public override void Update()
{
((GrabbableObject)this).Update();
if (!((NetworkBehaviour)this).IsServer || dormant)
{
return;
}
canAlarmFire = (Object)(object)base.playerHeldBy != (Object)null && StartOfRound.Instance.shipDoorsEnabled && !StartOfRound.Instance.inShipPhase;
if (!canAlarmFire && alarmTimer < 0.1f)
{
alarmTimer = 0.1f;
ToggleAlarmClientRpc(alarm: false);
return;
}
alarmTimer += Time.deltaTime;
if (alarmTimer > 2f)
{
alarmTimer = 0f;
DoAlarmInterval();
}
}
private void DoAlarmInterval()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
if (canAlarmFire)
{
if (IsNearbyPlayerInSight())
{
ToggleAlarmClientRpc(alarm: true);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, alarmSource.maxDistance + 15f, 1f, 0, false, 0);
}
else
{
ToggleAlarmClientRpc(alarm: false);
}
}
}
private bool IsNearbyPlayerInSight()
{
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
if (StartOfRound.Instance.connectedPlayersAmount > 0)
{
PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
foreach (PlayerControllerB val in allPlayerScripts)
{
if (!((Object)(object)val == (Object)null) && !((Object)(object)val == (Object)(object)base.playerHeldBy) && val.isPlayerControlled && !(Vector3.Distance(((Component)headlight).transform.position, ((Component)val).transform.position) > alarmSource.maxDistance - 15f))
{
return !Physics.Linecast(((Component)headlight).transform.position, val.playerEye.position, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1);
}
}
}
return false;
}
[ClientRpc]
private void ToggleAlarmClientRpc(bool alarm)
{
//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_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: 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)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3862976390u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref alarm, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3862976390u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
if (!((Behaviour)headlight).enabled)
{
((Behaviour)headlight).enabled = true;
}
if (alarm && !alarmSource.isPlaying)
{
spotlightAudio.PlayOneShot(lightOnClip);
alarmSource.Play();
headlight.color = alarmColor;
}
else if (!alarm && alarmSource.isPlaying)
{
spotlightAudio.PlayOneShot(lightOffClip);
alarmSource.Stop();
headlight.color = normalColor;
}
}
}
[ClientRpc]
public void AwakenClientRpc(int awakenedValue)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_017c: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4211676833u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, awakenedValue);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4211676833u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
Logger.LogDebug((object)$"{((Object)((Component)this).gameObject).name} #{((NetworkBehaviour)this).NetworkObjectId}: canWake {canWakeThisRound} // dormant {dormant}");
if (canWakeThisRound && dormant)
{
Logger.LogDebug((object)"awakening");
awakeSource.PlayOneShot(awakeClip);
WalkieTalkie.TransmitOneShotAudio(awakeSource, awakeClip, 0.5f);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, awakeSource.maxDistance, 0.1f, 0, false, 0);
((Behaviour)headlight).enabled = true;
headlight.color = normalColor;
dormant = false;
canWakeThisRound = false;
if (scanNode.headerText.Contains("(Dormant)"))
{
scanNode.headerText = scanNode.headerText.Replace("Dormant", "Awake");
}
((GrabbableObject)this).SetScrapValue(awakenedValue);
}
}
[ClientRpc]
public void DeactivateAtEndOfDayClientRpc()
{
//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_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_0183: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(634004460u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 634004460u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
if (!canWakeThisRound)
{
return;
}
canWakeThisRound = false;
Logger.LogDebug((object)$"{((Object)((Component)this).gameObject).name} #{((NetworkBehaviour)this).NetworkObjectId} can no longer wake");
if (dormant)
{
if (scanNode.headerText.Contains("(Dormant)"))
{
scanNode.headerText = scanNode.headerText.Replace("Dormant", "Dead");
}
spotlightAudio.PlayOneShot(dieClip);
Object.Instantiate<GameObject>(GoldScrapAssetsCollection.poofParticle, ((Component)headlight).transform.position, new Quaternion(0f, 0f, 0f, 0f)).GetComponent<ParticleSystem>().Play();
}
}
[ServerRpc(RequireOwnership = false)]
public void SyncUponJoinServerRpc(int playerID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: 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(2991509102u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerID);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2991509102u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
SyncUponJoinClientRpc(canWakeThisRound, ((Behaviour)headlight).enabled, scanNode.headerText, playerID);
}
}
}
[ClientRpc]
private void SyncUponJoinClientRpc(bool hostCanWakeValue, bool enableHeadlight, string scanNodeName, int playerID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: 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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: 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_0185: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1832698290u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hostCanWakeValue, default(ForPrimitives));
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref enableHeadlight, default(ForPrimitives));
bool flag = scanNodeName != null;
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
if (flag)
{
((FastBufferWriter)(ref val2)).WriteValueSafe(scanNodeName, false);
}
BytePacker.WriteValueBitPacked(val2, playerID);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1832698290u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost))
{
return;
}
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
if (playerID == (int)StartOfRound.Instance.localPlayerController.playerClientId)
{
canWakeThisRound = hostCanWakeValue;
((Behaviour)headlight).enabled = enableHeadlight;
if (enableHeadlight)
{
headlight.color = (alarmSource.isPlaying ? alarmColor : normalColor);
}
scanNode.headerText = scanNodeName;
}
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(3862976390u, new RpcReceiveHandler(__rpc_handler_3862976390), "ToggleAlarmClientRpc");
((NetworkBehaviour)this).__registerRpc(4211676833u, new RpcReceiveHandler(__rpc_handler_4211676833), "AwakenClientRpc");
((NetworkBehaviour)this).__registerRpc(634004460u, new RpcReceiveHandler(__rpc_handler_634004460), "DeactivateAtEndOfDayClientRpc");
((NetworkBehaviour)this).__registerRpc(2991509102u, new RpcReceiveHandler(__rpc_handler_2991509102), "SyncUponJoinServerRpc");
((NetworkBehaviour)this).__registerRpc(1832698290u, new RpcReceiveHandler(__rpc_handler_1832698290), "SyncUponJoinClientRpc");
((GrabbableObject)this).__initializeRpcs();
}
private static void __rpc_handler_3862976390(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_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool alarm = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref alarm, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((GoldBirdScript)(object)target).ToggleAlarmClientRpc(alarm);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4211676833(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int awakenedValue = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref awakenedValue);
target.__rpc_exec_stage = (__RpcExecStage)1;
((GoldBirdScript)(object)target).AwakenClientRpc(awakenedValue);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_634004460(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;
((GoldBirdScript)(object)target).DeactivateAtEndOfDayClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2991509102(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int playerID = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
target.__rpc_exec_stage = (__RpcExecStage)1;
((GoldBirdScript)(object)target).SyncUponJoinServerRpc(playerID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1832698290(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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: 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_00ca: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool hostCanWakeValue = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hostCanWakeValue, default(ForPrimitives));
bool enableHeadlight = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref enableHeadlight, default(ForPrimitives));
bool flag = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
string scanNodeName = null;
if (flag)
{
((FastBufferReader)(ref reader)).ReadValueSafe(ref scanNodeName, false);
}
int playerID = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
target.__rpc_exec_stage = (__RpcExecStage)1;
((GoldBirdScript)(object)target).SyncUponJoinClientRpc(hostCanWakeValue, enableHeadlight, scanNodeName, playerID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "GoldBirdScript";
}
}
public class GoldenClockScript : GrabbableObject
{
private static ManualLogSource Logger = GoldScrapPlugin.Logger;
[Space(3f)]
[Header("Original Clock")]
public Transform minuteHand;
public Transform secondHand;
private float timeOfLastSecond;
public AudioSource tickAudio;
public AudioClip tickSFX;
public AudioClip tockSFX;
private bool tickOrTock;
[Space(3f)]
[Header("Custom Timer")]
public AudioClip intervalClip;
public AudioClip failClip;
public int maxRealSeconds;
public int minRealSeconds;
public float countdownInterval;
[Space(3f)]
[Header("Close Call")]
public AudioSource closeCallAudio;
public AudioClip closeCallApproach;
public AudioClip closeCallSuccess;
public AudioClip closeCallFail;
private bool shouldCountDown;
private bool approachedShipFinalPhase;
private int secondsLeft;
private int thisClocksStartingSeconds;
private int thisClocksStartingValue;
private int thisClocksIntervalAmount;
private int thisClocksSpecialMultiplier;
private float timeOfLastTickTock;
public override void Start()
{
((GrabbableObject)this).Start();
if (((NetworkBehaviour)this).IsServer && !base.isInShipRoom)
{
((MonoBehaviour)this).StartCoroutine(RollForNewTimer());
}
}
public override void Update()
{
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Unknown result type (might be due to invalid IL or missing references)
((GrabbableObject)this).Update();
if (!shouldCountDown)
{
return;
}
if (Time.realtimeSinceStartup - timeOfLastSecond > countdownInterval)
{
timeOfLastSecond = Time.realtimeSinceStartup;
if (((NetworkBehaviour)this).IsServer || (!((NetworkBehaviour)this).IsServer && secondsLeft % 60 != 1))
{
secondsLeft--;
secondHand.Rotate(6f, 0f, 0f, (Space)1);
}
if (((NetworkBehaviour)this).IsServer)
{
if (secondsLeft <= 0)
{
shouldCountDown = false;
SyncFailureClientRpc(base.scrapValue / thisClocksSpecialMultiplier);
return;
}
if (secondsLeft % 60 == 0)
{
SyncTimeAndValueClientRpc(secondsLeft, base.scrapValue - (int)Mathf.Lerp(0f, (float)thisClocksStartingValue, (float)(Random.Range(40, 70) / thisClocksIntervalAmount) / 100f), isMinute: true);
}
if (secondsLeft < 60 && !approachedShipFinalPhase && (Object)(object)base.playerHeldBy != (Object)null && Vector3.Distance(((Component)base.playerHeldBy).transform.position, ((Component)StartOfRound.Instance.shipDoorNode).transform.position) < 10f)
{
approachedShipFinalPhase = true;
SyncApproachClientRpc();
}
}
if (secondsLeft > 60)
{
TickTock();
}
}
if (secondsLeft <= 60 && Time.realtimeSinceStartup - timeOfLastTickTock > countdownInterval / 2f)
{
TickTock();
}
}
public override void OnBroughtToShip()
{
((GrabbableObject)this).OnBroughtToShip();
if (shouldCountDown)
{
SyncSuccessServerRpc();
}
}
private IEnumerator RollForNewTimer()
{
yield return (object)new WaitUntil((Func<bool>)(() => StartOfRound.Instance.shipHasLanded));
int num = Random.Range(minRealSeconds, maxRealSeconds);
int num2 = (int)((float)num / countdownInterval);
int intervalAmount = num2 / 60;
int num3 = Mathf.Clamp(TimeOfDay.Instance.daysUntilDeadline, 1, 3) + 1;
int num4 = base.scrapValue * num3 + (maxRealSeconds - num) / 2;
if (RarityManager.CurrentlyGoldFever())
{
num4 *= 2;
}
SendNewTimerClientRpc(num2, intervalAmount, num3, num4);
}
[ClientRpc]
private void SendNewTimerClientRpc(int startingSeconds, int intervalAmount, int specialMultiplier, int startingValue)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00f5: 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.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(724639717u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, startingSeconds);
BytePacker.WriteValueBitPacked(val2, intervalAmount);
BytePacker.WriteValueBitPacked(val2, specialMultiplier);
BytePacker.WriteValueBitPacked(val2, startingValue);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 724639717u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
thisClocksStartingSeconds = startingSeconds;
thisClocksIntervalAmount = intervalAmount;
thisClocksSpecialMultiplier = specialMultiplier;
thisClocksStartingValue = startingValue;
shouldCountDown = true;
minuteHand.Rotate(-20f * (float)(thisClocksIntervalAmount % 18), 0f, 0f, (Space)1);
SetTimerRotationAndValue(thisClocksStartingSeconds, isMinute: false, thisClocksStartingValue);
Logger.LogDebug((object)$"{((Object)((Component)this).gameObject).name} #{((NetworkBehaviour)this).NetworkObjectId}:");
Logger.LogDebug((object)$"{thisClocksStartingSeconds}");
Logger.LogDebug((object)$"{thisClocksIntervalAmount}");
Logger.LogDebug((object)$"{thisClocksSpecialMultiplier}");
Logger.LogDebug((object)$"{thisClocksStartingValue}");
}
}
}
private void SetTimerRotationAndValue(int seconds, bool isMinute = false, int newScrapValue = -1)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
secondsLeft = seconds;
if (isMinute)
{
secondHand.localRotation = new Quaternion(0f, 0f, 0f, 0f);
}
else
{
secondHand.Rotate(-6f * (float)(seconds % 60), 0f, 0f, (Space)1);
}
if (newScrapValue != -1)
{
((GrabbableObject)this).SetScrapValue(newScrapValue);
}
}
[ClientRpc]
private void SyncTimeAndValueClientRpc(int hostSecondsLeft, int newScrapValue, bool isMinute)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: 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.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(173399023u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, hostSecondsLeft);
BytePacker.WriteValueBitPacked(val2, newScrapValue);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref isMinute, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 173399023u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
minuteHand.Rotate(20f, 0f, 0f, (Space)1);
tickAudio.PlayOneShot(intervalClip);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 5f, 0.5f, 0, false, 0);
WalkieTalkie.TransmitOneShotAudio(tickAudio, intervalClip, 1f);
SetTimerRotationAndValue(hostSecondsLeft, isMinute, newScrapValue);
}
}
}
[ServerRpc(RequireOwnership = false)]
private void SyncSuccessServerRpc()
{
//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_00c1: 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(1373350663u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1373350663u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
SyncSuccessClientRpc(secondsLeft < 60);
}
}
}
[ClientRpc]
private void SyncSuccessClientRpc(bool inFinalPhase)
{
//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_00dc: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2850989775u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref inFinalPhase, default(ForPrimitives));
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2850989775u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
shouldCountDown = false;
tickAudio.PlayOneShot(intervalClip);
WalkieTalkie.TransmitOneShotAudio(tickAudio, intervalClip, 1f);
if (inFinalPhase)
{
closeCallAudio.Stop();
closeCallAudio.PlayOneShot(closeCallSuccess);
WalkieTalkie.TransmitOneShotAudio(closeCallAudio, closeCallSuccess, 1f);
}
}
}
[ClientRpc]
private void SyncFailureClientRpc(int failedScrapValue)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3360715093u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, failedScrapValue);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3360715093u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
shouldCountDown = false;
secondsLeft = 0;
tickAudio.PlayOneShot(failClip);
WalkieTalkie.TransmitOneShotAudio(tickAudio, failClip, 1f);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 15f, 1f, 0, false, 0);
((GrabbableObject)this).SetScrapValue(failedScrapValue);
secondHand.localRotation = new Quaternion(0f, 0f, 0f, 0f);
minuteHand.localRotation = new Quaternion(0f, 0f, 0f, 0f);
if (approachedShipFinalPhase)
{
closeCallAudio.Stop();
closeCallAudio.PlayOneShot(closeCallFail);
WalkieTalkie.TransmitOneShotAudio(closeCallAudio, closeCallFail, 1f);
}
}
}
[ClientRpc]
private void SyncApproachClientRpc()
{
//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_00c1: 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.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2869504692u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2869504692u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
approachedShipFinalPhase = true;
closeCallAudio.PlayOneShot(closeCallApproach);
WalkieTalkie.TransmitOneShotAudio(closeCallAudio, closeCallApproach, 1f);
}
}
}
private void TickTock()
{
tickOrTock = !tickOrTock;
AudioClip val = (tickOrTock ? tickSFX : tockSFX);
tickAudio.PlayOneShot(val);
WalkieTalkie.TransmitOneShotAudio(tickAudio, val, 0.33f);
timeOfLastTickTock = Time.realtimeSinceStartup;
}
[ServerRpc(RequireOwnership = false)]
public void SyncUponJoinServerRpc(int playerID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: 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(118909299u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerID);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 118909299u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
SyncUponJoinClientRpc(shouldCountDown, secondsLeft, playerID);
}
}
}
[ClientRpc]
private void SyncUponJoinClientRpc(bool hostBroughtToShip, int hostSecondsLeft, int playerID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00cb: 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_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3919497654u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hostBroughtToShip, default(ForPrimitives));
BytePacker.WriteValueBitPacked(val2, hostSecondsLeft);
BytePacker.WriteValueBitPacked(val2, playerID);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3919497654u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
if (playerID == (int)StartOfRound.Instance.localPlayerController.playerClientId)
{
shouldCountDown = hostBroughtToShip;
SetTimerRotationAndValue(hostSecondsLeft);
}
}
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Expected O, but got Unknown
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Expected O, but got Unknown
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(724639717u, new RpcReceiveHandler(__rpc_handler_724639717), "SendNewTimerClientRpc");
((NetworkBehaviour)this).__registerRpc(173399023u, new RpcReceiveHandler(__rpc_handler_173399023), "SyncTimeAndValueClientRpc");
((NetworkBehaviour)this).__registerRpc(1373350663u, new RpcReceiveHandler(__rpc_handler_1373350663), "SyncSuccessServerRpc");
((NetworkBehaviour)this).__registerRpc(2850989775u, new RpcReceiveHandler(__rpc_handler_2850989775), "SyncSuccessClientRpc");
((NetworkBehaviour)this).__registerRpc(3360715093u, new RpcReceiveHandler(__rpc_handler_3360715093), "SyncFailureClientRpc");
((NetworkBehaviour)this).__registerRpc(2869504692u, new RpcReceiveHandler(__rpc_handler_2869504692), "SyncApproachClientRpc");
((NetworkBehaviour)this).__registerRpc(118909299u, new RpcReceiveHandler(__rpc_handler_118909299), "SyncUponJoinServerRpc");
((NetworkBehaviour)this).__registerRpc(3919497654u, new RpcReceiveHandler(__rpc_handler_3919497654), "SyncUponJoinClientRpc");
((GrabbableObject)this).__initializeRpcs();
}
private static void __rpc_handler_724639717(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int startingSeconds = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref startingSeconds);
int intervalAmount = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref intervalAmount);
int specialMultiplier = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref specialMultiplier);
int startingValue = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref startingValue);
target.__rpc_exec_stage = (__RpcExecStage)1;
((GoldenClockScript)(object)target).SendNewTimerClientRpc(startingSeconds, intervalAmount, specialMultiplier, startingValue);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_173399023(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: 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)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int hostSecondsLeft = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref hostSecondsLeft);
int newScrapValue = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref newScrapValue);
bool isMinute = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isMinute, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((GoldenClockScript)(object)target).SyncTimeAndValueClientRpc(hostSecondsLeft, newScrapValue, isMinute);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_1373350663(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;
((GoldenClockScript)(object)target).SyncSuccessServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2850989775(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_005e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool inFinalPhase = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref inFinalPhase, default(ForPrimitives));
target.__rpc_exec_stage = (__RpcExecStage)1;
((GoldenClockScript)(object)target).SyncSuccessClientRpc(inFinalPhase);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3360715093(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int failedScrapValue = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref failedScrapValue);
target.__rpc_exec_stage = (__RpcExecStage)1;
((GoldenClockScript)(object)target).SyncFailureClientRpc(failedScrapValue);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2869504692(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;
((GoldenClockScript)(object)target).SyncApproachClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_118909299(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int playerID = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
target.__rpc_exec_stage = (__RpcExecStage)1;
((GoldenClockScript)(object)target).SyncUponJoinServerRpc(playerID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3919497654(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool hostBroughtToShip = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref hostBroughtToShip, default(ForPrimitives));
int hostSecondsLeft = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref hostSecondsLeft);
int playerID = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
target.__rpc_exec_stage = (__RpcExecStage)1;
((GoldenClockScript)(object)target).SyncUponJoinClientRpc(hostBroughtToShip, hostSecondsLeft, playerID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "GoldenClockScript";
}
}
public class GoldenGirlScript : GrabbableObject, IGoldenGlassSecret
{
private static ManualLogSource Logger = GoldScrapPlugin.Logger;
private Mesh loadedMesh;
private bool broughtToShip;
private bool choseLocalPlayer;
[Space(3f)]
[Header("(In)visibility")]
public MeshFilter meshToToggle;
public MeshRenderer materialToToggle;
public AudioSource audioToMute;
[Space(3f)]
[Header("Audiovisual feedback")]
public AudioSource reappearSource;
public AudioClip reappearClip;
public Material appearMat;
public Material invisibleMat;
public override void Start()
{
((GrabbableObject)this).Start();
loadedMesh = ((Component)this).GetComponent<MeshFilter>().mesh;
if (((NetworkBehaviour)this).IsServer)
{
if (base.isInShipRoom)
{
broughtToShip = true;
}
else
{
((MonoBehaviour)this).StartCoroutine(ChoosePlayer());
}
}
}
private IEnumerator ChoosePlayer()
{
yield return (object)new WaitForSeconds(1f);
if (base.isInFactory && !base.isInShipRoom)
{
ChoosePlayerClientRpc((int)GoldScrapGeneral.GetRandomPlayer().playerClientId);
}
}
[ClientRpc]
private void ChoosePlayerClientRpc(int playerClientId)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2685509517u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerClientId);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2685509517u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
Logger.LogDebug((object)$"#{((NetworkBehaviour)this).NetworkObjectId}: [{playerClientId}]");
if ((Object)(object)StartOfRound.Instance.allPlayerScripts[playerClientId] == (Object)(object)StartOfRound.Instance.localPlayerController)
{
choseLocalPlayer = true;
}
else
{
ToggleGirl(enableGirl: false);
}
}
}
public override void OnHitGround()
{
((GrabbableObject)this).OnHitGround();
if (!broughtToShip && !choseLocalPlayer)
{
ToggleGirl(enableGirl: false);
}
}
public override void OnBroughtToShip()
{
((GrabbableObject)this).OnBroughtToShip();
if (((NetworkBehaviour)this).IsOwner && !broughtToShip)
{
ReappearForEveryoneServerRpc();
}
}
private void ToggleGirl(bool enableGirl)
{
//IL_0038: 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)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
meshToToggle.mesh = (enableGirl ? loadedMesh : null);
audioToMute.volume = (enableGirl ? 1 : 0);
Collider[] propColliders = base.propColliders;
for (int i = 0; i < propColliders.Length; i++)
{
((Collider)(BoxCollider)propColliders[i]).enabled = enableGirl;
}
if (enableGirl)
{
if (!StartOfRound.Instance.inShipPhase)
{
reappearSource.PlayOneShot(reappearClip);
Object.Instantiate<GameObject>(GoldScrapAssetsCollection.poofParticle, ((Component)this).transform.position, new Quaternion(0f, 0f, 0f, 0f)).GetComponent<ParticleSystem>().Play();
}
((Renderer)materialToToggle).material = appearMat;
GoldScrapGeneral.InstantiateSparklesOnTransform(((Component)this).transform);
}
else
{
if ((Object)(object)base.radarIcon != (Object)null)
{
Object.Destroy((Object)(object)((Component)base.radarIcon).gameObject);
}
GoldScrapGeneral.DestroySparklesOnTransform(((Component)this).transform);
}
}
[ServerRpc(RequireOwnership = false)]
private void ReappearForEveryoneServerRpc()
{
//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_00c1: 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(247589533u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 247589533u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
ReappearForEveryoneClientRpc();
}
}
}
[ClientRpc]
private void ReappearForEveryoneClientRpc()
{
//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_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(958526731u, val, (RpcDelivery)0);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 958526731u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
broughtToShip = true;
if (!choseLocalPlayer)
{
ToggleGirl(enableGirl: true);
}
}
}
[ServerRpc(RequireOwnership = false)]
public void SyncUponJoinServerRpc(int playerID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: 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(2777299986u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerID);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2777299986u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
SyncUponJoinClientRpc(broughtToShip, playerID);
}
}
}
[ClientRpc]
private void SyncUponJoinClientRpc(bool onShip, int playerID)
{
//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_00e9: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4022450178u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref onShip, default(ForPrimitives));
BytePacker.WriteValueBitPacked(val2, playerID);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4022450178u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
if (playerID == (int)StartOfRound.Instance.localPlayerController.playerClientId)
{
broughtToShip = onShip;
}
}
}
void IGoldenGlassSecret.BeginReveal()
{
if (!GoldScrapConfigs.hostToolRebalance && !broughtToShip && !choseLocalPlayer)
{
meshToToggle.mesh = loadedMesh;
((Renderer)materialToToggle).material = invisibleMat;
}
}
void IGoldenGlassSecret.EndReveal()
{
if (!broughtToShip && !choseLocalPlayer)
{
meshToToggle.mesh = null;
((Renderer)materialToToggle).material = appearMat;
}
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Expected O, but got Unknown
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Expected O, but got Unknown
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(2685509517u, new RpcReceiveHandler(__rpc_handler_2685509517), "ChoosePlayerClientRpc");
((NetworkBehaviour)this).__registerRpc(247589533u, new RpcReceiveHandler(__rpc_handler_247589533), "ReappearForEveryoneServerRpc");
((NetworkBehaviour)this).__registerRpc(958526731u, new RpcReceiveHandler(__rpc_handler_958526731), "ReappearForEveryoneClientRpc");
((NetworkBehaviour)this).__registerRpc(2777299986u, new RpcReceiveHandler(__rpc_handler_2777299986), "SyncUponJoinServerRpc");
((NetworkBehaviour)this).__registerRpc(4022450178u, new RpcReceiveHandler(__rpc_handler_4022450178), "SyncUponJoinClientRpc");
((GrabbableObject)this).__initializeRpcs();
}
private static void __rpc_handler_2685509517(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int playerClientId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId);
target.__rpc_exec_stage = (__RpcExecStage)1;
((GoldenGirlScript)(object)target).ChoosePlayerClientRpc(playerClientId);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_247589533(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;
((GoldenGirlScript)(object)target).ReappearForEveryoneServerRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_958526731(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;
((GoldenGirlScript)(object)target).ReappearForEveryoneClientRpc();
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_2777299986(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int playerID = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
target.__rpc_exec_stage = (__RpcExecStage)1;
((GoldenGirlScript)(object)target).SyncUponJoinServerRpc(playerID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4022450178(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 onShip = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref onShip, default(ForPrimitives));
int playerID = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerID);
target.__rpc_exec_stage = (__RpcExecStage)1;
((GoldenGirlScript)(object)target).SyncUponJoinClientRpc(onShip, playerID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "GoldenGirlScript";
}
}
public class GoldenGlassScript : GrabbableObject
{
private static ManualLogSource Logger = GoldScrapPlugin.Logger;
private Coroutine beginRevealCoroutine;
private Coroutine endRevealCoroutine;
[Space(3f)]
[Header("Audiovisual")]
public AudioSource audio2D;
public AudioClip beginRevealClip;
public AudioClip endRevealClip;
public string inspectingTooltip;
[Tooltip("The fewer reveals per frame, the better performance, but the slower things will appear/disappear on-screen when using the Glass.")]
public int revealPerFrame;
public override void InspectItem()
{
((GrabbableObject)this).InspectItem();
if (base.playerHeldBy.IsInspectingItem)
{
StartAndStopCoroutine(beginReveal: true);
}
else
{
StartAndStopCoroutine(beginReveal: false);
}
}
public override void PocketItem()
{
if ((Object)(object)base.playerHeldBy != (Object)null && (Object)(object)base.playerHeldBy == (Object)(object)GameNetworkManager.Instance.localPlayerController)
{
StartAndStopCoroutine(beginReveal: false, base.playerHeldBy.IsInspectingItem);
}
((GrabbableObject)this).PocketItem();
}
public override void DiscardItem()
{
StartAndStopCoroutine(beginReveal: false, base.playerHeldBy.IsInspectingItem);
((GrabbableObject)this).DiscardItem();
}
private void StartAndStopCoroutine(bool beginReveal, bool playClip = true)
{
if (beginReveal)
{
if (endRevealCoroutine != null)
{
Logger.LogDebug((object)"!!!STOPPING END REVEAL COROUTINE!!!");
((MonoBehaviour)this).StopCoroutine(endRevealCoroutine);
endRevealCoroutine = null;
}
beginRevealCoroutine = ((MonoBehaviour)this).StartCoroutine(BeginRevealLocal(playClip));
}
else
{
if (beginRevealCoroutine != null)
{
Logger.LogDebug((object)"!!!STOPPING BEGIN REVEAL COROUTINE!!!");
((MonoBehaviour)this).StopCoroutine(beginRevealCoroutine);
beginRevealCoroutine = null;
}
endRevealCoroutine = ((MonoBehaviour)this).StartCoroutine(EndRevealLocal(playClip));
}
}
private IEnumerator BeginRevealLocal(bool playClip = true)
{
if (!playClip)
{
yield break;
}
audio2D.Stop();
audio2D.PlayOneShot(beginRevealClip);
UpdateControlTipManually();
int num = 0;
GoldScrapObject[] array = Object.FindObjectsByType<GoldScrapObject>((FindObjectsSortMode)0);
GoldScrapObject[] array2 = array;
foreach (GoldScrapObject goldScrapObject in array2)
{
if (RarityManager.CurrentlyGoldFever() && (Object)(object)goldScrapObject.item != (Object)null)
{
SetAllItemsScanNodes(goldScrapObject.item, setTo: true);
}
IGoldenGlassSecret component = ((Component)goldScrapObject).GetComponent<IGoldenGlassSecret>();
if (component != null)
{
Logger.LogDebug((object)("BEGIN revealing " + ((Object)((Component)goldScrapObject).gameObject).name));
component.BeginReveal();
num++;
if (num >= revealPerFrame)
{
yield return null;
num = 0;
}
}
}
beginRevealCoroutine = null;
}
private IEnumerator EndRevealLocal(bool playClip = true)
{
if (!playClip)
{
yield break;
}
audio2D.Stop();
audio2D.PlayOneShot(endRevealClip);
UpdateControlTipManually(addTooltip: false);
int num = 0;
GoldScrapObject[] array = Object.FindObjectsByType<GoldScrapObject>((FindObjectsSortMode)0);
GoldScrapObject[] array2 = array;
foreach (GoldScrapObject goldScrapObject in array2)
{
if ((StartOfRound.Instance.inShipPhase || RarityManager.CurrentlyGoldFever()) && (Object)(object)goldScrapObject.item != (Object)null)
{
SetAllItemsScanNodes(goldScrapObject.item, setTo: false);
}
IGoldenGlassSecret component = ((Component)goldScrapObject).GetComponent<IGoldenGlassSecret>();
if (component != null)
{
Logger.LogDebug((object)("STOP revealing " + ((Object)((Component)goldScrapObject).gameObject).name));
component.EndReveal();
num++;
if (num >= revealPerFrame)
{
yield return null;
num = 0;
}
}
}
endRevealCoroutine = null;
}
private void SetAllItemsScanNodes(GrabbableObject item, bool setTo)
{
if ((Object)(object)item == (Object)null)
{
return;
}
ScanNodeProperties componentInChildren = ((Component)item).gameObject.GetComponentInChildren<ScanNodeProperties>();
if ((Object)(object)componentInChildren != (Object)null)
{
if (setTo && !item.isInShipRoom)
{
componentInChildren.maxRange = (GoldScrapConfigs.hostToolRebalance ? 128 : 256);
componentInChildren.requiresLineOfSight = false;
}
else if (!setTo)
{
componentInChildren.maxRange = 13;
componentInChildren.requiresLineOfSight = true;
}
}
}
private void UpdateControlTipManually(bool addTooltip = true)
{
for (int i = 0; i < HUDManager.Instance.controlTipLines.Length; i++)
{
string text = ((TMP_Text)HUDManager.Instance.controlTipLines[i]).text;
if (addTooltip && string.IsNullOrEmpty(text))
{
Logger.LogDebug((object)$"Found line '{text}' at [{i}] with bool {addTooltip}");
((TMP_Text)HUDManager.Instance.controlTipLines[i]).text = inspectingTooltip;
return;
}
if (!addTooltip && text == inspectingTooltip)
{
Logger.LogDebug((object)$"Found line '{text}' at [{i}] with bool {addTooltip}");
((TMP_Text)HUDManager.Instance.controlTipLines[i]).text = "";
return;
}
}
Logger.LogWarning((object)$"UpdateControlTipManually({addTooltip}) did not find tooltip correctly");
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
((GrabbableObject)this).__initializeRpcs();
}
protected internal override string __getTypeName()
{
return "GoldenGlassScript";
}
}
public class GoldenGuardianScript : GrabbableObject
{
[HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")]
public class NewPlayerDamage
{
[HarmonyPrefix]
public static bool PreventDamage(PlayerControllerB __instance)
{
return PatchToPreventDamage(__instance, isKillCommand: false);
}
}
[HarmonyPatch(typeof(PlayerControllerB), "KillPlayer")]
public class NewPlayerKill
{
[HarmonyPrefix]
public static bool PreventKill(PlayerControllerB __instance)
{
return PatchToPreventDamage(__instance, isKillCommand: true);
}
}
private static ManualLogSource Logger = GoldScrapPlugin.Logger;
private bool aboutToExplode;
private Coroutine explosionCoroutine;
[Space(3f)]
[Header("Audiovisual")]
public AudioSource audioSource;
public AudioClip buildUpClip;
public AudioClip explodeClip;
public GameObject stunGrenadeExplosion;
public override void Update()
{
((GrabbableObject)this).Update();
if (((NetworkBehaviour)this).IsOwner && !((Object)(object)base.playerHeldBy == (Object)null) && (Object)(object)base.playerHeldBy.inAnimationWithEnemy != (Object)null && !aboutToExplode)
{
LocalPlayerStartExplosion(delay: true);
}
}
public void LocalPlayerStartExplosion(bool delay = false, bool fromKillCommand = false)
{
float delayTime = 1.75f;
if (GoldScrapConfigs.hostToolRebalance)
{
delayTime = 1.3f;
delay = true;
}
if (fromKillCommand)
{
delay = false;
}
StartExplosion(delay, delayTime);
StartExplosionServerRpc(delay, delayTime, (int)GameNetworkManager.Instance.localPlayerController.playerClientId);
}
private void StartExplosion(bool delay, float delayTime)
{
Logger.LogDebug((object)$"{((Object)this).name} #{((NetworkBehaviour)this).NetworkObjectId} called StartExplosion with delay {delay} and delayTime {delayTime}");
aboutToExplode = true;
if (delay)
{
explosionCoroutine = ((MonoBehaviour)this).StartCoroutine(ExplodeOnDelay(delayTime));
return;
}
if (explosionCoroutine != null)
{
Logger.LogDebug((object)"interrupting coroutine to explode immediately!");
((MonoBehaviour)this).StopCoroutine(explosionCoroutine);
}
Explode();
}
private IEnumerator ExplodeOnDelay(float delayTime = 1.75f)
{
yield return (object)new WaitForSeconds(0.1f);
audioSource.PlayOneShot(buildUpClip);
WalkieTalkie.TransmitOneShotAudio(audioSource, buildUpClip, 0.5f);
yield return (object)new WaitForSeconds(delayTime);
Explode();
}
public void Explode()
{
//IL_00e6: 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)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
if (!base.deactivated)
{
audioSource.Stop();
((GrabbableObject)this).DestroyObjectInHand(base.playerHeldBy);
if (!GoldScrapConfigs.hostToolRebalance)
{
audioSource.PlayOneShot(explodeClip);
WalkieTalkie.TransmitOneShotAudio(audioSource, explodeClip, 1f);
RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 25f, 0.3f, 0, false, 0);
StunGrenadeItem.StunExplosion(((Component)this).transform.position, true, 0.2f, 10f, 1f, false, (PlayerControllerB)null, (PlayerControllerB)null, 0f);
Transform val = (base.isInElevator ? StartOfRound.Instance.elevatorTransform : RoundManager.Instance.mapPropsContainer.transform);
Object.Instantiate<GameObject>(stunGrenadeExplosion, ((Component)this).transform.position, Quaternion.identity, val);
}
else
{
Landmine.SpawnExplosion(((Component)this).transform.position, true, 4f, 8f, 25, 5f, (GameObject)null, false);
}
((MonoBehaviour)this).StartCoroutine(DelaySettingObjectAway());
}
}
private IEnumerator DelaySettingObjectAway()
{
yield return (object)new WaitForSeconds(5f);
base.targetFloorPosition = new Vector3(3000f, -400f, 3000f);
base.startFallingPosition = new Vector3(3000f, -400f, 3000f);
}
public override void PlayDropSFX()
{
if (!base.deactivated)
{
((GrabbableObject)this).PlayDropSFX();
}
}
[ServerRpc(RequireOwnership = false)]
private void StartExplosionServerRpc(bool delay, float delayTime, int heldPlayerID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: 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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: 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(619446056u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref delay, default(ForPrimitives));
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref delayTime, default(ForPrimitives));
BytePacker.WriteValueBitPacked(val2, heldPlayerID);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 619446056u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
StartExplosionClientRpc(delay, delayTime, heldPlayerID);
}
}
}
[ClientRpc]
private void StartExplosionClientRpc(bool delay, float delayTime, int heldPlayerID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d9: 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_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4234394122u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref delay, default(ForPrimitives));
((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref delayTime, default(ForPrimitives));
BytePacker.WriteValueBitPacked(val2, heldPlayerID);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4234394122u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
if (heldPlayerID != (int)GameNetworkManager.Instance.localPlayerController.playerClientId)
{
Logger.LogDebug((object)$"non-owner client starting GoldenGuardian #{((NetworkBehaviour)this).NetworkObjectId} explosion");
StartExplosion(delay, delayTime);
}
}
}
public static bool PatchToPreventDamage(PlayerControllerB __instance, bool isKillCommand)
{
if (!((NetworkBehaviour)__instance).IsOwner || __instance.isPlayerDead || !__instance.AllowPlayerDeath() || (Object)(object)__instance.currentlyHeldObjectServer == (Object)null)
{
return true;
}
GoldenGuardianScript component = ((Component)__instance.currentlyHeldObjectServer).GetComponent<GoldenGuardianScript>();
if ((Object)(object)component != (Object)null && !((GrabbableObject)component).deactivated && (isKillCommand || !component.aboutToExplode))
{
Logger.LogDebug((object)$"GoldenGuardianScript patch: local player likely holding GoldenGuardian on server, trying to execute explosion | isKillCommand = {isKillCommand}");
bool delay = !isKillCommand && GoldScrapConfigs.hostToolRebalance;
component.LocalPlayerStartExplosion(delay, isKillCommand);
return false;
}
return true;
}
protected override void __initializeVariables()
{
((GrabbableObject)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(619446056u, new RpcReceiveHandler(__rpc_handler_619446056), "StartExplosionServerRpc");
((NetworkBehaviour)this).__registerRpc(4234394122u, new RpcReceiveHandler(__rpc_handler_4234394122), "StartExplosionClientRpc");
((GrabbableObject)this).__initializeRpcs();
}
private static void __rpc_handler_619446056(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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool delay = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref delay, default(ForPrimitives));
float delayTime = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref delayTime, default(ForPrimitives));
int heldPlayerID = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref heldPlayerID);
target.__rpc_exec_stage = (__RpcExecStage)1;
((GoldenGuardianScript)(object)target).StartExplosionServerRpc(delay, delayTime, heldPlayerID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_4234394122(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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
bool delay = default(bool);
((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref delay, default(ForPrimitives));
float delayTime = default(float);
((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref delayTime, default(ForPrimitives));
int heldPlayerID = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref heldPlayerID);
target.__rpc_exec_stage = (__RpcExecStage)1;
((GoldenGuardianScript)(object)target).StartExplosionClientRpc(delay, delayTime, heldPlayerID);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
protected internal override string __getTypeName()
{
return "GoldenGuardianScript";
}
}
public class GoldkeeperScript : GrabbableObject, IGoldenGlassSecret
{
private static ManualLogSource Logger = GoldScrapPlugin.Logger;
[Space(3f)]
[Header("Blockers")]
public Collider losBlocker;
public NavMeshObstacle navBlocker;
private Coroutine checkDistanceCoroutine;
public MeshRenderer blockerRenderer;
public override void Start()
{
((GrabbableObject)this).Start();
navBlocker.carveOnlyStationary = true;
((Renderer)blockerRenderer).enabled = false;
}
public override void EquipItem()
{
((GrabbableObject)this).EquipItem();
if (checkDistanceCoroutine != null)
{
Logger.LogDebug((object)"stopped CheckDistance Coroutine");
((MonoBehaviour)this).StopCoroutine(checkDistanceCoroutine);
checkDistanceCoroutine = null;
}
losBlocker.enabled = false;
navBlocker.carving = false;
((Behaviour)navBlocker).enabled = false;
LogEnabled();
}
public override void PlayDropSFX()
{
((GrabbableObject)this).PlayDropSFX();
if (checkDistanceCoroutine != null)
{
Logger.LogDebug((object)"stopped CheckDistance Coroutine");
((MonoBehaviour)this).StopCoroutine(checkDistanceCoroutine);
checkDistanceCoroutine = null;
}
checkDistanceCoroutine = ((MonoBehaviour)this).StartCoroutine(CheckDistance());
}
private IEnumerator CheckDistance()
{
bool playerInRange = true;
bool setTo = true;
PlayerControllerB player = StartOfRound.Instance.localPlayerController;
while (playerInRange)
{
yield return (object)new WaitForSeconds(0.1f);
if ((Object)(object)((Component)this).GetComponentInParent<VehicleController>() != (Object)null || (Object)(object)((Component)this).GetComponentInParent<MineshaftElevatorController>() != (Object)null)
{
setTo = false;
Logger.LogDebug((object)$"WARNING!!! {((Object)((Component)this).gameObject).name} #{((NetworkBehaviour)this).NetworkObjectId} dropped inside vehicle or elevator! breaking and setting collision enabled to {setTo}");
break;
}
if ((Object)(object)player == (Object)null || !player.isPlayerControlled)
{
playerInRange = false;
}
if (Vector3.Distance(((Component)this).transform.position - Vector3.back * 0.15f, ((Component)player).transform.position) >= 0.65f)
{
playerInRange = false;
}
}
checkDistanceCoroutine = null;
losBlocker.enabled = setTo;
navBlocker.carving = setTo;
((Behaviour)navBlocker).enabled = setTo;
LogEnabled();
}
private void LogEnabled()
{
Logger.LogDebug((object)$"{((Object)((Component)this).gameObject).name} #{((NetworkBehaviour)this).NetworkObjectId}: {((Object)((Component)losBlocker).gameObject).name} enabled = {losBlocker.enabled}");
}
[ServerRpc(RequireOwnership = false)]
public void SyncUponJoinServerRpc(int playerID)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Invalid comparison between Unknown and I4
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: 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(688314264u, val, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val2, playerID);
((NetworkBehaviour)this).__endSendServerRpc(ref val2, 688314264u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
{
((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
SyncUponJoinClientRpc((Object)(object)base.playerHeldBy == (Object)null, playerID);
}
}
}
[ClientRpc]
private void SyncUponJoinClientRpc(bool hostNullHeld, int playerID)
{
//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_00e9: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost))
{
ClientRpcParams val = default(ClientRpcParams);
FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4258008049u, val, (RpcDelivery)0);
((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref hostNullHeld, default(ForPrimitives));
BytePacker.WriteValueBitPacked(val2, playerID);
((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4258008049u, val, (RpcDelivery)0);
}
if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (