using System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Logging; using Dawn.Utils; using Dusk; using GameNetcodeStuff; using HarmonyLib; using Microsoft.CodeAnalysis; using Reiko888.UtilityPylons.NetcodePatcher; using Unity.Netcode; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using UnityEngine.VFX; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("DunGen")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")] [assembly: IgnoresAccessChecksTo("Unity.XR.Management")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")] [assembly: AssemblyCompany("Reiko888.UtilityPylons")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+0beb3fe6750fadd37c6ae0f79f512cabcb3f0822")] [assembly: AssemblyProduct("UtilityPylons")] [assembly: AssemblyTitle("Reiko888.UtilityPylons")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PylonLC { [BepInPlugin("reiko888.UtilityPylons", "UtilityPylons", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class Plugin : BaseUnityPlugin { public const string modGUID = "reiko888.UtilityPylons"; public const string modName = "UtilityPylons"; public const string modVersion = "1.0.0"; public static Plugin Instance = null; internal static ManualLogSource Logger = null; internal static readonly Harmony harmony = new Harmony("reiko888.UtilityPylons"); internal static DuskMod mod = null; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } Logger = ((BaseUnityPlugin)this).Logger; AssetBundle val = AssetBundleUtils.LoadBundle(Assembly.GetExecutingAssembly(), "utilpylon_cont"); mod = DuskMod.RegisterMod((BaseUnityPlugin)(object)this, val); mod.RegisterContentHandlers(); harmony.PatchAll(Assembly.GetExecutingAssembly()); Logger.LogInfo((object)"Plugin UtilityPylons is loaded!"); } } internal class PylonHandler : ContentHandler { public class PylonAssets : AssetBundleLoader { public PylonAssets(DuskMod mod, string filePath) : base(mod, filePath) { } } internal PylonAssets? pylonAssets; public PylonHandler(DuskMod mod) : base(mod) { ((ContentHandler)this).RegisterContent("utilitypylons", ref pylonAssets, false); } } public class PylonItem : GrabbableObject { public enum PylonMode { Speed, Damage, Healing, DeathProtection, DanagingPylon, Sanity, Xray, Cloak } [Header("Machine SFX")] public AudioClip switchTurnOn; public AudioClip switchTurnOff; public AudioSource interactSFX; public AudioClip statusWarning; public AudioClip poweringOn; public AudioClip poweringOff; public AudioSource computerScreen; public AudioClip[] machineAmbience; public AudioClip[] machineOverloading; public AudioSource machineSFX; public AudioClip[] electricPulse; public AudioSource electricitySFX; public AudioClip[] modeSFXs; [Header("Robot Audio Settings")] public AudioSource robotAudio; public AudioClip[] modeVoicelines; public AudioClip[] overheatingVoicelines; public AudioClip[] powerOnVoicelines; public AudioClip[] powerOffVoicelines; public AudioClip[] playerSavedVoicelines; [Header("Components")] public Animator pylonAnimator; public GameObject screnPos; public InteractTrigger pylonTrigger; [Header("State")] public bool isPylonActive; [Header("Screen Settings")] public SkinnedMeshRenderer screenRenderer; public int screenMaterialIndex; public Texture2D[] screenTextures; private Material instantiatedScreenMaterial; [Header("VFX Settings")] public GameObject decalProjectorObj; public GameObject vfxParentObj; public ParticleSystem pylonParticleSystem; public VisualEffect middleVFX; public VisualEffect aoeVFX; [Header("Player Effects")] public ParticleSystem localPlayerElectricityPrefab; public static ParticleSystem playerElectricityPrefab; private static Dictionary playerElectricityEffects = new Dictionary(); private static float electricityUpdateTimer = 0f; [Header("HUD Settings")] public GameObject pylonHUDPrefab; private static GameObject activeHUDInstance; private static Dictionary hudIcons = new Dictionary(); [Header("Explosion Settings")] public GameObject burntCarcassPrefab; private float buffRange; private float buffHeightRange; private float speedBuffAmount; private float healRate; private float speedModeDrain; private float sanityModeDrain; private float xrayModeDrain; private float cloakModeDrain; private float healingModeDrain; private float deathProtectionDeduction; private float damagingModeDeduction; private float damageBoostDeduction; private float playerMultiplier1 = 1f; private float playerMultiplier2; private float playerMultiplier3; private float playerMultiplier4; private float pylonCooldown; private int protHealth; private int damageAreaVal; private float sanityRestVal; private float overheatThreshold; private int carryingPylonDmg; public static List activePylons = new List(); public static List allPylons = new List(); private static bool hasAppliedBuff = false; private static float originalSpeed = 0.5f; private float healAccumulator; private float damageTimer; public float stability = 100f; public bool isOverheating; public float cooldownTimer; private float syncTimer; private float heldDamageTimer; public PylonMode currentMode; public float DeathProtectionDeduction => deathProtectionDeduction; public override void Start() { //IL_0332: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Start(); buffRange = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Pylon AOE Radius").Value; buffHeightRange = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Pylon AOE Height").Value; pylonCooldown = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Pylon Cooldown").Value; speedBuffAmount = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Speed Boost").Value; healRate = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Healing amount").Value; protHealth = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Death protection health restoration").Value; damageAreaVal = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Damaging area value").Value; sanityRestVal = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Sanity stabilisation").Value; speedModeDrain = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Speed mode drain rate").Value; sanityModeDrain = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Sanity mode drain rate").Value; damageBoostDeduction = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Damage boost mode drain rate").Value; healingModeDrain = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Healing mode drain rate").Value; xrayModeDrain = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Xray mode drain rate").Value; cloakModeDrain = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Cloak mode drain").Value; deathProtectionDeduction = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Death protection drain").Value; damagingModeDeduction = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Damaging mode drain rate").Value; playerMultiplier2 = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("2 Players or Pylons multiplier").Value; playerMultiplier3 = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("3 Players or Pylons multiplier").Value; playerMultiplier4 = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("4 Players or Pylons multiplier").Value; overheatThreshold = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Overheat threshold").Value; carryingPylonDmg = ((AssetBundleLoader)(object)ContentHandler.Instance.pylonAssets).GetConfig("Carrying pylon damage").Value; if (!allPylons.Contains(this)) { allPylons.Add(this); } if ((Object)(object)localPlayerElectricityPrefab != (Object)null) { playerElectricityPrefab = localPlayerElectricityPrefab; } if ((Object)(object)activeHUDInstance == (Object)null && (Object)(object)pylonHUDPrefab != (Object)null && (Object)(object)HUDManager.Instance != (Object)null && (Object)(object)HUDManager.Instance.HUDContainer != (Object)null) { activeHUDInstance = Object.Instantiate(pylonHUDPrefab, HUDManager.Instance.HUDContainer.transform, false); activeHUDInstance.transform.localScale = Vector3.one; hudIcons.Clear(); Transform val = activeHUDInstance.transform.Find("PylonStatusPanel") ?? activeHUDInstance.transform; if ((Object)(object)val != (Object)null) { Dictionary dictionary = hudIcons; Transform obj = val.Find("SpeedIcon"); dictionary[PylonMode.Speed] = ((obj != null) ? ((Component)obj).gameObject : null); Dictionary dictionary2 = hudIcons; Transform obj2 = val.Find("DamageBoostIcon"); dictionary2[PylonMode.Damage] = ((obj2 != null) ? ((Component)obj2).gameObject : null); Dictionary dictionary3 = hudIcons; Transform obj3 = val.Find("HealingIcon"); dictionary3[PylonMode.Healing] = ((obj3 != null) ? ((Component)obj3).gameObject : null); Dictionary dictionary4 = hudIcons; Transform obj4 = val.Find("DeathProtIcon"); dictionary4[PylonMode.DeathProtection] = ((obj4 != null) ? ((Component)obj4).gameObject : null); Dictionary dictionary5 = hudIcons; Transform obj5 = val.Find("DamageAreaIcon"); dictionary5[PylonMode.DanagingPylon] = ((obj5 != null) ? ((Component)obj5).gameObject : null); Dictionary dictionary6 = hudIcons; Transform obj6 = val.Find("SanityIcon"); dictionary6[PylonMode.Sanity] = ((obj6 != null) ? ((Component)obj6).gameObject : null); Dictionary dictionary7 = hudIcons; Transform obj7 = val.Find("XrayIcon"); dictionary7[PylonMode.Xray] = ((obj7 != null) ? ((Component)obj7).gameObject : null); Dictionary dictionary8 = hudIcons; Transform obj8 = val.Find("CloakIcon"); dictionary8[PylonMode.Cloak] = ((obj8 != null) ? ((Component)obj8).gameObject : null); int num = 0; foreach (KeyValuePair hudIcon in hudIcons) { if ((Object)(object)hudIcon.Value != (Object)null) { num++; } } } ClearLocalPlayerHUD(); } if ((Object)(object)pylonTrigger != (Object)null) { ((UnityEvent)(object)pylonTrigger.onInteract).RemoveListener((UnityAction)OnInteractTriggered); ((UnityEvent)(object)pylonTrigger.onInteract).AddListener((UnityAction)OnInteractTriggered); pylonTrigger.interactable = !base.isHeld && !base.isPocketed; } if ((Object)(object)screenRenderer != (Object)null && ((Renderer)screenRenderer).materials.Length > screenMaterialIndex) { Material[] materials = ((Renderer)screenRenderer).materials; instantiatedScreenMaterial = materials[screenMaterialIndex]; ((Renderer)screenRenderer).materials = materials; } UpdateScreenMaterial(); UpdateVFXState(); } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); RemoveFromActivePylons(); if ((Object)(object)pylonTrigger != (Object)null) { pylonTrigger.interactable = false; } UpdateVFXState(); } public override void ItemActivate(bool used, bool buttonDown = true) { if ((!((Object)(object)StartOfRound.Instance != (Object)null) || !StartOfRound.Instance.inShipPhase) && (!used || !(cooldownTimer > 0f))) { ((GrabbableObject)this).ItemActivate(used, buttonDown); TogglePylonLocal(used); TogglePylonServerRpc(used); } } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); RemoveFromActivePylons(); if ((Object)(object)pylonTrigger != (Object)null) { pylonTrigger.interactable = false; } UpdateVFXState(); } public override void DiscardItem() { ((GrabbableObject)this).DiscardItem(); if ((Object)(object)pylonTrigger != (Object)null) { pylonTrigger.interactable = true; } if (isPylonActive) { AddToActivePylons(); } UpdateVFXState(); } public void ChangeModeLocal(PylonMode mode) { if (!isPylonActive || stability <= overheatThreshold) { return; } currentMode = mode; UpdateScreenMaterial(); if (modeSFXs != null && mode >= PylonMode.Speed && (int)mode < modeSFXs.Length && (Object)(object)modeSFXs[(int)mode] != (Object)null && (Object)(object)interactSFX != (Object)null) { interactSFX.PlayOneShot(modeSFXs[(int)mode]); } if ((Object)(object)robotAudio != (Object)null && modeVoicelines != null && mode >= PylonMode.Speed && (int)mode < modeVoicelines.Length) { AudioClip val = modeVoicelines[(int)mode]; if ((Object)(object)val != (Object)null) { robotAudio.Stop(); robotAudio.clip = val; robotAudio.Play(); } } UpdateVFXState(); } [ServerRpc(RequireOwnership = false)] public void ChangeModeServerRpc(PylonMode mode) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2647750659u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref mode, default(ForEnums)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2647750659u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (isPylonActive && !(stability <= overheatThreshold)) { ChangeModeClientRpc(mode); } } } [ClientRpc] public void ChangeModeClientRpc(PylonMode mode) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3308591578u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref mode, default(ForEnums)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3308591578u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; ChangeModeLocal(mode); } } } private void OnDisable() { RemoveFromActivePylons(); if (allPylons.Contains(this)) { allPylons.Remove(this); } CleanupLocalBuffIfLast(); } public override void OnDestroy() { ((GrabbableObject)this).OnDestroy(); RemoveFromActivePylons(); if (allPylons.Contains(this)) { allPylons.Remove(this); } CleanupLocalBuffIfLast(); } public void OnInteractTriggered(PlayerControllerB playerWhoInteracted) { if (isPylonActive && !(stability <= overheatThreshold)) { int length = Enum.GetValues(typeof(PylonMode)).Length; PylonMode mode = (PylonMode)((int)(currentMode + 1) % length); ChangeModeLocal(mode); ChangeModeServerRpc(mode); } } [ServerRpc(RequireOwnership = false)] public void TogglePylonServerRpc(bool active) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(2754904381u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref active, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 2754904381u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (!active || !(cooldownTimer > 0f)) { TogglePylonClientRpc(active); } } } [ClientRpc] public void TogglePylonClientRpc(bool active) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(2389651483u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref active, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 2389651483u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; TogglePylonLocal(active); } } } public void TogglePylonLocal(bool active) { if ((active && (Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.inShipPhase) || (active && cooldownTimer > 0f) || isPylonActive == active) { return; } if (!active && stability <= overheatThreshold) { cooldownTimer = pylonCooldown; } isPylonActive = active; if ((Object)(object)robotAudio != (Object)null) { AudioClip[] array = (active ? powerOnVoicelines : powerOffVoicelines); if (array != null && array.Length != 0) { AudioClip val = array[Random.Range(0, array.Length)]; if ((Object)(object)val != (Object)null) { robotAudio.Stop(); robotAudio.clip = val; robotAudio.Play(); } } } if (!active) { isOverheating = false; if ((Object)(object)pylonAnimator != (Object)null) { pylonAnimator.SetBool("isOverheating", false); } if ((Object)(object)computerScreen != (Object)null) { computerScreen.Stop(); } } if ((Object)(object)pylonAnimator != (Object)null) { pylonAnimator.SetBool("on", active); } if ((Object)(object)interactSFX != (Object)null) { AudioClip val2 = (active ? switchTurnOn : switchTurnOff); if ((Object)(object)val2 != (Object)null) { interactSFX.PlayOneShot(val2); } } if ((Object)(object)computerScreen != (Object)null) { AudioClip val3 = (active ? poweringOn : poweringOff); if ((Object)(object)val3 != (Object)null) { computerScreen.PlayOneShot(val3); } } if ((Object)(object)machineSFX != (Object)null) { if (active) { if (machineAmbience != null && machineAmbience.Length != 0 && (Object)(object)machineAmbience[0] != (Object)null) { machineSFX.clip = machineAmbience[0]; machineSFX.loop = true; machineSFX.Play(); } } else { machineSFX.Stop(); } } if (active) { if (!base.isHeld && !base.isPocketed) { AddToActivePylons(); } } else { RemoveFromActivePylons(); } UpdateScreenMaterial(); UpdateVFXState(); } private void AddToActivePylons() { if (!activePylons.Contains(this)) { activePylons.Add(this); } } private void RemoveFromActivePylons() { if (activePylons.Contains(this)) { activePylons.Remove(this); CleanupLocalBuffIfLast(); } } public static bool IsPlayerInPylonRange(PlayerControllerB player, PylonMode mode) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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) for (int i = 0; i < activePylons.Count; i++) { PylonItem pylonItem = activePylons[i]; if ((Object)(object)pylonItem != (Object)null && pylonItem.isPylonActive && pylonItem.currentMode == mode && !((GrabbableObject)pylonItem).isHeld && !((GrabbableObject)pylonItem).isPocketed) { Vector3 position = ((Component)player).transform.position; Vector3 position2 = ((Component)pylonItem).transform.position; float num = Vector2.Distance(new Vector2(position.x, position.z), new Vector2(position2.x, position2.z)); float num2 = Mathf.Abs(position.y - position2.y); if (num <= pylonItem.buffRange && num2 <= pylonItem.buffHeightRange) { return true; } } } return false; } public static int GetPylonCountInRange(PlayerControllerB player, PylonMode mode) { //IL_004e: 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_005a: 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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_0079: 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) //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) int num = 0; for (int i = 0; i < activePylons.Count; i++) { PylonItem pylonItem = activePylons[i]; if ((Object)(object)pylonItem != (Object)null && pylonItem.isPylonActive && pylonItem.currentMode == mode && !((GrabbableObject)pylonItem).isHeld && !((GrabbableObject)pylonItem).isPocketed) { Vector3 position = ((Component)player).transform.position; Vector3 position2 = ((Component)pylonItem).transform.position; float num2 = Vector2.Distance(new Vector2(position.x, position.z), new Vector2(position2.x, position2.z)); float num3 = Mathf.Abs(position.y - position2.y); if (num2 <= pylonItem.buffRange && num3 <= pylonItem.buffHeightRange) { num++; } } } return num; } public static void DeductDamageBoostStability(PlayerControllerB player) { //IL_004c: 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_0058: 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_005e: 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_006a: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < activePylons.Count; i++) { PylonItem pylonItem = activePylons[i]; if ((Object)(object)pylonItem != (Object)null && pylonItem.isPylonActive && pylonItem.currentMode == PylonMode.Damage && !((GrabbableObject)pylonItem).isHeld && !((GrabbableObject)pylonItem).isPocketed) { Vector3 position = ((Component)player).transform.position; Vector3 position2 = ((Component)pylonItem).transform.position; float num = Vector2.Distance(new Vector2(position.x, position.z), new Vector2(position2.x, position2.z)); float num2 = Mathf.Abs(position.y - position2.y); if (num <= pylonItem.buffRange && num2 <= pylonItem.buffHeightRange) { pylonItem.DeductStabilityServerRpc(pylonItem.damageBoostDeduction); } } } } public static PylonItem GetPylonSavingPlayer(PlayerControllerB player, PylonMode mode) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < activePylons.Count; i++) { PylonItem pylonItem = activePylons[i]; if ((Object)(object)pylonItem != (Object)null && pylonItem.isPylonActive && pylonItem.currentMode == mode && !((GrabbableObject)pylonItem).isHeld && !((GrabbableObject)pylonItem).isPocketed) { float num = Vector2.Distance(new Vector2(((Component)player).transform.position.x, ((Component)player).transform.position.z), new Vector2(((Component)pylonItem).transform.position.x, ((Component)pylonItem).transform.position.z)); float num2 = Mathf.Abs(((Component)player).transform.position.y - ((Component)pylonItem).transform.position.y); if (num <= pylonItem.buffRange && num2 <= pylonItem.buffHeightRange) { return pylonItem; } } } return null; } public override void Update() { //IL_0385: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_032f: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Update(); if (isPylonActive && (Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.inShipPhase) { TogglePylonLocal(active: false); } if (activePylons.Count > 0 && (Object)(object)activePylons[0] == (Object)(object)this) { electricityUpdateTimer += Time.deltaTime; if (electricityUpdateTimer >= 0.1f) { electricityUpdateTimer = 0f; UpdateAllPlayerElectricityEffects(); if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { UpdateLocalPlayerHUD(GameNetworkManager.Instance.localPlayerController); } } } if ((Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; UpdatePlayerSpeedBuff(localPlayerController); UpdatePlayerHealingBuff(localPlayerController); UpdateSanityPylon(localPlayerController); UpdateDamagingPylon(localPlayerController); UpdateXrayPylon(localPlayerController); if (isPylonActive && base.isHeld && (Object)(object)base.playerHeldBy != (Object)null) { heldDamageTimer += Time.deltaTime; if (heldDamageTimer >= 3f) { heldDamageTimer = 0f; base.playerHeldBy.DamagePlayer(carryingPylonDmg, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } } else { heldDamageTimer = 0f; } } if ((Object)(object)NetworkManager.Singleton != (Object)null && NetworkManager.Singleton.IsServer) { if (cooldownTimer > 0f) { cooldownTimer = Mathf.Max(0f, cooldownTimer - Time.deltaTime); } if (isPylonActive) { if ((Object)(object)StartOfRound.Instance == (Object)null || !StartOfRound.Instance.shipIsLeaving) { float baseStabilityDrain = GetBaseStabilityDrain(); float playerMultiplier = GetPlayerMultiplier(); stability = Mathf.Max(0f, stability - baseStabilityDrain * playerMultiplier * Time.deltaTime); if (stability <= overheatThreshold && !isOverheating) { SetOverheatingState(state: true); } if (stability <= 0f) { ExplodePylonServerRpc(); } } } else { float num = ((pylonCooldown > 0f) ? (100f / pylonCooldown) : 5f); stability = Mathf.Min(100f, stability + num * Time.deltaTime); if (stability > overheatThreshold && isOverheating) { SetOverheatingState(state: false); } } syncTimer += Time.deltaTime; if (syncTimer >= 0.2f) { syncTimer = 0f; SyncStabilityClientRpc(stability, isOverheating, cooldownTimer); } } if (isPylonActive && (Object)(object)instantiatedScreenMaterial != (Object)null) { if (isOverheating) { float num2 = Mathf.Lerp(0f, 20f, Mathf.PingPong(Time.time * 5f, 1f)); instantiatedScreenMaterial.SetColor("_EmissiveColor", Color.white * num2); instantiatedScreenMaterial.SetFloat("_EmissiveIntensity", num2); } else { Color val = default(Color); ((Color)(ref val))..ctor(0.718f, 0.718f, 0.718f); float num3 = Random.Range(7f, 10f); instantiatedScreenMaterial.SetColor("_EmissiveColor", val * num3); instantiatedScreenMaterial.SetFloat("_EmissiveIntensity", num3); } } } private void UpdatePlayerSpeedBuff(PlayerControllerB localPlayer) { int pylonCountInRange = GetPylonCountInRange(localPlayer, PylonMode.Speed); if (pylonCountInRange > 0) { if (!hasAppliedBuff) { originalSpeed = localPlayer.movementSpeed; hasAppliedBuff = true; } localPlayer.movementSpeed = originalSpeed + (float)pylonCountInRange * speedBuffAmount; } else if (hasAppliedBuff) { localPlayer.movementSpeed = originalSpeed; hasAppliedBuff = false; } } private void UpdatePlayerHealingBuff(PlayerControllerB localPlayer) { int pylonCountInRange = GetPylonCountInRange(localPlayer, PylonMode.Healing); if (pylonCountInRange > 0 && !localPlayer.isPlayerDead && localPlayer.health < 100) { healAccumulator += healRate * (float)pylonCountInRange * Time.deltaTime; if (healAccumulator >= 1f) { int num = (int)healAccumulator; healAccumulator -= num; localPlayer.health = Mathf.Min(100, localPlayer.health + num); if (localPlayer.health >= 20 && (localPlayer.criticallyInjured || localPlayer.bleedingHeavily)) { localPlayer.criticallyInjured = false; localPlayer.bleedingHeavily = false; } HUDManager.Instance.UpdateHealthUI(localPlayer.health, false); localPlayer.DamagePlayerServerRpc(0, localPlayer.health); } } else { healAccumulator = 0f; } } private void UpdateDamagingPylon(PlayerControllerB localPlayer) { //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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) if (IsPlayerInPylonRange(localPlayer, PylonMode.DanagingPylon) && !localPlayer.isPlayerDead) { damageTimer += Time.deltaTime; if (damageTimer >= 2f) { damageTimer = 0f; localPlayer.DamagePlayer(damageAreaVal, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); DeductStabilityServerRpc(damagingModeDeduction); } } if (!((Object)(object)NetworkManager.Singleton != (Object)null) || !NetworkManager.Singleton.IsServer || !isPylonActive || currentMode != PylonMode.DanagingPylon || base.isHeld || base.isPocketed || damageTimer != 0f || !((Object)(object)RoundManager.Instance != (Object)null) || RoundManager.Instance.SpawnedEnemies == null) { return; } for (int i = 0; i < RoundManager.Instance.SpawnedEnemies.Count; i++) { EnemyAI val = RoundManager.Instance.SpawnedEnemies[i]; if (!((Object)(object)val != (Object)null) || val.isEnemyDead) { continue; } float num = Vector2.Distance(new Vector2(((Component)val).transform.position.x, ((Component)val).transform.position.z), new Vector2(((Component)this).transform.position.x, ((Component)this).transform.position.z)); float num2 = Mathf.Abs(((Component)val).transform.position.y - ((Component)this).transform.position.y); if (num <= buffRange && num2 <= buffHeightRange) { val.HitEnemy(1, (PlayerControllerB)null, true, -1); stability = Mathf.Max(0f, stability - damagingModeDeduction); if (stability <= 0f) { ExplodePylonServerRpc(); } } } } private void UpdateSanityPylon(PlayerControllerB localPlayer) { int pylonCountInRange = GetPylonCountInRange(localPlayer, PylonMode.Sanity); if (pylonCountInRange > 0 && !localPlayer.isPlayerDead && localPlayer.insanityLevel > 0f) { localPlayer.insanityLevel = Mathf.Max(0f, localPlayer.insanityLevel - sanityRestVal * (float)pylonCountInRange * Time.deltaTime); } } private void UpdateXrayPylon(PlayerControllerB localPlayer) { if (IsPlayerInPylonRange(localPlayer, PylonMode.Xray) && !localPlayer.isPlayerDead && (Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.playerPingingScan = 2f; } } public void UpdateScreenMaterial() { //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)instantiatedScreenMaterial == (Object)null) { return; } if (isPylonActive) { Color val = default(Color); ((Color)(ref val))..ctor(0.718f, 0.718f, 0.718f); instantiatedScreenMaterial.SetColor("_BaseColor", val); instantiatedScreenMaterial.SetColor("_Color", val); if (isOverheating) { if (screenTextures != null && screenTextures.Length > 8) { instantiatedScreenMaterial.SetTexture("_BaseColorMap", (Texture)(object)screenTextures[8]); } } else { int num = (int)currentMode; if (screenTextures != null && num >= 0 && num < screenTextures.Length) { instantiatedScreenMaterial.SetTexture("_BaseColorMap", (Texture)(object)screenTextures[num]); } } instantiatedScreenMaterial.EnableKeyword("_EMISSIVE"); } else { instantiatedScreenMaterial.SetColor("_BaseColor", Color.black); instantiatedScreenMaterial.SetColor("_Color", Color.black); instantiatedScreenMaterial.DisableKeyword("_EMISSIVE"); } } private float GetBaseStabilityDrain() { switch (currentMode) { case PylonMode.Speed: return speedModeDrain; case PylonMode.Sanity: return sanityModeDrain; case PylonMode.Damage: return 0f; case PylonMode.Xray: return xrayModeDrain; case PylonMode.Cloak: return cloakModeDrain; case PylonMode.Healing: if (!IsAnyPlayerBeingHealed()) { return 0f; } return healingModeDrain; default: return 0f; } } private bool IsAnyPlayerBeingHealed() { if ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayerScripts == null) { return false; } 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.isPlayerDead && val.health < 100 && IsPlayerInPylonRange(val, PylonMode.Healing)) { return true; } } return false; } private int GetOtherActivePylonsInRangeCount() { //IL_0054: 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_006e: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) int num = 0; for (int i = 0; i < activePylons.Count; i++) { PylonItem pylonItem = activePylons[i]; if ((Object)(object)pylonItem != (Object)null && (Object)(object)pylonItem != (Object)(object)this && pylonItem.isPylonActive && !((GrabbableObject)pylonItem).isHeld && !((GrabbableObject)pylonItem).isPocketed) { float num2 = Vector2.Distance(new Vector2(((Component)pylonItem).transform.position.x, ((Component)pylonItem).transform.position.z), new Vector2(((Component)this).transform.position.x, ((Component)this).transform.position.z)); float num3 = Mathf.Abs(((Component)pylonItem).transform.position.y - ((Component)this).transform.position.y); if (num2 <= buffRange && num3 <= buffHeightRange) { num++; } } } return num; } private float GetPlayerMultiplier() { //IL_0062: 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_007d: 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_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) int num = 0; if ((Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.allPlayerScripts != null) { 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.isPlayerDead) { float num2 = Vector2.Distance(new Vector2(((Component)val).transform.position.x, ((Component)val).transform.position.z), new Vector2(((Component)this).transform.position.x, ((Component)this).transform.position.z)); float num3 = Mathf.Abs(((Component)val).transform.position.y - ((Component)this).transform.position.y); if (num2 <= buffRange && num3 <= buffHeightRange) { num++; } } } } int otherActivePylonsInRangeCount = GetOtherActivePylonsInRangeCount(); int num4 = num + otherActivePylonsInRangeCount; if (num4 <= 1) { return playerMultiplier1; } return num4 switch { 2 => playerMultiplier2, 3 => playerMultiplier3, _ => playerMultiplier4, }; } private void SetOverheatingState(bool state) { isOverheating = state; SetOverheatingClientRpc(state); } [ClientRpc] public void SetOverheatingClientRpc(bool state) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3751482577u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref state, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3751482577u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; isOverheating = state; if ((Object)(object)pylonAnimator != (Object)null) { pylonAnimator.SetBool("isOverheating", state); } if (state) { if ((Object)(object)robotAudio != (Object)null && overheatingVoicelines != null && overheatingVoicelines.Length != 0) { AudioClip val3 = overheatingVoicelines[Random.Range(0, overheatingVoicelines.Length)]; if ((Object)(object)val3 != (Object)null) { robotAudio.Stop(); robotAudio.clip = val3; robotAudio.Play(); } } if ((Object)(object)computerScreen != (Object)null && (Object)(object)statusWarning != (Object)null) { computerScreen.clip = statusWarning; computerScreen.loop = true; computerScreen.Play(); } if ((Object)(object)machineSFX != (Object)null && machineOverloading != null && machineOverloading.Length != 0 && (Object)(object)machineOverloading[0] != (Object)null) { machineSFX.clip = machineOverloading[0]; machineSFX.loop = true; machineSFX.Play(); } UpdateScreenMaterial(); return; } if ((Object)(object)computerScreen != (Object)null) { computerScreen.Stop(); } if ((Object)(object)machineSFX != (Object)null) { machineSFX.Stop(); if (isPylonActive && machineAmbience != null && machineAmbience.Length != 0 && (Object)(object)machineAmbience[0] != (Object)null) { machineSFX.clip = machineAmbience[0]; machineSFX.loop = true; machineSFX.Play(); } } UpdateScreenMaterial(); } [ClientRpc] public void SyncStabilityClientRpc(float newStability, bool overheatingState, float newCooldown) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: 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_0112: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(755763878u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref newStability, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref overheatingState, default(ForPrimitives)); ((FastBufferWriter)(ref val)).WriteValueSafe(ref newCooldown, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 755763878u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; stability = newStability; cooldownTimer = newCooldown; if (isOverheating != overheatingState) { isOverheating = overheatingState; if ((Object)(object)pylonAnimator != (Object)null) { pylonAnimator.SetBool("isOverheating", overheatingState); } UpdateScreenMaterial(); } } [ServerRpc(RequireOwnership = false)] public void DeductStabilityServerRpc(float amount) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(71179251u, val2, (RpcDelivery)0); ((FastBufferWriter)(ref val)).WriteValueSafe(ref amount, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 71179251u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer && (!((Object)(object)StartOfRound.Instance != (Object)null) || (!StartOfRound.Instance.shipIsLeaving && !StartOfRound.Instance.inShipPhase))) { stability = Mathf.Max(0f, stability - amount); if (stability <= 0f) { ExplodePylonServerRpc(); } } } [ServerRpc(RequireOwnership = false)] public void ExplodePylonServerRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(4115492691u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 4115492691u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; if (((NetworkBehaviour)this).IsServer) { ExplodePylonClientRpc(); if ((Object)(object)((NetworkBehaviour)this).NetworkObject != (Object)null) { ((NetworkBehaviour)this).NetworkObject.Despawn(true); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } } public static void SavePlayerFromDeath(PlayerControllerB player, PylonItem savingPylon) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) if (((NetworkBehaviour)player).IsOwner) { Vector3 val = ((Component)savingPylon).transform.position + Vector3.up * 0.2f; player.TeleportPlayer(val, false, 0f, false, true); if ((Object)(object)player.beamOutParticle != (Object)null) { player.beamOutParticle.Play(); } player.health = savingPylon.protHealth; player.criticallyInjured = true; player.bleedingHeavily = true; savingPylon.TogglePylonLocal(active: false); savingPylon.TogglePylonServerRpc(active: false); savingPylon.DeductStabilityServerRpc(savingPylon.DeathProtectionDeduction); savingPylon.SavePlayerServerRpc((int)player.playerClientId); Debug.Log((object)("[PylonMod] Saved " + player.playerUsername + "! Teleported to Pylon.")); } else { Debug.Log((object)("[PylonMod] Prevented remote death/grab of player " + player.playerUsername + " due to saving pylon.")); } } [ServerRpc(RequireOwnership = false)] public void SavePlayerServerRpc(int playerClientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val2 = default(ServerRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendServerRpc(1838876173u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerClientId); ((NetworkBehaviour)this).__endSendServerRpc(ref val, 1838876173u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; SavePlayerClientRpc(playerClientId); } } } [ClientRpc] public void SavePlayerClientRpc(int playerClientId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(782292837u, val2, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val, playerClientId); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 782292837u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB val3 = StartOfRound.Instance.allPlayerScripts[playerClientId]; if (!((Object)(object)val3 != (Object)null)) { return; } val3.health = 10; val3.criticallyInjured = true; val3.bleedingHeavily = true; val3.isPlayerDead = false; val3.inSpecialInteractAnimation = false; val3.inAnimationWithEnemy = null; val3.snapToServerPosition = false; if ((Object)(object)val3.deadBody != (Object)null) { Object.Destroy((Object)(object)((Component)val3.deadBody).gameObject); val3.deadBody = null; } if ((Object)(object)robotAudio != (Object)null && playerSavedVoicelines != null && playerSavedVoicelines.Length != 0) { AudioClip val4 = playerSavedVoicelines[Random.Range(0, playerSavedVoicelines.Length)]; if ((Object)(object)val4 != (Object)null) { robotAudio.Stop(); robotAudio.clip = val4; robotAudio.Play(); } } } [ClientRpc] public void ExplodePylonClientRpc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val2 = default(ClientRpcParams); FastBufferWriter val = ((NetworkBehaviour)this).__beginSendClientRpc(3913549475u, val2, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val, 3913549475u, val2, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsClient || networkManager.IsHost)) { ((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0; Landmine.SpawnExplosion(((Component)this).transform.position + Vector3.up * 0.5f, true, 5.7f, 6f, 50, 80f, (GameObject)null, false); if ((Object)(object)burntCarcassPrefab != (Object)null) { GameObject val3 = Object.Instantiate(burntCarcassPrefab, ((Component)this).transform.position, ((Component)this).transform.rotation); val3.AddComponent(); } } } private static void CleanupLocalBuffIfLast() { if (activePylons.Count == 0) { ClearAllElectricityEffects(); ClearLocalPlayerHUD(); if (hasAppliedBuff && (Object)(object)GameNetworkManager.Instance != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null) { GameNetworkManager.Instance.localPlayerController.movementSpeed = originalSpeed; hasAppliedBuff = false; } } if (allPylons.Count == 0 && (Object)(object)activeHUDInstance != (Object)null) { Object.Destroy((Object)(object)activeHUDInstance); activeHUDInstance = null; hudIcons.Clear(); } } private void UpdateVFXState() { //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_0106: 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_010f: 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_021d: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Expected O, but got Unknown //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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_0240: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) bool flag = (Object)(object)base.playerHeldBy == (Object)null && !base.isPocketed; bool flag2 = isPylonActive && flag; bool flag3 = isPylonActive; if ((Object)(object)decalProjectorObj != (Object)null) { decalProjectorObj.SetActive(flag2); } if ((Object)(object)vfxParentObj != (Object)null) { vfxParentObj.SetActive(flag3); } if ((Object)(object)aoeVFX != (Object)null) { bool activeSelf = ((Component)aoeVFX).gameObject.activeSelf; ((Component)aoeVFX).gameObject.SetActive(flag2); if (flag2 && !activeSelf) { aoeVFX.Play(); } } if ((Object)(object)pylonParticleSystem != (Object)null) { if (flag3) { if (!pylonParticleSystem.isPlaying) { pylonParticleSystem.Play(); } } else if (pylonParticleSystem.isPlaying) { pylonParticleSystem.Stop(); } } Color modeColor = GetModeColor(currentMode); if ((Object)(object)pylonParticleSystem != (Object)null) { MainModule main = pylonParticleSystem.main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(modeColor); } if ((Object)(object)middleVFX != (Object)null && flag3) { float num = 1f; if (currentMode == PylonMode.Speed || currentMode == PylonMode.Healing) { num = 6f; } middleVFX.SetVector4("Noise Color 1", Color.op_Implicit(modeColor * num)); middleVFX.SetVector4("Noise Color 2", Color.op_Implicit(modeColor * num * 0.8f)); middleVFX.SetVector4("Noise Color 3", Color.op_Implicit(modeColor * num * 0.6f)); middleVFX.SetVector4("Noise Color 4", Color.op_Implicit(modeColor * num * 0.4f)); } if ((Object)(object)aoeVFX != (Object)null && flag2) { aoeVFX.SetFloat("(Blocks) Lifetime", buffRange); aoeVFX.SetFloat("Spark radius", buffRange); Gradient val = new Gradient(); val.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(modeColor, 0f), new GradientColorKey(modeColor, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0f, 1f) }); aoeVFX.SetGradient("Color Gradient", val); aoeVFX.SetGradient("(Blocks) Color Gradient", val); } } private Color GetModeColor(PylonMode mode) { //IL_003a: 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_0064: 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_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_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) return (Color)(mode switch { PylonMode.Speed => new Color(0.051f, 0.349f, 0.341f), PylonMode.Damage => new Color(1f, 0.1f, 0.1f), PylonMode.Healing => new Color(0.031f, 0.227f, 0.02f), PylonMode.DeathProtection => new Color(1f, 0.8f, 0.3f), PylonMode.DanagingPylon => new Color(1f, 0.4f, 0f), PylonMode.Sanity => new Color(0.7f, 0.3f, 1f), PylonMode.Xray => new Color(0.1f, 1f, 0.2f), PylonMode.Cloak => new Color(0.1f, 0.2f, 0.8f), _ => Color.white, }); } private static void UpdateAllPlayerElectricityEffects() { //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_00af: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayerScripts == null) { ClearAllElectricityEffects(); return; } 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.isPlayerDead) { RemoveElectricityFromPlayer(val); continue; } bool flag = false; PylonItem pylonItem = null; float num = 99999f; for (int j = 0; j < activePylons.Count; j++) { PylonItem pylonItem2 = activePylons[j]; if (!((Object)(object)pylonItem2 != (Object)null) || !pylonItem2.isPylonActive || ((GrabbableObject)pylonItem2).isHeld || ((GrabbableObject)pylonItem2).isPocketed) { continue; } float num2 = Vector2.Distance(new Vector2(((Component)val).transform.position.x, ((Component)val).transform.position.z), new Vector2(((Component)pylonItem2).transform.position.x, ((Component)pylonItem2).transform.position.z)); float num3 = Mathf.Abs(((Component)val).transform.position.y - ((Component)pylonItem2).transform.position.y); if (num2 <= pylonItem2.buffRange && num3 <= pylonItem2.buffHeightRange) { flag = true; float num4 = Vector3.Distance(((Component)val).transform.position, ((Component)pylonItem2).transform.position); if (num4 < num) { num = num4; pylonItem = pylonItem2; } } } if (flag && (Object)(object)pylonItem != (Object)null) { ApplyElectricityToPlayer(val, pylonItem.GetModeColor(pylonItem.currentMode)); } else { RemoveElectricityFromPlayer(val); } } } private static void ApplyElectricityToPlayer(PlayerControllerB player, Color color) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_008d: 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_0107: 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_010c: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Expected O, but got Unknown if (playerElectricityEffects.TryGetValue(player, out ParticleSystem value)) { if ((Object)(object)value != (Object)null) { MainModule main = value.main; ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(color); return; } playerElectricityEffects.Remove(player); } if ((Object)(object)playerElectricityPrefab != (Object)null) { Transform playerGlobalHead = player.playerGlobalHead; if ((Object)(object)playerGlobalHead != (Object)null) { ParticleSystem val = Object.Instantiate(playerElectricityPrefab, playerGlobalHead); ((Component)val).transform.localPosition = new Vector3(0f, 0.35f, 0f); ((Component)val).transform.localRotation = Quaternion.identity; if ((Object)(object)player == (Object)(object)GameNetworkManager.Instance.localPlayerController) { ((Component)val).gameObject.layer = 23; foreach (Transform item in ((Component)val).transform) { Transform val2 = item; ((Component)val2).gameObject.layer = 23; } } MainModule main2 = val.main; ((MainModule)(ref main2)).startColor = MinMaxGradient.op_Implicit(color); val.Play(); playerElectricityEffects[player] = val; } else { Debug.LogWarning((object)("[Pylon] Player head container is null for player " + player.playerUsername + "! Cannot attach electricity.")); } } else { Debug.LogWarning((object)"[Pylon] Container is null! Cannot spawn head effect."); } } private static void RemoveElectricityFromPlayer(PlayerControllerB player) { if (playerElectricityEffects.TryGetValue(player, out ParticleSystem value)) { if ((Object)(object)value != (Object)null) { Object.Destroy((Object)(object)((Component)value).gameObject); } playerElectricityEffects.Remove(player); } } private static void ClearAllElectricityEffects() { foreach (KeyValuePair playerElectricityEffect in playerElectricityEffects) { if ((Object)(object)playerElectricityEffect.Value != (Object)null) { Object.Destroy((Object)(object)((Component)playerElectricityEffect.Value).gameObject); } } playerElectricityEffects.Clear(); } private static void UpdateLocalPlayerHUD(PlayerControllerB localPlayer) { if ((Object)(object)activeHUDInstance == (Object)null) { return; } foreach (KeyValuePair hudIcon in hudIcons) { if ((Object)(object)hudIcon.Value != (Object)null) { int pylonCountInRange = GetPylonCountInRange(localPlayer, hudIcon.Key); bool flag = pylonCountInRange > 0; if (hudIcon.Value.activeSelf != flag) { hudIcon.Value.SetActive(flag); } } } } private static void ClearLocalPlayerHUD() { if ((Object)(object)activeHUDInstance == (Object)null) { return; } foreach (KeyValuePair hudIcon in hudIcons) { if ((Object)(object)hudIcon.Value != (Object)null) { hudIcon.Value.SetActive(false); } } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Expected O, but got Unknown //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2647750659u, new RpcReceiveHandler(__rpc_handler_2647750659), "ChangeModeServerRpc"); ((NetworkBehaviour)this).__registerRpc(3308591578u, new RpcReceiveHandler(__rpc_handler_3308591578), "ChangeModeClientRpc"); ((NetworkBehaviour)this).__registerRpc(2754904381u, new RpcReceiveHandler(__rpc_handler_2754904381), "TogglePylonServerRpc"); ((NetworkBehaviour)this).__registerRpc(2389651483u, new RpcReceiveHandler(__rpc_handler_2389651483), "TogglePylonClientRpc"); ((NetworkBehaviour)this).__registerRpc(3751482577u, new RpcReceiveHandler(__rpc_handler_3751482577), "SetOverheatingClientRpc"); ((NetworkBehaviour)this).__registerRpc(755763878u, new RpcReceiveHandler(__rpc_handler_755763878), "SyncStabilityClientRpc"); ((NetworkBehaviour)this).__registerRpc(71179251u, new RpcReceiveHandler(__rpc_handler_71179251), "DeductStabilityServerRpc"); ((NetworkBehaviour)this).__registerRpc(4115492691u, new RpcReceiveHandler(__rpc_handler_4115492691), "ExplodePylonServerRpc"); ((NetworkBehaviour)this).__registerRpc(1838876173u, new RpcReceiveHandler(__rpc_handler_1838876173), "SavePlayerServerRpc"); ((NetworkBehaviour)this).__registerRpc(782292837u, new RpcReceiveHandler(__rpc_handler_782292837), "SavePlayerClientRpc"); ((NetworkBehaviour)this).__registerRpc(3913549475u, new RpcReceiveHandler(__rpc_handler_3913549475), "ExplodePylonClientRpc"); ((GrabbableObject)this).__initializeRpcs(); } private static void __rpc_handler_2647750659(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { PylonMode mode = default(PylonMode); ((FastBufferReader)(ref reader)).ReadValueSafe(ref mode, default(ForEnums)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PylonItem)(object)target).ChangeModeServerRpc(mode); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3308591578(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { PylonMode mode = default(PylonMode); ((FastBufferReader)(ref reader)).ReadValueSafe(ref mode, default(ForEnums)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PylonItem)(object)target).ChangeModeClientRpc(mode); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2754904381(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool active = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref active, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PylonItem)(object)target).TogglePylonServerRpc(active); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2389651483(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool active = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref active, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PylonItem)(object)target).TogglePylonClientRpc(active); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3751482577(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool overheatingClientRpc = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref overheatingClientRpc, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PylonItem)(object)target).SetOverheatingClientRpc(overheatingClientRpc); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_755763878(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float newStability = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newStability, default(ForPrimitives)); bool overheatingState = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe(ref overheatingState, default(ForPrimitives)); float newCooldown = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref newCooldown, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PylonItem)(object)target).SyncStabilityClientRpc(newStability, overheatingState, newCooldown); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_71179251(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { float amount = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe(ref amount, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((PylonItem)(object)target).DeductStabilityServerRpc(amount); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4115492691(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; ((PylonItem)(object)target).ExplodePylonServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1838876173(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerClientId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((PylonItem)(object)target).SavePlayerServerRpc(playerClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_782292837(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerClientId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerClientId); target.__rpc_exec_stage = (__RpcExecStage)1; ((PylonItem)(object)target).SavePlayerClientRpc(playerClientId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3913549475(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; ((PylonItem)(object)target).ExplodePylonClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "PylonItem"; } } public class BurntCarcassCleanup : MonoBehaviour { private void Update() { if ((Object)(object)StartOfRound.Instance != (Object)null && (StartOfRound.Instance.shipIsLeaving || StartOfRound.Instance.inShipPhase)) { Object.Destroy((Object)(object)((Component)this).gameObject); } } } [HarmonyPatch(typeof(EnemyAI))] internal class EnemyDamagePatch { [HarmonyPatch("HitEnemyOnLocalClient")] [HarmonyPrefix] private static void DoublePlayerDamagePrefix(ref int force, Vector3 hitDirection, PlayerControllerB playerWhoHit, bool playHitSFX, int hitID) { if ((Object)(object)playerWhoHit != (Object)null && ((NetworkBehaviour)playerWhoHit).IsOwner) { int pylonCountInRange = PylonItem.GetPylonCountInRange(playerWhoHit, PylonItem.PylonMode.Damage); if (pylonCountInRange > 0) { force *= 1 + pylonCountInRange; PylonItem.DeductDamageBoostStability(playerWhoHit); } } } } [HarmonyPatch(typeof(PlayerControllerB))] internal class PlayerDamagePatch { [HarmonyPatch("DamagePlayerFromOtherClientServerRpc")] [HarmonyPrefix] private static void DoublePlayer2PDamagePrefix(ref int damageAmount, Vector3 hitDirection, int playerWhoHit) { if (!((Object)(object)GameNetworkManager.Instance != (Object)null) || !((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null)) { return; } int num = (int)GameNetworkManager.Instance.localPlayerController.playerClientId; PlayerControllerB localPlayerController = GameNetworkManager.Instance.localPlayerController; if (playerWhoHit == num) { int pylonCountInRange = PylonItem.GetPylonCountInRange(localPlayerController, PylonItem.PylonMode.Damage); if (pylonCountInRange > 0) { damageAmount *= 1 + pylonCountInRange; PylonItem.DeductDamageBoostStability(localPlayerController); } } } } [HarmonyPatch(typeof(EnemyAI))] internal class EnemyTargetingCloakPatch { [HarmonyPatch("PlayerIsTargetable")] [HarmonyPostfix] private static void PreventTargeting(ref bool __result, PlayerControllerB playerScript) { if (__result && PylonItem.IsPlayerInPylonRange(playerScript, PylonItem.PylonMode.Cloak)) { __result = false; } } [HarmonyPatch("CheckLineOfSightForClosestPlayer")] [HarmonyPostfix] private static void PreventLineOfSight(ref PlayerControllerB __result) { if ((Object)(object)__result != (Object)null && PylonItem.IsPlayerInPylonRange(__result, PylonItem.PylonMode.Cloak)) { __result = null; } } [HarmonyPatch("CheckLineOfSightForPlayer")] [HarmonyPostfix] private static void PreventSpecificLineOfSight(ref PlayerControllerB __result) { if ((Object)(object)__result != (Object)null && PylonItem.IsPlayerInPylonRange(__result, PylonItem.PylonMode.Cloak)) { __result = null; } } [HarmonyPatch("GetClosestPlayer")] [HarmonyPostfix] private static void PreventProximity(ref PlayerControllerB __result) { if ((Object)(object)__result != (Object)null && PylonItem.IsPlayerInPylonRange(__result, PylonItem.PylonMode.Cloak)) { __result = null; } } } [HarmonyPatch(typeof(PlayerControllerB))] internal class DeathProtectionPatch { [HarmonyPatch("KillPlayer")] [HarmonyPrefix] private static bool PreventDeathPrefix(PlayerControllerB __instance) { if ((Object)(object)__instance == (Object)null) { return true; } PylonItem pylonSavingPlayer = PylonItem.GetPylonSavingPlayer(__instance, PylonItem.PylonMode.DeathProtection); if ((Object)(object)pylonSavingPlayer != (Object)null) { PylonItem.SavePlayerFromDeath(__instance, pylonSavingPlayer); return false; } return true; } } [HarmonyPatch(typeof(HUDManager))] internal class XrayScanPatch { [HarmonyPatch("MeetsScanNodeRequirements")] [HarmonyPostfix] private static void ForceScanThroughWalls(ref bool __result, ScanNodeProperties node, PlayerControllerB playerScript) { if (!((Object)(object)node == (Object)null) && node.nodeType != 0 && PylonItem.IsPlayerInPylonRange(playerScript, PylonItem.PylonMode.Xray)) { __result = true; } } } [HarmonyPatch(typeof(FlowermanAI))] internal class BrackenGrabPatch { [HarmonyPatch("OnCollideWithPlayer")] [HarmonyPrefix] private static bool PreventBrackenGrabPrefix(FlowermanAI __instance, Collider other) { if ((Object)(object)__instance == (Object)null) { return true; } PlayerControllerB val = ((EnemyAI)__instance).MeetsStandardPlayerCollisionConditions(other, __instance.inKillAnimation || __instance.startingKillAnimationLocalClient || __instance.carryingPlayerBody, false); if ((Object)(object)val != (Object)null) { PylonItem pylonSavingPlayer = PylonItem.GetPylonSavingPlayer(val, PylonItem.PylonMode.DeathProtection); if ((Object)(object)pylonSavingPlayer != (Object)null) { PylonItem.SavePlayerFromDeath(val, pylonSavingPlayer); return false; } } return true; } } [HarmonyPatch(typeof(ForestGiantAI))] internal class GiantGrabPatch { [HarmonyPatch("OnCollideWithPlayer")] [HarmonyPrefix] private static bool PreventGiantGrabPrefix(ForestGiantAI __instance, Collider other) { if ((Object)(object)__instance == (Object)null) { return true; } PlayerControllerB val = ((EnemyAI)__instance).MeetsStandardPlayerCollisionConditions(other, __instance.inEatingPlayerAnimation, false); if ((Object)(object)val != (Object)null) { PylonItem pylonSavingPlayer = PylonItem.GetPylonSavingPlayer(val, PylonItem.PylonMode.DeathProtection); if ((Object)(object)pylonSavingPlayer != (Object)null) { PylonItem.SavePlayerFromDeath(val, pylonSavingPlayer); return false; } } return true; } } public class PylonRemoteItem : GrabbableObject { public AudioSource remoteAudio; public AudioClip clickSFX; public MeshRenderer buttonsRenderer; public Material[] remoteButtonMaterials; public Canvas remoteCanvas; private Image stabilityMeterFill; private float updateIntervalTimer; private PylonItem lastTarget; private int lastActiveModeIndex = -2; private bool lastPylonActiveState; private Material[] instantiatedRemoteMaterials; private Color[] originalButtonColors; private Material baseMaterial; private Color originalBaseEmissionColor; private bool lastBatteryStateEmpty; public override void Start() { //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0251: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) ((GrabbableObject)this).Start(); if ((Object)(object)buttonsRenderer != (Object)null && remoteButtonMaterials != null) { Material[] materials = ((Renderer)buttonsRenderer).materials; instantiatedRemoteMaterials = (Material[])(object)new Material[remoteButtonMaterials.Length]; originalButtonColors = (Color[])(object)new Color[remoteButtonMaterials.Length]; for (int i = 0; i < remoteButtonMaterials.Length; i++) { if ((Object)(object)remoteButtonMaterials[i] == (Object)null) { continue; } string a = ((Object)remoteButtonMaterials[i]).name.Replace(" (Instance)", "").Trim(); foreach (Material val in materials) { if (!((Object)(object)val != (Object)null)) { continue; } string b = ((Object)val).name.Replace(" (Instance)", "").Trim(); if (string.Equals(a, b, StringComparison.OrdinalIgnoreCase)) { instantiatedRemoteMaterials[i] = val; Color val2 = Color.white; if (val.HasProperty("_EmissiveColor")) { val2 = val.GetColor("_EmissiveColor"); } else if (val.HasProperty("_EmissionColor")) { val2 = val.GetColor("_EmissionColor"); } originalButtonColors[i] = val2; break; } } } } if ((Object)(object)remoteCanvas != (Object)null) { Image[] componentsInChildren = ((Component)remoteCanvas).GetComponentsInChildren(true); Image[] array = componentsInChildren; foreach (Image val3 in array) { if ((Object)(object)val3 != (Object)null && ((Object)((Component)val3).gameObject).name == "Meter_FillBar") { stabilityMeterFill = val3; break; } } } if ((Object)(object)remoteCanvas != (Object)null) { ((Behaviour)remoteCanvas).enabled = true; } MeshRenderer component = ((Component)this).GetComponent(); if (!((Object)(object)component != (Object)null) || ((Renderer)component).materials.Length == 0) { return; } baseMaterial = ((Renderer)component).materials[0]; if ((Object)(object)baseMaterial != (Object)null) { if (baseMaterial.HasProperty("_EmissionColor")) { originalBaseEmissionColor = baseMaterial.GetColor("_EmissionColor"); } else if (baseMaterial.HasProperty("_EmissiveColor")) { originalBaseEmissionColor = baseMaterial.GetColor("_EmissiveColor"); } } } public override void EquipItem() { ((GrabbableObject)this).EquipItem(); if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = true; } if ((Object)(object)remoteCanvas != (Object)null) { ((Behaviour)remoteCanvas).enabled = true; } } public override void PocketItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = false; } ((GrabbableObject)this).PocketItem(); if ((Object)(object)remoteCanvas != (Object)null) { ((Behaviour)remoteCanvas).enabled = false; } } public override void DiscardItem() { if ((Object)(object)base.playerHeldBy != (Object)null) { base.playerHeldBy.equippedUsableItemQE = false; } ((GrabbableObject)this).DiscardItem(); if ((Object)(object)remoteCanvas != (Object)null) { ((Behaviour)remoteCanvas).enabled = true; } } public override void Update() { ((GrabbableObject)this).Update(); bool flag = (Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.inShipPhase; bool flag2 = base.itemProperties.requiresBattery && (base.insertedBattery == null || base.insertedBattery.empty || base.insertedBattery.charge <= 0f); if (flag2 || flag) { if (!lastBatteryStateEmpty) { lastBatteryStateEmpty = true; lastTarget = null; lastActiveModeIndex = -2; lastPylonActiveState = false; if ((Object)(object)stabilityMeterFill != (Object)null) { stabilityMeterFill.fillAmount = 0f; } UpdateRemoteButtonEmissions(null); UpdateBaseMaterialEmission(0f); } return; } lastBatteryStateEmpty = false; updateIntervalTimer += Time.deltaTime; float num = (base.isHeld ? 0.1f : 1f); if (updateIntervalTimer >= num) { updateIntervalTimer = 0f; PylonItem closestPylon = GetClosestPylon(); base.isBeingUsed = (Object)(object)closestPylon != (Object)null && closestPylon.isPylonActive; if ((Object)(object)stabilityMeterFill != (Object)null) { stabilityMeterFill.fillAmount = (((Object)(object)closestPylon != (Object)null) ? (closestPylon.stability / 100f) : 0f); } UpdateRemoteButtonEmissions(closestPylon); UpdateBaseMaterialEmission(((Object)(object)closestPylon != (Object)null) ? 0.1f : 0f); } } public override void ItemActivate(bool used, bool buttonDown = true) { if ((Object)(object)base.playerHeldBy == (Object)null || (Object)(object)base.playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController || ((Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.inShipPhase) || (base.itemProperties.requiresBattery && (base.insertedBattery == null || base.insertedBattery.empty || base.insertedBattery.charge <= 0f)) || !buttonDown) { return; } PylonItem closestPylon = GetClosestPylon(); if ((Object)(object)closestPylon != (Object)null) { bool flag = !closestPylon.isPylonActive; if (!flag || !(closestPylon.cooldownTimer > 0f)) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if ((Object)(object)remoteAudio != (Object)null && (Object)(object)clickSFX != (Object)null) { remoteAudio.PlayOneShot(clickSFX); WalkieTalkie.TransmitOneShotAudio(remoteAudio, clickSFX, 1f); } closestPylon.TogglePylonServerRpc(flag); } } else { ((GrabbableObject)this).ItemActivate(used, buttonDown); } } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if ((Object)(object)base.playerHeldBy == (Object)null || (Object)(object)base.playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController || ((Object)(object)StartOfRound.Instance != (Object)null && StartOfRound.Instance.inShipPhase) || (base.itemProperties.requiresBattery && (base.insertedBattery == null || base.insertedBattery.empty || base.insertedBattery.charge <= 0f)) || right) { return; } PylonItem closestPylon = GetClosestPylon(); if (!((Object)(object)closestPylon != (Object)null) || !(closestPylon.stability <= 15f)) { if ((Object)(object)remoteAudio != (Object)null && (Object)(object)clickSFX != (Object)null) { remoteAudio.PlayOneShot(clickSFX); WalkieTalkie.TransmitOneShotAudio(remoteAudio, clickSFX, 1f); } if ((Object)(object)closestPylon != (Object)null) { int length = Enum.GetValues(typeof(PylonItem.PylonMode)).Length; PylonItem.PylonMode mode = (PylonItem.PylonMode)((int)(closestPylon.currentMode + 1) % length); closestPylon.ChangeModeServerRpc(mode); } } } public override void SetControlTipsForItem() { string[] array = new string[2] { "Toggle Power: [LMB]", "Switch Mode: [Q]" }; if ((Object)(object)HUDManager.Instance != (Object)null) { HUDManager.Instance.ChangeControlTipMultiple(array, true, base.itemProperties); } } public void UpdateRemoteButtonEmissions(PylonItem target) { //IL_00a2: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: 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_00e4: 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_00d3: 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) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) if (instantiatedRemoteMaterials == null || originalButtonColors == null) { return; } bool flag = (Object)(object)target != (Object)null && target.isPylonActive; int num = (int)(((Object)(object)target != (Object)null) ? target.currentMode : ((PylonItem.PylonMode)(-1))); if ((Object)(object)target == (Object)(object)lastTarget && num == lastActiveModeIndex && flag == lastPylonActiveState) { return; } lastTarget = target; lastActiveModeIndex = num; lastPylonActiveState = flag; for (int i = 0; i < instantiatedRemoteMaterials.Length && i < 8; i++) { if ((Object)(object)instantiatedRemoteMaterials[i] == (Object)null) { continue; } float num2 = ((flag && num == i) ? 0.1f : 0f); Color val = originalButtonColors[i]; float num3 = Mathf.Max(val.r, Mathf.Max(val.g, val.b)); Color val2 = ((num3 > 0.0001f) ? (val / num3 * num2) : (Color.white * num2)); string[] array = new string[2] { "_EmissionColor", "_EmissiveColor" }; string[] array2 = array; foreach (string text in array2) { if (instantiatedRemoteMaterials[i].HasProperty(text)) { instantiatedRemoteMaterials[i].SetColor(text, val2); } } if (num2 > 0f) { instantiatedRemoteMaterials[i].EnableKeyword("_EMISSIVE"); } else { instantiatedRemoteMaterials[i].DisableKeyword("_EMISSIVE"); } } } private PylonItem GetClosestPylon() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) PylonItem result = null; float num = 70f; for (int i = 0; i < PylonItem.allPylons.Count; i++) { PylonItem pylonItem = PylonItem.allPylons[i]; if ((Object)(object)pylonItem != (Object)null) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)pylonItem).transform.position); if (num2 < num) { num = num2; result = pylonItem; } } } return result; } private void UpdateBaseMaterialEmission(float intensity) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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) if ((Object)(object)baseMaterial == (Object)null) { return; } Color val = originalBaseEmissionColor * intensity; if (intensity > 0f && Mathf.Max(originalBaseEmissionColor.r, Mathf.Max(originalBaseEmissionColor.g, originalBaseEmissionColor.b)) < 0.001f) { val = new Color(0f, 0.55f, 0.65f) * intensity; } string[] array = new string[2] { "_EmissionColor", "_EmissiveColor" }; string[] array2 = array; foreach (string text in array2) { if (baseMaterial.HasProperty(text)) { baseMaterial.SetColor(text, val); } } if (intensity > 0f) { baseMaterial.EnableKeyword("_EMISSIVE"); } else { baseMaterial.DisableKeyword("_EMISSIVE"); } } protected override void __initializeVariables() { ((GrabbableObject)this).__initializeVariables(); } protected override void __initializeRpcs() { ((GrabbableObject)this).__initializeRpcs(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "PylonRemoteItem"; } } public static class PluginInfo { public const string PLUGIN_GUID = "Reiko888.UtilityPylons"; public const string PLUGIN_NAME = "UtilityPylons"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } } namespace __GEN { internal class NetworkVariableSerializationHelper { [RuntimeInitializeOnLoadMethod] internal static void InitializeSerialization() { } } } namespace Reiko888.UtilityPylons.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }