using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using WaterGunLib.Bundles; using WaterGunLib.Fields; using WaterGunLib.Modules; using WaterGunLib.NetcodePatcher; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("WaterGunLib")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WaterGunLib")] [assembly: AssemblyTitle("WaterGunLib")] [assembly: AssemblyVersion("1.0.0.0")] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace WaterGunLib { public class DamageTrigger : MonoBehaviour { [Space] [Header("Settings")] public int Delay = 3; public int Damage = 20; public CauseOfDeath DeathType; public int DeathAnimation = 0; public bool DamageSFX = false; private bool IsAbleToDealDamage = true; private void OnTriggerStay(Collider other) { if (Object.op_Implicit((Object)(object)((Component)other).GetComponent())) { ((MonoBehaviour)this).StartCoroutine(DamagePlayerAfterDelay(((Component)other).GetComponent())); } } private IEnumerator DamagePlayerAfterDelay(PlayerControllerB Player) { if (IsAbleToDealDamage) { IsAbleToDealDamage = false; Player.DamagePlayer(Damage, true, true, DeathType, DeathAnimation, false, default(Vector3)); Debug.Log((object)("Damaged Player: " + Player.playerUsername)); yield return (object)new WaitForSeconds((float)Delay); IsAbleToDealDamage = true; } } } public class EnemySpawner : NetworkBehaviour { [Space] [Header("Refrences")] public Transform SpawnTransform; [Space] [Header("Settings")] public bool IsDynamic = false; [Space] [Header("Single Enemy Spawn Settings")] private string EnemyName; [Space] [Header("Mutiple Enemy Spawn Settings")] public string[] EnemyNames; public float TimeBetweenSpawn = 5f; public int SpawnCap = -1; private int Spawns = 0; private bool IsSpawningEnabled; public void SpawnEnemy() { SpawnEnemyServerRpc(); } [Rpc(/*Could not decode attribute arguments.*/)] private void SpawnEnemyServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1067344233u, val3, val, (SendTo)2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1067344233u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (!IsDynamic) { EnemyType val4 = Resources.FindObjectsOfTypeAll().First((EnemyType enemytype) => enemytype.enemyName == EnemyName); GameObject val5 = Object.Instantiate(val4.enemyPrefab, SpawnTransform.position, SpawnTransform.rotation); val5.GetComponent().Spawn(false); if (SpawnCap != -1) { Spawns++; } } else { if (Spawns > SpawnCap) { return; } EnemyType[] array = Resources.FindObjectsOfTypeAll(); List list = new List(); EnemyType[] array2 = array; foreach (EnemyType val6 in array2) { if (EnemyNames.Contains(val6.enemyName)) { list.Add(val6); } } int index = Random.Range(0, list.Count); GameObject val7 = Object.Instantiate(list[index].enemyPrefab, SpawnTransform.position, SpawnTransform.rotation); val7.GetComponent().Spawn(false); if (SpawnCap != -1) { Spawns++; } ((MonoBehaviour)this).StartCoroutine(SpawnEnemyAfterDelay()); } } public void ToggleSpawning() { if (!IsSpawningEnabled) { IsSpawningEnabled = true; ((MonoBehaviour)this).StartCoroutine(SpawnEnemyAfterDelay()); } else { IsSpawningEnabled = false; } } private IEnumerator SpawnEnemyAfterDelay() { yield return (object)new WaitForSeconds(TimeBetweenSpawn); if (IsSpawningEnabled) { SpawnEnemy(); } } 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 ((NetworkBehaviour)this).__registerRpc(1067344233u, new RpcReceiveHandler(__rpc_handler_1067344233), "SpawnEnemyServerRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_1067344233(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((EnemySpawner)(object)target).SpawnEnemyServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "EnemySpawner"; } } public class HittableObject : NetworkBehaviour, IHittable { public UnityEvent? onObjectBreak; public UnityEvent? onObjectHit; public bool syncObjectBreak = false; public bool syncObjectHit = false; public int objectHp = 5; bool IHittable.Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID) { if (syncObjectHit) { DamageObjectRpc(); } else { DamageObject(); } return true; } private void DamageObject() { objectHp--; if (objectHp == 0) { UnityEvent? obj = onObjectBreak; if (obj != null) { obj.Invoke(); } } else { UnityEvent? obj2 = onObjectHit; if (obj2 != null) { obj2.Invoke(); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void DamageObjectRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(682840934u, val3, val, (SendTo)2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 682840934u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; objectHp--; if (objectHp == 0) { InvokeBreakRpc(); } else { InvokeHitRpc(); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void InvokeBreakRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_00a5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(460235183u, val3, val, (SendTo)6, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 460235183u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; UnityEvent? obj = onObjectBreak; if (obj != null) { obj.Invoke(); } } } [Rpc(/*Could not decode attribute arguments.*/)] private void InvokeHitRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_00a5: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1869107307u, val3, val, (SendTo)6, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1869107307u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; UnityEvent? obj = onObjectHit; if (obj != null) { obj.Invoke(); } } } 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 ((NetworkBehaviour)this).__registerRpc(682840934u, new RpcReceiveHandler(__rpc_handler_682840934), "DamageObjectRpc"); ((NetworkBehaviour)this).__registerRpc(460235183u, new RpcReceiveHandler(__rpc_handler_460235183), "InvokeBreakRpc"); ((NetworkBehaviour)this).__registerRpc(1869107307u, new RpcReceiveHandler(__rpc_handler_1869107307), "InvokeHitRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_682840934(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((HittableObject)(object)target).DamageObjectRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_460235183(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((HittableObject)(object)target).InvokeBreakRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1869107307(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { target.__rpc_exec_stage = (__RpcExecStage)1; ((HittableObject)(object)target).InvokeHitRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "HittableObject"; } } public class ItemSpawner : MonoBehaviour { [Header("Settings")] public bool spawnOnStart = false; public Transform? spawnPos; [Space(5f)] [Header("Items")] public string[]? possibleItemNames; private void Start() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (spawnOnStart && (Object)(object)spawnPos != (Object)null) { SpawnRandomItem(spawnPos.position); } } public void SpawnRandomItem(Vector3 position) { //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) if (!NetworkManager.Singleton.IsServer) { return; } string[]? array = possibleItemNames; if (array != null && array.Length != 0) { int num = Random.Range(0, possibleItemNames.Count()); Item itemFromName = ItemManagement.GetItemFromName(possibleItemNames[num]); GameObject val = Object.Instantiate(ItemManagement.GetItemFromName(possibleItemNames[num]).spawnPrefab, position, Quaternion.identity, (Transform)null); Debug.Log((object)$"Spawning item: {val}"); if (itemFromName.isScrap) { int num2 = Random.Range(itemFromName.minValue, itemFromName.maxValue); val.GetComponent().SetScrapValue(Mathf.RoundToInt((float)(num2 / 2))); val.GetComponent().Spawn(false); } else { val.GetComponent().Spawn(false); } } } public void SpawnRandomItem(Transform transform) { //IL_0063: 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) if (!NetworkManager.Singleton.IsServer) { return; } string[]? array = possibleItemNames; if (array != null && array.Length != 0) { int num = Random.Range(0, possibleItemNames.Count()); Item itemFromName = ItemManagement.GetItemFromName(possibleItemNames[num]); GameObject val = Object.Instantiate(ItemManagement.GetItemFromName(possibleItemNames[num]).spawnPrefab, transform.position, Quaternion.identity, (Transform)null); Debug.Log((object)$"Spawning item: {val}"); if (itemFromName.isScrap) { int num2 = Random.Range(itemFromName.minValue, itemFromName.maxValue); val.GetComponent().SetScrapValue(Mathf.RoundToInt((float)(num2 / 2))); val.GetComponent().Spawn(false); } else { val.GetComponent().Spawn(false); } } } public void SpawnRandomItem() { //IL_007e: 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 (!NetworkManager.Singleton.IsServer) { return; } string[]? array = possibleItemNames; if (array == null || array.Length == 0) { return; } int num = Random.Range(0, possibleItemNames.Count()); Item itemFromName = ItemManagement.GetItemFromName(possibleItemNames[num]); if ((Object)(object)spawnPos != (Object)null) { GameObject val = Object.Instantiate(ItemManagement.GetItemFromName(possibleItemNames[num]).spawnPrefab, spawnPos.position, Quaternion.identity, (Transform)null); Debug.Log((object)$"Spawning item: {val}"); if (itemFromName.isScrap) { int num2 = Random.Range(itemFromName.minValue, itemFromName.maxValue); val.GetComponent().SetScrapValue(Mathf.RoundToInt((float)(num2 / 2))); val.GetComponent().Spawn(false); } else { val.GetComponent().Spawn(false); } } } } [BepInPlugin("WaterGun.WaterGunLib", "WaterGunLib", "1.6.0")] public class Plugin : BaseUnityPlugin { [HarmonyPatch(typeof(GameNetworkManager), "Start")] internal class GameNetworkManager_Start { [HarmonyPrefix] public static void Prefix(GameNetworkManager __instance) { foreach (GameObject item in prefabsToNetwork) { if (NetworkManager.Singleton.NetworkConfig.Prefabs.Contains(item)) { break; } NetworkManager.Singleton.AddNetworkPrefab(item); } } } [HarmonyPatch(typeof(StartOfRound), "Awake")] internal class StartOfRound_Awake { [HarmonyPostfix] public static void Postfix() { //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Expected O, but got Unknown //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Expected O, but got Unknown //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Expected O, but got Unknown //IL_0391: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Expected O, but got Unknown //IL_04d9: Unknown result type (might be due to invalid IL or missing references) //IL_04e3: Expected O, but got Unknown //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Expected O, but got Unknown //IL_0603: Unknown result type (might be due to invalid IL or missing references) //IL_060d: Expected O, but got Unknown Terminal val = Object.FindObjectOfType(); TerminalKeyword val2 = val.terminalNodes.allKeywords.First((TerminalKeyword keyword) => keyword.word == "info"); foreach (Enemies.RegisteredEnemy enemy in Enemies.registeredEnemies) { if (enemy.globalRarity > -1) { SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val3 in levels) { if (enemy.spawnType == Enemies.SpawnType.Indoor) { val3.Enemies.Add(new SpawnableEnemyWithRarity(enemy.enemyType, enemy.globalRarity)); } else if (enemy.spawnType == Enemies.SpawnType.Outdoor) { val3.OutsideEnemies.Add(new SpawnableEnemyWithRarity(enemy.enemyType, enemy.globalRarity)); } else if (enemy.spawnType == Enemies.SpawnType.DayTime) { val3.DaytimeEnemies.Add(new SpawnableEnemyWithRarity(enemy.enemyType, enemy.globalRarity)); } } } if (enemy.moons.Count <= 0) { return; } foreach (MoonObject moonRarity in enemy.moons) { if (!StartOfRound.Instance.levels.Any((SelectableLevel level) => level.PlanetName == moonRarity.moonName)) { continue; } bool flag = enemy.globalRarity > -1; SelectableLevel val4 = StartOfRound.Instance.levels.First((SelectableLevel moon) => moon.PlanetName == moonRarity.moonName); if (flag) { if (enemy.spawnType == Enemies.SpawnType.Indoor) { ((IEnumerable)val4.Enemies).FirstOrDefault((Func)((SpawnableEnemyWithRarity e) => (Object)(object)e.enemyType == (Object)(object)enemy.enemyType)).rarity = moonRarity.rarity; } else if (enemy.spawnType == Enemies.SpawnType.Outdoor) { ((IEnumerable)val4.OutsideEnemies).FirstOrDefault((Func)((SpawnableEnemyWithRarity e) => (Object)(object)e.enemyType == (Object)(object)enemy.enemyType)).rarity = moonRarity.rarity; } else if (enemy.spawnType == Enemies.SpawnType.DayTime) { ((IEnumerable)val4.DaytimeEnemies).FirstOrDefault((Func)((SpawnableEnemyWithRarity e) => (Object)(object)e.enemyType == (Object)(object)enemy.enemyType)).rarity = moonRarity.rarity; } } else if (enemy.spawnType == Enemies.SpawnType.Indoor) { val4.Enemies.Add(new SpawnableEnemyWithRarity(enemy.enemyType, enemy.globalRarity)); } else if (enemy.spawnType == Enemies.SpawnType.Outdoor) { val4.OutsideEnemies.Add(new SpawnableEnemyWithRarity(enemy.enemyType, enemy.globalRarity)); } else if (enemy.spawnType == Enemies.SpawnType.DayTime) { val4.DaytimeEnemies.Add(new SpawnableEnemyWithRarity(enemy.enemyType, enemy.globalRarity)); } } } foreach (SpawnableOutsideObjects.RegisteredOutsideObject obj in SpawnableOutsideObjects.registeredOutsideObjects) { SelectableLevel[] levels2 = StartOfRound.Instance.levels; foreach (SelectableLevel val5 in levels2) { if (obj.globalRandomAmount == null) { break; } if (!val5.spawnableOutsideObjects.Any((SpawnableOutsideObjectWithRarity x) => (Object)(object)x.spawnableObject == (Object)(object)obj.outsideObject)) { List list = val5.spawnableOutsideObjects.ToList(); list.Add(new SpawnableOutsideObjectWithRarity(obj.outsideObject, obj.globalRandomAmount)); val5.spawnableOutsideObjects = list.ToArray(); } } if (obj.moons.Count <= 0) { break; } foreach (MoonObjectCurve moonRarity2 in obj.moons) { SelectableLevel val6 = ((IEnumerable)StartOfRound.Instance.levels).FirstOrDefault((Func)((SelectableLevel moon) => moon.PlanetName == moonRarity2.moonName)); if (!((Object)(object)val6 == (Object)null)) { SpawnableOutsideObjectWithRarity val7 = ((IEnumerable)val6.spawnableOutsideObjects).FirstOrDefault((Func)((SpawnableOutsideObjectWithRarity o) => (Object)(object)o.spawnableObject == (Object)(object)obj.outsideObject)); if (val7 != null) { val7.randomAmount = moonRarity2.randomSpawn; continue; } List list2 = val6.spawnableOutsideObjects.ToList(); list2.Add(new SpawnableOutsideObjectWithRarity(obj.outsideObject, moonRarity2.randomSpawn)); val6.spawnableOutsideObjects = list2.ToArray(); } } } } } [HarmonyPatch(typeof(Terminal), "Start")] internal class Terminal_Start { [HarmonyPrefix] public static void Prefix(Terminal __instance) { //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Expected O, but got Unknown TerminalKeyword val = __instance.terminalNodes.allKeywords.First((TerminalKeyword val3) => val3.word == "info"); foreach (Enemies.RegisteredEnemy enemy in Enemies.registeredEnemies) { if ((Object)(object)enemy.infoNode == (Object)null) { enemy.infoNode = ScriptableObject.CreateInstance(); enemy.infoNode.displayText = "No information given about " + enemy.enemyType.enemyName + "\n\n"; enemy.infoNode.clearPreviousText = true; enemy.infoNode.creatureName = enemy.enemyType.enemyName; enemy.infoNode.maxCharactersToType = 35; } if (__instance.enemyFiles.Any((TerminalNode file) => file.creatureName == enemy.infoNode.creatureName)) { Debug.LogError((object)("[WaterGunLib]: " + enemy.infoNode.creatureName + "Already exists in enemiesList")); continue; } TerminalKeyword keyword = ScriptableObject.CreateInstance(); keyword.word = enemy.infoNode.creatureName.ToLowerInvariant().Replace(" ", "-"); keyword.defaultVerb = val; List list = __instance.terminalNodes.allKeywords.ToList(); if (!list.Any((TerminalKeyword x) => x.word == keyword.word)) { list.Add(keyword); __instance.terminalNodes.allKeywords = list.ToArray(); } List list2 = val.compatibleNouns.ToList(); if (!list2.Any((CompatibleNoun x) => x.noun.word == keyword.word)) { list2.Add(new CompatibleNoun(keyword, enemy.infoNode)); val.compatibleNouns = list2.ToArray(); } enemy.infoNode.creatureFileID = __instance.enemyFiles.Count; __instance.enemyFiles.Add(enemy.infoNode); ScanNodeProperties[] componentsInChildren = enemy.enemyType.enemyPrefab.GetComponentsInChildren(); ScanNodeProperties[] array = componentsInChildren; foreach (ScanNodeProperties val2 in array) { val2.creatureScanID = enemy.infoNode.creatureFileID; } } } } [HarmonyPatch(typeof(Terminal), "Awake")] internal class Terminal_Awake { [HarmonyPrefix] public static void Prefix(Terminal __instance) { //IL_0bb8: Unknown result type (might be due to invalid IL or missing references) //IL_0bbe: Expected O, but got Unknown //IL_02bc: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Expected O, but got Unknown //IL_0bf0: Unknown result type (might be due to invalid IL or missing references) //IL_0bf6: Expected O, but got Unknown //IL_0720: Unknown result type (might be due to invalid IL or missing references) //IL_0726: Expected O, but got Unknown //IL_0758: Unknown result type (might be due to invalid IL or missing references) //IL_075e: Expected O, but got Unknown //IL_0c86: Unknown result type (might be due to invalid IL or missing references) //IL_0c90: Expected O, but got Unknown //IL_07d8: Unknown result type (might be due to invalid IL or missing references) //IL_07e2: Expected O, but got Unknown //IL_0d57: Unknown result type (might be due to invalid IL or missing references) //IL_0d61: Expected O, but got Unknown //IL_08a9: Unknown result type (might be due to invalid IL or missing references) //IL_08b3: Expected O, but got Unknown //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Expected O, but got Unknown foreach (Unlockables.RegisteredUnlockable unlockable in Unlockables.registeredUnlockables) { if (StartOfRound.Instance.unlockablesList.unlockables.Any((UnlockableItem x) => x.unlockableName == unlockable.unlockableItem?.unlockableName)) { Debug.LogError((object)("[WaterGunLib]: " + unlockable.unlockableItem?.unlockableName + "Already exists in unlockablesList")); continue; } if ((Object)(object)unlockable.unlockableItem?.prefabObject != (Object)null) { PlaceableShipObject componentInChildren = unlockable.unlockableItem.prefabObject.GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.unlockableID = StartOfRound.Instance.unlockablesList.unlockables.Count; } } StartOfRound.Instance.unlockablesList.unlockables.Add(unlockable.unlockableItem); } TerminalKeyword val = __instance.terminalNodes.allKeywords.First((TerminalKeyword val12) => val12.word == "buy"); TerminalNode result = val.compatibleNouns[0].result.terminalOptions[1].result; TerminalKeyword val2 = __instance.terminalNodes.allKeywords.First((TerminalKeyword val12) => val12.word == "info"); foreach (Items.RegisteredItem item in Items.registeredItems) { if (!StartOfRound.Instance.allItemsList.itemsList.Any((Item x) => x.itemName == item.item.itemName)) { StartOfRound.Instance.allItemsList.itemsList.Add(item.item); } if (!item.isShopItem) { if (item.globalRarity > -1) { SelectableLevel[] levels = StartOfRound.Instance.levels; foreach (SelectableLevel val3 in levels) { if (!val3.spawnableScrap.Any((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)item.item)) { val3.spawnableScrap.Add(new SpawnableItemWithRarity(item.item, item.globalRarity)); } } } if (item.moons == null || item.moons.Count <= 0) { continue; } foreach (MoonObject moonRarity in item.moons) { SelectableLevel val4 = ((IEnumerable)StartOfRound.Instance.levels).FirstOrDefault((Func)((SelectableLevel moon) => moon.PlanetName == moonRarity.moonName)); if (!((Object)(object)val4 == (Object)null)) { SpawnableItemWithRarity val5 = ((IEnumerable)val4.spawnableScrap).FirstOrDefault((Func)((SpawnableItemWithRarity x) => (Object)(object)x.spawnableItem == (Object)(object)item.item)); if (val5 != null) { val5.rarity = moonRarity.rarity; } else { val4.spawnableScrap.Add(new SpawnableItemWithRarity(item.item, moonRarity.rarity)); } } } } else { if (!item.isShopItem) { continue; } if (!__instance.buyableItemsList.Any((Item itemScript) => (Object)(object)itemScript == (Object)(object)item.item)) { List list = __instance.buyableItemsList.ToList(); list.Add(item.item); __instance.buyableItemsList = list.ToArray(); } TerminalKeyword keyword = ScriptableObject.CreateInstance(); ((Object)keyword).name = item.item.itemName.Replace(" ", "-"); keyword.defaultVerb = val; keyword.word = item.item.itemName.ToLowerInvariant().Replace(" ", "-"); if (__instance.terminalNodes.allKeywords.Any((TerminalKeyword x) => x.word == keyword.word)) { Debug.LogError((object)("[WaterGunLib]: Keyword: " + keyword.word + " already exists")); continue; } List list2 = __instance.buyableItemsList.ToList(); int num2 = list2.IndexOf(item.item); int buyItemIndex = ((num2 == -1) ? (list2.Count - 1) : num2); TerminalNode val6 = ScriptableObject.CreateInstance(); ((Object)val6).name = item.item.itemName.Replace(" ", "-") + "BuyNode2"; val6.displayText = "Ordered [variableAmount] " + item.item.itemName + ". Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\r\n\r\n"; val6.clearPreviousText = true; val6.maxCharactersToType = 15; val6.buyItemIndex = buyItemIndex; val6.creatureName = item.item.itemName; val6.isConfirmationNode = false; val6.itemCost = item.item.creditsWorth; val6.playSyncedClip = 0; TerminalNode val7 = ScriptableObject.CreateInstance(); ((Object)val7).name = item.item.itemName.Replace(" ", "-") + "BuyNode1"; val7.displayText = "You have requested to order " + item.item.itemName + ". Amount: [variableAmount].\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\r\n\r\n"; val7.clearPreviousText = true; val7.maxCharactersToType = 35; val7.buyItemIndex = buyItemIndex; val7.creatureName = item.item.itemName; val7.isConfirmationNode = true; val7.overrideOptions = true; val7.itemCost = item.item.creditsWorth; val7.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2] { new CompatibleNoun(__instance.terminalNodes.allKeywords.First((TerminalKeyword val12) => val12.word == "confirm"), val6), new CompatibleNoun(__instance.terminalNodes.allKeywords.First((TerminalKeyword val12) => val12.word == "deny"), result) }; if (!__instance.terminalNodes.allKeywords.Any((TerminalKeyword k) => k.word == keyword.word)) { List list3 = __instance.terminalNodes.allKeywords.ToList(); list3.Add(keyword); __instance.terminalNodes.allKeywords = list3.ToArray(); List list4 = val.compatibleNouns.ToList(); list4.Add(new CompatibleNoun(keyword, val7)); val.compatibleNouns = list4.ToArray(); TerminalNode val8 = item.infoNode; if ((Object)(object)val8 == (Object)null) { val8 = ScriptableObject.CreateInstance(); ((Object)val8).name = item.item.itemName.Replace(" ", "-") + "InfoNode"; val8.displayText = "No information given about " + item.item.itemName + "\n\n"; val8.clearPreviousText = true; val8.maxCharactersToType = 25; } __instance.terminalNodes.allKeywords = list3.ToArray(); List list5 = val2.compatibleNouns.ToList(); list5.Add(new CompatibleNoun(keyword, val8)); val2.compatibleNouns = list5.ToArray(); } } } foreach (Unlockables.RegisteredUnlockable item2 in Unlockables.registeredUnlockables) { TerminalKeyword keyword2 = ScriptableObject.CreateInstance(); ((Object)keyword2).name = item2.unlockableItem.unlockableName.Replace(" ", "-"); keyword2.defaultVerb = val; keyword2.word = item2.unlockableItem.unlockableName.ToLowerInvariant().Replace(" ", "-"); if (__instance.terminalNodes.allKeywords.Any((TerminalKeyword x) => x.word == keyword2.word)) { Debug.LogError((object)("[WaterGunLib]: Keyword: " + keyword2.word + " already exists")); continue; } int shipUnlockableID = StartOfRound.Instance.unlockablesList.unlockables.FindIndex((UnlockableItem val12) => val12.unlockableName == item2.unlockableItem.unlockableName); TerminalNode val9 = ScriptableObject.CreateInstance(); ((Object)val9).name = item2.unlockableItem.unlockableName.Replace(" ", "-") + "BuyNode2"; val9.displayText = "Ordered [variableAmount] " + item2.unlockableItem.unlockableName + ". Your new balance is [playerCredits].\n\nOur contractors enjoy fast, free shipping while on the job! Any purchased items will arrive hourly at your approximate location.\r\n\r\n"; val9.clearPreviousText = true; val9.maxCharactersToType = 15; val9.buyItemIndex = -1; val9.shipUnlockableID = shipUnlockableID; val9.buyUnlockable = true; val9.creatureName = item2.unlockableItem.unlockableName; val9.isConfirmationNode = false; val9.itemCost = item2.price; val9.playSyncedClip = 0; TerminalNode val10 = ScriptableObject.CreateInstance(); val10 = ScriptableObject.CreateInstance(); ((Object)val10).name = item2.unlockableItem.unlockableName.Replace(" ", "-") + "BuyNode1"; val10.displayText = "You have requested to order " + item2.unlockableItem.unlockableName + ". Amount: [variableAmount].\nTotal cost of items: [totalCost].\n\nPlease CONFIRM or DENY.\r\n\r\n"; val10.clearPreviousText = true; val10.maxCharactersToType = 35; val10.buyItemIndex = -1; val10.shipUnlockableID = shipUnlockableID; val10.creatureName = item2.unlockableItem.unlockableName; val10.isConfirmationNode = true; val10.overrideOptions = true; val10.itemCost = item2.price; val10.terminalOptions = (CompatibleNoun[])(object)new CompatibleNoun[2] { new CompatibleNoun(__instance.terminalNodes.allKeywords.First((TerminalKeyword val12) => val12.word == "confirm"), val9), new CompatibleNoun(__instance.terminalNodes.allKeywords.First((TerminalKeyword val12) => val12.word == "deny"), result) }; if (item2.storeType == Unlockables.StoreType.Decor) { item2.unlockableItem.shopSelectionNode = val10; } else { item2.unlockableItem.shopSelectionNode = null; } List list6 = __instance.terminalNodes.allKeywords.ToList(); list6.Add(keyword2); __instance.terminalNodes.allKeywords = list6.ToArray(); List list7 = val.compatibleNouns.ToList(); list7.Add(new CompatibleNoun(keyword2, val10)); val.compatibleNouns = list7.ToArray(); TerminalNode val11 = item2.itemInfo; if ((Object)(object)val11 == (Object)null) { val11 = ScriptableObject.CreateInstance(); ((Object)val11).name = item2.unlockableItem.unlockableName.Replace(" ", "-") + "InfoNode"; val11.displayText = "No information given about " + item2.unlockableItem.unlockableName + "\n\n"; val11.clearPreviousText = true; val11.maxCharactersToType = 25; } __instance.terminalNodes.allKeywords = list6.ToArray(); List list8 = val2.compatibleNouns.ToList(); list8.Add(new CompatibleNoun(keyword2, val11)); val2.compatibleNouns = list8.ToArray(); } } } [HarmonyPatch(typeof(Terminal), "TextPostProcess")] internal class Terminal_TextPostProcess { [HarmonyPrefix] public static void Prefix(ref TerminalNode node, ref string modifiedDisplayText, Terminal __instance) { if (!modifiedDisplayText.Contains("[buyableItemsList]") || !modifiedDisplayText.Contains("[unlockablesSelectionList]")) { return; } int num = modifiedDisplayText.IndexOf(":"); foreach (Unlockables.RegisteredUnlockable registeredUnlockable in Unlockables.registeredUnlockables) { if (registeredUnlockable.storeType == Unlockables.StoreType.ShipUpgrade) { string unlockableName = registeredUnlockable.unlockableItem.unlockableName; int price = registeredUnlockable.price; string value = $"\n* {unlockableName} // Price: ${price}"; modifiedDisplayText = modifiedDisplayText.Insert(num + 1, value); } } } } private const string GUID = "WaterGun.WaterGunLib"; private const string VER = "1.6.0"; private const string NAME = "WaterGunLib"; public static List prefabsToNetwork = new List(); public static List sceneBundles = new List(); private void Awake() { //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Expected O, but got Unknown Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } string pluginPath = Paths.PluginPath; string[] files = Directory.GetFiles(pluginPath, "*.watergunlib", SearchOption.AllDirectories); string[] array3 = files; foreach (string text in array3) { Debug.Log((object)("[WaterGunLib]: Found bundle: " + text)); AssetBundle val = AssetBundle.LoadFromFile(text); if ((Object)(object)val == (Object)null) { Debug.LogError((object)("[WaterGunLib]: Failed to load bundle: " + text)); continue; } WaterGunLibMod[] array4 = val.LoadAllAssets(); WaterGunLibMod[] array5 = array4; foreach (WaterGunLibMod waterGunLibMod in array5) { foreach (UnlockableItemRef unlockable in waterGunLibMod.Unlockables) { Unlockables.RegisterUnlockable(unlockable, waterGunLibMod.ModGUID); } foreach (SpawnableOutsideObjectRef outsideObject in waterGunLibMod.OutsideObjects) { SpawnableOutsideObjects.RegisterSpawnableOutsideObject(outsideObject, waterGunLibMod.ModGUID); } foreach (EnemyTypeRef enemy in waterGunLibMod.Enemies) { Enemies.RegisterEnemy(enemy, waterGunLibMod.ModGUID); } foreach (ItemRef item in waterGunLibMod.Items) { Items.RegisterItem(item, waterGunLibMod.ModGUID); } } } Harmony val2 = new Harmony("WaterGun.WaterGunLib"); val2.PatchAll(); Debug.Log((object)"[WaterGunLib]: Loaded with all modules"); } } public class PowerGenerator : NetworkBehaviour { [Space] [Header("Refrences")] public List LightsToDisable; public AudioClip FailSound; public AudioClip ToggleSound; public AudioSource GeneratorAudioSource; [Space] [Header("Settings")] public bool IsAbleToFail = true; [Range(0f, 100f)] public float ChanceToFail = 50f; public int FailDamage = 50; [Space] [Header("Events")] public UnityEvent OnGeneratorFail; public UnityEvent OnGeneratorSuccess; public void ToggleAllLights(PlayerControllerB player) { ulong playerClientId = player.playerClientId; ToggleLightsServerRpc(playerClientId); } [Rpc(/*Could not decode attribute arguments.*/)] public void ToggleLightsServerRpc(ulong clientid) { //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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(4017266650u, val3, val, (SendTo)2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, clientid); ((NetworkBehaviour)this).__endSendRpc(ref val2, 4017266650u, val3, val, (SendTo)2, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val4 in allPlayerScripts) { if (val4.playerClientId == clientid) { if (Random.value <= ChanceToFail / 100f) { ToggleLightsClientRpc(IsFailed: true, clientid); } else { ToggleLightsClientRpc(IsFailed: false, clientid); } } } } [Rpc(/*Could not decode attribute arguments.*/)] public void ToggleLightsClientRpc(bool IsFailed, ulong clientid) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = default(RpcAttributeParams); RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1129565366u, val3, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe(ref IsFailed, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val2, clientid); ((NetworkBehaviour)this).__endSendRpc(ref val2, 1129565366u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; if (!IsFailed) { if ((Object)(object)GeneratorAudioSource != (Object)null) { GeneratorAudioSource.PlayOneShot(ToggleSound); } foreach (Light item in LightsToDisable) { if (!((Behaviour)item).enabled) { ((Behaviour)item).enabled = true; } else { ((Behaviour)item).enabled = false; } } OnGeneratorSuccess.Invoke(); } else { if (!IsFailed || !IsAbleToFail) { return; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val4 in allPlayerScripts) { if (val4.playerClientId == clientid) { val4.DamagePlayer(FailDamage, true, true, (CauseOfDeath)11, 0, false, default(Vector3)); } } if ((Object)(object)GeneratorAudioSource != (Object)null) { GeneratorAudioSource.PlayOneShot(FailSound); } OnGeneratorFail.Invoke(); } } 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(4017266650u, new RpcReceiveHandler(__rpc_handler_4017266650), "ToggleLightsServerRpc"); ((NetworkBehaviour)this).__registerRpc(1129565366u, new RpcReceiveHandler(__rpc_handler_1129565366), "ToggleLightsClientRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_4017266650(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) { ulong clientid = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientid); target.__rpc_exec_stage = (__RpcExecStage)1; ((PowerGenerator)(object)target).ToggleLightsServerRpc(clientid); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1129565366(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool isFailed = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref isFailed, default(ForPrimitives)); ulong clientid = default(ulong); ByteUnpacker.ReadValueBitPacked(reader, ref clientid); target.__rpc_exec_stage = (__RpcExecStage)1; ((PowerGenerator)(object)target).ToggleLightsClientRpc(isFailed, clientid); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "PowerGenerator"; } } public class ShaderRestorer : MonoBehaviour { public List materialsToApplyShader = new List(); public string shaderName = "Shader Graphs/WavingGrass"; public bool ApplyShaderOnAwake = true; public void Awake() { if (!ApplyShaderOnAwake) { return; } Shader shader = GetShader(shaderName); if (materialsToApplyShader.Count == 0) { return; } foreach (Material item in materialsToApplyShader) { if ((Object)(object)shader == (Object)null) { Debug.LogError((object)"Shader missing"); } else { item.shader = shader; } } } public Shader GetShader(string shaderName) { return Shader.Find(shaderName); } } public class TeleportTarget : NetworkBehaviour { [Space] [Header("Refrences")] public Transform Target; public AudioClip StartTeleport; public AudioClip EndTeleport; [Space] [Header("AudioSource")] public AudioSource EndAudioSource; public AudioSource StartAudioSource; public void TeleportPlayer(PlayerControllerB player) { TeleportPlayerRpc((int)player.playerClientId); Debug.Log((object)"TeleportStarted"); } [Rpc(/*Could not decode attribute arguments.*/)] private void TeleportPlayerRpc(int PlayerObj) { //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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val3 = default(RpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(3733794665u, val3, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, PlayerObj); ((NetworkBehaviour)this).__endSendRpc(ref val2, 3733794665u, val3, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; StartOfRound.Instance.allPlayerScripts[PlayerObj].TeleportPlayer(Target.position, true, Target.eulerAngles.y, false, true); StartOfRound.Instance.allPlayerScripts[PlayerObj].isInElevator = false; StartOfRound.Instance.allPlayerScripts[PlayerObj].isInHangarShipRoom = false; if ((Object)(object)EndTeleport != (Object)null && (Object)(object)EndAudioSource != (Object)null) { EndAudioSource.PlayOneShot(EndTeleport); } if ((Object)(object)StartTeleport != (Object)null && (Object)(object)StartAudioSource != (Object)null) { StartAudioSource.PlayOneShot(StartTeleport); } } } 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 ((NetworkBehaviour)this).__registerRpc(3733794665u, new RpcReceiveHandler(__rpc_handler_3733794665), "TeleportPlayerRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_3733794665(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 playerObj = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerObj); target.__rpc_exec_stage = (__RpcExecStage)1; ((TeleportTarget)(object)target).TeleportPlayerRpc(playerObj); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "TeleportTarget"; } } } namespace WaterGunLib.Modules { [CreateAssetMenu(menuName = "WaterGunLib/Enemies/EnemyTypeRefrence")] public class EnemyTypeRef : ScriptableObject { [Header("Settings")] [Tooltip("Registers prefab into networkmanager")] public bool networkPrefab; public EnemyType enemyType; [Tooltip("Rarity that is set to all moons and will be replaced per moon value below")] public int globalRarity = -1; public TerminalNode infoNode = null; public Enemies.SpawnType spawnType = Enemies.SpawnType.Indoor; [Tooltip("Override global rarity on special moons")] public List moons = new List(); } public class Enemies { public enum SpawnType { Outdoor, Indoor, DayTime } public class RegisteredEnemy { public EnemyType enemyType; public string modGUID; public SpawnType spawnType; public int globalRarity; public TerminalNode infoNode; public List moons; } public static List registeredEnemies = new List(); public static void RegisterEnemy(EnemyTypeRef enemyTypeRef, string modGUID) { RegisteredEnemy enemy = new RegisteredEnemy { enemyType = enemyTypeRef.enemyType, modGUID = modGUID, spawnType = enemyTypeRef.spawnType, globalRarity = enemyTypeRef.globalRarity, infoNode = enemyTypeRef.infoNode, moons = enemyTypeRef.moons }; if (registeredEnemies.Any((RegisteredEnemy i) => i.enemyType.enemyName == enemy.enemyType.enemyName)) { Debug.LogError((object)("[WaterGunLib]: " + enemy.enemyType.enemyName + " is already registered. modName: " + enemy.modGUID)); return; } if (enemyTypeRef.networkPrefab) { Plugin.prefabsToNetwork.Add(enemy.enemyType.enemyPrefab); } registeredEnemies.Add(enemy); Debug.Log((object)("[WaterGunLib]: Registered " + enemy.enemyType.enemyName + ". modGUID: " + enemy.modGUID)); } } public class ItemManagement { public static Item GetItemFromName(string itemName) { foreach (Item items in StartOfRound.Instance.allItemsList.itemsList) { if (items.itemName == itemName) { return items; } } return null; } } [CreateAssetMenu(menuName = "WaterGunLib/Items/ItemRefrence")] public class ItemRef : ScriptableObject { [Header("Settings")] [Tooltip("Registers prefab into networkmanager")] public bool networkPrefab; public Item item; [Space(5f)] [Header("ShopItem")] public TerminalNode infoNode = null; public bool isShopItem = false; [Space(5f)] [Header("Scrap")] [Tooltip("Rarity that is set to all moons and will be replaced per moon value below")] public int globalRarity = -1; [Tooltip("Override global rarity on special moons")] public List moons = new List(); } public class Items { [Serializable] public class RegisteredItem { public string modGUID; public Item item; public int globalRarity; public TerminalNode infoNode; public bool isShopItem; public List moons; } public static List registeredItems = new List(); public static void RegisterItem(ItemRef itemRef, string modGUID) { RegisteredItem item = new RegisteredItem { modGUID = modGUID, item = itemRef.item, globalRarity = itemRef.globalRarity, infoNode = itemRef.infoNode, isShopItem = itemRef.isShopItem, moons = itemRef.moons }; if (registeredItems.Any((RegisteredItem i) => i.item.itemName == item.item.itemName)) { Debug.LogError((object)("[WaterGunLib]: " + item.item.itemName + " is already registered. modName: " + item.modGUID)); return; } if (itemRef.networkPrefab) { Plugin.prefabsToNetwork.Add(item.item.spawnPrefab); } registeredItems.Add(item); Debug.Log((object)("[WaterGunLib]: Registered " + item.item.itemName + ". modGUID: " + item.modGUID)); } } [CreateAssetMenu(menuName = "WaterGunLib/OutsideObjects/SpawnableOutsideObjectRefrence")] public class SpawnableOutsideObjectRef : ScriptableObject { [Header("Settings")] [Tooltip("Registers prefab into networkmanager")] public bool networkPrefab; [Tooltip("Rarity that is set to all moons and will be replaced per moon value below")] public AnimationCurve? globalRandomAmount; [Tooltip("Override global rarity curve on special moons")] public List moons = new List(); public SpawnableOutsideObject? outsideObject; } public class SpawnableOutsideObjects { public class RegisteredOutsideObject { public string? modGUID; public SpawnableOutsideObject? outsideObject; public AnimationCurve? globalRandomAmount; public List moons = new List(); } public static List registeredOutsideObjects = new List(); public static void RegisterSpawnableOutsideObject(SpawnableOutsideObjectRef outsideObject, string modGUID) { RegisteredOutsideObject registeredOutsideObject = new RegisteredOutsideObject { modGUID = modGUID, outsideObject = outsideObject.outsideObject, globalRandomAmount = outsideObject.globalRandomAmount, moons = outsideObject.moons }; if (registeredOutsideObjects.Any((RegisteredOutsideObject obj) => (Object)(object)obj.outsideObject == (Object)(object)outsideObject)) { SpawnableOutsideObject? outsideObject2 = registeredOutsideObject.outsideObject; Debug.LogError((object)("[WaterGunLib]: " + ((outsideObject2 != null) ? ((Object)outsideObject2.prefabToSpawn).name : null) + " is already registered. modGUID: " + registeredOutsideObject.modGUID)); return; } if (outsideObject.networkPrefab && (Object)(object)registeredOutsideObject.outsideObject != (Object)null) { Plugin.prefabsToNetwork.Add(registeredOutsideObject.outsideObject.prefabToSpawn); } registeredOutsideObjects.Add(registeredOutsideObject); SpawnableOutsideObject? outsideObject3 = registeredOutsideObject.outsideObject; Debug.Log((object)("[WaterGunLib]: Registered " + ((outsideObject3 != null) ? ((Object)outsideObject3.prefabToSpawn).name : null) + ". modGUID: " + registeredOutsideObject.modGUID)); } } [CreateAssetMenu(menuName = "WaterGunLib/Unlockables/UnlockableItemRefrence")] public class UnlockableItemRef : ScriptableObject { [Header("Settings")] [Tooltip("Registers prefab into networkmanager")] public bool networkPrefab; public UnlockableItem? UnlockableItem; public Unlockables.StoreType StoreType = Unlockables.StoreType.ShipUpgrade; public int Price = 0; public TerminalNode? InfoNode; } public class Unlockables { public enum StoreType { ShipUpgrade, Decor } public class RegisteredUnlockable { public StoreType storeType; public UnlockableItem? unlockableItem; public string? modGUID; public int price; public TerminalNode? itemInfo; } public static List registeredUnlockables = new List(); public static void RegisterUnlockable(UnlockableItemRef unlockable, string modGUID) { RegisteredUnlockable registeredUnlockable = new RegisteredUnlockable { storeType = unlockable.StoreType, unlockableItem = unlockable.UnlockableItem, price = unlockable.Price, itemInfo = unlockable.InfoNode, modGUID = modGUID }; if (registeredUnlockables.Any((RegisteredUnlockable obj) => obj.unlockableItem == unlockable.UnlockableItem)) { Debug.LogError((object)("[WaterGunLib]: " + unlockable.UnlockableItem?.unlockableName + " is already registered. modName: " + registeredUnlockable.modGUID)); return; } if (unlockable.networkPrefab && unlockable.UnlockableItem != null) { Plugin.prefabsToNetwork.Add(unlockable.UnlockableItem.prefabObject); } registeredUnlockables.Add(registeredUnlockable); Debug.Log((object)("[WaterGunLib]: Registered " + unlockable.UnlockableItem?.unlockableName + ". modGUID: " + registeredUnlockable.modGUID)); } } } namespace WaterGunLib.Modules.Prefabs { public class NetworkPrefabs { public static void RegisterNetworkPrefab(GameObject prefab) { if (!Plugin.prefabsToNetwork.Contains(prefab)) { Plugin.prefabsToNetwork.Add(prefab); } } } } namespace WaterGunLib.Fields { [Serializable] public class MoonObject { public string moonName = ""; public int rarity; } [Serializable] public class MoonObjectCurve { public string moonName; public AnimationCurve randomSpawn; } } namespace WaterGunLib.Bundles { [CreateAssetMenu(menuName = "WaterGunLib/Mod")] public class WaterGunLibMod : ScriptableObject { [Header("Settings")] public string ModGUID; [Space(5f)] public List Unlockables; public List OutsideObjects; public List Enemies; public List Items; } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace WaterGunLib.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }