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 LCNewDonkCityMod v0.8.0
LCNewDonkCityMod.dll
Decompiled 3 hours ago
The result has been truncated due to the large size, download it to view full contents!
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.Xml.Serialization; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using STSharedAudioLib; using TMPro; using Unity.AI.Navigation; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Rendering.HighDefinition; using UnityEngine.SceneManagement; [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 = "New Donk City/AllAssets")] internal class AllAssets : ScriptableObject { [Header("Netcode")] public GameObject[] allNetworkPrefabs; [Space(3f)] [Header("Scrap")] public Item[] allGrabbableObjects; [Space(3f)] [Header("Terminal")] public TerminalKeyword[] allTerminalKeywords; public TerminalNode[] allTerminalNodes; [Space(3f)] [Header("Spawnables")] public List<SpawnableItemWithRarity> allItems; public List<SpawnableEnemyWithRarity> allEnemies; public List<SpawnableEnemyWithRarity> allOutsideEnemies; public List<SpawnableEnemyWithRarity> allDaytimeEnemies; public IndoorMapHazard[] allIndoorHazards; [Space(3f)] [Header("SelectableLevel Parameters")] public int baseMinScrap; public int baseMaxScrap; [Space] public float baseSizeMultiplier; } public class CrossModEasterEggs { private static ManualLogSource Logger; public static bool compatibilityPlaylistsMod; public static bool compatibilityCrashBandicootCrates; public static bool compatibilityLethalLevelLoader; public static void LCPlaylistsModCompatibility() { if (compatibilityPlaylistsMod) { AddLoadingScreenMusic(); } } private static void AddLoadingScreenMusic() { SharedAudioComponent genericPlaylistsContainer = GetGenericPlaylistsContainer(); if ((Object)(object)genericPlaylistsContainer != (Object)null) { SharedAudioMethods.AudioClipAddNew(Plugin.ndcBundleAssets.LoadAsset<AudioClip>("Assets/LCNewDonkCityMod/ModCompatibility/LCSimonTendoPlaylistsMod/LoadingScreenMusic.ogg"), SharedAudioMethods.AudioListGetByName("LCSimonTendoPlaylistsMod - Loading Screen", genericPlaylistsContainer, false, true), true, 250, false); } } private static SharedAudioComponent GetGenericPlaylistsContainer() { if ((Object)(object)StartOfRound.Instance == (Object)null) { return null; } Transform val = ((Component)StartOfRound.Instance).transform.parent.Find("SimonTendoManagers"); if ((Object)(object)val == (Object)null) { Logger.LogWarning((object)"failed to find: SimonTendoManagers"); return null; } Transform val2 = val.Find("LCSimonTendoPlaylistsMod"); if ((Object)(object)val2 == (Object)null) { Logger.LogWarning((object)"failed to find: LCSimonTendoPlaylistsMod"); return null; } SharedAudioComponent component = ((Component)val2).GetComponent<SharedAudioComponent>(); if ((Object)(object)component == (Object)null) { Logger.LogError((object)"failed to find: SharedAudioComponent"); } return component; } public static void LCCrashBandicootCratesMod() { if (compatibilityCrashBandicootCrates) { CreateCoinCrate(); } } public static void CreateCoinCrate() { //IL_0057: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0069: 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) //IL_00db: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0128: 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) Item val = CreateACrate.MakeItem("Coin Crate", true, true, false, true, 1.1f, false, false, true, true, 160, 10, false, 0f, false, Plugin.ndcBundleAssets.LoadAsset<Sprite>("Assets/LCNewDonkCityMod/ModCompatibility/LCCrashBandicootCratesMod/CoinCrateIcon.png"), "HoldLung", (AudioClip)null, (AudioClip)null, (AudioClip)null, false, new string[2] { "Thank you for playing:", "LCNewDonkCityMod" }, 0.01f, 0, true, default(Vector3), default(Vector3), default(Vector3), (Mesh[])null, (Material[])null, false, false); CrateData obj = CreateACrate.MakeCrateData((AudioClip)null, (AudioClip)null, (AudioClip[])null, true, true, false, true, 0.5f, 10f, 2f, (Material[])null, (int[])null, 2f, 10f, 1f, (AnimationCurve)null, -1f, -1f, -1f, false, false, false, false, false, false, false, false, false, false, (GameObject[])null, false, false, 0f, -1, -1, -1, -1, false, false, false, true, 0, true, 45f); Vector3 val2 = default(Vector3); ModdedCrateRuntimeParameters val3 = CreateACrate.MakeModdedCrateRuntimeParameters(obj, val, (string)null, (Material[])(object)new Material[3] { Plugin.ndcBundleAssets.LoadAsset<Material>("Assets/LCNewDonkCityMod/ModCompatibility/LCCrashBandicootCratesMod/CoinCrateRimMat.mat"), Plugin.ndcBundleAssets.LoadAsset<Material>("Assets/LCNewDonkCityMod/ModCompatibility/LCCrashBandicootCratesMod/CoinCrateTopMat.mat"), Plugin.ndcBundleAssets.LoadAsset<Material>("Assets/LCNewDonkCityMod/ModCompatibility/LCCrashBandicootCratesMod/CoinCrateMat.mat") }, (Mesh)null, val2, (GameObject)null, default(Color), (GameObject)null, default(Color), true, (string)null, (string)null, 0.25f, 20f, 0, 1, true, 0, 0, 1, (UnityAction<CrateGrabbableObject, PlayerControllerB>)CoinCrateEventStart, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)CoinCrateEventJump, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (UnityAction<CrateGrabbableObject, PlayerControllerB>)null, (GameObject)null, 0, -1f, (GameObject)null); CreateACrate.RegisterCrateToAllLevelsWithRarity(val3, 1, 1, 3, 3, 3, 5, 7, 1, 9, 7, 9, 3); CreateACrate.RegisterCrateToLevelWithRarity("New Donk City", val3, 32); } public static void CoinCrateEventStart(CrateGrabbableObject crate, PlayerControllerB player) { if (!((Object)(object)crate == (Object)null)) { Logger.LogDebug((object)$"CoinCrateEvent(): START on {crate} #{((NetworkBehaviour)crate).NetworkObjectId}"); ((Component)crate).gameObject.AddComponent<CoinContainer>().spawnCoinVisualAt = ((Component)crate).transform; } } public static void CoinCrateEventJump(CrateGrabbableObject crate, PlayerControllerB player) { if ((Object)(object)crate == (Object)null || (Object)(object)player == (Object)null) { return; } Logger.LogDebug((object)$"CoinCrateEvent(): JUMP on {crate} #{((NetworkBehaviour)crate).NetworkObjectId}"); CoinContainer component = ((Component)crate).GetComponent<CoinContainer>(); if (!((Object)(object)component == (Object)null) && ((GrabbableObject)crate).scrapValue > 0) { GenericManager.AddCollectedCoins(component, player); ((GrabbableObject)crate).SetScrapValue(((GrabbableObject)crate).scrapValue - 1); if (((GrabbableObject)crate).scrapValue <= 0) { crate.UpdateSpecialIntLocal(1, false, player, true); } } } } public class LLLCompatibilityFixer : MonoBehaviour { public static void SpawnFrameDelaySceneFixer(NetworkSceneManager sceneManager) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) new GameObject("NDCLLLFix").AddComponent<LLLCompatibilityFixer>().DelayAddingSceneToBuild(sceneManager); } public void DelayAddingSceneToBuild(NetworkSceneManager sceneManager) { ((MonoBehaviour)this).StartCoroutine(AddSceneOnDelay(sceneManager)); } private IEnumerator AddSceneOnDelay(NetworkSceneManager sceneManager) { Plugin.Logger.LogWarning((object)"Adding scene to build on frame delay!!"); yield return (object)new WaitForEndOfFrame(); SceneManagerPatches.AddSceneToBuild(sceneManager); } } public class AestheticsManager : NetworkBehaviour { private static ManualLogSource Logger; public static AestheticsManager Instance; public Aesthetic[] allLevelAesthetics; [HideInInspector] public Aesthetic todaysAesthetics; private void Awake() { if ((Object)(object)Instance != (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Instance = this; } } public override void OnNetworkSpawn() { ((NetworkBehaviour)this).OnNetworkSpawn(); NewDonkCityManager.Instance.onHitGroundEvent.AddListener((UnityAction<Collider>)CheckStartOfSong); } private void Update() { DoSpecialAestheticChecks(); } public void OnSceneLoad() { DetermineTodaysSkybox(); } public void DetermineTodaysSkybox() { //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (allLevelAesthetics == null || allLevelAesthetics.Length == 0) { return; } todaysAesthetics = null; for (int i = 0; i < allLevelAesthetics.Length; i++) { Aesthetic aesthetic = allLevelAesthetics[i]; if (!((Object)(object)aesthetic == (Object)null) && aesthetic.activateOnWeather.Contains(StartOfRound.Instance.currentLevel.currentWeather)) { todaysAesthetics = aesthetic; break; } } if ((Object)(object)todaysAesthetics == (Object)null) { return; } Logger.LogInfo((object)todaysAesthetics); for (int j = 0; j < allLevelAesthetics.Length; j++) { Aesthetic aesthetic2 = allLevelAesthetics[j]; if (!((Object)(object)aesthetic2 == (Object)null)) { aesthetic2.ToggleAestheticSpecificPrefabs(setTo: false); } } todaysAesthetics.ToggleAestheticSpecificPrefabs(setTo: true); for (int k = 0; k < allLevelAesthetics.Length; k++) { Aesthetic aesthetic3 = allLevelAesthetics[k]; if (!((Object)(object)aesthetic3 == (Object)null)) { aesthetic3.DestroyUnusedAestheticSpecificPrefabs(); } } NewDonkCityManager.Instance.skyboxAnimator.SetBool("Initialized", true); if (!string.IsNullOrEmpty(todaysAesthetics.skyboxAnimatorTrigger)) { NewDonkCityManager.Instance.skyboxAnimator.SetTrigger(todaysAesthetics.skyboxAnimatorTrigger); } if (!todaysAesthetics.rebakeNavMesh) { return; } GameObject val = GameObject.FindGameObjectWithTag("OutsideLevelNavMesh"); if ((Object)(object)val != (Object)null) { NavMeshSurface component = val.GetComponent<NavMeshSurface>(); if ((Object)(object)component != (Object)null) { component.BuildNavMesh(); } } } private void CheckStartOfSong(Collider colliderHit) { if (!((Object)(object)colliderHit == (Object)null) && !((Object)(object)todaysAesthetics == (Object)null) && todaysAesthetics.backgroundMusic != null && todaysAesthetics.backgroundMusic.Length != 0 && !((Object)(object)todaysAesthetics.backgroundMusic[0].globalAudio == (Object)null) && !todaysAesthetics.backgroundMusic[0].globalAudio.isPlaying && !((Object)(object)((Component)colliderHit).gameObject.GetComponentInParent<NewDonkCityManager>() == (Object)null)) { Logger.LogDebug((object)"LOCALLY met conditions to start song"); StartTodaysSongLocal(); StartTodaysSongServerRpc(NewDonkCityManager.localPlayerID); } } [ServerRpc(RequireOwnership = false)] private void StartTodaysSongServerRpc(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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(113678267u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerID); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 113678267u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; StartTodaysSongClientRpc(playerID); } } } [ClientRpc] private void StartTodaysSongClientRpc(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) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3169010161u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerID); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3169010161u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (playerID != NewDonkCityManager.localPlayerID) { Logger.LogDebug((object)"RECEIVED met conditions to start song"); StartTodaysSongLocal(); } } } private void StartTodaysSongLocal() { if (!((Object)(object)todaysAesthetics == (Object)null) && todaysAesthetics.backgroundMusic != null && todaysAesthetics.backgroundMusic.Length != 0 && !((Object)(object)todaysAesthetics.backgroundMusic[0].globalAudio == (Object)null) && !todaysAesthetics.backgroundMusic[0].globalAudio.isPlaying) { todaysAesthetics.ToggleAestheticSpecificSong(setTo: true); todaysAesthetics.ToggleParticles(setTo: true); ((MonoBehaviour)this).StartCoroutine(IncreaseSongVolumeDuringIntro()); if ((Object)(object)FestivalManager.Instance != (Object)null) { FestivalManager.Instance.StartFestival(todaysAesthetics); } NewDonkCityManager.Instance.onHitGroundEvent.RemoveListener((UnityAction<Collider>)CheckStartOfSong); } } private IEnumerator IncreaseSongVolumeDuringIntro() { if (!((Object)(object)SongsManager.Instance == (Object)null) && !((Object)(object)todaysAesthetics == (Object)null)) { string introVolumeMultiplierKey = "SceneBGM Intro Multiplier"; float multiplierValue = 2.5f; float startingAddition = multiplierValue - 1f; SongsManager.Instance.SetGlobalVolumeMultiplier(introVolumeMultiplierKey, multiplierValue); yield return (object)new WaitForSeconds(todaysAesthetics.introMusicTime); while (multiplierValue > 1f) { yield return null; multiplierValue -= startingAddition / todaysAesthetics.introMusicFade * Time.deltaTime; SongsManager.Instance.SetGlobalVolumeMultiplier(introVolumeMultiplierKey, multiplierValue); } SongsManager.Instance.RemoveGlobalVolumeMultiplier(introVolumeMultiplierKey); } } private void DoSpecialAestheticChecks() { //IL_0106: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)NewDonkCityManager.Instance == (Object)null) && (Object)(object)todaysAesthetics != (Object)null) { if ((Object)(object)todaysAesthetics.outsideFog != (Object)null && ((Behaviour)todaysAesthetics.outsideFog).enabled == NewDonkCityManager.Instance.localCameraInFactory) { todaysAesthetics.ToggleFogObject(ofOutsideFog: true, !((Behaviour)todaysAesthetics.outsideFog).enabled); } else if ((Object)(object)todaysAesthetics.insideFog != (Object)null && ((Behaviour)todaysAesthetics.insideFog).enabled == !NewDonkCityManager.Instance.localCameraInFactory) { todaysAesthetics.ToggleFogObject(ofOutsideFog: false, !((Behaviour)todaysAesthetics.insideFog).enabled); } if ((Object)(object)todaysAesthetics.outdoorParticles != (Object)null && todaysAesthetics.outdoorParticles.isPlaying && !NewDonkCityManager.Instance.localCameraInFactory) { ((Component)todaysAesthetics.outdoorParticles).transform.position = NewDonkCityManager.Instance.localCameraPosition; } } } 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 ((NetworkBehaviour)this).__registerRpc(113678267u, new RpcReceiveHandler(__rpc_handler_113678267), "StartTodaysSongServerRpc"); ((NetworkBehaviour)this).__registerRpc(3169010161u, new RpcReceiveHandler(__rpc_handler_3169010161), "StartTodaysSongClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_113678267(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; ((AestheticsManager)(object)target).StartTodaysSongServerRpc(playerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3169010161(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; ((AestheticsManager)(object)target).StartTodaysSongClientRpc(playerID); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "AestheticsManager"; } } public class ConditionalsManager : MonoBehaviour { public enum SpecialScript { None, CheckScripts, SubConditionals, TimeOfDay, RoundManager } public enum ComparisonType { Equals, NotEquals, GreaterThan, SmallerThan } private static ManualLogSource Logger; public Transform conditionsContainer; private List<Conditional> allConditions; private float conditionalTimer; private int conditionalIndex; public void OnLoadDelay() { allConditions = new List<Conditional>(); ((Component)conditionsContainer).GetComponentsInChildren<Conditional>(false, allConditions); } private void Update() { if (NewDonkCityManager.localPlayerServer && allConditions != null && allConditions.Count != 0 && MoonManager.loadedMoonSaveData) { conditionalTimer -= Time.deltaTime; if (conditionalTimer <= 0f) { CheckConditionals(); } } } private void CheckConditionals() { conditionalTimer = 0.5f; conditionalIndex++; if (conditionalIndex >= allConditions.Count) { conditionalIndex = 0; } ((MonoBehaviour)this).StartCoroutine(CheckConditionalOnDelay(allConditions[conditionalIndex])); } private LoadedDataState CheckConditionalInstant(Conditional toCheck) { if ((Object)(object)toCheck == (Object)null) { Logger.LogWarning((object)$"null conditional {toCheck}, removing"); return new LoadedDataState(successful: false); } Behaviour[] array = null; switch (toCheck.useValuesOf) { default: Logger.LogDebug((object)$"automatically spawning from conditional {toCheck}"); return new LoadedDataState(successful: true, true); case SpecialScript.CheckScripts: if (toCheck.checkComponents != null && toCheck.checkFields != null && toCheck.fieldValuesToMeet != null && toCheck.compareBy != null && toCheck.checkComponents.Length == toCheck.checkFields.Length && toCheck.checkComponents.Length == toCheck.fieldValuesToMeet.Length && toCheck.checkComponents.Length == toCheck.compareBy.Length) { array = toCheck.checkComponents; break; } Logger.LogWarning((object)$"conditional {toCheck} with type {toCheck.useValuesOf} should have as many scripts to check as fields to check, removing (null: scripts? {toCheck.checkComponents == null} // fields? {toCheck.checkFields == null} // values? {toCheck.fieldValuesToMeet == null} // comparisons? {toCheck.compareBy == null})"); return new LoadedDataState(successful: false); case SpecialScript.SubConditionals: if (toCheck.checkSubConditions == null || toCheck.checkSubConditions.Length == 0) { Logger.LogWarning((object)$"conditional {toCheck} with type {toCheck.useValuesOf} should conditionals to check, removing (null? {toCheck.checkSubConditions == null})"); return new LoadedDataState(successful: false); } break; case SpecialScript.TimeOfDay: array = FillArrayWithScriptSingle((Behaviour)(object)TimeOfDay.Instance, toCheck.checkFields.Length); break; case SpecialScript.RoundManager: array = FillArrayWithScriptSingle((Behaviour)(object)RoundManager.Instance, toCheck.checkFields.Length); break; } bool flag = false; if (toCheck.useValuesOf == SpecialScript.SubConditionals) { for (int i = 0; i < toCheck.checkSubConditions.Length; i++) { if ((Object)(object)toCheck.checkSubConditions[i] == (Object)null) { continue; } LoadedDataState loadedDataState = CheckConditionalInstant(toCheck.checkSubConditions[i]); if (loadedDataState == null || !loadedDataState.loadSuccessful) { continue; } if ((bool)loadedDataState.loadedValue) { flag = true; if (!toCheck.andOr) { break; } } else if (toCheck.andOr) { flag = false; break; } } } else { if (array == null || array.Length == 0) { Logger.LogWarning((object)"invalid normal behaviour that needs checking, removing"); return new LoadedDataState(successful: false); } for (int j = 0; j < array.Length; j++) { if ((Object)(object)array[j] == (Object)null || string.IsNullOrEmpty(toCheck.checkFields[j]) || string.IsNullOrEmpty(toCheck.fieldValuesToMeet[j])) { continue; } string fieldValue = GetFieldValue(array[j], toCheck.checkFields[j]); if (string.IsNullOrEmpty(fieldValue)) { continue; } if (CompareFieldValue(fieldValue, toCheck, j)) { flag = true; if (!toCheck.andOr) { break; } } else if (toCheck.andOr) { flag = false; break; } } } if (flag) { if (Application.isEditor && toCheck.removeUponSucceedingCondition) { Logger.LogDebug((object)$"conditional {toCheck} succeeded - instant"); } return new LoadedDataState(successful: true, true); } if (Application.isEditor && toCheck.removeUponFailingCondition) { Logger.LogDebug((object)$"conditional {toCheck} failed - instant"); } return new LoadedDataState(successful: true, false); } private IEnumerator CheckConditionalOnDelay(Conditional toCheck) { if ((Object)(object)toCheck == (Object)null) { Logger.LogWarning((object)$"null conditional {toCheck}, removing"); FinalizeConditionalCheckAndRemove(new LoadedDataState(successful: false)); yield break; } Behaviour[] checkBehaviour = null; switch (toCheck.useValuesOf) { default: Logger.LogDebug((object)$"automatically spawning from conditional {toCheck}"); FinalizeConditionalCheckAndRemove(new LoadedDataState(successful: true, true)); yield break; case SpecialScript.CheckScripts: if (toCheck.checkComponents != null && toCheck.checkFields != null && toCheck.fieldValuesToMeet != null && toCheck.compareBy != null && toCheck.checkComponents.Length == toCheck.checkFields.Length && toCheck.checkComponents.Length == toCheck.fieldValuesToMeet.Length && toCheck.checkComponents.Length == toCheck.compareBy.Length) { checkBehaviour = toCheck.checkComponents; break; } Logger.LogWarning((object)$"conditional {toCheck} with type {toCheck.useValuesOf} should have as many scripts to check as fields to check, removing (null: scripts? {toCheck.checkComponents == null} // fields? {toCheck.checkFields == null} // values? {toCheck.fieldValuesToMeet == null} // comparisons? {toCheck.compareBy == null})"); FinalizeConditionalCheckAndRemove(new LoadedDataState(successful: false)); yield break; case SpecialScript.SubConditionals: if (toCheck.checkSubConditions == null || toCheck.checkSubConditions.Length == 0) { Logger.LogWarning((object)$"conditional {toCheck} with type {toCheck.useValuesOf} should conditionals to check, removing (null? {toCheck.checkSubConditions == null})"); FinalizeConditionalCheckAndRemove(new LoadedDataState(successful: false)); yield break; } break; case SpecialScript.TimeOfDay: checkBehaviour = FillArrayWithScriptSingle((Behaviour)(object)TimeOfDay.Instance, toCheck.checkFields.Length); break; case SpecialScript.RoundManager: checkBehaviour = FillArrayWithScriptSingle((Behaviour)(object)RoundManager.Instance, toCheck.checkFields.Length); break; } bool metAllConditions = false; if (toCheck.useValuesOf == SpecialScript.SubConditionals) { for (int i = 0; i < toCheck.checkSubConditions.Length; i++) { yield return null; if ((Object)(object)toCheck.checkSubConditions[i] == (Object)null) { continue; } LoadedDataState loadedDataState = CheckConditionalInstant(toCheck.checkSubConditions[i]); if (loadedDataState == null || !loadedDataState.loadSuccessful) { continue; } if ((bool)loadedDataState.loadedValue) { metAllConditions = true; if (!toCheck.andOr) { break; } } else if (toCheck.andOr) { metAllConditions = false; break; } } } else { if (checkBehaviour == null || checkBehaviour.Length == 0) { Logger.LogWarning((object)"invalid normal behaviour that needs checking, removing"); FinalizeConditionalCheckAndRemove(new LoadedDataState(successful: false)); yield break; } for (int i = 0; i < checkBehaviour.Length; i++) { yield return null; if ((Object)(object)checkBehaviour[i] == (Object)null || string.IsNullOrEmpty(toCheck.checkFields[i]) || string.IsNullOrEmpty(toCheck.fieldValuesToMeet[i])) { continue; } string fieldValue = GetFieldValue(checkBehaviour[i], toCheck.checkFields[i]); if (string.IsNullOrEmpty(fieldValue)) { continue; } if (CompareFieldValue(fieldValue, toCheck, i)) { metAllConditions = true; if (!toCheck.andOr) { break; } } else if (toCheck.andOr) { metAllConditions = false; break; } } } if (metAllConditions) { if (Application.isEditor && toCheck.removeUponSucceedingCondition) { Logger.LogDebug((object)$"conditional {toCheck} succeeded - delayed"); } FinalizeConditionalCheckAndRemove(new LoadedDataState(successful: true, true)); } else { if (Application.isEditor && toCheck.removeUponFailingCondition) { Logger.LogDebug((object)$"conditional {toCheck} failed - delayed"); } FinalizeConditionalCheckAndRemove(new LoadedDataState(successful: true, false)); } } private void FinalizeConditionalCheckAndRemove(LoadedDataState comparisonResult) { if (comparisonResult == null || comparisonResult.loadedValue == null) { return; } bool flag = false; if ((bool)comparisonResult.loadedValue) { allConditions[conditionalIndex].invokeOnSucceeding.Invoke(); if (allConditions[conditionalIndex].removeUponSucceedingCondition) { flag = true; } } else { allConditions[conditionalIndex].invokeOnFailing.Invoke(); if (allConditions[conditionalIndex].removeUponFailingCondition) { flag = true; } } if (!comparisonResult.loadSuccessful) { flag = true; } if (flag) { allConditions.RemoveAt(conditionalIndex); } } private Behaviour[] FillArrayWithScriptSingle(Behaviour fillWith, int length) { if ((Object)(object)fillWith == (Object)null || length == 0) { return null; } Behaviour[] array = (Behaviour[])(object)new Behaviour[length]; for (int i = 0; i < array.Length; i++) { array[i] = fillWith; } return array; } private Behaviour[] FillArrayWithScriptMultiple(Behaviour[] fillWith) { if (fillWith == null || fillWith.Length == 0) { return null; } Behaviour[] array = (Behaviour[])(object)new Behaviour[fillWith.Length]; for (int i = 0; i < array.Length; i++) { array[i] = fillWith[i]; } return array; } private string GetFieldValue(Behaviour checkScript, string checkField) { if ((Object)(object)checkScript == (Object)null || string.IsNullOrEmpty(checkField)) { return null; } try { object value = ((object)checkScript).GetType().GetField(checkField, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).GetValue(checkScript); if (value == null) { return "null"; } return value.ToString(); } catch (Exception arg) { Logger.LogError((object)$"error when trying to read value {checkField} from script {checkScript}:\n{arg}"); return null; } } private bool CompareFieldValue(string fieldValue, Conditional condition, int comparisonIndex) { if (string.IsNullOrEmpty(fieldValue) || (Object)(object)condition == (Object)null || comparisonIndex < 0 || comparisonIndex >= condition.compareBy.Length) { return false; } switch (condition.compareBy[comparisonIndex]) { default: return fieldValue == condition.fieldValuesToMeet[comparisonIndex]; case ComparisonType.NotEquals: return fieldValue != condition.fieldValuesToMeet[comparisonIndex]; case ComparisonType.GreaterThan: { if (!float.TryParse(fieldValue, out var result3) || !float.TryParse(condition.fieldValuesToMeet[comparisonIndex], out var result4)) { Logger.LogWarning((object)"error when parsing GreaterThan"); return false; } return result3 > result4; } case ComparisonType.SmallerThan: { if (!float.TryParse(fieldValue, out var result) || !float.TryParse(condition.fieldValuesToMeet[comparisonIndex], out var result2)) { Logger.LogWarning((object)"error when parsing SmallerThan"); return false; } return result < result2; } } } } public class FestivalManager : NetworkBehaviour { private static ManualLogSource Logger; public static FestivalManager Instance; public Aesthetic activateOnAesthetics; private void Awake() { if ((Object)(object)Instance != (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); } else { Instance = this; } } public void StartFestival(Aesthetic todaysAesthetics) { if ((Object)(object)activateOnAesthetics == (Object)null && (Object)(object)todaysAesthetics == (Object)null) { _ = (Object)(object)activateOnAesthetics != (Object)(object)todaysAesthetics; } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { ((NetworkBehaviour)this).__initializeRpcs(); } protected internal override string __getTypeName() { return "FestivalManager"; } } public class GenericManager : NetworkBehaviour { private static ManualLogSource Logger; public static GenericManager Instance; [Header("Audio")] public AudioSource[] tempAudioSources; [Space(3f)] [Header("Coins")] public GameObject[] staticCoinVisuals; public AudioClip[] collectCoinSFX; private void Awake() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if ((Object)(object)Instance != (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Instance = this; GameObject val = new GameObject("LCNewDonkCityMod"); val.transform.SetParent(Plugin.SearchForObject("SimonTendoManagers", ((Component)StartOfRound.Instance).transform.parent).transform); ((Component)this).transform.SetParent(val.transform, true); } public void SyncPreLevelGenerate() { if (((NetworkBehaviour)this).IsSpawned && ((NetworkBehaviour)this).IsServer) { Logger.LogDebug((object)$"SyncPreLevelGenerate - SERVER: {Plugin.ndcSelectableLevel.minScrap} // {Plugin.ndcSelectableLevel.maxScrap} // {Plugin.ndcSelectableLevel.factorySizeMultiplier}"); SyncPreLevelGenerateClientRpc(Plugin.ndcSelectableLevel.minScrap, Plugin.ndcSelectableLevel.maxScrap, Plugin.ndcSelectableLevel.factorySizeMultiplier); } } [ClientRpc] private void SyncPreLevelGenerateClientRpc(int serverMinScrap, int serverMaxScrap, float serverFactorySize) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3996748794u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, serverMinScrap); BytePacker.WriteValueBitPacked(val, serverMaxScrap); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref serverFactorySize, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3996748794u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { Plugin.ndcSelectableLevel.minScrap = serverMinScrap; Plugin.ndcSelectableLevel.maxScrap = serverMaxScrap; Plugin.ndcSelectableLevel.factorySizeMultiplier = serverFactorySize; Logger.LogDebug((object)$"SyncPreLevelGenerate - CLIENT: {Plugin.ndcSelectableLevel.minScrap} // {Plugin.ndcSelectableLevel.maxScrap} // {Plugin.ndcSelectableLevel.factorySizeMultiplier}"); } } } public static void PlaySFXAtLocation(Vector3 position, AudioClip clip, bool audible = true, float audibleRange = 10f, float audibleLoudness = 0.75f, float dopplerEffect = 1f, float pitchOffset = 0f, bool isMonoSound = false, int audibleID = 0, bool transmitWalkie = true) { //IL_009c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null || Instance.tempAudioSources == null || Instance.tempAudioSources.Length == 0 || (Object)(object)clip == (Object)null) { return; } AudioSource val = null; for (int i = 0; i < Instance.tempAudioSources.Length; i++) { if ((Object)(object)Instance.tempAudioSources[i] != (Object)null && (!Instance.tempAudioSources[i].isPlaying || i == Instance.tempAudioSources.Length - 1)) { val = Instance.tempAudioSources[i]; break; } } val.Stop(); ((Component)val).transform.position = position; val.volume = audibleLoudness * 1.25f; val.maxDistance = audibleRange * 1.25f; val.dopplerLevel = dopplerEffect; val.pitch = 1f + Random.Range(pitchOffset * -1f, pitchOffset); val.spatialBlend = (isMonoSound ? 0f : 1f); PlaySFX(val, clip, audible, audibleRange, audibleLoudness, audibleID, transmitWalkie); } public static void PlaySFX(AudioSource source, AudioClip clip, bool audible = true, float audibleRange = 10f, float audibleLoudness = 0.75f, int audibleID = 0, bool transmitWalkie = true) { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_0061: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)source == (Object)null || (Object)(object)clip == (Object)null) { return; } source.PlayOneShot(clip); if (transmitWalkie) { WalkieTalkie.TransmitOneShotAudio(source, clip, audibleLoudness); } if (audible) { int num; if ((Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.shipInnerRoomBounds != (Object)null) { Bounds bounds = StartOfRound.Instance.shipInnerRoomBounds.bounds; num = (((Bounds)(ref bounds)).Contains(((Component)source).transform.position) ? 1 : 0); } else { num = 0; } bool flag = (byte)num != 0; RoundManager.Instance.PlayAudibleNoise(((Component)source).transform.position, audibleRange, audibleLoudness, 0, flag, audibleID); } } public static void PlaySFXSynced(Vector3 position, AudioClip clip, bool audible = true, float audibleRange = 10f, float audibleLoudness = 0.75f, float dopplerEffect = 1f, float pitchOffset = 0f, bool isMonoSound = false, bool isMonoSynced = false, int audibleID = 0, bool transmitWalkie = true) { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null || (Object)(object)SoundManager.Instance == (Object)null || SoundManager.Instance.syncedAudioClips == null || SoundManager.Instance.syncedAudioClips.Length == 0) { return; } int num = -1; for (int i = 0; i < SoundManager.Instance.syncedAudioClips.Length; i++) { if ((Object)(object)SoundManager.Instance.syncedAudioClips[i] == (Object)(object)clip) { num = i; break; } } if (num != -1) { PlaySFXAtLocation(position, SoundManager.Instance.syncedAudioClips[num], audible, audibleRange, audibleLoudness, dopplerEffect, pitchOffset, isMonoSound, audibleID, transmitWalkie); Instance.PlaySFXSyncedServerRpc(NewDonkCityManager.localPlayerID, position, num, audible, audibleRange, audibleLoudness, dopplerEffect, pitchOffset, isMonoSound && isMonoSynced, audibleID, transmitWalkie); } } [ServerRpc(RequireOwnership = false)] private void PlaySFXSyncedServerRpc(int playerID, Vector3 position, int clipIndex, bool audible, float audibleRange, float audibleLoudness, float dopplerEffect, float pitchOffset, bool isMonoSound, int audibleID, bool transmitWalkie) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0187: 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_008b: 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_00aa: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2751274751u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerID); ((FastBufferWriter)(ref val)).WriteValueSafe(ref position); BytePacker.WriteValueBitPacked(val, clipIndex); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref audible, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref audibleRange, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref audibleLoudness, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref dopplerEffect, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref pitchOffset, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isMonoSound, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val, audibleID); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref transmitWalkie, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2751274751u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; PlaySFXSyncedClientRpc(playerID, position, clipIndex, audible, audibleRange, audibleLoudness, dopplerEffect, pitchOffset, isMonoSound, audibleID, transmitWalkie); } } } [ClientRpc] private void PlaySFXSyncedClientRpc(int playerID, Vector3 position, int clipIndex, bool audible, float audibleRange, float audibleLoudness, float dopplerEffect, float pitchOffset, bool isMonoSound, int audibleID, bool transmitWalkie) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0187: 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_008b: 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_00aa: 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_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4019402321u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerID); ((FastBufferWriter)(ref val)).WriteValueSafe(ref position); BytePacker.WriteValueBitPacked(val, clipIndex); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref audible, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref audibleRange, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref audibleLoudness, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref dopplerEffect, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref pitchOffset, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref isMonoSound, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val, audibleID); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref transmitWalkie, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 4019402321u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (playerID != NewDonkCityManager.localPlayerID && !((Object)(object)SoundManager.Instance == (Object)null) && SoundManager.Instance.syncedAudioClips != null && SoundManager.Instance.syncedAudioClips.Length != 0 && clipIndex >= 0 && clipIndex < SoundManager.Instance.syncedAudioClips.Length) { PlaySFXAtLocation(position, SoundManager.Instance.syncedAudioClips[clipIndex], audible, audibleRange, audibleLoudness, dopplerEffect, pitchOffset, isMonoSound, audibleID, transmitWalkie); } } } public static void AddCollectedCoins(CoinContainer coinContainer, PlayerControllerB collectedBy) { //IL_0033: 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) if ((Object)(object)Instance == (Object)null || (Object)(object)coinContainer == (Object)null) { return; } Logger.LogDebug((object)$"AddCollectedCoins(): {coinContainer} at {((Component)coinContainer).transform.position} with ${coinContainer.worthAmount} and visual {(Object)(object)coinContainer.spawnCoinVisualAt != (Object)null} by {collectedBy}"); PropsManager.SaveCollectedCoinIntoMemory(GameNetworkManager.Instance.saveFileNum, ((Component)coinContainer).transform.position, (int)coinContainer.collectType); if ((Object)(object)coinContainer.spawnCoinVisualAt == (Object)null) { UpdateCoinCount(coinContainer.worthAmount); if (coinContainer.destroyOnCollect) { Object.Destroy((Object)(object)((Component)coinContainer).gameObject); } } else { ((MonoBehaviour)Instance).StartCoroutine(Instance.SpawnCoinsCoroutine(coinContainer, collectedBy)); } } private IEnumerator SpawnCoinsCoroutine(CoinContainer coinContainer, PlayerControllerB collectedBy) { int currentAmount = 0; while (currentAmount < coinContainer.worthAmount) { currentAmount++; UpdateCoinCount(1); SpawnStaticCoinVisual(coinContainer.spawnCoinVisualAt, coinContainer.visualUsesRotation, coinContainer.coinIndex, collectedBy); yield return (object)new WaitForSeconds(0.2f); } if (coinContainer.destroyOnCollect) { Object.Destroy((Object)(object)((Component)coinContainer).gameObject); } } private static void UpdateCoinCount(int add) { if ((Object)(object)RoundManager.Instance != (Object)null) { RoundManager instance = RoundManager.Instance; instance.scrapCollectedInLevel += add; RoundManager instance2 = RoundManager.Instance; instance2.valueOfFoundScrapItems += add; } if ((Object)(object)TimeOfDay.Instance != (Object)null) { TimeOfDay instance3 = TimeOfDay.Instance; instance3.quotaFulfilled += add; TimeOfDay.Instance.UpdateProfitQuotaCurrentTime(); } } private static void SpawnStaticCoinVisual(Transform spawnCoinFromPoint, bool useTransformRotation, int coinIndex, PlayerControllerB collectedBy) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0083: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Instance == (Object)null) && Instance.staticCoinVisuals != null && Instance.staticCoinVisuals.Length != 0 && coinIndex >= 0 && coinIndex < Instance.staticCoinVisuals.Length && !((Object)(object)Object.Instantiate<GameObject>(Instance.staticCoinVisuals[coinIndex], spawnCoinFromPoint.position, useTransformRotation ? spawnCoinFromPoint.rotation : Quaternion.identity) == (Object)null)) { bool flag = (Object)(object)collectedBy != (Object)null && (Object)(object)collectedBy == (Object)(object)NewDonkCityManager.localPlayer; PlaySFXAtLocation(spawnCoinFromPoint.position, Instance.collectCoinSFX[coinIndex], audible: true, 15f, 0.4f, flag ? 0f : 1f, 0f, flag); } } public static void SetLevelWeather(int weatherIndex) { if (Application.isEditor && !((Object)(object)Instance == (Object)null) && ((NetworkBehaviour)Instance).IsServer && !((Object)(object)StartOfRound.Instance == (Object)null) && StartOfRound.Instance.inShipPhase) { Instance.SetLevelWeatherClientRpc(weatherIndex); } } [ClientRpc] private void SetLevelWeatherClientRpc(int weatherIndex) { //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_00d9: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3358364691u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, weatherIndex); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3358364691u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; try { Plugin.ndcSelectableLevel.currentWeather = (LevelWeatherType)weatherIndex; StartOfRound.Instance.SetMapScreenInfoToCurrentLevel(); } catch { Logger.LogDebug((object)$"weatherIndex {weatherIndex} failed"); } } 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 ((NetworkBehaviour)this).__registerRpc(3996748794u, new RpcReceiveHandler(__rpc_handler_3996748794), "SyncPreLevelGenerateClientRpc"); ((NetworkBehaviour)this).__registerRpc(2751274751u, new RpcReceiveHandler(__rpc_handler_2751274751), "PlaySFXSyncedServerRpc"); ((NetworkBehaviour)this).__registerRpc(4019402321u, new RpcReceiveHandler(__rpc_handler_4019402321), "PlaySFXSyncedClientRpc"); ((NetworkBehaviour)this).__registerRpc(3358364691u, new RpcReceiveHandler(__rpc_handler_3358364691), "SetLevelWeatherClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3996748794(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 serverMinScrap = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref serverMinScrap); int serverMaxScrap = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref serverMaxScrap); float serverFactorySize = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref serverFactorySize, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((GenericManager)(object)target).SyncPreLevelGenerateClientRpc(serverMinScrap, serverMaxScrap, serverFactorySize); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2751274751(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0077: 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_0092: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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); Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); int clipIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex); bool audible = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref audible, default(ForPrimitives)); float audibleRange = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref audibleRange, default(ForPrimitives)); float audibleLoudness = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref audibleLoudness, default(ForPrimitives)); float dopplerEffect = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref dopplerEffect, default(ForPrimitives)); float pitchOffset = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref pitchOffset, default(ForPrimitives)); bool isMonoSound = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isMonoSound, default(ForPrimitives)); int audibleID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref audibleID); bool transmitWalkie = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref transmitWalkie, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((GenericManager)(object)target).PlaySFXSyncedServerRpc(playerID, position, clipIndex, audible, audibleRange, audibleLoudness, dopplerEffect, pitchOffset, isMonoSound, audibleID, transmitWalkie); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4019402321(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: 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_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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_0077: 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_0092: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_015c: 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); Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); int clipIndex = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref clipIndex); bool audible = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref audible, default(ForPrimitives)); float audibleRange = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref audibleRange, default(ForPrimitives)); float audibleLoudness = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref audibleLoudness, default(ForPrimitives)); float dopplerEffect = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref dopplerEffect, default(ForPrimitives)); float pitchOffset = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref pitchOffset, default(ForPrimitives)); bool isMonoSound = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isMonoSound, default(ForPrimitives)); int audibleID = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref audibleID); bool transmitWalkie = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref transmitWalkie, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((GenericManager)(object)target).PlaySFXSyncedClientRpc(playerID, position, clipIndex, audible, audibleRange, audibleLoudness, dopplerEffect, pitchOffset, isMonoSound, audibleID, transmitWalkie); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3358364691(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 levelWeatherClientRpc = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref levelWeatherClientRpc); target.__rpc_exec_stage = (__RpcExecStage)1; ((GenericManager)(object)target).SetLevelWeatherClientRpc(levelWeatherClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "GenericManager"; } } public class MoonManager : NetworkBehaviour { public static MoonManager Instance; private static ManualLogSource Logger; public GameObject spawnPrefabMoon; public GameObject spawnPrefabShard; [Space(3f)] public AudioClip[] spawnSFX; public AudioClip correctSolutionSFX; [Space(3f)] public Transform dataContainerMoons; public Transform dataContainerShards; private List<MoonData> allMoons; private List<MoonData> allShards; [Space(3f)] public Odyssey moonDisplay; [HideInInspector] public static bool loadedMoonSaveData; private void Awake() { if ((Object)(object)Instance != (Object)null) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Instance = this; loadedMoonSaveData = false; } public void OnSceneLoad() { SetUpMoonArrays(); } private void SetUpMoonArrays() { Transform val = null; MoonData moonData = null; if ((Object)(object)dataContainerMoons != (Object)null && dataContainerMoons.childCount > 0) { allMoons = new List<MoonData>(); for (int i = 0; i < dataContainerMoons.childCount; i++) { val = dataContainerMoons.GetChild(i); if (!((Object)(object)val == (Object)null)) { moonData = ((Component)val).GetComponent<MoonData>(); if (Application.isEditor) { Logger.LogDebug((object)$"m{i}: {moonData}"); } if ((Object)(object)moonData != (Object)null) { allMoons.Add(moonData); } } } } if (!((Object)(object)dataContainerShards != (Object)null) || dataContainerShards.childCount <= 0) { return; } allShards = new List<MoonData>(); for (int j = 0; j < dataContainerShards.childCount; j++) { val = dataContainerShards.GetChild(j); if (!((Object)(object)val == (Object)null)) { moonData = ((Component)val).GetComponent<MoonData>(); if (Application.isEditor) { Logger.LogDebug((object)$"s{j}: {moonData}"); } if ((Object)(object)moonData != (Object)null) { allShards.Add(moonData); } } } } public static bool SpawnMoon(MoonData fromData) { //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)fromData == (Object)null || fromData.collected || (Object)(object)fromData.spawnedMoon != (Object)null || (Object)(object)Instance == (Object)null || !((NetworkBehaviour)Instance).IsServer) { return false; } Transform val = (((Object)(object)fromData.overrideMoonParent != (Object)null) ? ((Component)fromData.overrideMoonParent).transform : ((Component)fromData).transform); GameObject overrideSpawnPrefab = Instance.spawnPrefabMoon; _ = fromData.moonValue; bool flag = false; int sfxCase = 0; if (fromData.shardsToCollect != -1) { return false; } if ((Object)(object)fromData.mainMoon != (Object)null) { overrideSpawnPrefab = Instance.spawnPrefabShard; sfxCase = 1; } else if ((Object)(object)fromData.overrideSpawnPrefab != (Object)null) { overrideSpawnPrefab = fromData.overrideSpawnPrefab; flag = true; } if (fromData.overrideSpawnSfx != -1 && fromData.overrideSpawnSfx >= 0 && fromData.overrideSpawnSfx < Instance.spawnSFX.Length) { sfxCase = fromData.overrideSpawnSfx; } if ((Object)(object)overrideSpawnPrefab == (Object)null || (Object)(object)val == (Object)null) { return false; } GameObject val2 = Object.Instantiate<GameObject>(overrideSpawnPrefab, val.position, val.rotation); if ((Object)(object)val2 == (Object)null) { return false; } GrabbableObject component = val2.GetComponent<GrabbableObject>(); if ((Object)(object)component == (Object)null || (Object)(object)component.itemProperties == (Object)null) { Object.Destroy((Object)(object)val2); return false; } PowerMoon component2 = val2.GetComponent<PowerMoon>(); if ((Object)(object)component2 != (Object)null) { fromData.spawnedMoon = component2; component2.ID = GetMoonOrShardID(fromData); } ((NetworkBehaviour)component).NetworkObject.Spawn(false); float sfxRange = ((fromData.overrideSfxRange != -1f) ? fromData.overrideSfxRange : 25f); Transform parentObject = (((Object)(object)fromData.overrideMoonParent != (Object)null) ? ((Component)fromData.overrideMoonParent).transform : null); Vector3 moverPosition = (Vector3)(((Object)(object)fromData.moveMoonOnSpawn != (Object)null) ? ((Component)fromData.moveMoonOnSpawn).transform.position : default(Vector3)); if (flag && (Object)(object)component.itemProperties != (Object)null && (Object)(object)RoundManager.Instance != (Object)null) { Random.Range((float)component.itemProperties.minValue * RoundManager.Instance.scrapValueMultiplier, (float)component.itemProperties.maxValue * RoundManager.Instance.scrapValueMultiplier); } Instance.SpawnItemClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)component2).NetworkObject), fromData.moonValue, val.position, (Object)(object)fromData.overrideMoonParent != (Object)null, sfxRange, sfxCase, fromData.shardGroupTooltip, moverPosition); Instance.SpawnItemLocal((GrabbableObject)(object)component2, fromData.moonValue, val.position, parentObject, sfxRange, sfxCase, fromData.shardGroupTooltip, fromData.moveMoonOnSpawn); return true; } [ClientRpc] private void SpawnItemClientRpc(NetworkObjectReference itemNOR, int moonValue, Vector3 targetPos, bool searchLocalNetworkParent, float sfxRange, int sfxCase, string shardTooltip, Vector3 moverPosition) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00d3: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_01a0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3692726653u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref itemNOR, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val, moonValue); ((FastBufferWriter)(ref val)).WriteValueSafe(ref targetPos); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref searchLocalNetworkParent, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe<float>(ref sfxRange, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val, sfxCase); bool flag = shardTooltip != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe(shardTooltip, false); } ((FastBufferWriter)(ref val)).WriteValueSafe(ref moverPosition); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3692726653u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(GetItemOnClientDelayed(itemNOR, toSpawn: true, moonValue, targetPos, searchLocalNetworkParent, sfxRange, sfxCase, shardTooltip, moverPosition)); } } } private IEnumerator GetItemOnClientDelayed(NetworkObjectReference itemNOR, bool toSpawn, int moonValue = -1, Vector3 targetPos = default(Vector3), bool searchLocalNetworkParent = false, float sfxRange = -1f, int sfxCase = 0, string shardTooltip = null, Vector3 moverPosition = default(Vector3)) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_004d: Unknown result type (might be due to invalid IL or missing references) float timeWaited = 0f; float maxTime = 5f; float waitIntervals = 0.25f; bool success = false; GrabbableObject itemScript = null; NetworkObject val = default(NetworkObject); while (timeWaited < maxTime && !success) { if (((NetworkObjectReference)(ref itemNOR)).TryGet(ref val, (NetworkManager)null)) { itemScript = (GrabbableObject)(object)((Component)val).GetComponent<PowerMoon>(); } if ((Object)(object)itemScript != (Object)null) { success = true; continue; } yield return (object)new WaitForSeconds(waitIntervals); timeWaited += waitIntervals; } if ((Object)(object)itemScript == (Object)null) { yield break; } if (toSpawn) { Transform val2 = null; if (searchLocalNetworkParent) { GameObject val3 = NewDonkCityManager.SearchPhysicsComponentAtPosition(targetPos, "Local NetworkObject", 5f, logResults: true); if ((Object)(object)val3 != (Object)null) { val2 = val3.transform; } } MoveToPoint moveOnSpawn = null; if ((Object)(object)val2 != (Object)null && moverPosition != default(Vector3)) { GameObject val4 = NewDonkCityManager.SearchPhysicsComponentAtPosition(moverPosition, "Move To Point", 5f, logResults: true); if ((Object)(object)val4 != (Object)null) { moveOnSpawn = val4.GetComponent<MoveToPoint>(); } } SpawnItemLocal(itemScript, moonValue, targetPos, val2, sfxRange, sfxCase, shardTooltip, moveOnSpawn); } else { DespawnItemLocal(itemScript); } } private void SpawnItemLocal(GrabbableObject item, int moonValue, Vector3 targetPos, Transform parentObject, float sfxRange, int sfxCase, string shardTooltip, MoveToPoint moveOnSpawn) { //IL_0089: 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) //IL_0079: 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) if ((Object)(object)item == (Object)null || (Object)(object)item.itemProperties == (Object)null) { return; } item.fallTime = 1f; item.reachedFloorTarget = true; item.hasHitGround = true; ((Component)item).transform.SetParent(parentObject); if (item.itemProperties.isScrap) { item.SetScrapValue(moonValue); } PowerMoon powerMoon = item as PowerMoon; if ((Object)(object)powerMoon != (Object)null) { powerMoon.overrideSpawnPos = (((Object)(object)((Component)powerMoon).transform.parent != (Object)null) ? ((Component)powerMoon).transform.parent.InverseTransformPoint(parentObject.position) : targetPos); powerMoon.DoMoonSpawnAnimation(); powerMoon.InitializeShardOnSpawn(shardTooltip); if ((Object)(object)powerMoon.spawnSFX != (Object)null && spawnSFX != null && sfxCase >= 0 && sfxCase < spawnSFX.Length) { powerMoon.spawnSFX.minDistance = Mathf.Max(0f, sfxRange - 0.1f); powerMoon.spawnSFX.maxDistance = Mathf.Max(sfxRange, powerMoon.spawnSFX.minDistance + 0.1f); GenericManager.PlaySFX(powerMoon.spawnSFX, spawnSFX[sfxCase], audible: true, sfxRange * 0.75f); } if ((Object)(object)moveOnSpawn != (Object)null && (Object)(object)((Component)item).transform.parent != (Object)null) { moveOnSpawn.StartMovingObjectToPointNoSync(((Component)((Component)item).transform.parent).gameObject); } } if (HoarderBugAI.grabbableObjectsInMap != null && !HoarderBugAI.grabbableObjectsInMap.Contains(((Component)item).gameObject)) { HoarderBugAI.grabbableObjectsInMap.Add(((Component)item).gameObject); } if (item.itemProperties.isConductiveMetal) { StormyWeather stormWeather = NewDonkCityManager.GetStormWeather(); if ((Object)(object)stormWeather != (Object)null && stormWeather.metalObjects != null && !stormWeather.metalObjects.Contains(item)) { stormWeather.metalObjects.Add(item); } } } public static int GetMoonOrShardID(MoonData fromData) { if ((Object)(object)Instance == (Object)null || Instance.allMoons == null || Instance.allMoons.Count == 0 || Instance.allShards == null || Instance.allShards.Count == 0) { return -1; } MoonData moonData = null; for (int i = 0; i < Instance.allMoons.Count; i++) { moonData = Instance.allMoons[i]; if (!((Object)(object)moonData == (Object)null) && !((Object)(object)moonData != (Object)(object)fromData)) { Logger.LogDebug((object)$"got ID {i} for MOON {fromData}"); return i; } } for (int j = 0; j < Instance.allShards.Count; j++) { moonData = Instance.allShards[j]; if (!((Object)(object)moonData == (Object)null) && !((Object)(object)moonData != (Object)(object)fromData)) { Logger.LogDebug((object)$"got ID {j} for SHARD {fromData}"); return j; } } return -1; } public static MoonData GetMoonOrShard(int fromID, bool isMoon = true) { if ((Object)(object)Instance == (Object)null || fromID < 0) { return null; } if (isMoon) { if (Instance.allMoons == null || Instance.allMoons.Count == 0 || fromID >= Instance.allMoons.Count) { return null; } return Instance.allMoons[fromID]; } if (Instance.allShards == null || Instance.allShards.Count == 0 || fromID >= Instance.allShards.Count) { return null; } return Instance.allShards[fromID]; } public static void SetMoonIDCollected(PowerMoon moon, bool setTo = true) { if ((Object)(object)Instance == (Object)null || !((NetworkBehaviour)Instance).IsServer || (Object)(object)moon == (Object)null || moon.ID < 0 || ((GrabbableObject)moon).deactivated) { return; } if (moon.isShard) { if (Instance.allShards != null && Instance.allShards.Count != 0 && moon.ID < Instance.allShards.Count && setTo != Instance.allShards[moon.ID].collected) { Instance.allShards[moon.ID].collected = setTo; Logger.LogDebug((object)$"set SHARD {Instance.allShards[moon.ID]} at ID {moon.ID} to {Instance.allShards[moon.ID].collected}"); } } else if (Instance.allMoons != null && Instance.allMoons.Count != 0 && moon.ID < Instance.allMoons.Count && setTo != Instance.allMoons[moon.ID].collected) { Instance.allMoons[moon.ID].collected = setTo; Logger.LogDebug((object)$"set MOON {Instance.allMoons[moon.ID]} at ID {moon.ID} to {Instance.allMoons[moon.ID].collected}"); } } public static void DespawnMoon(MoonData fromData) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Instance == (Object)null) && ((NetworkBehaviour)Instance).IsServer && !((Object)(object)fromData == (Object)null) && !fromData.collected && !((Object)(object)fromData.spawnedMoon == (Object)null) && !((Object)(object)((NetworkBehaviour)fromData.spawnedMoon).NetworkObject == (Object)null) && ((NetworkBehaviour)fromData.spawnedMoon).NetworkObject.IsSpawned) { PowerMoon spawnedMoon = fromData.spawnedMoon; fromData.spawnedMoon = null; Instance.DespawnItemClientRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)spawnedMoon).NetworkObject)); Instance.DespawnItemLocal((GrabbableObject)(object)spawnedMoon); } } [ClientRpc] private void DespawnItemClientRpc(NetworkObjectReference moonNOR) { //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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3161010376u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(ref moonNOR, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3161010376u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer) { ((MonoBehaviour)this).StartCoroutine(GetItemOnClientDelayed(moonNOR, toSpawn: false)); } } } private void DespawnItemLocal(GrabbableObject item) { NewDonkCityManager.DestroyItem(item, ((NetworkBehaviour)item).NetworkObject); } public void OnLoadDelay() { LoadSavedData(); } public static void CheckShardsCollected(PowerMoon shard) { //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance == (Object)null || !((NetworkBehaviour)Instance).IsServer || Instance.allMoons == null || Instance.allMoons.Count == 0 || (Object)(object)shard == (Object)null || !shard.isShard || shard.ID < 0 || shard.ID >= Instance.allMoons.Count || (Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayerScripts == null) { return; } MoonData moonData = Instance.allShards[shard.ID]; if ((Object)(object)moonData == (Object)null || (moonData.shardsToCollect == -1 && (Object)(object)moonData.mainMoon == (Object)null)) { return; } MoonData moonData2 = null; if ((Object)(object)moonData.mainMoon != (Object)null) { moonData2 = moonData.mainMoon; } else if (moonData.shardsToCollect != -1) { moonData2 = moonData; } if ((Object)(object)moonData2 == (Object)null) { return; } List<PowerMoon> list = new List<PowerMoon>(); for (int i = 0; i < StartOfRound.Instance.allPlayerScripts.Length; i++) { PlayerControllerB val = StartOfRound.Instance.allPlayerScripts[i]; if ((Object)(object)val == (Object)null || !val.isPlayerControlled || val.ItemSlots == null) { continue; } for (int j = 0; j < val.ItemSlots.Length; j++) { GrabbableObject val2 = val.ItemSlots[j]; if ((Object)(object)val2 == (Object)null) { continue; } PowerMoon powerMoon = val2 as PowerMoon; if ((Object)(object)powerMoon == (Object)null || !powerMoon.isShard || ((GrabbableObject)powerMoon).deactivated) { continue; } MoonData moonDataForShard = GetMoonDataForShard(powerMoon); if (!((Object)(object)moonDataForShard == (Object)null) && !((Object)(object)moonDataForShard != (Object)(object)moonData2)) { list.Add(powerMoon); if (Application.isEditor) { Logger.LogDebug((object)$"found shard {powerMoon} #{list.Count} for moon {moonData2}"); } } } } if (list != null && list.Count >= moonData2.shardsToCollect) { Vector3 position = ((Component)shard).transform.position; GenericManager.PlaySFXAtLocation(position, Instance.correctSolutionSFX, audible: false, 15f, 0.6f, 0f); MoonManager instance = Instance; MoonManager instance2 = Instance; GrabbableObject[] shardsForMoon = (GrabbableObject[])(object)list.ToArray(); ((MonoBehaviour)instance).StartCoroutine(instance2.SpawnMoonAndDestroyShards(shardsForMoon, moonData2, position)); } } private IEnumerator SpawnMoonAndDestroyShards(GrabbableObject[] shardsForMoon, MoonData moonData, Vector3 startPos) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) yield return (object)new WaitForSeconds(0.75f); DestroyShardsServer(shardsForMoon, moonData, startPos); yield return (object)new WaitForSeconds(0.1f); moonData.shardsToCollect = -1; SpawnMoon(moonData); } private void DestroyShardsServer(GrabbableObject[] items, MoonData setMoonParentObject, Vector3 setParentObjectPosition) { //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)Instance == (Object)null) && ((NetworkBehaviour)Instance).IsServer && items != null && items.Length != 0) { NewDonkCityManager.DestroyItemMultiple(items, despawnNetworkObjects: true, printDebug: true); NetworkObjectReference[] array = (NetworkObjectReference[])(object)new NetworkObjectReference[items.Length]; for (int i = 0; i < items.Length; i++) { array[i] = NetworkObjectReference.op_Implicit(((NetworkBehaviour)items[i]).NetworkObject); } Instance.DestroyShardsClientRpc(array, GetMoonOrShardID(setMoonParentObject), setParentObjectPosition); if ((Object)(object)setMoonParentObject != (Object)null && (Object)(object)setMoonParentObject.overrideMoonParent != (Object)null) { ((Component)setMoonParentObject.overrideMoonParent).transform.position = setParentObjectPosition; } } } [ClientRpc] private void DestroyShardsClientRpc(NetworkObjectReference[] itemNORs, int setMoonParentObject, Vector3 setParentObjectPosition) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_0088: 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) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: 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_01e2: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(4179404541u, val2, (RpcDelivery)0); bool flag = itemNORs != null; ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val)).WriteValueSafe<NetworkObjectReference>(itemNORs, default(ForNetworkSerializable)); } BytePacker.WriteValueBitPacked(val, setMoonParentObject); ((FastBufferWriter)(ref val)).WriteValueSafe(ref setParentObjectPosition); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 4179404541u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { return; } GrabbableObject[] array = (GrabbableObject[])(object)new GrabbableObject[itemNORs.Length]; NetworkObject val3 = null; for (int i = 0; i < itemNORs.Length; i++) { if (((NetworkObjectReference)(ref itemNORs[i])).TryGet(ref val3, (NetworkManager)null)) { array[i] = ((Component)val3).GetComponent<GrabbableObject>(); } } NewDonkCityManager.DestroyItemMultiple(array); if ((Object)(object)Instance != (Object)null && Instance.allMoons != null && Instance.allMoons.Count != 0 && setMoonParentObject >= 0 && setMoonParentObject < Instance.allMoons.Count) { MoonData moonData = Instance.allMoons[setMoonParentObject]; if ((Object)(object)moonData != (Object)null && (Object)(object)moonData.overrideMoonParent != (Object)null) { ((Component)moonData.overrideMoonParent).transform.position = setParentObjectPosition; } } } private static MoonData GetMoonDataForShard(PowerMoon shard) { if ((Object)(object)shard == (Object)null || Instance.allShards == null || Instance.allShards.Count == 0 || shard.ID < 0 || shard.ID >= Instance.allShards.Count || (Object)(object)Instance.allShards[shard.ID].mainMoon == (Object)null) { return null; } return Instance.allShards[shard.ID].mainMoon; } public void OnDayEnd() { SaveSavedData(); } private void SaveSavedData() { if (!((NetworkBehaviour)this).IsServer || allMoons == null || allMoons.Count == 0) { return; } bool flag = true; for (int i = 0; i < allMoons.Count; i++) { if (!((Object)(object)allMoons[i] == (Object)null)) { if ((Object)(object)allMoons[i].saveScript != (Object)null) { allMoons[i].saveScript.SaveData(allMoons[i].collected ? 1 : 0); } if (!allMoons[i].collected) { flag = false; } } } if (flag) { NewDonkCityManager.SetParameterScrapSpawn(1.75f, 1.5f); NewDonkCityManager.SetParameterSizeMultiplier(1.2f); } } private void LoadSavedData() { if (((NetworkBehaviour)this).IsServer && allMoons != null && allMoons.Count != 0) { ((MonoBehaviour)this).StartCoroutine(LoadSavedDataCoroutine()); } } private IEnumerator LoadSavedDataCoroutine() { int moonsCollected = 0; bool collectedAllMoons = true; for (int i = 0; i < Instance.allMoons.Count; i++) { yield return null; if ((Object)(object)Instance.allMoons[i] == (Object)null || (Object)(object)Instance.allMoons[i].saveScript == (Object)null) { continue; } LoadedDataState loadedDataState = Instance.allMoons[i].saveScript.RetrieveData(); Instance.allMoons[i].collected = ((loadedDataState != null && loadedDataState.loadSuccessful && (int)loadedDataState.loadedValue == 1) ? true : false); if (Instance.allMoons[i].collected) { moonsCollected += GetMoonCountTowardTotal(Instance.allMoons[i]); if (Instance.allMoons[i].onAlreadyCollected != null && ((UnityEventBase)Instance.allMoons[i].onAlreadyCollected).GetPersistentEventCount() != 0) { Instance.allMoons[i].onAlreadyCollected.Invoke(); OnAlreadyCollectedClientRpc(i); } } else { collectedAllMoons = false; } } if ((Object)(object)moonDisplay != (Object)null) { moonDisplay.SetCollectedMoonsDisplay(moonsCollected, collectedAllMoons); UpdateMoonDisplayOnShipClientRpc(moonsCollected, collectedAllMoons); } loadedMoonSaveData = true; } private int GetMoonCountTowardTotal(MoonData fromData) { if ((Object)(object)fromData == (Object)null) { return 0; } GameObject overrideSpawnPrefab = Instance.spawnPrefabMoon; if ((Object)(object)fromData.mainMoon != (Object)null) { overrideSpawnPrefab = Instance.spawnPrefabShard; } else if ((Object)(object)fromData.overrideSpawnPrefab != (Object)null) { overrideSpawnPrefab = fromData.overrideSpawnPrefab; } if ((Object)(object)overrideSpawnPrefab == (Object)null) { return 0; } PowerMoon component = overrideSpawnPrefab.GetComponent<PowerMoon>(); if ((Object)(object)component == (Object)null) { return 0; } return component.countTowardsTotal; } [ClientRpc] private void OnAlreadyCollectedClientRpc(int moonID) { //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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3656971199u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, moonID); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3656971199u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer && allMoons != null && moonID >= 0 && moonID < allMoons.Count) { MoonData moonData = allMoons[moonID]; if (!((Object)(object)moonData == (Object)null)) { moonData.collected = true; moonData.onAlreadyCollected.Invoke(); } } } [ClientRpc] private void UpdateMoonDisplayOnShipClientRpc(int serverCollected, bool serverComplete) { //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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: 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)base.__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(1978534493u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, serverCollected); ((FastBufferWriter)(ref val)).WriteValueSafe<bool>(ref serverComplete, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 1978534493u, val2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { base.__rpc_exec_stage = (__RpcExecStage)0; if (!((NetworkBehaviour)this).IsServer && (Object)(object)moonDisplay != (Object)null) { moonDisplay.SetCollectedMoonsDisplay(serverCollected, serverComplete); } } } 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, b