Decompiled source of LightEater v1.0.7
LightEater.dll
Decompiled a month ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using LightEater.Behaviours; using LightEater.Behaviours.LightSystem.Factories; using LightEater.Behaviours.LightSystem.Handlers.DeluminatorHandlers; using LightEater.Behaviours.LightSystem.Handlers.LightEaterHandlers; using LightEater.Behaviours.LightSystem.Interfaces; using LightEater.Managers; using LightEater.NetcodePatcher; using LightEater.Patches; using LightEater.Values; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Rendering.HighDefinition; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("LightEater")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LightEater")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("4f6e7a3d-9f39-4466-b505-b6ce2e3133d4")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [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.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("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 LightEater { public class Constants { public const string GLOBAL = "_Global_"; public const string ENEMIES_INTERACTIONS = "Enemies Interactions"; public const string SHIP_INTERACTIONS = "Ship Interactions"; public const string STORM_INTERACTIONS = "Storm Interactions"; public const string LIGHT_EATER = "Light Eater"; public const string OLD_BIRD_NAME = "RadMech"; public const string DELUMINATOR = "Deluminator"; public const string IMPOSSIBLE_ACTION = "Impossible Action"; public const string INFORMATION = "Information"; public const string MESSAGE_INFO_WAIT_SHIP = "Cannot be used until the ship has landed"; public const string MESSAGE_INFO_NO_LIGHT = "No targeted light source or unavailable charge"; public const string MESSAGE_INFO_ABSORPTION_CANCELED = "Light source absorption cancelled out"; public const string MESSAGE_INFO_MAX_CHARGES = "You have already reached the maximum number of charges for this item"; public const string MESSAGE_INFO_MIN_CHARGES = "You don't have any charges on this item"; public const string MESSAGE_INFO_RELEASE_CANCELED = "Light source release cancelled out"; public const string MESSAGE_RECHARGE_SHIP_ENERGY = "Recharge ship's energy"; public const string MESSAGE_NO_SHIP_ENERGY = "Not enough energy left..."; public const string MESSAGE_DEFAULT_ITEM_CHARGER = "(Requires battery-powered item)"; public const string MESSAGE_DEFAULT_SHIP_LEVER = "[Wait for ship to land]"; public const string SHIP_LIGHTS = "ShipElectricLights"; public const string TURRET = "TurretScript"; public const string LANDMINE = "Landmine"; } [BepInPlugin("Lega.LightEater", "Light Eater", "1.0.7")] public class LightEater : BaseUnityPlugin { private const string modGUID = "Lega.LightEater"; private const string modName = "Light Eater"; private const string modVersion = "1.0.7"; private readonly Harmony harmony = new Harmony("Lega.LightEater"); private static readonly AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lighteater")); internal static ManualLogSource mls; public static ConfigFile configFile; public static GameObject deluminatorObj; public static Material overchargeShader; public static bool isSellBodies = false; public void Awake() { mls = Logger.CreateLogSource("LightEater"); configFile = ((BaseUnityPlugin)this).Config; ConfigManager.Load(); ConfigManager.GetEnemiesValues(); NetcodePatcher(); LoadEnemies(); LoadItems(); LoadShaders(); harmony.PatchAll(typeof(StartOfRoundPatch)); harmony.PatchAll(typeof(RoundManagerPatch)); harmony.PatchAll(typeof(GrabbableObjectPatch)); harmony.PatchAll(typeof(TurretPatch)); harmony.PatchAll(typeof(LandminePatch)); harmony.PatchAll(typeof(EnemyAIPatch)); harmony.PatchAll(typeof(PatcherToolPatch)); if (ConfigManager.interactWithStorm.Value) { harmony.PatchAll(typeof(StormyWeatherPatch)); } if (ConfigManager.disableShipLights.Value) { harmony.PatchAll(typeof(ShipLightsPatch)); } if (ConfigManager.disableShipDoor.Value) { harmony.PatchAll(typeof(HangarShipDoorPatch)); } if (ConfigManager.disableItemCharger.Value) { harmony.PatchAll(typeof(ItemChargerPatch)); } if (ConfigManager.disableShipScreen.Value) { harmony.PatchAll(typeof(ManualCameraRendererPatch)); } if (ConfigManager.disableShipTeleporters.Value) { harmony.PatchAll(typeof(ShipTeleporterPatch)); } PatchOtherMods(); } private static void NetcodePatcher() { Type[] types = Assembly.GetExecutingAssembly().GetTypes(); Type[] array = types; foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); MethodInfo[] array2 = methods; foreach (MethodInfo methodInfo in array2) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } public static void LoadEnemies() { EnemyType val = bundle.LoadAsset<EnemyType>("Assets/LightEater/LightEaterEnemy.asset"); NetworkPrefabs.RegisterNetworkPrefab(val.enemyPrefab); var (dictionary, dictionary2) = ConfigManager.GetEnemiesSpawns(); Enemies.RegisterEnemy(val, dictionary, dictionary2, bundle.LoadAsset<TerminalNode>("Assets/LightEater/LightEaterTN.asset"), bundle.LoadAsset<TerminalKeyword>("Assets/LightEater/LightEaterTK.asset")); } public void LoadItems() { if (ConfigManager.isDeluminator.Value) { deluminatorObj = RegisterItem(typeof(Deluminator), bundle.LoadAsset<Item>("Assets/Deluminator/DeluminatorItem.asset")).spawnPrefab; } } public Item RegisterItem(Type type, Item item) { if ((Object)(object)item.spawnPrefab.GetComponent(type) == (Object)null) { Component obj = item.spawnPrefab.AddComponent(type); PhysicsProp val = (PhysicsProp)(object)((obj is PhysicsProp) ? obj : null); ((GrabbableObject)val).grabbable = true; ((GrabbableObject)val).grabbableToEnemies = true; ((GrabbableObject)val).itemProperties = item; } NetworkPrefabs.RegisterNetworkPrefab(item.spawnPrefab); Utilities.FixMixerGroups(item.spawnPrefab); Items.RegisterItem(item); return item; } public static void LoadShaders() { overchargeShader = bundle.LoadAsset<Material>("Assets/Shaders/OverchargeMaterial.mat"); } public static void PatchOtherMods() { isSellBodies = Type.GetType("SellBodies.MyPluginInfo, SellBodies") != null; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "LightEater"; public const string PLUGIN_NAME = "LightEater"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace LightEater.Values { public class EnemyValue { public string EnemyName { get; internal set; } public int AbsorbDistance { get; internal set; } public int AbsorbCharge { get; internal set; } public bool Destroy { get; internal set; } public EnemyValue(string enemyName, int absorbDistance, int absorbCharge, bool destroy) { EnemyName = enemyName; AbsorbDistance = absorbDistance; AbsorbCharge = absorbCharge; Destroy = destroy; base..ctor(); } } } namespace LightEater.Patches { internal class EnemyAIPatch { [HarmonyPatch(typeof(EnemyAI), "Start")] [HarmonyPostfix] private static void StartEnemy(ref EnemyAI __instance) { LightEnergyManager.AddEnemy(__instance); } [HarmonyPatch(typeof(EnemyAICollisionDetect), "IShockableWithGun.CanBeShocked")] [HarmonyPrefix] private static bool CanBeShocked(ref EnemyAICollisionDetect __instance, ref bool __result) { if ((Object)(object)__instance.mainScript == (Object)null || !(__instance.mainScript is LightEaterAI)) { return true; } __result = true; return false; } [HarmonyPatch(typeof(EnemyAICollisionDetect), "IShockableWithGun.ShockWithGun")] [HarmonyPostfix] private static void ShockWithGun(ref EnemyAICollisionDetect __instance) { if (!((Object)(object)__instance.mainScript == (Object)null) && __instance.mainScript is LightEaterAI lightEaterAI) { lightEaterAI.isShocked = true; } } } internal class GrabbableObjectPatch { [HarmonyPatch(typeof(GrabbableObject), "Start")] [HarmonyPostfix] private static void StartGrabbableObject(ref GrabbableObject __instance) { GrabbableObject obj = __instance; BeltBagItem val = (BeltBagItem)(object)((obj is BeltBagItem) ? obj : null); if (val != null) { LightEnergyManager.AddBeltBag(val); } else { LightEnergyManager.AddObject(__instance); } } } internal class HangarShipDoorPatch { [HarmonyPatch(typeof(HangarShipDoor), "Update")] [HarmonyPostfix] private static void UpdateShipDoor(HangarShipDoor __instance) { if (ShipLightsPatch.hasBeenAbsorbed) { __instance.doorPower = 0f; ((TMP_Text)__instance.doorPowerDisplay).text = "0%"; } } } internal class ItemChargerPatch { [HarmonyPatch(typeof(ItemCharger), "Update")] [HarmonyPostfix] private static void UpdateItemCharger(ref ItemCharger __instance) { if (ShipLightsPatch.hasBeenAbsorbed) { __instance.triggerScript.disabledHoverTip = "Not enough energy left..."; __instance.triggerScript.interactable = false; } } } internal class LandminePatch { [HarmonyPatch(typeof(Landmine), "Start")] [HarmonyPostfix] private static void StartLandmine(ref Landmine __instance) { LightEnergyManager.AddLandmine(__instance); } } internal class ManualCameraRendererPatch { [HarmonyPatch(typeof(ManualCameraRenderer), "SwitchScreenButton")] [HarmonyPrefix] private static bool SwitchScreenButton() { return !ShipLightsPatch.hasBeenAbsorbed; } [HarmonyPatch(typeof(ManualCameraRenderer), "SwitchScreenOn")] [HarmonyPrefix] private static bool SwitchScreenOn() { return !ShipLightsPatch.hasBeenAbsorbed; } [HarmonyPatch(typeof(ManualCameraRenderer), "SwitchScreenOnClientRpc")] [HarmonyPrefix] private static bool SwitchScreenOnClientRpc() { return !ShipLightsPatch.hasBeenAbsorbed; } } internal class PatcherToolPatch { private static float shockingTimer; [HarmonyPatch(typeof(PatcherTool), "StopShockingAnomalyOnClient")] [HarmonyPrefix] private static void StopShocking(ref PatcherTool __instance) { if (__instance.shockedTargetScript != null) { IShockableWithGun shockedTargetScript = __instance.shockedTargetScript; EnemyAICollisionDetect val = (EnemyAICollisionDetect)(object)((shockedTargetScript is EnemyAICollisionDetect) ? shockedTargetScript : null); if (val != null && !((Object)(object)val.mainScript == (Object)null) && val.mainScript is LightEaterAI lightEaterAI) { lightEaterAI.StopShockingServerRpc(); shockingTimer = 0f; } } } [HarmonyPatch(typeof(PatcherTool), "LateUpdate")] [HarmonyPostfix] private static void UpdateShocking(ref PatcherTool __instance) { if (!__instance.isShocking || (Object)(object)((GrabbableObject)__instance).playerHeldBy == (Object)null || (Object)(object)((GrabbableObject)__instance).playerHeldBy != (Object)(object)GameNetworkManager.Instance.localPlayerController || __instance.shockedTargetScript == null) { return; } IShockableWithGun shockedTargetScript = __instance.shockedTargetScript; EnemyAICollisionDetect val = (EnemyAICollisionDetect)(object)((shockedTargetScript is EnemyAICollisionDetect) ? shockedTargetScript : null); if (val != null && !((Object)(object)val.mainScript == (Object)null) && val.mainScript is LightEaterAI lightEaterAI) { shockingTimer += Time.deltaTime; int num = (int)(shockingTimer * 40f); if (num > 0) { shockingTimer -= (float)num / 40f; lightEaterAI.energyNetwork.UpdateCharges(lightEaterAI.energyNetwork.currentCharge + num); } } } } internal class RoundManagerPatch { [HarmonyPatch(typeof(RoundManager), "FinishGeneratingNewLevelClientRpc")] [HarmonyPostfix] private static void StartGame() { StormyWeatherPatch.lightEaters.Clear(); LightEnergyManager.ResetEnemies(); LightEnergyManager.ResetObjects(); LightEnergyManager.ResetTurrets(); LightEnergyManager.ResetLandmines(); LightEnergyManager.ResetPoweredLights(); LightEnergyManager.ResetBeltBags(); } } internal class ShipLightsPatch { public static bool hasBeenAbsorbed; [HarmonyPatch(typeof(ShipLights), "SetShipLightsBoolean")] [HarmonyPrefix] private static bool SetShipLightsBoolean() { return !hasBeenAbsorbed; } [HarmonyPatch(typeof(ShipLights), "SetShipLightsClientRpc")] [HarmonyPrefix] private static bool SetShipLightsClientRpc() { return !hasBeenAbsorbed; } [HarmonyPatch(typeof(ShipLights), "SetShipLightsOnLocalClientOnly")] [HarmonyPrefix] private static bool SetShipLightsOnLocalClientOnly() { return !hasBeenAbsorbed; } [HarmonyPatch(typeof(ShipLights), "ToggleShipLights")] [HarmonyPrefix] private static bool ToggleShipLights() { return !hasBeenAbsorbed; } [HarmonyPatch(typeof(ShipLights), "ToggleShipLightsOnLocalClientOnly")] [HarmonyPrefix] private static bool ToggleShipLightsOnLocalClientOnly() { return !hasBeenAbsorbed; } } internal class ShipTeleporterPatch { [HarmonyPatch(typeof(ShipTeleporter), "Update")] [HarmonyPostfix] private static void UpdateShipTeleporter(ref ShipTeleporter __instance) { if (ShipLightsPatch.hasBeenAbsorbed) { __instance.buttonTrigger.disabledHoverTip = "Not enough energy left..."; __instance.buttonTrigger.interactable = false; } } } internal class StartOfRoundPatch { public static HangarShipDoor shipDoor; public static StartMatchLever shipLever; public static ItemCharger itemCharger; public static Terminal terminal; public static ShipTeleporter shipTeleporter; public static ShipTeleporter inverseShipTeleporter; [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyPostfix] private static void StartRound() { if (ConfigManager.disableShipDoor.Value) { shipDoor = Object.FindObjectOfType<HangarShipDoor>(); } if (ConfigManager.disableShipLever.Value) { shipLever = Object.FindObjectOfType<StartMatchLever>(); } if (ConfigManager.disableItemCharger.Value) { itemCharger = Object.FindObjectOfType<ItemCharger>(); } if (ConfigManager.disableTerminal.Value) { terminal = Object.FindObjectOfType<Terminal>(); } if (ConfigManager.disableShipTeleporters.Value) { shipTeleporter = ((IEnumerable<ShipTeleporter>)Object.FindObjectsOfType<ShipTeleporter>()).FirstOrDefault((Func<ShipTeleporter, bool>)((ShipTeleporter t) => !t.isInverseTeleporter)); inverseShipTeleporter = ((IEnumerable<ShipTeleporter>)Object.FindObjectsOfType<ShipTeleporter>()).FirstOrDefault((Func<ShipTeleporter, bool>)((ShipTeleporter t) => t.isInverseTeleporter)); } } [HarmonyPatch(typeof(StartOfRound), "ShipLeave")] [HarmonyPostfix] private static void ShipLeave() { EndGame(); } public static void EndGame() { Deluminator[] array = Object.FindObjectsOfType<Deluminator>(); foreach (Deluminator deluminator in array) { deluminator.energyNetwork.StopHandleLightCoroutine(showMsg: false); } LightEaterAI[] array2 = Object.FindObjectsOfType<LightEaterAI>(); foreach (LightEaterAI lightEaterAI in array2) { lightEaterAI.energyNetwork.StopHandleLightCoroutine(showMsg: false); } ShipLightsPatch.hasBeenAbsorbed = false; EnablesShipFunctionalities(enable: true); } public static void EnablesShipFunctionalities(bool enable) { EnablesShipDoor(enable); EnablesShipLever(enable); EnablesItemCharger(enable); EnablesTerminal(enable); EnablesShipTeleporter(enable); EnablesInverseShipTeleporter(enable); } public static void EnablesShipDoor(bool enable) { if (!ConfigManager.disableShipDoor.Value) { return; } if (shipDoor == null) { shipDoor = Object.FindObjectOfType<HangarShipDoor>(); } if (!((Object)(object)shipDoor == (Object)null)) { shipDoor.hydraulicsScreenDisplayed = enable; shipDoor.hydraulicsDisplay.SetActive(enable); shipDoor.SetDoorButtonsEnabled(enable); if (!enable) { StartOfRound.Instance.shipDoorsAnimator.SetBool("Closed", enable); } if (!enable) { shipDoor.SetDoorOpen(); } } } public static void EnablesShipLever(bool enable) { if (ConfigManager.disableShipLever.Value) { if (shipLever == null) { shipLever = Object.FindObjectOfType<StartMatchLever>(); } if (!((Object)(object)shipLever == (Object)null)) { shipLever.triggerScript.disabledHoverTip = (enable ? "[Wait for ship to land]" : "Not enough energy left..."); shipLever.triggerScript.interactable = enable; } } } public static void EnablesItemCharger(bool enable) { if (ConfigManager.disableItemCharger.Value) { if (itemCharger == null) { itemCharger = Object.FindObjectOfType<ItemCharger>(); } if (!((Object)(object)itemCharger == (Object)null)) { itemCharger.triggerScript.disabledHoverTip = (enable ? "(Requires battery-powered item)" : "Not enough energy left..."); itemCharger.triggerScript.interactable = enable; } } } public static void EnablesTerminal(bool enable) { if (!ConfigManager.disableTerminal.Value) { return; } if (terminal == null) { terminal = Object.FindObjectOfType<Terminal>(); } if (!((Object)(object)terminal == (Object)null)) { if (!enable) { terminal.terminalTrigger.disabledHoverTip = "Not enough energy left..."; } terminal.terminalTrigger.interactable = enable; } } public static void EnablesShipTeleporter(bool enable) { if (!ConfigManager.disableShipTeleporters.Value) { return; } if (shipTeleporter == null) { shipTeleporter = ((IEnumerable<ShipTeleporter>)Object.FindObjectsOfType<ShipTeleporter>()).FirstOrDefault((Func<ShipTeleporter, bool>)((ShipTeleporter t) => !t.isInverseTeleporter)); } if (!((Object)(object)shipTeleporter == (Object)null)) { if (!enable) { shipTeleporter.buttonTrigger.disabledHoverTip = "Not enough energy left..."; } shipTeleporter.buttonTrigger.interactable = enable; } } public static void EnablesInverseShipTeleporter(bool enable) { if (!ConfigManager.disableShipTeleporters.Value) { return; } if (inverseShipTeleporter == null) { inverseShipTeleporter = ((IEnumerable<ShipTeleporter>)Object.FindObjectsOfType<ShipTeleporter>()).FirstOrDefault((Func<ShipTeleporter, bool>)((ShipTeleporter t) => t.isInverseTeleporter)); } if (!((Object)(object)inverseShipTeleporter == (Object)null)) { if (!enable) { inverseShipTeleporter.buttonTrigger.disabledHoverTip = "Not enough energy left..."; } inverseShipTeleporter.buttonTrigger.interactable = enable; } } } internal class StormyWeatherPatch { public static List<LightEaterAI> lightEaters = new List<LightEaterAI>(); public static int randomStrikeTimer = 10; public static float strikeLightEaterTimer = 0f; public static GameObject setStaticToEnemy; public static LightEaterAI targetedLightEater; [HarmonyPatch(typeof(StormyWeather), "Update")] [HarmonyPostfix] private static void UpdateStormyWeather(ref StormyWeather __instance) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)setStaticToEnemy != (Object)null) { EnemyAI componentInChildren = setStaticToEnemy.GetComponentInChildren<EnemyAI>(); if ((Object)(object)componentInChildren != (Object)null && !componentInChildren.isOutside) { __instance.staticElectricityParticle.Stop(); } ((Component)__instance.staticElectricityParticle).transform.position = setStaticToEnemy.transform.position; } if (!((NetworkBehaviour)RoundManager.Instance).IsOwner) { return; } lightEaters.RemoveAll((LightEaterAI l) => (Object)(object)l == (Object)null); if (!lightEaters.Any()) { return; } strikeLightEaterTimer += Time.deltaTime; if (strikeLightEaterTimer < (float)randomStrikeTimer) { return; } LightEaterAI lightEaterAI = null; PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB player in allPlayerScripts) { if (player.isPlayerControlled && !player.isPlayerDead) { lightEaterAI = lightEaters.FirstOrDefault((LightEaterAI l) => ((EnemyAI)l).isOutside && Vector3.Distance(((Component)player).transform.position, ((Component)l).transform.position) < 20f); if ((Object)(object)lightEaterAI != (Object)null) { break; } } } if (!((Object)(object)lightEaterAI == (Object)null)) { randomStrikeTimer = new Random().Next(ConfigManager.minStrikeDuration.Value, ConfigManager.maxStrikeDuration.Value); strikeLightEaterTimer = 0f; ((MonoBehaviour)__instance).StartCoroutine(StrikeLightEaterCoroutine()); } } public static IEnumerator StrikeLightEaterCoroutine() { LightEaterAI lightEater = lightEaters[new Random().Next(lightEaters.Count)]; RoundManager.Instance.ShowStaticElectricityWarningServerRpc(NetworkObjectReference.op_Implicit(((EnemyAI)lightEater).thisNetworkObject), 1.5f); yield return (object)new WaitForSeconds(2f); if (((EnemyAI)lightEater).isOutside) { targetedLightEater = lightEater; RoundManager.Instance.LightningStrikeServerRpc(((Component)lightEater).transform.position); } } [HarmonyPatch(typeof(StormyWeather), "SetStaticElectricityWarning")] [HarmonyPrefix] private static bool SetStaticElectricityWarning(ref StormyWeather __instance, ref NetworkObject warningObject, ref float particleTime) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)((Component)warningObject).GetComponentInChildren<EnemyAI>() == (Object)null) { return true; } setStaticToEnemy = ((Component)warningObject).gameObject; ShapeModule shape = __instance.staticElectricityParticle.shape; ((ShapeModule)(ref shape)).meshRenderer = setStaticToEnemy.GetComponentInChildren<MeshRenderer>(); __instance.staticElectricityParticle.time = particleTime; __instance.staticElectricityParticle.Play(); AudioSource component = ((Component)__instance.staticElectricityParticle).gameObject.GetComponent<AudioSource>(); component.clip = __instance.staticElectricityAudio; component.Play(); component.time = particleTime; return false; } [HarmonyPatch(typeof(StormyWeather), "LightningStrike")] [HarmonyPostfix] private static void LightningStrike() { if (!((Object)(object)targetedLightEater == (Object)null)) { targetedLightEater.energyNetwork.UpdateCharges(targetedLightEater.energyNetwork.currentCharge + ConfigManager.stormCharge.Value); } } } internal class TurretPatch { [HarmonyPatch(typeof(Turret), "Start")] [HarmonyPostfix] private static void StartTurret(ref Turret __instance) { LightEnergyManager.AddTurret(__instance); } } } namespace LightEater.Managers { public class ConfigManager { public static List<EnemyValue> enemiesValues = new List<EnemyValue>(); public static ConfigEntry<string> spawnWeights; public static ConfigEntry<bool> isDeluminator; public static ConfigEntry<float> huntingSpeed; public static ConfigEntry<float> chasingSpeed; public static ConfigEntry<int> damage; public static ConfigEntry<int> lightCharge; public static ConfigEntry<int> itemCharge; public static ConfigEntry<int> turretCharge; public static ConfigEntry<int> landmineCharge; public static ConfigEntry<string> absorbedEnemies; public static ConfigEntry<int> shipMinHour; public static ConfigEntry<bool> disableShipLights; public static ConfigEntry<bool> disableShipDoor; public static ConfigEntry<bool> disableShipLever; public static ConfigEntry<bool> disableItemCharger; public static ConfigEntry<bool> disableTerminal; public static ConfigEntry<bool> disableShipScreen; public static ConfigEntry<bool> disableShipTeleporters; public static ConfigEntry<bool> interactWithStorm; public static ConfigEntry<int> minStrikeDuration; public static ConfigEntry<int> maxStrikeDuration; public static ConfigEntry<int> stormCharge; public static void Load() { spawnWeights = LightEater.configFile.Bind<string>("_Global_", "Spawn weights", "Vanilla:20,Modded:20", "Light Eater spawn weights"); isDeluminator = LightEater.configFile.Bind<bool>("_Global_", "Enable Deluminator", true, "Is Deluminator item enabled?"); huntingSpeed = LightEater.configFile.Bind<float>("_Global_", "Hunting speed", 3f, "Light Eater speed when it moves towards a light"); chasingSpeed = LightEater.configFile.Bind<float>("_Global_", "Chasing speed", 4f, "Light Eater speed when it moves towards a player"); damage = LightEater.configFile.Bind<int>("_Global_", "Damage", 20, "Light Eater damage"); lightCharge = LightEater.configFile.Bind<int>("_Global_", "Light charge", 20, "Electric charge received upon absorption of a dungeon light"); itemCharge = LightEater.configFile.Bind<int>("_Global_", "Item charge", 20, "Electric charge received upon absorption of an item"); turretCharge = LightEater.configFile.Bind<int>("_Global_", "Turret charge", 20, "Electric charge received upon absorption of a turret"); landmineCharge = LightEater.configFile.Bind<int>("_Global_", "Landmine charge", 10, "Electric charge received upon absorption of a landmine"); absorbedEnemies = LightEater.configFile.Bind<string>("Enemies Interactions", "Enemies list", "RadMech:20:100:True,Boomba:5:20:False,Cleaning Drone:5:20:False,Mobile Turret:5:20:True,Shockwave Drone:5:20:True", "List of enemies that can be absorbed.\nThe format is 'EnemyName:AbsorbDistance:AbsorbCharge'."); shipMinHour = LightEater.configFile.Bind<int>("Ship Interactions", "Min hour", 9, "Hour at which the Light Eater can absorb the ship (between 1 and 18)"); disableShipLights = LightEater.configFile.Bind<bool>("Ship Interactions", "Disable lights", true, "Disable ship lights"); disableShipDoor = LightEater.configFile.Bind<bool>("Ship Interactions", "Disable door", true, "Disable ship door"); disableShipLever = LightEater.configFile.Bind<bool>("Ship Interactions", "Disable lever", false, "Disable ship lever"); disableItemCharger = LightEater.configFile.Bind<bool>("Ship Interactions", "Disable item charger", true, "Disable item charger"); disableTerminal = LightEater.configFile.Bind<bool>("Ship Interactions", "Disable terminal", true, "Disable terminal"); disableShipScreen = LightEater.configFile.Bind<bool>("Ship Interactions", "Disable screen", true, "Disable ship screen"); disableShipTeleporters = LightEater.configFile.Bind<bool>("Ship Interactions", "Disable teleporters", true, "Disable ship teleporters"); interactWithStorm = LightEater.configFile.Bind<bool>("Storm Interactions", "Enable", true, "Enable Storm Interactions"); minStrikeDuration = LightEater.configFile.Bind<int>("Storm Interactions", "Min strike duration", 7, "Minimum time interval before a new strike"); maxStrikeDuration = LightEater.configFile.Bind<int>("Storm Interactions", "Max strike duration", 15, "Maximum time interval before a new strike"); stormCharge = LightEater.configFile.Bind<int>("Storm Interactions", "Storm charge", 100, "Electrical charge received by lightning"); } public static (Dictionary<LevelTypes, int> spawnRateByLevelType, Dictionary<string, int> spawnRateByCustomLevelType) GetEnemiesSpawns() { //IL_0083: Unknown result type (might be due to invalid IL or missing references) Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int>(); Dictionary<string, int> dictionary2 = new Dictionary<string, int>(); foreach (string item in from s in spawnWeights.Value.Split(',') select s.Trim()) { string[] array = item.Split(':'); if (array.Length != 2) { continue; } string text = array[0]; if (int.TryParse(array[1], out var result)) { if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out LevelTypes result2)) { dictionary[result2] = result; } else { dictionary2[text] = result; } } } return (dictionary, dictionary2); } public static void GetEnemiesValues() { string[] array = absorbedEnemies.Value.Split(','); string[] array2 = array; foreach (string text in array2) { string[] array3 = text.Split(':'); if (array3.Length == 4) { enemiesValues.Add(new EnemyValue(array3[0], int.Parse(array3[1]), int.Parse(array3[2]), bool.Parse(array3[3]))); } } } } public class CustomPassManager : MonoBehaviour { public static OverchargeCustomPass overchargePass; public static CustomPassVolume customPassVolume; public static Dictionary<LightEaterAI, List<Renderer>> overchargeEnemies = new Dictionary<LightEaterAI, List<Renderer>>(); public static CustomPassVolume CustomPassVolume { get { //IL_0057: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)customPassVolume == (Object)null) { customPassVolume = ((Component)GameNetworkManager.Instance.localPlayerController.gameplayCamera).gameObject.AddComponent<CustomPassVolume>(); if ((Object)(object)customPassVolume != (Object)null) { customPassVolume.targetCamera = GameNetworkManager.Instance.localPlayerController.gameplayCamera; customPassVolume.injectionPoint = (CustomPassInjectionPoint)1; customPassVolume.isGlobal = true; overchargePass = new OverchargeCustomPass(); customPassVolume.customPasses.Add((CustomPass)(object)overchargePass); } } return customPassVolume; } } public static void SetupCustomPassForEnemy(LightEaterAI lightEater) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (overchargeEnemies.ContainsKey(lightEater)) { return; } LayerMask frozenLayer = LayerMask.op_Implicit(524288); List<Renderer> list = (from r in ((Component)lightEater).GetComponentsInChildren<Renderer>() where (LayerMask.op_Implicit(frozenLayer) & (1 << ((Component)r).gameObject.layer)) != 0 select r).ToList(); if ((Object)(object)CustomPassVolume == (Object)null) { LightEater.mls.LogError((object)"CustomPassVolume is not assigned."); return; } overchargePass = CustomPassVolume.customPasses.Find((CustomPass pass) => pass is OverchargeCustomPass) as OverchargeCustomPass; if (overchargePass == null) { LightEater.mls.LogError((object)"FrozenCustomPass could not be found in CustomPassVolume."); return; } overchargeEnemies[lightEater] = list; overchargePass.AddTargetRenderers(list.ToArray(), LightEater.overchargeShader); } public static void RemoveAura(LightEaterAI lightEater) { if (overchargeEnemies.ContainsKey(lightEater)) { overchargePass.RemoveTargetRenderers(overchargeEnemies[lightEater]); overchargeEnemies.Remove(lightEater); } } } public class LightEnergyManager { public static Dictionary<Animator, bool> poweredLights = new Dictionary<Animator, bool>(); public static Dictionary<Turret, bool> turrets = new Dictionary<Turret, bool>(); public static Dictionary<Landmine, bool> landmines = new Dictionary<Landmine, bool>(); public static HashSet<EnemyAI> enemies = new HashSet<EnemyAI>(); public static HashSet<GrabbableObject> grabbableObjects = new HashSet<GrabbableObject>(); public static HashSet<BeltBagItem> beltBags = new HashSet<BeltBagItem>(); public static void ResetEnemies() { enemies.Clear(); EnemyAI[] array = Object.FindObjectsOfType<EnemyAI>(); foreach (EnemyAI enemy in array) { AddEnemy(enemy); } } public static void AddEnemy(EnemyAI enemy) { if (!string.IsNullOrEmpty(enemy.enemyType?.enemyName) && ConfigManager.enemiesValues.Select((EnemyValue e) => e.EnemyName).Contains(enemy.enemyType.enemyName) && !enemies.Contains(enemy)) { enemies.Add(enemy); } } public static void ResetTurrets() { turrets.Clear(); Turret[] array = Object.FindObjectsOfType<Turret>(); foreach (Turret turret in array) { AddTurret(turret); } } public static void AddTurret(Turret turret) { if (turret.turretActive && !turrets.ContainsKey(turret)) { turrets.Add(turret, value: true); } } public static void ResetLandmines() { landmines.Clear(); Landmine[] array = Object.FindObjectsOfType<Landmine>(); foreach (Landmine landmine in array) { AddLandmine(landmine); } } public static void AddLandmine(Landmine landmine) { if (landmine.mineActivated && !landmines.ContainsKey(landmine)) { landmines.Add(landmine, value: true); } } public static void ResetPoweredLights() { poweredLights.Clear(); foreach (Animator allPoweredLightsAnimator in RoundManager.Instance.allPoweredLightsAnimators) { AddPoweredLight(allPoweredLightsAnimator); } } public static void AddPoweredLight(Animator poweredLight) { if (!poweredLights.ContainsKey(poweredLight)) { poweredLights.Add(poweredLight, value: true); } } public static void ResetObjects() { grabbableObjects.Clear(); GrabbableObject[] array = Object.FindObjectsOfType<GrabbableObject>(); foreach (GrabbableObject grabbableObject in array) { AddObject(grabbableObject); } } public static void AddObject(GrabbableObject grabbableObject) { if (grabbableObject.itemProperties.requiresBattery && !grabbableObjects.Contains(grabbableObject)) { grabbableObjects.Add(grabbableObject); } } public static void ResetBeltBags() { beltBags.Clear(); BeltBagItem[] array = Object.FindObjectsOfType<BeltBagItem>(); foreach (BeltBagItem beltBag in array) { AddBeltBag(beltBag); } } public static void AddBeltBag(BeltBagItem beltBag) { if (!beltBags.Contains(beltBag)) { beltBags.Add(beltBag); } } public static List<Turret> GetTurrets(bool value) { return (from t in turrets where t.Value == value select t.Key).ToList(); } public static List<Landmine> GetLandmines(bool value) { return (from l in landmines where l.Value == value select l.Key).ToList(); } public static List<Animator> GetPoweredLights(bool value) { return (from p in poweredLights where p.Value == value select p.Key).ToList(); } public static void SetTurretValue(Turret turret, bool value) { turrets[turret] = value; } public static void SetLandmineValue(Landmine landmine, bool value) { landmines[landmine] = value; } public static void SetPoweredLightValue(GameObject gameObject, bool value) { Animator key = ((IEnumerable<Animator>)RoundManager.Instance.allPoweredLightsAnimators).FirstOrDefault((Func<Animator, bool>)((Animator l) => (Object)(object)((l != null) ? ((Component)l).gameObject : null) == (Object)(object)gameObject)); poweredLights[key] = value; } public static GameObject GetLightSourceByName(string objectName, Vector3 position, bool enable) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) return (GameObject)(objectName switch { "ShipElectricLights" => ((Component)StartOfRound.Instance.shipRoomLights).gameObject, "TurretScript" => ((Component)(from t in GetTurrets(enable) orderby (!((Object)(object)t != (Object)null)) ? float.MaxValue : Vector3.Distance(position, ((Component)t).transform.position) select t).FirstOrDefault()).gameObject, "Landmine" => ((Component)(from l in GetLandmines(enable) orderby (!((Object)(object)l != (Object)null)) ? float.MaxValue : Vector3.Distance(position, ((Component)l).transform.position) select l).FirstOrDefault()).gameObject, _ => ((Component)(from p in GetPoweredLights(enable) orderby (!((Object)(object)p != (Object)null)) ? float.MaxValue : Vector3.Distance(position, ((Component)p).transform.position) select p).FirstOrDefault()).gameObject, }); } public static GameObject GetClosestLightSourceInView(Deluminator deluminator, bool enable) { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB val = ((GrabbableObject)(deluminator?)).playerHeldBy; if ((Object)(object)val == (Object)null) { return null; } Ray val2 = default(Ray); ((Ray)(ref val2))..ctor(((Component)val.gameplayCamera).transform.position, ((Component)val.gameplayCamera).transform.forward); RaycastHit[] array = Physics.SphereCastAll(val2, 2f, 5f); RaycastHit[] array2 = array; for (int i = 0; i < array2.Length; i++) { RaycastHit hit = array2[i]; EnemyAI? obj = ((IEnumerable<EnemyAI>)enemies).FirstOrDefault((Func<EnemyAI, bool>)((EnemyAI e) => (Object)(object)e == (Object)(object)((Component)((RaycastHit)(ref hit)).collider).GetComponent<EnemyAI>())); object obj2 = ((obj != null) ? ((Component)obj).gameObject : null); if (obj2 == null) { GrabbableObject? obj3 = ((IEnumerable<GrabbableObject>)grabbableObjects).FirstOrDefault((Func<GrabbableObject, bool>)((GrabbableObject o) => CanBeTransferred(o, enable) && (Object)(object)o == (Object)(object)((Component)((RaycastHit)(ref hit)).collider).GetComponent<GrabbableObject>())); obj2 = ((obj3 != null) ? ((Component)obj3).gameObject : null); if (obj2 == null) { Turret? obj4 = ((IEnumerable<Turret>)GetTurrets(enable)).FirstOrDefault((Func<Turret, bool>)((Turret o) => (Object)(object)o == (Object)(object)((Component)((RaycastHit)(ref hit)).collider).GetComponent<Turret>())); obj2 = ((obj4 != null) ? ((Component)obj4).gameObject : null); if (obj2 == null) { Landmine? obj5 = ((IEnumerable<Landmine>)GetLandmines(enable)).FirstOrDefault((Func<Landmine, bool>)((Landmine o) => (Object)(object)o == (Object)(object)((Component)((RaycastHit)(ref hit)).collider).GetComponent<Landmine>())); obj2 = ((obj5 != null) ? ((Component)obj5).gameObject : null); if (obj2 == null) { Animator? obj6 = ((IEnumerable<Animator>)GetPoweredLights(enable)).FirstOrDefault((Func<Animator, bool>)((Animator o) => (Object)(object)o == (Object)(object)((Component)((RaycastHit)(ref hit)).collider).GetComponent<Animator>())); obj2 = ((obj6 != null) ? ((Component)obj6).gameObject : null) ?? ((enable != ShipLightsPatch.hasBeenAbsorbed && Vector3.Distance(((Component)val).transform.position, StartOfRound.Instance.shipLandingPosition.position) <= 20f) ? ((Component)StartOfRound.Instance.shipRoomLights).gameObject : null); } } } } GameObject val3 = (GameObject)obj2; if (!((Object)(object)val3 == (Object)null) && CanChargeBeApplied(deluminator.energyNetwork.currentCharge, val3, enable)) { return val3; } } return null; } public static bool CanBeTransferred(GrabbableObject grabbableObject, bool enable) { if (grabbableObject.itemProperties.requiresBattery && grabbableObject.insertedBattery != null) { if (!enable || !(grabbableObject.insertedBattery.charge > 0f)) { if (!enable) { return grabbableObject.insertedBattery.charge < 1f; } return false; } return true; } return false; } public static bool CanChargeBeApplied(int currentCharge, GameObject lightSource, bool enable) { object obj = DetermineLightSource(lightSource, enable); if (!(obj is ShipLights)) { if (!(obj is EnemyAI)) { if (!(obj is GrabbableObject)) { if (!(obj is Turret)) { if (!(obj is Landmine)) { if (obj is Animator) { return enable || (!enable && currentCharge >= ConfigManager.lightCharge.Value); } return false; } return enable || (!enable && currentCharge >= ConfigManager.landmineCharge.Value); } return enable || (!enable && currentCharge >= ConfigManager.turretCharge.Value); } return enable || (!enable && currentCharge >= ConfigManager.itemCharge.Value); } return enable; } return enable || (!enable && (float)currentCharge >= 200f); } public static object DetermineLightSource(GameObject lightSource, bool enable) { ShipLights componentInParent = lightSource.GetComponentInParent<ShipLights>(); if (componentInParent == null) { GrabbableObject result = default(GrabbableObject); if (!lightSource.TryGetComponent<GrabbableObject>(ref result)) { Turret componentInParent2 = lightSource.GetComponentInParent<Turret>(); if (componentInParent2 == null) { Landmine componentInParent3 = lightSource.GetComponentInParent<Landmine>(); if (componentInParent3 == null) { EnemyAI componentInParent4 = lightSource.GetComponentInParent<EnemyAI>(); if (componentInParent4 == null) { return ((IEnumerable<Animator>)GetPoweredLights(enable)).FirstOrDefault((Func<Animator, bool>)((Animator l) => (Object)(object)((l != null) ? ((Component)l).gameObject : null) == (Object)(object)lightSource)); } return componentInParent4; } return componentInParent3; } return componentInParent2; } return result; } return componentInParent; } public static bool CanBeAbsorbed(GrabbableObject grabbableObject, Vector3 position, float distance) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)grabbableObject != (Object)null && grabbableObject.itemProperties.requiresBattery) { Battery insertedBattery = grabbableObject.insertedBattery; if (insertedBattery != null && insertedBattery.charge > 0f) { PatcherTool val = (PatcherTool)(object)((grabbableObject is PatcherTool) ? grabbableObject : null); if (val == null || !val.isShocking) { return IsObjectClose(grabbableObject, position, distance); } } } return false; } public static bool IsObjectClose(GrabbableObject grabbableObject, Vector3 position, float distance) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(position, ((Component)grabbableObject).transform.position) <= distance) { return true; } foreach (BeltBagItem beltBag in beltBags) { if (!((Object)(object)beltBag == (Object)null) && !(Vector3.Distance(position, ((Component)beltBag).transform.position) > distance) && (Object)(object)((IEnumerable<GrabbableObject>)beltBag.objectsInBag).FirstOrDefault((Func<GrabbableObject, bool>)((GrabbableObject o) => (Object)(object)o == (Object)(object)grabbableObject)) != (Object)null) { return true; } } return false; } } public class LightEnergyNetworkManager : NetworkBehaviour { public enum LightActionType { Absorb, Release } public int currentCharge; public GameObject closestLightSource; public float totalDuration; public Coroutine handleLightCoroutine; public Action PlayActionSound; public Action StopActionSound; public Action ResetAction; public int currentActionType; public void UpdateCharges(int charges) { if (NetworkManager.Singleton.IsHost) { UpdateChargesClientRpc(charges); } else { UpdateChargesServerRpc(charges); } } [ServerRpc(RequireOwnership = false)] public void UpdateChargesServerRpc(int charges) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(963873486u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, charges); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 963873486u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { UpdateChargesClientRpc(charges); } } } [ClientRpc] public void UpdateChargesClientRpc(int charges) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(11223553u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, charges); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 11223553u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 2 || (!networkManager.IsClient && !networkManager.IsHost)) { return; } currentCharge = charges; LightEaterAI componentInParent = ((Component)this).GetComponentInParent<LightEaterAI>(); if (!((Object)(object)componentInParent == (Object)null)) { if (currentCharge <= 200) { CustomPassManager.RemoveAura(componentInParent); } else { CustomPassManager.SetupCustomPassForEnemy(componentInParent); } } } public void HandleLight(GameObject lightSource, LightActionType actionType) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) if (handleLightCoroutine != null) { return; } NetworkObject component = lightSource.GetComponent<NetworkObject>(); if (NetworkManager.Singleton.IsHost) { if ((Object)(object)component != (Object)null) { HandleLightClientRpc(NetworkObjectReference.op_Implicit(component), (int)actionType); } else { HandleLightClientRpc(((Object)lightSource).name, lightSource.transform.position, (int)actionType); } } else if ((Object)(object)component != (Object)null) { HandleLightServerRpc(NetworkObjectReference.op_Implicit(component), (int)actionType); } else { HandleLightServerRpc(((Object)lightSource).name, lightSource.transform.position, (int)actionType); } } [ServerRpc(RequireOwnership = false)] public void HandleLightServerRpc(NetworkObjectReference obj, int actionType) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3015799205u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, actionType); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3015799205u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { HandleLightClientRpc(obj, actionType); } } } [ClientRpc] public void HandleLightClientRpc(NetworkObjectReference obj, int actionType) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2816409877u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val2, actionType); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2816409877u, val, (RpcDelivery)0); } NetworkObject val3 = default(NetworkObject); if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && ((NetworkObjectReference)(ref obj)).TryGet(ref val3, (NetworkManager)null)) { currentActionType = actionType; closestLightSource = ((Component)val3).gameObject; if (handleLightCoroutine == null) { handleLightCoroutine = ((MonoBehaviour)this).StartCoroutine(HandleLightCoroutine()); } } } [ServerRpc(RequireOwnership = false)] public void HandleLightServerRpc(string objectName, Vector3 position, int actionType) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2861031515u, val, (RpcDelivery)0); bool flag = objectName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(objectName, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); BytePacker.WriteValueBitPacked(val2, actionType); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2861031515u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { HandleLightClientRpc(objectName, position, actionType); } } [ClientRpc] public void HandleLightClientRpc(string objectName, Vector3 position, int actionType) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(189894096u, val, (RpcDelivery)0); bool flag = objectName != null; ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val2)).WriteValueSafe(objectName, false); } ((FastBufferWriter)(ref val2)).WriteValueSafe(ref position); BytePacker.WriteValueBitPacked(val2, actionType); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 189894096u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { currentActionType = actionType; closestLightSource = LightEnergyManager.GetLightSourceByName(objectName, position, currentActionType == 0); if (handleLightCoroutine == null) { handleLightCoroutine = ((MonoBehaviour)this).StartCoroutine(HandleLightCoroutine()); } } } public IEnumerator HandleLightCoroutine() { bool isAbsorbing = currentActionType == 0; object obj = LightEnergyManager.DetermineLightSource(closestLightSource, isAbsorbing); ILightSource lightHandler = LightSourceFactory.GetLightHandler(obj, this); if (lightHandler == null) { StopHandleLightCoroutine(showMsg: false); yield break; } bool completed = true; totalDuration = ((obj is EnemyAI) ? 10f : 5f); float remainingDuration = totalDuration; float timePassed = 0f; PlayActionSound?.Invoke(); lightHandler.HandleLightInitialization(ref remainingDuration, isAbsorbing); while (timePassed < remainingDuration) { yield return (object)new WaitForSeconds(0.5f); timePassed += 0.5f; if (!(isAbsorbing ? lightHandler.HandleLightConsumption(totalDuration, remainingDuration, timePassed) : lightHandler.HandleLightInjection(totalDuration, remainingDuration, timePassed))) { completed = false; break; } } lightHandler.HandleInterruptAction(); if (completed) { if (isAbsorbing) { lightHandler.HandleLightDepletion(); } else { lightHandler.HandleLightRestoration(); } } ResetAction?.Invoke(); StopHandleLightCoroutine(showMsg: false); } [ServerRpc(RequireOwnership = false)] public void StopCoroutineServerRpc(bool showMsg) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3237239182u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref showMsg, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3237239182u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { StopCoroutineClientRpc(showMsg); } } } [ClientRpc] public void StopCoroutineClientRpc(bool showMsg) { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2028439026u, val, (RpcDelivery)0); ((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref showMsg, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2028439026u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { StopHandleLightCoroutine(showMsg); } } } public void StopHandleLightCoroutine(bool showMsg) { if (handleLightCoroutine == null) { return; } ((MonoBehaviour)this).StopCoroutine(handleLightCoroutine); handleLightCoroutine = null; StopActionSound?.Invoke(); if ((Object)(object)closestLightSource != (Object)null) { object lightSource = LightEnergyManager.DetermineLightSource(closestLightSource, currentActionType == 0); LightSourceFactory.GetLightHandler(lightSource, this)?.HandleInterruptAction(); closestLightSource = null; } if (!showMsg) { return; } PlayerControllerB val = ((GrabbableObject)(((Component)this).GetComponentInParent<Deluminator>()?)).playerHeldBy; if ((Object)(object)val != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController == (Object)(object)val) { if (currentActionType == 0) { HUDManager.Instance.DisplayTip("Information", "Light source absorption cancelled out", false, false, "LC_Tip1"); } else { HUDManager.Instance.DisplayTip("Information", "Light source release cancelled out", false, false, "LC_Tip1"); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_LightEnergyNetworkManager() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Expected O, but got Unknown NetworkManager.__rpc_func_table.Add(963873486u, new RpcReceiveHandler(__rpc_handler_963873486)); NetworkManager.__rpc_func_table.Add(11223553u, new RpcReceiveHandler(__rpc_handler_11223553)); NetworkManager.__rpc_func_table.Add(3015799205u, new RpcReceiveHandler(__rpc_handler_3015799205)); NetworkManager.__rpc_func_table.Add(2816409877u, new RpcReceiveHandler(__rpc_handler_2816409877)); NetworkManager.__rpc_func_table.Add(2861031515u, new RpcReceiveHandler(__rpc_handler_2861031515)); NetworkManager.__rpc_func_table.Add(189894096u, new RpcReceiveHandler(__rpc_handler_189894096)); NetworkManager.__rpc_func_table.Add(3237239182u, new RpcReceiveHandler(__rpc_handler_3237239182)); NetworkManager.__rpc_func_table.Add(2028439026u, new RpcReceiveHandler(__rpc_handler_2028439026)); } private static void __rpc_handler_963873486(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 charges = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref charges); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightEnergyNetworkManager)(object)target).UpdateChargesServerRpc(charges); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_11223553(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 charges = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref charges); target.__rpc_exec_stage = (__RpcExecStage)2; ((LightEnergyNetworkManager)(object)target).UpdateChargesClientRpc(charges); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3015799205(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference obj = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable)); int actionType = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref actionType); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightEnergyNetworkManager)(object)target).HandleLightServerRpc(obj, actionType); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2816409877(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { NetworkObjectReference obj = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable)); int actionType = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref actionType); target.__rpc_exec_stage = (__RpcExecStage)2; ((LightEnergyNetworkManager)(object)target).HandleLightClientRpc(obj, actionType); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2861031515(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_0068: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string objectName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref objectName, false); } Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); int actionType = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref actionType); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightEnergyNetworkManager)(object)target).HandleLightServerRpc(objectName, position, actionType); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_189894096(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_0068: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { bool flag = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives)); string objectName = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref objectName, false); } Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); int actionType = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref actionType); target.__rpc_exec_stage = (__RpcExecStage)2; ((LightEnergyNetworkManager)(object)target).HandleLightClientRpc(objectName, position, actionType); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3237239182(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 showMsg = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref showMsg, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((LightEnergyNetworkManager)(object)target).StopCoroutineServerRpc(showMsg); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2028439026(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 showMsg = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref showMsg, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)2; ((LightEnergyNetworkManager)(object)target).StopCoroutineClientRpc(showMsg); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "LightEnergyNetworkManager"; } } } namespace LightEater.Behaviours { public class Deluminator : PhysicsProp { public LightEnergyNetworkManager energyNetwork; public AudioSource ActionAudio; public AudioClip ActionSound; public override void Start() { ((GrabbableObject)this).Start(); energyNetwork.PlayActionSound = PlayActionSound; energyNetwork.StopActionSound = StopActionSound; energyNetwork.ResetAction = ResetAction; } public override void EquipItem() { ((PhysicsProp)this).EquipItem(); ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = true; } public override void PocketItem() { ((GrabbableObject)this).PocketItem(); if ((Object)(object)((GrabbableObject)this).playerHeldBy != (Object)null) { ((GrabbableObject)this).playerHeldBy.activatingItem = false; ((GrabbableObject)this).playerHeldBy.equippedUsableItemQE = false; } energyNetwork.StopCoroutineServerRpc(showMsg: true); } public override void DiscardItem() { energyNetwork.StopCoroutineServerRpc(showMsg: true); ((GrabbableObject)this).DiscardItem(); } public override void ItemActivate(bool used, bool buttonDown = true) { ((GrabbableObject)this).ItemActivate(used, buttonDown); if (buttonDown && !((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)) { StartEnergyTransfer(enable: true); } } public override void ItemInteractLeftRight(bool right) { ((GrabbableObject)this).ItemInteractLeftRight(right); if (!right && !((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null)) { StartEnergyTransfer(enable: false); } } public void StartEnergyTransfer(bool enable) { if (!StartOfRound.Instance.shipHasLanded) { HUDManager.Instance.DisplayTip("Impossible Action", "Cannot be used until the ship has landed", false, false, "LC_Tip1"); return; } if (energyNetwork.handleLightCoroutine != null) { energyNetwork.StopCoroutineServerRpc(showMsg: true); return; } if (enable && energyNetwork.currentCharge >= 200) { HUDManager.Instance.DisplayTip("Impossible Action", "You have already reached the maximum number of charges for this item", false, false, "LC_Tip1"); return; } if (!enable && energyNetwork.currentCharge <= 0) { HUDManager.Instance.DisplayTip("Impossible Action", "You don't have any charges on this item", false, false, "LC_Tip1"); return; } energyNetwork.closestLightSource = LightEnergyManager.GetClosestLightSourceInView(this, enable); if ((Object)(object)energyNetwork.closestLightSource == (Object)null) { HUDManager.Instance.DisplayTip("Impossible Action", "No targeted light source or unavailable charge", false, false, "LC_Tip1"); } else { energyNetwork.HandleLight(energyNetwork.closestLightSource, (!enable) ? LightEnergyNetworkManager.LightActionType.Release : LightEnergyNetworkManager.LightActionType.Absorb); } } public void PlayActionSound() { if (energyNetwork.totalDuration > 0f) { ActionAudio.pitch = ActionSound.length / energyNetwork.totalDuration; } ActionAudio.PlayOneShot(ActionSound); ActionAudio.pitch = 1f; } public void StopActionSound() { ActionAudio.Stop(); } public void ResetAction() { if (!((Object)(object)((GrabbableObject)this).playerHeldBy == (Object)null) && !((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)(object)((GrabbableObject)this).playerHeldBy)) { ((GrabbableObject)this).SetControlTipsForItem(); } } public override void SetControlTipsForItem() { ((GrabbableObject)this).itemProperties.toolTips[2] = $"[Charges : {energyNetwork.currentCharge}]"; HUDManager.Instance.ChangeControlTipMultiple(((GrabbableObject)this).itemProperties.toolTips, true, ((GrabbableObject)this).itemProperties); } protected override void __initializeVariables() { ((PhysicsProp)this).__initializeVariables(); } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "Deluminator"; } } public class LightEaterAI : EnemyAI { public enum State { WANDERING, HUNTING, ABSORBING, CHASING } public LightEnergyNetworkManager energyNetwork; public bool isShocked; public Transform TurnCompass; public AudioClip[] MoveSounds = Array.Empty<AudioClip>(); public AudioClip AbsorptionSound; public AudioClip SwingSound; public AudioClip ChargeSound; public AudioClip StunSound; public AudioClip ExplosionSound; public float moveTimer; public List<EntranceTeleport> entrances; public int absorbDistance = 5; private float explodeTimer; public Coroutine stunCoroutine; public Coroutine attackCoroutine; public Coroutine killCoroutine; public override void Start() { //IL_005e: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Start(); energyNetwork.PlayActionSound = PlayAbsorptionSound; energyNetwork.StopActionSound = StopAbsorptionSound; base.enemyType.canDie = false; base.currentBehaviourStateIndex = 0; base.creatureAnimator.SetTrigger("startWalk"); ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); entrances = Object.FindObjectsOfType<EntranceTeleport>().ToList(); StormyWeatherPatch.lightEaters.Add(this); } public override void Update() { //IL_0062: 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_0088: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead) { explodeTimer += Time.deltaTime; PlayMoveSound(); int currentBehaviourStateIndex = base.currentBehaviourStateIndex; if ((Object)(object)base.targetPlayer != (Object)null && currentBehaviourStateIndex == 3) { TurnCompass.LookAt(((Component)base.targetPlayer.gameplayCamera).transform.position); ((Component)this).transform.rotation = Quaternion.Lerp(((Component)this).transform.rotation, Quaternion.Euler(new Vector3(0f, TurnCompass.eulerAngles.y, 0f)), 4f * Time.deltaTime); } } } public void PlayMoveSound() { if (base.currentBehaviourStateIndex != 2) { moveTimer -= Time.deltaTime; if (MoveSounds.Length != 0 && moveTimer <= 0f) { base.creatureSFX.PlayOneShot(MoveSounds[Random.Range(0, MoveSounds.Length)]); moveTimer = 3f; } } } public override void DoAIInterval() { ((EnemyAI)this).DoAIInterval(); if (!base.isEnemyDead && !StartOfRound.Instance.allPlayersDead) { switch (base.currentBehaviourStateIndex) { case 0: DoWandering(); break; case 1: DoHunting(); break; case 2: DoAbsorbing(); break; case 3: DoChasing(); break; } } } public void DoWandering() { base.agent.speed = 2f; if (FoundClosestPlayerInRange(25, 10)) { energyNetwork.closestLightSource = null; ((EnemyAI)this).StopSearch(base.currentSearch, true); DoAnimationClientRpc("startRun"); ((EnemyAI)this).SwitchToBehaviourClientRpc(3); } else if (energyNetwork.currentCharge > 200 || FoundLightSource()) { ((EnemyAI)this).StopSearch(base.currentSearch, true); DoAnimationClientRpc("startRun"); ((EnemyAI)this).SwitchToBehaviourClientRpc(1); } } private bool FoundClosestPlayerInRange(int range, int senseRange) { PlayerControllerB val = ((EnemyAI)this).CheckLineOfSightForPlayer(60f, range, senseRange); if ((Object)(object)val != (Object)null && ((EnemyAI)this).PlayerIsTargetable(val, false, false)) { return Object.op_Implicit((Object)(object)(base.targetPlayer = val)); } return false; } public bool FoundLightSource() { //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown if (CrossingLight()) { return true; } if (TimeOfDay.Instance.hour >= ConfigManager.shipMinHour.Value && !ShipLightsPatch.hasBeenAbsorbed) { absorbDistance = 20; energyNetwork.closestLightSource = ((Component)StartOfRound.Instance.shipRoomLights).gameObject; } else if (LightEnergyManager.enemies.Any((EnemyAI r) => !r.isEnemyDead)) { EnemyAI closestEnemy = (from r in LightEnergyManager.enemies where !r.isEnemyDead orderby Vector3.Distance(((Component)this).transform.position, ((Component)r).transform.position) select r).FirstOrDefault(); absorbDistance = ConfigManager.enemiesValues.FirstOrDefault((EnemyValue e) => e.EnemyName.Equals(closestEnemy.enemyType.enemyName))?.AbsorbDistance ?? 5; energyNetwork.closestLightSource = ((Component)closestEnemy).gameObject; } else { absorbDistance = 5; if (!base.isOutside) { base.path1 = new NavMeshPath(); LightEnergyNetworkManager lightEnergyNetworkManager = energyNetwork; Animator? obj = (from l in LightEnergyManager.GetPoweredLights(value: true) where (Object)(object)l != (Object)null && base.agent.CalculatePath(((EnemyAI)this).ChooseClosestNodeToPosition(((Component)l).transform.position, false, 0).position, base.path1) orderby Vector3.Distance(((Component)this).transform.position, ((Component)l).transform.position) select l).FirstOrDefault(); lightEnergyNetworkManager.closestLightSource = ((obj != null) ? ((Component)obj).gameObject : null); } else { LightEnergyNetworkManager lightEnergyNetworkManager2 = energyNetwork; Animator? obj2 = (from l in LightEnergyManager.GetPoweredLights(value: true) orderby (!Object.op_Implicit((Object)(object)l)) ? float.MaxValue : Vector3.Distance(GetEntranceExitPosition(GetClosestEntrance()), ((Component)l).transform.position) select l).FirstOrDefault(); lightEnergyNetworkManager2.closestLightSource = ((obj2 != null) ? ((Component)obj2).gameObject : null); } } return (Object)(object)energyNetwork.closestLightSource != (Object)null; } public void DoHunting() { base.agent.speed = ConfigManager.huntingSpeed.Value; if (FoundClosestPlayerInRange(25, 10)) { energyNetwork.closestLightSource = null; ((EnemyAI)this).SwitchToBehaviourClientRpc(3); } else if (!HuntPlayers() && CloseToLightSource()) { DoAnimationClientRpc("startAbsorb"); ((EnemyAI)this).SwitchToBehaviourClientRpc(2); } } public bool HuntPlayers() { //IL_0089: Unknown result type (might be due to invalid IL or missing references) if (energyNetwork.currentCharge <= 200 && (Object)(object)energyNetwork.closestLightSource != (Object)null) { return false; } PlayerControllerB val = (from p in StartOfRound.Instance.allPlayerScripts where p.isPlayerControlled && !p.isPlayerDead orderby Vector3.Distance(((Component)this).transform.position, ((Component)p).transform.position) select p).FirstOrDefault(); if (val.isInsideFactory == base.isOutside) { GoTowardsEntrance(); return true; } ((EnemyAI)this).SetDestinationToPosition(((Component)val).transform.position, false); return true; } public bool CloseToLightSource() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_009e: 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) CrossingLight(); object obj = LightEnergyManager.DetermineLightSource(energyNetwork.closestLightSource, enable: true); if (!(obj is ShipLights) || base.isOutside) { EnemyAI val = (EnemyAI)((obj is EnemyAI) ? obj : null); if ((val == null || val.isOutside == base.isOutside) && (!(obj is Animator) || !base.isOutside)) { ILightSource lightHandler = LightSourceFactory.GetLightHandler(obj, this); if (lightHandler == null) { return false; } ((EnemyAI)this).SetDestinationToPosition(lightHandler.GetClosestNodePosition(), false); if (!(Vector3.Distance(((Component)base.eye).transform.position, lightHandler.GetClosestLightPosition()) < (float)absorbDistance)) { return Vector3.Distance(((Component)this).transform.position, lightHandler.GetClosestNodePosition()) < 1f; } return true; } } GoTowardsEntrance(); return false; } public void DoAbsorbing() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) base.agent.speed = 0f; if ((Object)(object)energyNetwork.closestLightSource == (Object)null || !StartOfRound.Instance.shipHasLanded) { ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); DoAnimationClientRpc("startWalk"); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } else { energyNetwork.HandleLight(energyNetwork.closestLightSource, LightEnergyNetworkManager.LightActionType.Absorb); } } public void PlayAbsorptionSound() { if (energyNetwork.totalDuration > 0f) { base.creatureSFX.pitch = AbsorptionSound.length / energyNetwork.totalDuration; } base.creatureSFX.PlayOneShot(AbsorptionSound); base.creatureSFX.pitch = 1f; } public void StopAbsorptionSound() { base.creatureSFX.Stop(); } public void DoChasing() { //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) if (stunCoroutine != null) { return; } base.agent.speed = (isShocked ? (ConfigManager.chasingSpeed.Value / 2f) : ConfigManager.chasingSpeed.Value); if (TargetOutsideChasedPlayer()) { return; } if (explodeTimer < 10f) { ((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer); } else if (!TargetClosestPlayerInAnyCase() || (Vector3.Distance(((Component)this).transform.position, ((Component)base.targetPlayer).transform.position) > 20f && !((EnemyAI)this).CheckLineOfSightForPosition(((Component)base.targetPlayer).transform.position, 45f, 60, -1f, (Transform)null))) { ((EnemyAI)this).StartSearch(((Component)this).transform.position, (AISearchRoutine)null); DoAnimationClientRpc("startWalk"); ((EnemyAI)this).SwitchToBehaviourClientRpc(0); } else if (!StunExplosion()) { if (CrossingLight()) { DoAnimationClientRpc("startAbsorb"); ((EnemyAI)this).SwitchToBehaviourClientRpc(2); } else { ((EnemyAI)this).SetMovingTowardsTargetPlayer(base.targetPlayer); } } } public bool TargetOutsideChasedPlayer() { if (base.targetPlayer.isInsideFactory == base.isOutside) { GoTowardsEntrance(); return true; } return false; } public bool TargetClosestPlayerInAnyCase() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) base.mostOptimalDistance = 2000f; base.targetPlayer = null; for (int i = 0; i < StartOfRound.Instance.connectedPlayersAmount + 1; i++) { base.tempDist = Vector3.Distance(((Component)this).transform.position, ((Component)StartOfRound.Instance.allPlayerScripts[i]).transform.position); if (base.tempDist < base.mostOptimalDistance) { base.mostOptimalDistance = base.tempDist; base.targetPlayer = StartOfRound.Instance.allPlayerScripts[i]; } } return (Object)(object)base.targetPlayer != (Object)null; } public bool StunExplosion() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (isShocked) { return false; } if (energyNetwork.currentCharge < 100 || explodeTimer < 10f) { return false; } if (!base.targetPlayer.HasLineOfSightToPosition(base.eye.position, 60f, 15, -1f)) { return false; } base.agent.speed = 0f; if (energyNetwork.currentCharge > 200) { StunEnemyClientRpc(); return true; } energyNetwork.UpdateCharges(energyNetwork.currentCharge - 100); explodeTimer = 0f; StunExplosionClientRpc(); return true; } [ClientRpc] public void StunEnemyClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2458810888u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2458810888u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { stunCoroutine = ((MonoBehaviour)this).StartCoroutine(StunEnemyCoroutine()); } } } public IEnumerator StunEnemyCoroutine() { base.creatureAnimator.SetTrigger("startStun"); base.creatureSFX.PlayOneShot(StunSound); base.enemyType.canDie = true; yield return (object)new WaitForSeconds(5f); if (killCoroutine == null) { energyNetwork.UpdateCharges(200); base.creatureAnimator.SetTrigger("startRun"); base.enemyType.canDie = false; stunCoroutine = null; } } [ClientRpc] public void StunExplosionClientRpc() { //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) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost)) { ClientRpcParams val = default(ClientRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2969224247u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2969224247u, val, (RpcDelivery)0); } if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { ((MonoBehaviour)this).StartCoroutine(StunExplosionCoroutine()); } } } public IEnumerator StunExplosionCoroutine() { base.creatureAnimator.SetTrigger("startExplode"); base.creatureSFX.PlayOneShot(ChargeSound); yield return (object)new WaitForSeconds(0.75f); base.creatureSFX.PlayOneShot(ExplosionSound); StunGrenadeItem.StunExplosion(base.eye.position, true, 2f, 2f, 1f, false, (PlayerControllerB)null, (PlayerControllerB)null, 0f); base.creatureAnimator.SetTrigger("startRun"); } public override void OnCollideWithPlayer(Collider other) { ((EnemyAI)this).OnCollideWithPlayer(other); if (base.currentBehaviourStateIndex == 3 && stunCoroutine == null && attackCoroutine == null && killCoroutine == null) { PlayerControllerB val = ((EnemyAI)this).MeetsStandardPlayerCollisionConditions(other, false, false); if (!((Object)(object)val == (Object)null) && !((Object)(object)val != (Object)(object)GameNetworkManager.Instance.localPlayerController)) { AttackServerRpc((int)val.playerClientId); } } } [ServerRpc(RequireOwnership = false)] public void AttackServerRpc(int playerId) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Invalid comparison between Unknown and I4 //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager != null && networkManager.IsListening) { if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3866375404u, val, (RpcDelivery)0); BytePacker.W