Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of FullClearTimer v1.1.0
Tomatobird.FullClearTimer.dll
Decompiled a month agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LC_FullClearTimer.MonoBehaviours; using LC_FullClearTimer.Network; using Microsoft.CodeAnalysis; using TMPro; using Tomatobird.FullClearTimer.NetcodePatcher; using Unity.Netcode; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Tomatobird.FullClearTimer")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0+84e9a8a4f275b04dc48b8ae8c36c5a581ad1487a")] [assembly: AssemblyProduct("LC_FullClearTimer")] [assembly: AssemblyTitle("Tomatobird.FullClearTimer")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LC_FullClearTimer { [BepInPlugin("Tomatobird.FullClearTimer", "LC_FullClearTimer", "1.1.0")] public class LC_FullClearTimer : BaseUnityPlugin { internal static HUDTimer? onScreenTimer; internal static bool timerOn = true; internal static ConfigEntry<float> timerChance = null; internal static ConfigEntry<int> timerItemLimit = null; internal static ConfigEntry<bool> itemCounter = null; internal static ConfigEntry<bool> soundOnCompletion = null; internal static ConfigEntry<bool> countEverything = null; internal static ConfigEntry<bool> rewards = null; internal static ConfigEntry<bool> rewards_scaleByScrapCount = null; internal static ConfigEntry<bool> rewards_scaleByCompletionTime = null; internal static ConfigEntry<bool> rewards_scaleByPlayerCount = null; internal static ConfigEntry<float> rewards_scrapScale = null; internal static ConfigEntry<float> rewards_maxMultiplier = null; internal static ConfigEntry<int> rewards_credits = null; internal static ConfigEntry<float> rewards_shipScrapValueMultiplier = null; internal static ConfigEntry<int> rewards_shipScrapValuesToModify = null; internal static ConfigEntry<int> rewards_giftBoxes = null; public static LC_FullClearTimer Instance { get; private set; } = null; internal static ManualLogSource Logger { get; private set; } = null; internal static Harmony? Harmony { get; set; } private void Awake() { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; Instance = this; timerChance = ((BaseUnityPlugin)this).Config.Bind<float>("General", "TimerChance", 1f, new ConfigDescription("Chance for ", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); timerItemLimit = ((BaseUnityPlugin)this).Config.Bind<int>("General", "TimerItemLimit", 0, "If the moon average scrap count is equal or higher than this value, the timer won't appear. Set to 0 to disable."); itemCounter = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ItemCounter", true, "Adds a counter for how many uncollected items are left."); soundOnCompletion = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "SoundOnCompletion", true, "Should a sound effect play once all items are collected and timer is stopped?"); countEverything = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "CountEverything", false, "Should bodies and deactivated items like blown up eggs and opened giftboxes outside of ship count towards missing objects count?"); rewards = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Rewards", true, "Should rewards be given out for full clearing?"); rewards_scaleByScrapCount = ((BaseUnityPlugin)this).Config.Bind<bool>("Rewards", "ScaleByScrapCount", true, "Should the rewards be multiplied by the moon average scrap count? Calculation used is moon scrap count average divided by the scrap scale configuration value."); rewards_scaleByCompletionTime = ((BaseUnityPlugin)this).Config.Bind<bool>("Rewards", "ScaleByCompletionTime", true, "Should the rewards be multiplied by the completion time? Calculation used is 1 divided by normalized day time."); rewards_scaleByPlayerCount = ((BaseUnityPlugin)this).Config.Bind<bool>("Rewards", "ScaleByPlayerCount", false, "Should the rewards be scaled by the amount of players in the lobby?"); rewards_scrapScale = ((BaseUnityPlugin)this).Config.Bind<float>("Rewards", "DivideScrapScaleRewardsBy", 6f, "This determines how many times the rewards should be multiplied when using a reward scale type that uses the moon scrap count. The moon average scrap count divided by this value will determine the multiplier for the rewards."); rewards_maxMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Rewards", "MaxMultiplier", 10f, "This is the maximum multiplier allowed for reward multiplication. Acts as a safety in case the reward multiplication goes out of hand. Recommended values are between 1 to 100"); rewards_credits = ((BaseUnityPlugin)this).Config.Bind<int>("Rewards", "TerminalCredits", 200, "How many credits should be given for full clearing? Set to 0 to disable."); rewards_shipScrapValueMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Rewards", "ShipScrapValueMultiplier", 1f, "What should the scrap value of scrap on ship be multiplied by for full clearing? Set to 0 or 1.0 to disable."); rewards_shipScrapValuesToModify = ((BaseUnityPlugin)this).Config.Bind<int>("Rewards", "AmountOfShipScrapToModify", 0, "How many randomly selected scrap items on ship should be modified by the ShipScrapValueMultiplier? Set to 0 to select all."); rewards_giftBoxes = ((BaseUnityPlugin)this).Config.Bind<int>("Rewards", "GiftBoxes", 2, "How many gift boxes should be spawned for full clearing? Set to 0 to disable."); Patch(); Logger.LogInfo((object)"Tomatobird.FullClearTimer v1.1.0 has loaded!"); } internal static void Patch() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("Tomatobird.FullClearTimer"); } Logger.LogDebug((object)"Patching..."); Harmony.PatchAll(); Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Tomatobird.FullClearTimer"; public const string PLUGIN_NAME = "LC_FullClearTimer"; public const string PLUGIN_VERSION = "1.1.0"; } } namespace LC_FullClearTimer.Patches { [HarmonyPatch(typeof(HUDManager))] internal class AddTimer { [HarmonyPatch("Start")] [HarmonyPostfix] internal static void Start_Postfix(HUDManager __instance) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("FullClearTimer_BaseObject"); val.transform.parent = __instance.HUDContainer.transform.parent; val.transform.position = __instance.HUDContainer.transform.parent.position; val.transform.rotation = __instance.HUDContainer.transform.parent.rotation; val.transform.localScale = Vector3.one; HUDTimer onScreenTimer = val.AddComponent<HUDTimer>(); LC_FullClearTimer.onScreenTimer = onScreenTimer; } } [HarmonyPatch(typeof(QuickMenuManager))] internal class HideTimer { [HarmonyPatch("OpenQuickMenu")] [HarmonyPostfix] internal static void OpenQuickMenu_Postfix() { if ((Object)(object)LC_FullClearTimer.onScreenTimer != (Object)null) { TextMeshProUGUI val = default(TextMeshProUGUI); ((Component)((Component)LC_FullClearTimer.onScreenTimer).transform.GetChild(0)).TryGetComponent<TextMeshProUGUI>(ref val); ((TMP_Text)val).alpha = 0.1f; if (LC_FullClearTimer.itemCounter.Value) { TextMeshProUGUI val2 = default(TextMeshProUGUI); ((Component)((Component)LC_FullClearTimer.onScreenTimer).transform.GetChild(1)).TryGetComponent<TextMeshProUGUI>(ref val2); ((TMP_Text)val2).alpha = 0.1f; } } } [HarmonyPatch("CloseQuickMenu")] [HarmonyPostfix] internal static void CloseQuickMenu_Postfix() { if ((Object)(object)LC_FullClearTimer.onScreenTimer != (Object)null) { TextMeshProUGUI val = default(TextMeshProUGUI); ((Component)((Component)LC_FullClearTimer.onScreenTimer).transform.GetChild(0)).TryGetComponent<TextMeshProUGUI>(ref val); ((TMP_Text)val).alpha = 1f; if (LC_FullClearTimer.itemCounter.Value) { TextMeshProUGUI val2 = default(TextMeshProUGUI); ((Component)((Component)LC_FullClearTimer.onScreenTimer).transform.GetChild(1)).TryGetComponent<TextMeshProUGUI>(ref val2); ((TMP_Text)val2).alpha = 1f; } } } } [HarmonyPatch] internal class RewardHandler { internal static Item? giftBoxItem; public static void AddTerminalCredits(int amount) { Terminal val = Object.FindFirstObjectByType<Terminal>(); if (!((Object)(object)val == (Object)null)) { val.groupCredits += amount; val.SyncGroupCreditsClientRpc(val.groupCredits, val.numberOfItemsInDropship); } } public static void IncreaseValueOfShipScrap(float multiplier, int scrapsToMultiply) { //IL_00da: Unknown result type (might be due to invalid IL or missing references) List<NetworkObjectReference> list = new List<NetworkObjectReference>(); List<int> list2 = new List<int>(); GrabbableObject[] array = Object.FindObjectsByType<GrabbableObject>((FindObjectsSortMode)0); List<GrabbableObject> list3 = new List<GrabbableObject>(); for (int i = 0; i < array.Length; i++) { if (array[i].itemProperties.isScrap && array[i].isInShipRoom && array[i].isInElevator && !(array[i] is RagdollGrabbableObject) && !array[i].deactivated) { list3.Add(array[i]); } } if (scrapsToMultiply > 0) { if (list3.Count > scrapsToMultiply) { list3 = GetRandomElements(list3, LC_FullClearTimer.rewards_shipScrapValuesToModify.Value); } else { LC_FullClearTimer.Logger.LogInfo((object)"Selected scraps list is shorter than the amount to be modified. Full clear bonus will be lower than configured."); } } for (int j = 0; j < list3.Count; j++) { list.Add(NetworkObjectReference.op_Implicit(((NetworkBehaviour)list3[j]).NetworkObject)); list2.Add((int)((float)list3[j].scrapValue * LC_FullClearTimer.rewards_shipScrapValueMultiplier.Value)); } Net.Instance.SendItemClientRpc(list.ToArray(), list2.ToArray()); } public static void SpawnGiftBoxes(int amount) { //IL_0066: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)giftBoxItem == (Object)null) { FindGiftBox(); if ((Object)(object)giftBoxItem == (Object)null) { LC_FullClearTimer.Logger.LogError((object)"giftbox item was not found!"); return; } } List<NetworkObjectReference> list = new List<NetworkObjectReference>(); List<int> list2 = new List<int>(); for (int i = 0; i < amount; i++) { GameObject val = Object.Instantiate<GameObject>(giftBoxItem.spawnPrefab, StartOfRound.Instance.outsideShipSpawnPosition.position + Vector3.up * giftBoxItem.verticalOffset, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer); GrabbableObject component = val.GetComponent<GrabbableObject>(); ((Component)component).transform.rotation = Quaternion.Euler(component.itemProperties.restingRotation); component.fallTime = 0f; list2.Add((int)((float)Random.Range(giftBoxItem.minValue, giftBoxItem.maxValue) * RoundManager.Instance.scrapValueMultiplier)); component.scrapValue = list2[list2.Count - 1]; NetworkObject component2 = val.GetComponent<NetworkObject>(); component2.Spawn(false); val.GetComponent<GrabbableObject>().EnablePhysics(true); component.FallToGround(false, true, default(Vector3)); list.Add(NetworkObjectReference.op_Implicit(component2)); } Net.Instance.SyncScrap(list.ToArray(), list2.ToArray()); } internal static List<T> GetRandomElements<T>(List<T> list, int count) { List<T> list2 = list.ToList(); List<T> list3 = new List<T>(count); Random random = new Random(); for (int i = 0; i < count; i++) { int index = random.Next(i, list2.Count); T value = list2[i]; list2[i] = list2[index]; list2[index] = value; list3.Add(list2[i]); } return list3; } [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] internal static void FindGiftBox() { if ((Object)(object)giftBoxItem != (Object)null) { return; } LC_FullClearTimer.Logger.LogInfo((object)"Finding giftbox item..."); GiftBoxItem[] array = Resources.FindObjectsOfTypeAll<GiftBoxItem>(); for (int i = 0; i < array.Length; i++) { if (((Object)array[i]).name == "GiftBox") { giftBoxItem = ((GrabbableObject)array[i]).itemProperties; return; } } LC_FullClearTimer.Logger.LogError((object)"Giftbox item was not found. Spawning giftboxes as reward won't happen."); } } [HarmonyPatch] internal class TimerHooks { [HarmonyPatch(typeof(TimeOfDay), "SetTimeForAdToPlay")] [HarmonyPostfix] internal static void SetTimeForAdToPlay_Postfix() { //IL_006f: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer && LC_FullClearTimer.timerOn && (LC_FullClearTimer.timerItemLimit.Value <= 0 || !((float)LC_FullClearTimer.timerItemLimit.Value >= GetAverageScrapCount()))) { Random random = new Random(); if (LC_FullClearTimer.timerChance.Value > (float)random.NextDouble()) { Net.Instance.SetTimerStatusClientRpc(running: true, 0f, HUDTimer.clockColor, visible: true, playsound: false); GetItemCount(); } } } [HarmonyPatch(typeof(StartOfRound), "SetShipReadyToLand")] [HarmonyPostfix] internal static void SetShipReadyToLand_Postfix() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (NetworkManager.Singleton.IsServer) { Net.Instance.SetTimerStatusClientRpc(running: false, 0f, HUDTimer.clockColor, visible: false, playsound: false); Net.Instance.SetMissingItemsStatusClientRpc(0, visible: false); } } [HarmonyPatch(typeof(Terminal), "LoadNewNode")] [HarmonyPostfix] internal static void LoadNewNode_Postfix(Terminal __instance) { if (NetworkManager.Singleton.IsServer && (StartOfRound.Instance.shipHasLanded || StartOfRound.Instance.shipIsLeaving) && (Object)(object)LC_FullClearTimer.onScreenTimer != (Object)null && LC_FullClearTimer.onScreenTimer.running && (GetItemCount() == 0 || (LC_FullClearTimer.countEverything.Value && __instance.currentText.Contains("There are 0 objects")))) { StopTimer(); } } [HarmonyPatch(typeof(PlayerControllerB), "SetItemInElevator")] [HarmonyPostfix] internal static void SetItemInElevator_Postfix() { if (NetworkManager.Singleton.IsServer && (StartOfRound.Instance.shipHasLanded || StartOfRound.Instance.shipIsLeaving) && (Object)(object)LC_FullClearTimer.onScreenTimer != (Object)null && LC_FullClearTimer.onScreenTimer.running && GetItemCount() == 0) { StopTimer(); } } [HarmonyPatch(typeof(RoundManager), "SpawnRandomOutsideEnemy")] [HarmonyPatch(typeof(RoundManager), "SpawnRandomDaytimeEnemy")] [HarmonyPatch(typeof(RoundManager), "SpawnRandomWeedEnemy")] [HarmonyPatch(typeof(RoundManager), "SpawnEnemyFromVent")] [HarmonyPostfix] internal static void SpawnEnemies_Postfix() { if (NetworkManager.Singleton.IsServer && (Object)(object)LC_FullClearTimer.onScreenTimer != (Object)null && LC_FullClearTimer.onScreenTimer.running && GetItemCount() == 0) { StopTimer(); } } [HarmonyPatch(typeof(RoundManager), "DespawnPropsAtEndOfRound")] [HarmonyPrefix] internal static void DespawnPropsAtEndOfRound_Prefix() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)LC_FullClearTimer.onScreenTimer == (Object)null) && LC_FullClearTimer.onScreenTimer.running) { Net.Instance.SetTimerStatusClientRpc(running: false, 0f, HUDTimer.clockColor, visible: true, playsound: false); } } internal static void StopTimer() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)LC_FullClearTimer.onScreenTimer == (Object)null || !LC_FullClearTimer.onScreenTimer.running) { return; } Net.Instance.SetTimerStatusClientRpc(running: false, LC_FullClearTimer.onScreenTimer.time, Color.blue, visible: true, playsound: true); if (LC_FullClearTimer.rewards.Value) { float rewardMultiplier = GetRewardMultiplier(); if (LC_FullClearTimer.rewards_credits.Value != 0) { RewardHandler.AddTerminalCredits((int)((float)LC_FullClearTimer.rewards_credits.Value * rewardMultiplier)); } if (LC_FullClearTimer.rewards_shipScrapValueMultiplier.Value != 0f && LC_FullClearTimer.rewards_shipScrapValueMultiplier.Value != 1f) { RewardHandler.IncreaseValueOfShipScrap(LC_FullClearTimer.rewards_shipScrapValueMultiplier.Value * rewardMultiplier, LC_FullClearTimer.rewards_shipScrapValuesToModify.Value); } if (LC_FullClearTimer.rewards_giftBoxes.Value != 0) { RewardHandler.SpawnGiftBoxes((int)((float)LC_FullClearTimer.rewards_giftBoxes.Value * rewardMultiplier)); } } } internal static int GetItemCount() { GrabbableObject[] array = Object.FindObjectsByType<GrabbableObject>((FindObjectsSortMode)0); int num = 0; if (LC_FullClearTimer.countEverything.Value) { for (int i = 0; i < array.Length; i++) { if (array[i].itemProperties.isScrap && !array[i].isInShipRoom && !array[i].isInElevator) { num++; } } } else { for (int j = 0; j < array.Length; j++) { if (array[j].itemProperties.isScrap && !array[j].isInShipRoom && !array[j].isInElevator && !(array[j] is RagdollGrabbableObject) && !array[j].deactivated) { num++; } } } if ((Object)(object)LC_FullClearTimer.onScreenTimer != (Object)null && LC_FullClearTimer.onScreenTimer.itemCount != num && LC_FullClearTimer.onScreenTimer.running) { Net.Instance.SetMissingItemsStatusClientRpc(num, num != 0); } LC_FullClearTimer.Logger.LogInfo((object)$"Total item count outside of ship: {num}"); return num; } internal static float GetAverageScrapCount() { return (float)(StartOfRound.Instance.currentLevel.maxScrap + StartOfRound.Instance.currentLevel.minScrap) / 2f; } internal static float GetRewardMultiplier() { float num = 1f; if (LC_FullClearTimer.rewards_scaleByScrapCount.Value) { num = GetAverageScrapCount() / LC_FullClearTimer.rewards_scrapScale.Value; } if (LC_FullClearTimer.rewards_scaleByCompletionTime.Value) { num *= 1f / TimeOfDay.Instance.normalizedTimeOfDay; } if (LC_FullClearTimer.rewards_scaleByPlayerCount.Value) { num *= (float)(GameNetworkManager.Instance.connectedPlayers + 1); } return Mathf.Clamp(num, 1f, LC_FullClearTimer.rewards_maxMultiplier.Value); } } } namespace LC_FullClearTimer.Network { internal class Net : NetworkBehaviour { private static GameObject? prefab; public static Net Instance { get; private set; } internal static void CreateAndRegisterPrefab() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)prefab != (Object)null)) { prefab = new GameObject("Tomatobird.FullClearTimer Prefab"); GameObject? obj = prefab; ((Object)obj).hideFlags = (HideFlags)(((Object)obj).hideFlags | 0x3D); NetworkObject obj2 = prefab.AddComponent<NetworkObject>(); FieldInfo field = typeof(NetworkObject).GetField("GlobalObjectIdHash", BindingFlags.Instance | BindingFlags.NonPublic); field.SetValue(obj2, GetHash("Tomatobird.FullClearTimer Prefab")); prefab.AddComponent<Net>(); NetworkManager.Singleton.PrefabHandler.AddNetworkPrefab(prefab); LC_FullClearTimer.Logger.LogInfo((object)"Network object registered."); } } private void Awake() { Instance = this; } internal static uint GetHash(string value) { return value?.Aggregate(17u, (uint current, char c) => (current * 31) ^ c) ?? 0; } internal static void SpawnNetworkHandler() { if (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost) { GameObject obj = Object.Instantiate<GameObject>(prefab); if (obj != null) { obj.GetComponent<NetworkObject>().Spawn(false); } LC_FullClearTimer.Logger.LogInfo((object)"Network object spawned."); } } internal static void DespawnNetworkHandler() { if ((Object)(object)Instance != (Object)null && ((Component)Instance).gameObject.GetComponent<NetworkObject>().IsSpawned && (NetworkManager.Singleton.IsServer || NetworkManager.Singleton.IsHost)) { ((Component)Instance).gameObject.GetComponent<NetworkObject>().Despawn(true); LC_FullClearTimer.Logger.LogInfo((object)"Network object despawned."); } } [Rpc(/*Could not decode attribute arguments.*/)] public void SetTimerStatusClientRpc(bool running, float currentTime, Color color, bool visible, bool playsound) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2406867037u, val3, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref running, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref currentTime, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref color); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref visible, default(ForPrimitives)); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref playsound, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 2406867037u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; LC_FullClearTimer.Logger.LogDebug((object)$"SetTimerStatusClientRpc --- running: {running}, currentTime: {currentTime}, visible: {visible}"); if ((Object)(object)LC_FullClearTimer.onScreenTimer != (Object)null) { LC_FullClearTimer.onScreenTimer.SetTimerStatus(running, currentTime, color, visible); if (playsound) { HUDManager.Instance.UIAudio.PlayOneShot(HUDManager.Instance.reachedQuotaSFX); } } } [Rpc(/*Could not decode attribute arguments.*/)] public void SetMissingItemsStatusClientRpc(int count, bool visible) { //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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2990838109u, val3, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, count); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref visible, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val2, 2990838109u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; LC_FullClearTimer.Logger.LogDebug((object)$"SetMissingItemsStatusClientRpc --- count: {count}, visible: {visible}"); if ((Object)(object)LC_FullClearTimer.onScreenTimer != (Object)null && LC_FullClearTimer.itemCounter.Value) { LC_FullClearTimer.onScreenTimer.SetMissingStatus(count, visible); } } } [Rpc(/*Could not decode attribute arguments.*/)] public void SendItemClientRpc(NetworkObjectReference[] networkObjects, int[] itemValues) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(2381872917u, val3, val, (SendTo)6, (RpcDelivery)0); bool flag = networkObjects != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(networkObjects, default(ForNetworkSerializable)); } bool flag2 = itemValues != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe<int>(itemValues, default(ForPrimitives)); } ((NetworkBehaviour)this).__endSendRpc(ref val2, 2381872917u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val4 = default(NetworkObject); GrabbableObject val5 = default(GrabbableObject); for (int i = 0; i < networkObjects.Length; i++) { if (((NetworkObjectReference)(ref networkObjects[i])).TryGet(ref val4, (NetworkManager)null)) { if (((Component)val4).TryGetComponent<GrabbableObject>(ref val5)) { if (i >= itemValues.Length) { LC_FullClearTimer.Logger.LogError((object)"ItemValues list exceeded. Scrap values will be desynced."); break; } val5.SetScrapValue(itemValues[i]); } else { LC_FullClearTimer.Logger.LogError((object)"No GrabbableObject in the network object! Was there a desync?"); } } else { LC_FullClearTimer.Logger.LogError((object)"No network object from networkobjectreference! Was there a desync?"); } } } public void SyncScrap(NetworkObjectReference[] spawnedScrap, int[] allScrapValue) { ((MonoBehaviour)this).StartCoroutine(SyncScrapDelayed(spawnedScrap, allScrapValue)); } private IEnumerator SyncScrapDelayed(NetworkObjectReference[] spawnedScrap, int[] allScrapValue) { yield return (object)new WaitForSeconds(0.5f); string[] giftboxItems = SelectGiftboxItems(spawnedScrap); EditGiftBoxesClientRpc(containedItemValues: SelectItemValues(giftboxItems), spawnedScrap: spawnedScrap, containedItemsString: string.Join(',', giftboxItems)); yield return (object)new WaitForSeconds(0.5f); SyncScrapValuesClientRpc(spawnedScrap, allScrapValue); } [Rpc(/*Could not decode attribute arguments.*/)] public void SyncScrapValuesClientRpc(NetworkObjectReference[] spawnedScrap, int[] allScrapValue) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3484988418u, val3, val, (SendTo)6, (RpcDelivery)0); bool flag = spawnedScrap != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(spawnedScrap, default(ForNetworkSerializable)); } bool flag2 = allScrapValue != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe<int>(allScrapValue, default(ForPrimitives)); } ((NetworkBehaviour)this).__endSendRpc(ref val2, 3484988418u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; Random random = new Random(StartOfRound.Instance.randomMapSeed + 210); int num = 0; NetworkObject val4 = default(NetworkObject); for (int i = 0; i < spawnedScrap.Length; i++) { if (((NetworkObjectReference)(ref spawnedScrap[i])).TryGet(ref val4, (NetworkManager)null)) { GrabbableObject component = ((Component)val4).GetComponent<GrabbableObject>(); if ((Object)(object)component != (Object)null) { if (i >= allScrapValue.Length) { LC_FullClearTimer.Logger.LogError((object)$"spawnedScrap amount exceeded allScrapValue!: {spawnedScrap.Length}"); break; } component.SetScrapValue(allScrapValue[i]); num += allScrapValue[i]; try { if (component.itemProperties.meshVariants.Length != 0) { ((Component)component).gameObject.GetComponent<MeshFilter>().mesh = component.itemProperties.meshVariants[random.Next(0, component.itemProperties.meshVariants.Length)]; } if (component.itemProperties.materialVariants.Length != 0) { ((Renderer)((Component)component).gameObject.GetComponent<MeshRenderer>()).sharedMaterial = component.itemProperties.materialVariants[random.Next(0, component.itemProperties.materialVariants.Length)]; } } catch (Exception arg) { LC_FullClearTimer.Logger.LogInfo((object)$"Item name: {((Object)((Component)component).gameObject).name}; {arg}"); } } else { LC_FullClearTimer.Logger.LogError((object)("Scrap networkobject object did not contain grabbable object!: " + ((Object)((Component)val4).gameObject).name)); } } else { LC_FullClearTimer.Logger.LogError((object)$"Failed to get networkobject reference for scrap. id: {((NetworkObjectReference)(ref spawnedScrap[i])).NetworkObjectId}"); } } RoundManager instance = RoundManager.Instance; instance.totalScrapValueInLevel += (float)num; } [Rpc(/*Could not decode attribute arguments.*/)] public void EditGiftBoxesClientRpc(NetworkObjectReference[] spawnedScrap, string containedItemsString, int[] containedItemValues) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0179: 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) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0147: 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_012c: 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) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(424498560u, val3, val, (SendTo)6, (RpcDelivery)0); bool flag = spawnedScrap != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(spawnedScrap, default(ForNetworkSerializable)); } bool flag2 = containedItemsString != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag2, default(ForPrimitives)); if (flag2) { ((FastBufferWriter)(ref val2)).WriteValueSafe(containedItemsString, false); } bool flag3 = containedItemValues != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag3, default(ForPrimitives)); if (flag3) { ((FastBufferWriter)(ref val2)).WriteValueSafe<int>(containedItemValues, default(ForPrimitives)); } ((NetworkBehaviour)this).__endSendRpc(ref val2, 424498560u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; string[] containedItems = containedItemsString.Split(','); int i; NetworkObject val4 = default(NetworkObject); GiftBoxItem val5 = default(GiftBoxItem); for (i = 0; i < spawnedScrap.Length; i++) { if (((NetworkObjectReference)(ref spawnedScrap[i])).TryGet(ref val4, (NetworkManager)null) && ((Component)val4).TryGetComponent<GiftBoxItem>(ref val5) && containedItems[i] != "") { SpawnableItemWithRarity val6 = StartOfRound.Instance.currentLevel.spawnableScrap.Find((SpawnableItemWithRarity x) => x.spawnableItem.itemName.Equals(containedItems[i], StringComparison.OrdinalIgnoreCase)); if (val6 == null) { break; } val5.objectInPresentItem = val6.spawnableItem; val5.objectInPresent = val6.spawnableItem.spawnPrefab; val5.objectInPresentValue = containedItemValues[i]; } } } internal string[] SelectGiftboxItems(NetworkObjectReference[] spawnedScrap) { List<int> list = new List<int>(RoundManager.Instance.currentLevel.spawnableScrap.Count); for (int i = 0; i < RoundManager.Instance.currentLevel.spawnableScrap.Count; i++) { if (RoundManager.Instance.currentLevel.spawnableScrap[i].spawnableItem.itemId == 152767) { list.Add(0); } else { list.Add(RoundManager.Instance.currentLevel.spawnableScrap[i].rarity); } } List<string> list2 = new List<string>(); NetworkObject val = default(NetworkObject); GiftBoxItem val2 = default(GiftBoxItem); for (int j = 0; j < spawnedScrap.Length; j++) { if (((NetworkObjectReference)(ref spawnedScrap[j])).TryGet(ref val, (NetworkManager)null)) { if (((Component)val).TryGetComponent<GiftBoxItem>(ref val2)) { int randomWeightedIndexList = RoundManager.Instance.GetRandomWeightedIndexList(list, new Random(StartOfRound.Instance.randomMapSeed + j)); LC_FullClearTimer.Logger.LogInfo((object)$"randomWeightedIndexList: {randomWeightedIndexList}"); Item spawnableItem = StartOfRound.Instance.currentLevel.spawnableScrap[randomWeightedIndexList].spawnableItem; LC_FullClearTimer.Logger.LogInfo((object)(spawnableItem.itemName ?? "")); list2.Add(spawnableItem.itemName); } else { list2.Add(""); } } } return list2.ToArray(); } internal int[] SelectItemValues(string[] scrapNames) { List<int> list = new List<int>(); int i; for (i = 0; i < scrapNames.Length; i++) { if (scrapNames[i] != "") { SpawnableItemWithRarity val = StartOfRound.Instance.currentLevel.spawnableScrap.Find((SpawnableItemWithRarity x) => x.spawnableItem.itemName.Equals(scrapNames[i], StringComparison.OrdinalIgnoreCase)); list.Add((int)((float)Random.Range(val.spawnableItem.minValue, val.spawnableItem.maxValue) * RoundManager.Instance.scrapValueMultiplier)); } else { list.Add(0); } } return list.ToArray(); } protected override void __initializeVariables() { ((NetworkBehaviour)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(2406867037u, new RpcReceiveHandler(__rpc_handler_2406867037), "SetTimerStatusClientRpc"); ((NetworkBehaviour)this).__registerRpc(2990838109u, new RpcReceiveHandler(__rpc_handler_2990838109), "SetMissingItemsStatusClientRpc"); ((NetworkBehaviour)this).__registerRpc(2381872917u, new RpcReceiveHandler(__rpc_handler_2381872917), "SendItemClientRpc"); ((NetworkBehaviour)this).__registerRpc(3484988418u, new RpcReceiveHandler(__rpc_handler_3484988418), "SyncScrapValuesClientRpc"); ((NetworkBehaviour)this).__registerRpc(424498560u, new RpcReceiveHandler(__rpc_handler_424498560), "EditGiftBoxesClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2406867037(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_0072: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool running = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref running, default(ForPrimitives)); float currentTime = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref currentTime, default(ForPrimitives)); Color color = default(Color); ((FastBufferReader)(ref reader)).ReadValueSafe(ref color); bool visible = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref visible, default(ForPrimitives)); bool playsound = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref playsound, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((Net)(object)target).SetTimerStatusClientRpc(running, currentTime, color, visible, playsound); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2990838109(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_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) { int count = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref count); bool visible = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref visible, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((Net)(object)target).SetMissingItemsStatusClientRpc(count, visible); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2381872917(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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00a3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); NetworkObjectReference[] networkObjects = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref networkObjects, default(ForNetworkSerializable)); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); int[] itemValues = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref itemValues, default(ForPrimitives)); } target.__rpc_exec_stage = (__RpcExecStage)1; ((Net)(object)target).SendItemClientRpc(networkObjects, itemValues); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3484988418(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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: 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_00a3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); NetworkObjectReference[] spawnedScrap = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref spawnedScrap, default(ForNetworkSerializable)); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); int[] allScrapValue = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref allScrapValue, default(ForPrimitives)); } target.__rpc_exec_stage = (__RpcExecStage)1; ((Net)(object)target).SyncScrapValuesClientRpc(spawnedScrap, allScrapValue); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_424498560(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_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); NetworkObjectReference[] spawnedScrap = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref spawnedScrap, default(ForNetworkSerializable)); } bool flag2 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag2, default(ForPrimitives)); string containedItemsString = null; if (flag2) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref containedItemsString, false); } bool flag3 = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag3, default(ForPrimitives)); int[] containedItemValues = null; if (flag3) { ((FastBufferReader)(ref reader)).ReadValueSafe<int>(ref containedItemValues, default(ForPrimitives)); } target.__rpc_exec_stage = (__RpcExecStage)1; ((Net)(object)target).EditGiftBoxesClientRpc(spawnedScrap, containedItemsString, containedItemValues); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "Net"; } } [HarmonyPatch] internal class NetworkInit { [HarmonyPatch(typeof(GameNetworkManager), "Start")] [HarmonyPostfix] private static void Start_Postfix() { Net.CreateAndRegisterPrefab(); } [HarmonyPatch(typeof(StartOfRound), "Awake")] [HarmonyPrefix] private static void Awake_Prefix() { Net.SpawnNetworkHandler(); } [HarmonyPatch(typeof(GameNetworkManager), "Disconnect")] [HarmonyPostfix] private static void Disconnect_Postfix() { Net.DespawnNetworkHandler(); } } } namespace LC_FullClearTimer.MonoBehaviours { internal class HUDTimer : MonoBehaviour { private TextMeshProUGUI? timerText; private TextMeshProUGUI? missingText; public float time; public bool running; public int itemCount = 0; public static Color clockColor = Color.black; private Vector2 timerObjectTextPosition = new Vector2(350f, 200f); private Vector2 missingObjectsTextPosition = new Vector2(350f, 175f); private void Awake() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) timerText = GenerateTextElement("CountdownTimerObject", "00:00.00", timerObjectTextPosition); if (LC_FullClearTimer.itemCounter.Value) { missingText = GenerateTextElement("MissingScrapObject", "Missing: 0", missingObjectsTextPosition); } } private TextMeshProUGUI? GenerateTextElement(string name, string defaultText, Vector2 pos) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) TextMeshProUGUI clockNumber = HUDManager.Instance.clockNumber; if ((Object)(object)clockNumber == (Object)null) { LC_FullClearTimer.Logger.LogError((object)"gameclock was null."); return null; } GameObject val = new GameObject(name); val.transform.parent = ((Component)this).gameObject.transform; TextMeshProUGUI val2 = val.AddComponent<TextMeshProUGUI>(); TMP_FontAsset font = ((TMP_Text)clockNumber).font; Material fontMaterial = ((TMP_Text)clockNumber).fontMaterial; if ((Object)(object)font != (Object)null) { ((TMP_Text)val2).font = font; } if ((Object)(object)fontMaterial != (Object)null) { ((TMP_Text)val2).fontMaterial = fontMaterial; ((TMP_Text)val2).fontSharedMaterial = fontMaterial; } ((TMP_Text)val2).transform.position = ((TMP_Text)clockNumber).transform.position; ((TMP_Text)val2).transform.rotation = ((TMP_Text)clockNumber).transform.rotation; ((TMP_Text)val2).transform.localScale = Vector3.one; ((Graphic)val2).color = ((Graphic)clockNumber).color; clockColor = ((Graphic)clockNumber).color; ((TMP_Text)val2).alignment = ((TMP_Text)clockNumber).alignment; ((Transform)((TMP_Text)val2).rectTransform).localEulerAngles = ((Transform)((TMP_Text)clockNumber).rectTransform).localEulerAngles; ((Transform)((TMP_Text)val2).rectTransform).localScale = ((Transform)((TMP_Text)clockNumber).rectTransform).localScale; ((Transform)((TMP_Text)val2).rectTransform).localPosition = ((Transform)((TMP_Text)clockNumber).rectTransform).localPosition; ((TMP_Text)val2).rectTransform.anchorMax = ((TMP_Text)clockNumber).rectTransform.anchorMax; ((TMP_Text)val2).rectTransform.anchorMin = ((TMP_Text)clockNumber).rectTransform.anchorMin; ((TMP_Text)val2).rectTransform.offsetMin = ((TMP_Text)clockNumber).rectTransform.offsetMin; ((TMP_Text)val2).rectTransform.offsetMax = ((TMP_Text)clockNumber).rectTransform.offsetMax; ((TMP_Text)val2).enableWordWrapping = false; ((TMP_Text)val2).rectTransform.sizeDelta = new Vector2(175f, 50f); ((TMP_Text)val2).rectTransform.anchoredPosition = pos; ((TMP_Text)val2).fontSize = ((TMP_Text)clockNumber).fontSize; ((TMP_Text)val2).text = defaultText; val.SetActive(false); return val2; } private void Start() { //IL_001e: 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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)timerText == (Object)null)) { ((TMP_Text)timerText).transform.localScale = Vector3.one; ((TMP_Text)timerText).rectTransform.anchoredPosition = timerObjectTextPosition; if (!((Object)(object)missingText == (Object)null)) { ((TMP_Text)missingText).transform.localScale = Vector3.one; ((TMP_Text)missingText).rectTransform.anchoredPosition = missingObjectsTextPosition; } } } private void Update() { if (running && (Object)(object)timerText != (Object)null) { time += Time.deltaTime; ((TMP_Text)timerText).text = FormatTime(time); } } public void SetTimerStatus(bool running, float time, Color color, bool visible) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) this.time = time; this.running = running; if (!((Object)(object)timerText == (Object)null)) { ((Graphic)timerText).color = color; ((TMP_Text)timerText).text = FormatTime(time); ((Component)timerText).gameObject.SetActive(visible); } } private string FormatTime(float time) { int num = (int)(time / 3600f); int num2 = (int)(time % 3600f / 60f); int num3 = (int)(time % 60f); int num4 = (int)(time * 100f % 100f); if (num > 0) { return $"{num:D2}:{num2:D2}:{num3:D2}.{num4:D2}"; } return $"{num2:D2}:{num3:D2}.{num4:D2}"; } public void SetMissingStatus(int count, bool visible) { if (!((Object)(object)missingText == (Object)null)) { ((TMP_Text)missingText).text = $"Missing: {count}"; ((Component)missingText).gameObject.SetActive(visible); itemCount = count; } } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace Tomatobird.FullClearTimer.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }