using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using AK;
using Agents;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Unity.IL2CPP;
using CellMenu;
using EOSExt.EMP.Definition;
using EOSExt.EMP.EMPComponent;
using EOSExt.EMP.Impl;
using EOSExt.EMP.Impl.Handlers;
using EOSExt.EMP.Impl.PersistentEMP;
using ExtraObjectiveSetup;
using ExtraObjectiveSetup.BaseClasses;
using ExtraObjectiveSetup.ExtendedWardenEvents;
using ExtraObjectiveSetup.Utils;
using FloLib.Networks.Replications;
using GTFO.API;
using GTFO.API.Utilities;
using GameData;
using Gear;
using HarmonyLib;
using Il2CppInterop.Runtime.Attributes;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using LevelGeneration;
using Microsoft.CodeAnalysis;
using Player;
using SNetwork;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("Inas07.EOSExt.EMP")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+b53a54585e6132f803ae629e04db454f84fa1c83")]
[assembly: AssemblyProduct("Inas07.EOSExt.EMP")]
[assembly: AssemblyTitle("Inas07.EOSExt.EMP")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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 EOSExt.EMP
{
internal static class AWOUtil
{
public const string PLUGIN_GUID = "GTFO.AWO";
public static bool IsLoaded { get; private set; }
static AWOUtil()
{
IsLoaded = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.TryGetValue("GTFO.AWO", out var _);
EOSLogger.Debug($"EOSExt.EMP: AWO Loaded? {IsLoaded}");
}
}
public class EMPManager : GenericExpeditionDefinitionManager<pEMPDefinition>
{
private Dictionary<uint, pEMP> _pEMPs { get; } = new Dictionary<uint, pEMP>();
public IEnumerable<pEMP> pEMPs => _pEMPs.Values;
protected override string DEFINITION_NAME => "PersistentEMP";
public static EMPManager Current { get; private set; }
public PlayerAgent Player
{
get
{
if (!SNet.HasLocalPlayer || !SNet.LocalPlayer.HasPlayerAgent)
{
return null;
}
return ((Il2CppObjectBase)SNet.LocalPlayer.PlayerAgent).Cast<PlayerAgent>();
}
}
internal List<EMPShock> ActiveEMPs { get; } = new List<EMPShock>();
internal void SetupHUDAndFlashlight()
{
if ((Object)(object)Player == (Object)null)
{
EOSLogger.Error($"{"SetupHUDAndFlashlight": LocalPlayerAgent is not set!}");
return;
}
if (EMPPlayerHudHandler.Instance == null)
{
((Component)Player).gameObject.AddComponent<EMPController>().AssignHandler(new EMPPlayerHudHandler());
EOSLogger.Log("pEMP: PlayerHud setup completed");
}
if (EMPPlayerFlashLightHandler.Instance == null)
{
((Component)Player).gameObject.AddComponent<EMPController>().AssignHandler(new EMPPlayerFlashLightHandler());
EOSLogger.Log("pEMP: PlayerFlashlight setup completed");
}
}
internal void SetupAmmoWeaponHandlers(InventorySlot slot)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Invalid comparison between Unknown and I4
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
if (slot - 1 <= 1)
{
SetupAmmoWeaponHandlerForSlot(slot);
}
static void SetupAmmoWeaponHandlerForSlot(InventorySlot slot)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
BackpackItem val = default(BackpackItem);
if (PlayerBackpackManager.LocalBackpack.TryGetBackpackItem(slot, ref val))
{
if (!((Object)(object)((Component)val.Instance).gameObject.GetComponent<EMPController>() != (Object)null))
{
((Component)val.Instance).gameObject.AddComponent<EMPController>().AssignHandler(new EMPGunSightHandler());
EOSLogger.Log($"pEMP: Backpack {slot} setup completed");
}
}
else
{
EOSLogger.Warning($"Couldn't get item for slot {slot}!");
}
}
}
internal void SetupToolHandler()
{
BackpackItem val = default(BackpackItem);
if (PlayerBackpackManager.LocalBackpack.TryGetBackpackItem((InventorySlot)3, ref val))
{
if (!((Object)(object)((Component)val.Instance).gameObject.GetComponent<EMPController>() != (Object)null) && (Object)(object)((Component)val.Instance).GetComponent<EnemyScanner>() != (Object)null)
{
((Component)val.Instance).gameObject.AddComponent<EMPController>().AssignHandler(new EMPBioTrackerHandler());
EOSLogger.Log($"pEMP: Backpack {3} setup completed");
}
}
else
{
EOSLogger.Warning($"Couldn't get item for slot {3}!");
}
}
public void TogglepEMPState(uint pEMPIndex, bool enabled)
{
if (!_pEMPs.ContainsKey(pEMPIndex))
{
EOSLogger.Error($"TogglepEMPState: pEMPIndex {pEMPIndex} not defined");
}
else
{
ActiveState newState = (enabled ? ActiveState.ENABLED : ActiveState.DISABLED);
_pEMPs[pEMPIndex].ChangeToState(newState);
}
}
public void TogglepEMPState(WardenObjectiveEventData e)
{
uint count = (uint)e.Count;
bool enabled = e.Enabled;
TogglepEMPState(count, enabled);
}
private void pEMPInit()
{
LevelAPI.OnBuildStart += delegate
{
pEMPClear();
InitializepEMPs();
};
LevelAPI.OnLevelCleanup += pEMPClear;
}
private void pEMPClear()
{
foreach (pEMP value in _pEMPs.Values)
{
value.Destroy();
}
_pEMPs.Clear();
}
private void InitializepEMPs()
{
if (!base.definitions.ContainsKey(base.CurrentMainLevelLayout))
{
return;
}
GenericExpeditionDefinition<pEMPDefinition> val = base.definitions[base.CurrentMainLevelLayout];
if (val == null || val.Definitions.Count < 1)
{
return;
}
foreach (pEMPDefinition definition in val.Definitions)
{
pEMP pEMP = new pEMP(definition);
_pEMPs[definition.pEMPIndex] = pEMP;
uint num = EOSNetworking.AllotReplicatorID();
if (num == 0)
{
EOSLogger.Error("SetuppEMPReplicators: replicator ID depleted, cannot set up!");
continue;
}
pEMP.SetupReplicator(num);
EOSLogger.Debug($"pEMP_{definition.pEMPIndex} initialized");
}
}
internal void SetLocalPlayerAgent(PlayerAgent localPlayerAgent)
{
if ((Object)(object)PlayerpEMPComponent.Current == (Object)null)
{
((Component)localPlayerAgent).gameObject.AddComponent<PlayerpEMPComponent>();
}
}
public void ActivateEMPShock(Vector3 position, float range, float duration)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
if (!GameStateManager.IsInExpedition)
{
EOSLogger.Error("Tried to activate an EMP when not in level, this shouldn't happen!");
return;
}
float endTime = Clock.Time + duration;
EMPShock eMPShock = new EMPShock(position, range, endTime);
foreach (EMPHandler allHandler in EMPHandler.AllHandlers)
{
if (Vector3.Distance(position, allHandler.position) < range)
{
allHandler.AddAffectedBy(eMPShock);
}
}
ActiveEMPs.Add(eMPShock);
}
internal void RemoveInactiveEMPs()
{
float time = Clock.Time;
ActiveEMPs.RemoveAll((EMPShock emp) => emp.endTime < time);
}
public bool IsPlayerMapEMPD()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Player == (Object)null || !GameStateManager.IsInExpedition)
{
return false;
}
Vector3 position = ((Agent)Player).Position;
foreach (EMPShock activeEMP in ActiveEMPs)
{
if (Vector3.Distance(position, activeEMP.position) < activeEMP.range)
{
return true;
}
}
foreach (pEMP pEMP in pEMPs)
{
if (pEMP.State == ActiveState.ENABLED && pEMP.ItemToDisable.Map && Vector3.Distance(position, pEMP.position) < pEMP.range)
{
EOSLogger.Warning("MapEMPD: by pEMP");
return true;
}
}
return false;
}
protected override void FileChanged(LiveEditEventArgs e)
{
base.FileChanged(e);
if (!base.definitions.TryGetValue(base.CurrentMainLevelLayout, out var value))
{
return;
}
foreach (pEMPDefinition definition in value.Definitions)
{
EOSLogger.Warning(definition.ItemToDisable.ToString());
}
}
public override void Init()
{
EMPWardenEvents.Init();
Events.InventoryWielded = (Action<InventorySlot>)Delegate.Combine(Events.InventoryWielded, new Action<InventorySlot>(SetupAmmoWeaponHandlers));
pEMPInit();
}
private EMPManager()
{
}
static EMPManager()
{
Current = new EMPManager();
ClassInjector.RegisterTypeInIl2Cpp<EMPController>();
ClassInjector.RegisterTypeInIl2Cpp<PlayerpEMPComponent>();
}
}
internal static class EMPWardenEvents
{
public enum EMPEvents
{
Instant_Shock = 300,
Toggle_PEMP_State
}
internal static void InstantShock(WardenObjectiveEventData e)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
Vector3 position = e.Position;
float fogTransitionDuration = e.FogTransitionDuration;
float duration = e.Duration;
EMPManager.Current.ActivateEMPShock(position, fogTransitionDuration, duration);
}
internal static void TogglepEMPState(WardenObjectiveEventData e)
{
EMPManager.Current.TogglepEMPState(e);
}
internal static void Init()
{
EOSWardenEventManager.Current.AddEventDefinition(EMPEvents.Instant_Shock.ToString(), 300u, (Action<WardenObjectiveEventData>)InstantShock);
EOSWardenEventManager.Current.AddEventDefinition(EMPEvents.Toggle_PEMP_State.ToString(), 301u, (Action<WardenObjectiveEventData>)TogglepEMPState);
}
}
public static class Events
{
public static Action<GearPartFlashlight> FlashLightWielded;
public static Action<InventorySlot> InventoryWielded;
public static Action EnterGSInLevel;
}
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInPlugin("Inas.EOSExt.EMP", "EOSExt.EMP", "1.1.7")]
public class EntryPoint : BasePlugin
{
public const string AUTHOR = "Inas";
public const string PLUGIN_NAME = "EOSExt.EMP";
public const string VERSION = "1.1.7";
private Harmony m_Harmony;
public override void Load()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
m_Harmony = new Harmony("EOSExt.EMP");
m_Harmony.PatchAll();
SetupManagers();
}
private void SetupManagers()
{
((GenericExpeditionDefinitionManager<pEMPDefinition>)EMPManager.Current).Init();
}
}
}
namespace EOSExt.EMP.Patches
{
[HarmonyPatch]
[HarmonyWrapSafe]
internal class Inject_CM_PageMap
{
[HarmonyPostfix]
[HarmonyPatch(typeof(CM_PageMap), "UpdatePlayerData")]
private static void Post_CM_PageMap_OnEnable()
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Invalid comparison between Unknown and I4
CM_PageMap pageMap = MainMenuGuiLayer.Current.PageMap;
if (!((Object)(object)pageMap == (Object)null) && RundownManager.ActiveExpedition != null && (int)GameStateManager.CurrentStateName == 10 && EMPManager.Current.IsPlayerMapEMPD())
{
pageMap.SetMapVisualsIsActive(false);
pageMap.SetMapDisconnetedTextIsActive(true);
}
}
}
[HarmonyPatch(typeof(EnemyScanner))]
internal static class Inject_EnemyScanner
{
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch("UpdateDetectedEnemies")]
internal static bool Pre_UpdateDetectedEnemies()
{
EMPBioTrackerHandler instance = EMPBioTrackerHandler.Instance;
if (instance == null)
{
return true;
}
return !instance.IsEMPed();
}
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch("UpdateTagProgress")]
internal static bool Pre_UpdateTagProgress(EnemyScanner __instance)
{
//IL_006f: 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 (EMPBioTrackerHandler.Instance == null)
{
return true;
}
if (EMPBioTrackerHandler.Instance.IsEMPed())
{
((ItemEquippable)__instance).Sound.Post(EVENTS.BIOTRACKER_TOOL_LOOP_STOP, true);
__instance.m_screen.SetStatusText("ERROR");
((ProgressBarBase)__instance.m_progressBar).SetProgress(1f);
__instance.m_screen.SetGuixColor(Color.yellow);
return false;
}
__instance.m_screen.SetStatusText("Ready to tag");
__instance.m_screen.SetGuixColor(Color.red);
return true;
}
}
[HarmonyPatch]
internal static class Inject_LG_Light
{
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(LG_Light), "Start")]
internal static void Pre_Start(LG_Light __instance)
{
((Component)__instance).gameObject.AddComponent<EMPController>().AssignHandler(new EMPLightHandler());
}
[HarmonyPostfix]
[HarmonyPatch(typeof(LG_BuildZoneLightsJob), "ApplyLightSettings")]
private static void Post_ApplyColorScheme(Il2CppReferenceArray<LG_Light> lights, bool firstPass)
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
foreach (LG_Light item in (Il2CppArrayBase<LG_Light>)(object)lights)
{
if ((firstPass && ((Component)item).gameObject.activeInHierarchy) || (!firstPass && item.AvailableInLevel))
{
EMPLightHandler handler = EMPLightHandler.GetHandler(item);
if (handler != null)
{
handler.SetOriginalColor(item.m_color);
handler.SetOriginalIntensity(item.m_intensity);
}
}
}
}
}
[HarmonyPatch]
internal static class Inject_PlayerAgent
{
[HarmonyPostfix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(PlayerAgent), "Setup")]
internal static void Post_Setup(PlayerAgent __instance)
{
if (((Agent)__instance).IsLocallyOwned)
{
EMPManager.Current.SetLocalPlayerAgent(__instance);
}
}
}
[HarmonyPatch]
internal static class Inject_PlayerHUD
{
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(PlayerGuiLayer), "UpdateGUIElementsVisibility")]
private static bool Pre_UpdateGUIElementsVisibility()
{
if (EMPPlayerHudHandler.Instance != null && EMPPlayerHudHandler.Instance.IsEMPed())
{
return false;
}
return true;
}
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(CellSettingsApply), "ApplyPlayerGhostOpacity")]
private static void Pre_ApplyPlayerGhostOpacity(ref float value)
{
if (EMPPlayerHudHandler.Instance != null && EMPPlayerHudHandler.Instance.IsEMPed())
{
value = 0f;
}
}
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(CellSettingsApply), "ApplyHUDAlwaysShowTeammateInfo")]
private static void Pre_ApplyHUDAlwaysShowTeammateInfo(ref bool value)
{
if (EMPPlayerHudHandler.Instance != null && EMPPlayerHudHandler.Instance.IsEMPed())
{
value = false;
}
}
}
[HarmonyPatch]
internal static class Inject_Events
{
[HarmonyPostfix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(PlayerInventoryBase), "OnItemEquippableFlashlightWielded")]
internal static void Post_OnItemEquippableFlashlightWielded(GearPartFlashlight flashlight)
{
Events.FlashLightWielded?.Invoke(flashlight);
}
[HarmonyPostfix]
[HarmonyWrapSafe]
[HarmonyPatch(typeof(PlayerInventoryLocal), "DoWieldItem")]
internal static void Post_DoWieldItem(PlayerInventoryLocal __instance)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
Events.InventoryWielded?.Invoke(((PlayerInventoryBase)__instance).WieldedSlot);
}
[HarmonyPostfix]
[HarmonyPatch(typeof(GS_InLevel), "Enter")]
private static void Post_SetupGear(GS_InLevel __instance)
{
Events.EnterGSInLevel?.Invoke();
}
}
[HarmonyPatch(typeof(PlayerSync))]
internal static class Inject_PlayerSync
{
[HarmonyPrefix]
[HarmonyWrapSafe]
[HarmonyPatch("WantsToSetFlashlightEnabled")]
internal static void Pre_WantsToSetFlashlightEnabled(PlayerSync __instance, ref bool enable)
{
if (EMPPlayerFlashLightHandler.Instance != null && EMPPlayerFlashLightHandler.Instance.IsEMPed())
{
enable = false;
}
}
}
[HarmonyPatch(typeof(SentryGunInstance))]
internal static class Inject_SentryGunInstance
{
[HarmonyPostfix]
[HarmonyWrapSafe]
[HarmonyPatch("Setup")]
internal static void Post_Setup(SentryGunInstance __instance)
{
((Component)__instance).gameObject.AddComponent<EMPController>().AssignHandler(new EMPSentryHandler());
}
}
}
namespace EOSExt.EMP.EMPComponent
{
public class PlayerpEMPComponent : MonoBehaviour
{
private float nextUpdateTime = float.NaN;
public const float UPDATE_INTERVAL = 0.2f;
public static PlayerpEMPComponent Current
{
get
{
if (!SNet.HasLocalPlayer || !SNet.LocalPlayer.HasPlayerAgent)
{
return null;
}
return ((Component)((Il2CppObjectBase)SNet.LocalPlayer.PlayerAgent).Cast<PlayerAgent>()).GetComponent<PlayerpEMPComponent>();
}
}
public PlayerAgent player => ((Component)this).gameObject.GetComponent<PlayerAgent>();
private void CheckSetup()
{
if (!((Object)(object)EMPManager.Current.Player == (Object)null))
{
EMPManager.Current.SetupHUDAndFlashlight();
EMPManager.Current.SetupToolHandler();
}
}
private void Update()
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Invalid comparison between Unknown and I4
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
if ((int)GameStateManager.CurrentStateName != 10 || (!float.IsNaN(nextUpdateTime) && Clock.Time < nextUpdateTime))
{
return;
}
nextUpdateTime = Clock.Time + 0.2f;
CheckSetup();
EMPManager.Current.RemoveInactiveEMPs();
if ((Object)(object)player == (Object)null)
{
return;
}
foreach (pEMP pEMP in EMPManager.Current.pEMPs)
{
ItemToDisable itemToDisable = pEMP.ItemToDisable;
if (pEMP.State == ActiveState.ENABLED && pEMP.InRange(((Agent)player).Position))
{
if (itemToDisable.BioTracker)
{
EMPBioTrackerHandler.Instance?.AddAffectedBy(pEMP);
}
if (itemToDisable.PlayerFlashLight)
{
EMPPlayerFlashLightHandler.Instance?.AddAffectedBy(pEMP);
}
if (itemToDisable.PlayerHUD)
{
EMPPlayerHudHandler.Instance?.AddAffectedBy(pEMP);
}
if (itemToDisable.Sentry)
{
EMPSentryHandler.Instance?.AddAffectedBy(pEMP);
}
if (!itemToDisable.GunSight)
{
continue;
}
foreach (EMPGunSightHandler instance in EMPGunSightHandler.Instances)
{
instance.AddAffectedBy(pEMP);
}
continue;
}
EMPBioTrackerHandler.Instance?.RemoveAffectedBy(pEMP);
EMPPlayerFlashLightHandler.Instance?.RemoveAffectedBy(pEMP);
EMPPlayerHudHandler.Instance?.RemoveAffectedBy(pEMP);
EMPSentryHandler.Instance?.RemoveAffectedBy(pEMP);
foreach (EMPGunSightHandler instance2 in EMPGunSightHandler.Instances)
{
instance2.RemoveAffectedBy(pEMP);
}
}
}
private void OnDestroy()
{
}
static PlayerpEMPComponent()
{
}
}
}
namespace EOSExt.EMP.Impl
{
public sealed class EMPController : MonoBehaviour
{
private bool _hasHandler;
private bool _setup;
private float next_remove_time = float.NaN;
private const float UPDATE_INTERVAL = 1f;
public EMPHandler Handler { get; private set; }
public float endTime { get; private set; }
public Vector3 Position => ((Component)this).transform.position;
private void Update()
{
if (_hasHandler)
{
float time = Clock.Time;
Handler.Tick();
if (float.IsNaN(next_remove_time) || next_remove_time < time)
{
Handler.RemoveEndedEMPs();
next_remove_time = time + 1f;
}
}
}
[HideFromIl2Cpp]
public void AssignHandler(EMPHandler handler)
{
if (Handler != null)
{
EOSLogger.Warning("Tried to assign a handler to a controller that already had one!");
return;
}
Handler = handler;
Handler.Setup(((Component)this).gameObject, this);
_hasHandler = true;
_setup = true;
}
[HideFromIl2Cpp]
public void ForceState(EMPState state)
{
if (Handler != null)
{
Handler.ForceState(state);
}
}
private void OnDestroy()
{
Handler.OnDespawn();
Handler = null;
}
}
public abstract class EMPHandler
{
protected enum DeviceState
{
On,
Off,
Unknown
}
private static long next_handler_id = 0L;
protected DeviceState _deviceState;
protected float _stateTimer;
private float _delayTimer;
private bool _destroyed;
protected static Dictionary<long, EMPHandler> Handlers { get; } = new Dictionary<long, EMPHandler>();
public static IEnumerable<EMPHandler> AllHandlers => Handlers.Values;
protected long HandlerId { get; private set; }
public EMPState State { get; protected set; }
protected HashSet<EMPShock> AffectedBy { get; } = new HashSet<EMPShock>();
public GameObject go { get; protected set; }
public Vector3 position
{
get
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
GameObject obj = go;
if (obj == null)
{
return Vector3.zero;
}
return obj.transform.position;
}
}
protected virtual float FlickerDuration => 0.2f;
protected virtual float OnToOffMinDelay => 0f;
protected virtual float OnToOffMaxDelay => 0.75f;
protected virtual float OffToOnMinDelay => 0.85f;
protected virtual float OffToOnMaxDelay => 1.5f;
protected virtual bool IsDeviceOnPlayer => false;
public virtual bool IsEMPed()
{
foreach (EMPShock item in AffectedBy)
{
if (Clock.Time < item.endTime)
{
return true;
}
}
return false;
}
public virtual void Setup(GameObject gameObject, EMPController controller)
{
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
go = gameObject;
foreach (EMPShock activeEMP in EMPManager.Current.ActiveEMPs)
{
if (Vector3.Distance(go.transform.position, activeEMP.position) < activeEMP.range)
{
AddAffectedBy(activeEMP);
}
}
HandlerId = next_handler_id++;
if (Handlers.ContainsKey(HandlerId))
{
EOSLogger.Warning("What the hell we got a duplicate EMPHandler ID!?");
}
Handlers[HandlerId] = this;
}
public virtual void OnDespawn()
{
_destroyed = true;
AffectedBy.Clear();
Handlers.Remove(HandlerId);
go = null;
}
public void AddAffectedBy(EMPShock empShock)
{
AffectedBy.Add(empShock);
}
public void RemoveAffectedBy(EMPShock empShock)
{
AffectedBy.Remove(empShock);
}
internal void RemoveEndedEMPs()
{
float time = Clock.Time;
AffectedBy.RemoveWhere((EMPShock emp) => emp.endTime < time);
}
public void ForceState(EMPState state)
{
if (State != state)
{
State = state;
_delayTimer = Clock.Time - 1f;
_stateTimer = Clock.Time - 1f;
switch (state)
{
case EMPState.Off:
_deviceState = DeviceState.Off;
DeviceOff();
break;
default:
_deviceState = DeviceState.Unknown;
break;
case EMPState.On:
_deviceState = DeviceState.On;
DeviceOn();
break;
}
}
}
public void Tick()
{
if (_destroyed)
{
return;
}
bool flag = IsEMPed();
if (flag && State == EMPState.On)
{
float randomDelay = Random.GetRandomDelay(OnToOffMinDelay, OnToOffMaxDelay);
State = EMPState.FlickerOff;
_delayTimer = Clock.Time + randomDelay;
_stateTimer = Clock.Time + randomDelay + FlickerDuration;
}
if (!flag && State == EMPState.Off)
{
float randomDelay2 = Random.GetRandomDelay(OffToOnMinDelay, OffToOnMaxDelay);
State = EMPState.FlickerOn;
_delayTimer = Clock.Time + randomDelay2;
_stateTimer = Clock.Time + randomDelay2 + FlickerDuration;
}
switch (State)
{
case EMPState.On:
if (_deviceState != 0)
{
DeviceOn();
_deviceState = DeviceState.On;
}
break;
case EMPState.FlickerOff:
if (!(_delayTimer > Clock.Time))
{
if (Clock.Time < _stateTimer)
{
FlickerDevice();
}
else
{
State = EMPState.Off;
}
}
break;
case EMPState.Off:
if (_deviceState != DeviceState.Off)
{
DeviceOff();
_deviceState = DeviceState.Off;
}
break;
case EMPState.FlickerOn:
if (!(_delayTimer > Clock.Time))
{
if (Clock.Time < _stateTimer)
{
FlickerDevice();
}
else
{
State = EMPState.On;
}
}
break;
}
OnTick(flag);
}
protected virtual void OnTick(bool isEMPD)
{
}
protected abstract void FlickerDevice();
protected abstract void DeviceOn();
protected abstract void DeviceOff();
}
public class EMPShock
{
public static readonly ItemToDisable DISABLE_NOTHING = new ItemToDisable
{
BioTracker = false,
PlayerFlashLight = false,
PlayerHUD = false,
Sentry = false,
EnvLight = false,
GunSight = false,
Map = false
};
public virtual ActiveState State
{
get
{
if (!(RemainingTime > 0f))
{
return ActiveState.DISABLED;
}
return ActiveState.ENABLED;
}
}
public Vector3 position { get; protected set; }
public float range { get; protected set; }
public float endTime { get; protected set; }
public virtual float RemainingTime => endTime - Clock.Time;
public virtual ItemToDisable ItemToDisable => new ItemToDisable();
public EMPShock(Vector3 position, float range, float endTime)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
this.position = position;
this.range = range;
this.endTime = endTime;
}
public bool InRange(Vector3 position)
{
//IL_0000: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
return Vector3.Distance(position, this.position) < range;
}
public override bool Equals(object obj)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
if (obj is EMPShock eMPShock && position == eMPShock.position)
{
return range == eMPShock.range;
}
return false;
}
public override int GetHashCode()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
return HashCode.Combine<ActiveState, Vector3, float, float, float, ItemToDisable>(State, position, range, endTime, RemainingTime, ItemToDisable);
}
}
public enum EMPState
{
On,
FlickerOff,
Off,
FlickerOn
}
internal static class Random
{
internal static System.Random _rand { get; private set; } = new System.Random();
internal static float GetRandomDelay(float min, float max)
{
return min + GetRandom01() * (max - min);
}
internal static float GetRandom01()
{
return (float)_rand.NextDouble();
}
internal static int GetRandomRange(int min, int maxPlusOne)
{
return _rand.Next(min, maxPlusOne);
}
internal static int Index(int length)
{
return _rand.Next(0, length);
}
internal static bool FlickerUtil(int oneInX = 2)
{
return Index(oneInX) == 0;
}
}
}
namespace EOSExt.EMP.Impl.PersistentEMP
{
public enum ActiveState
{
DISABLED,
ENABLED
}
public class pEMP : EMPShock
{
private uint replicatorID;
public pEMPDefinition def { get; private set; }
public StateReplicator<pEMPState> StateReplicator { get; private set; }
public override ActiveState State
{
get
{
if (StateReplicator == null)
{
return ActiveState.DISABLED;
}
return StateReplicator.State.status;
}
}
public override float RemainingTime => base.endTime;
public override ItemToDisable ItemToDisable => def?.ItemToDisable ?? EMPShock.DISABLE_NOTHING;
private void OnStateChanged(pEMPState oldState, pEMPState newState, bool isRecall)
{
if (isRecall)
{
ChangeToStateUnsynced(newState.status);
}
}
private void ChangeToStateUnsynced(ActiveState newState)
{
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
EOSLogger.Debug($"pEMP_{def.pEMPIndex} Change state: {State} -> {newState}");
switch (newState)
{
case ActiveState.DISABLED:
base.endTime = float.NegativeInfinity;
break;
case ActiveState.ENABLED:
base.endTime = float.PositiveInfinity;
break;
default:
throw new NotImplementedException();
}
if (!ItemToDisable.EnvLight)
{
return;
}
foreach (EMPLightHandler instance in EMPLightHandler.Instances)
{
switch (newState)
{
case ActiveState.DISABLED:
instance.RemoveAffectedBy(this);
break;
case ActiveState.ENABLED:
if (InRange(instance.position))
{
instance.AddAffectedBy(this);
}
else
{
instance.RemoveAffectedBy(this);
}
break;
default:
throw new NotImplementedException();
}
}
}
public void ChangeToState(ActiveState newState)
{
ChangeToStateUnsynced(newState);
if (SNet.IsMaster)
{
StateReplicator?.SetState(new pEMPState
{
status = newState
});
}
}
internal void SetupReplicator(uint replicatorID)
{
this.replicatorID = replicatorID;
StateReplicator = StateReplicator<pEMPState>.Create(replicatorID, new pEMPState
{
status = ActiveState.DISABLED
}, (LifeTimeType)1, (IStateReplicatorHolder<pEMPState>)null);
StateReplicator.OnStateChanged += OnStateChanged;
}
public pEMP(pEMPDefinition def)
: base(def.Position.ToVector3(), def.Range, float.NegativeInfinity)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
this.def = new pEMPDefinition(def);
}
internal void Destroy()
{
base.endTime = float.NegativeInfinity;
StateReplicator = null;
def = null;
}
public override bool Equals(object obj)
{
if (obj is pEMP pEMP2 && def.Equals(pEMP2.def))
{
return replicatorID == pEMP2.replicatorID;
}
return false;
}
public override int GetHashCode()
{
return HashCode.Combine(def, replicatorID);
}
}
public struct pEMPState
{
public ActiveState status;
public pEMPState()
{
status = ActiveState.DISABLED;
}
public pEMPState(ActiveState status)
{
this.status = status;
}
public pEMPState(pEMPState o)
{
status = o.status;
}
}
}
namespace EOSExt.EMP.Impl.Handlers
{
public class EMPBioTrackerHandler : EMPHandler
{
private EnemyScanner _scanner;
public static EMPBioTrackerHandler Instance { get; private set; }
static EMPBioTrackerHandler()
{
}
public override void Setup(GameObject gameObject, EMPController controller)
{
if (Instance != null)
{
EOSLogger.Warning("EMP: re-setup EMPBioTrackerHandler");
Instance.OnDespawn();
}
base.Setup(gameObject, controller);
_scanner = gameObject.GetComponent<EnemyScanner>();
if ((Object)(object)_scanner == (Object)null)
{
EOSLogger.Error("Couldn't get bio-tracker component!");
}
Instance = this;
}
public override void OnDespawn()
{
base.OnDespawn();
Instance = null;
}
protected override void DeviceOff()
{
((ItemEquippable)_scanner).Sound.Post(EVENTS.BIOTRACKER_TOOL_LOOP_STOP, true);
_scanner.m_graphics.m_display.enabled = false;
}
protected override void DeviceOn()
{
_scanner.m_graphics.m_display.enabled = true;
}
protected override void FlickerDevice()
{
((Behaviour)_scanner).enabled = Random.FlickerUtil();
}
}
public class EMPGunSightHandler : EMPHandler
{
private static List<EMPGunSightHandler> handlers;
public GameObject[] _sightPictures;
public static IEnumerable<EMPGunSightHandler> Instances => handlers;
static EMPGunSightHandler()
{
handlers = new List<EMPGunSightHandler>();
LevelAPI.OnLevelCleanup += Clear;
LevelAPI.OnBuildStart += Clear;
}
private void SetupGunSights()
{
Il2CppArrayBase<Renderer> componentsInChildren = base.go.GetComponentsInChildren<Renderer>(true);
if (componentsInChildren != null)
{
_sightPictures = (from x in (IEnumerable<Renderer>)componentsInChildren
where (Object)(object)x.sharedMaterial != (Object)null && (Object)(object)x.sharedMaterial.shader != (Object)null
where ((Object)x.sharedMaterial.shader).name.Contains("HolographicSight")
select ((Component)x).gameObject).ToArray();
}
if (_sightPictures == null || _sightPictures.Length < 1)
{
EOSLogger.Error("Unable to find sight on " + ((Object)base.go).name + "!");
}
}
public override void Setup(GameObject gameObject, EMPController controller)
{
base.Setup(gameObject, controller);
SetupGunSights();
handlers.Add(this);
}
protected override void DeviceOff()
{
ForEachSights(delegate(GameObject x)
{
x.SetActive(false);
});
}
protected override void DeviceOn()
{
ForEachSights(delegate(GameObject x)
{
x.SetActive(true);
});
}
protected override void FlickerDevice()
{
ForEachSights(delegate(GameObject x)
{
x.SetActive(Random.FlickerUtil());
});
}
private void ForEachSights(Action<GameObject> action)
{
GameObject[] sightPictures = _sightPictures;
foreach (GameObject val in sightPictures)
{
if ((Object)(object)val != (Object)null)
{
action?.Invoke(val);
}
}
}
private static void Clear()
{
handlers.Clear();
}
}
public class EMPLightHandler : EMPHandler
{
private static Dictionary<IntPtr, EMPLightHandler> handlers;
private LG_Light _light;
private float _originalIntensity;
private Color _originalColor;
public static IEnumerable<EMPLightHandler> Instances => handlers.Values;
internal static EMPLightHandler GetHandler(LG_Light light)
{
if (!handlers.TryGetValue(((Il2CppObjectBase)light).Pointer, out var value))
{
return null;
}
return value;
}
private static void Clear()
{
handlers.Clear();
}
static EMPLightHandler()
{
handlers = new Dictionary<IntPtr, EMPLightHandler>();
LevelAPI.OnBuildStart += Clear;
LevelAPI.OnLevelCleanup += Clear;
}
public override void Setup(GameObject gameObject, EMPController controller)
{
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: 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)
base.Setup(gameObject, controller);
_light = gameObject.GetComponent<LG_Light>();
if ((Object)(object)_light == (Object)null)
{
EOSLogger.Warning("No Light!");
}
else
{
_originalIntensity = _light.GetIntensity();
_originalColor = new Color(_light.m_color.r, _light.m_color.g, _light.m_color.b, _light.m_color.a);
base.State = EMPState.On;
}
handlers[((Il2CppObjectBase)_light).Pointer] = this;
}
public void SetOriginalColor(Color color)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
_originalColor = color;
}
public void SetOriginalIntensity(float intensity)
{
_originalIntensity = intensity;
}
protected override void OnTick(bool isEMPD)
{
base.OnTick(isEMPD);
if (base.State == EMPState.Off)
{
DeviceOff();
}
else if (base.State == EMPState.On)
{
DeviceOn();
}
}
protected override void FlickerDevice()
{
if (!((Object)(object)_light == (Object)null))
{
_light.ChangeIntensity(Random.GetRandom01() * _originalIntensity);
}
}
protected override void DeviceOn()
{
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_light == (Object)null))
{
_light.ChangeIntensity(_originalIntensity);
_light.ChangeColor(_originalColor);
}
}
protected override void DeviceOff()
{
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)_light == (Object)null))
{
_light.ChangeIntensity(0f);
_light.ChangeColor(Color.black);
}
}
}
public class EMPPlayerFlashLightHandler : EMPHandler
{
private PlayerInventoryBase _inventory;
private float _originalIntensity;
private bool _originalFlashlightState;
public static EMPPlayerFlashLightHandler Instance { get; private set; }
protected override bool IsDeviceOnPlayer => true;
private bool FlashlightEnabled => _inventory.FlashlightEnabled;
static EMPPlayerFlashLightHandler()
{
}
public override void Setup(GameObject gameObject, EMPController controller)
{
if (Instance != null)
{
EOSLogger.Warning("EMP: re-setup EMPPlayerFlashLightHandler");
Instance.OnDespawn();
}
base.Setup(gameObject, controller);
_inventory = gameObject.GetComponent<PlayerAgent>().Inventory;
if ((Object)(object)_inventory == (Object)null)
{
EOSLogger.Warning("Player inventory was null!");
}
else
{
base.State = EMPState.On;
Events.FlashLightWielded = (Action<GearPartFlashlight>)Delegate.Combine(Events.FlashLightWielded, new Action<GearPartFlashlight>(InventoryEvents_ItemWielded));
}
Instance = this;
}
public override void OnDespawn()
{
base.OnDespawn();
Events.FlashLightWielded = (Action<GearPartFlashlight>)Delegate.Remove(Events.FlashLightWielded, new Action<GearPartFlashlight>(Instance.InventoryEvents_ItemWielded));
Instance = null;
}
private void InventoryEvents_ItemWielded(GearPartFlashlight flashlight)
{
_originalIntensity = GameDataBlockBase<FlashlightSettingsDataBlock>.GetBlock(flashlight.m_settingsID).intensity;
}
protected override void DeviceOff()
{
_originalFlashlightState = FlashlightEnabled;
if (_originalFlashlightState)
{
_inventory.Owner.Sync.WantsToSetFlashlightEnabled(false, false);
}
}
protected override void DeviceOn()
{
if (_originalFlashlightState != FlashlightEnabled)
{
_inventory.Owner.Sync.WantsToSetFlashlightEnabled(_originalFlashlightState, false);
}
_inventory.m_flashlight.intensity = _originalIntensity;
}
protected override void FlickerDevice()
{
if (FlashlightEnabled)
{
_inventory.m_flashlight.intensity = Random.GetRandom01() * _originalIntensity;
}
}
}
public class EMPPlayerHudHandler : EMPHandler
{
private readonly List<RectTransformComp> _targets = new List<RectTransformComp>();
public static EMPPlayerHudHandler Instance { get; private set; }
static EMPPlayerHudHandler()
{
}
public override void Setup(GameObject gameObject, EMPController controller)
{
if (Instance != null)
{
EOSLogger.Warning("EMP: re-setup EMPPlayerHudHandler");
Instance.OnDespawn();
}
_targets.Clear();
base.Setup(gameObject, controller);
_targets.Add((RectTransformComp)(object)GuiManager.PlayerLayer.m_compass);
_targets.Add((RectTransformComp)(object)GuiManager.PlayerLayer.m_wardenObjective);
_targets.Add((RectTransformComp)(object)GuiManager.PlayerLayer.Inventory);
_targets.Add((RectTransformComp)(object)GuiManager.PlayerLayer.m_playerStatus);
Instance = this;
}
public override void OnDespawn()
{
base.OnDespawn();
_targets.Clear();
Instance = null;
}
private void ForAllComponents(bool enabled)
{
foreach (RectTransformComp target in _targets)
{
((Component)target).gameObject.SetActive(enabled);
}
}
private void ForPlayerNavMarker(bool enabled)
{
Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerAgent current = enumerator.Current;
if (!((Agent)current).IsLocallyOwned)
{
current.NavMarker.SetMarkerVisible(enabled);
}
}
}
private void ForPlayerGhostOpacity(bool enabled)
{
CellSettingsApply.ApplyPlayerGhostOpacity(enabled ? CellSettingsManager.SettingsData.HUD.Player_GhostOpacity.Value : 0f);
}
protected override void OnTick(bool isEMPD)
{
base.OnTick(isEMPD);
if (base.State == EMPState.Off)
{
DeviceOff();
}
else if (base.State == EMPState.On)
{
DeviceOn();
}
}
protected override void DeviceOff()
{
ForAllComponents(enabled: false);
ForPlayerNavMarker(enabled: false);
ForPlayerGhostOpacity(enabled: false);
}
protected override void DeviceOn()
{
ForAllComponents(enabled: true);
ForPlayerNavMarker(enabled: true);
ForPlayerGhostOpacity(enabled: true);
}
protected override void FlickerDevice()
{
bool enabled = Random.FlickerUtil();
ForAllComponents(enabled);
ForPlayerNavMarker(enabled);
ForPlayerGhostOpacity(enabled);
}
}
public class EMPSentryHandler : EMPHandler
{
private static Color _offColor;
private SentryGunInstance _sentry;
private SentryGunInstance_ScannerVisuals_Plane _visuals;
public static EMPSentryHandler Instance { get; private set; }
static EMPSentryHandler()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
_offColor = new Color
{
r = 0f,
g = 0f,
b = 0f,
a = 0f
};
}
public override void Setup(GameObject gameObject, EMPController controller)
{
if (Instance != null)
{
EOSLogger.Warning("EMP: re-setup EMPSentryHandler");
Instance.OnDespawn();
}
base.Setup(gameObject, controller);
_sentry = gameObject.GetComponent<SentryGunInstance>();
_visuals = gameObject.GetComponent<SentryGunInstance_ScannerVisuals_Plane>();
if ((Object)(object)_sentry == (Object)null || (Object)(object)_visuals == (Object)null)
{
EOSLogger.Error($"Missing components on Sentry! Has Sentry?: {(Object)(object)_sentry == (Object)null}, Has Visuals?: {(Object)(object)_visuals == (Object)null}");
}
Instance = this;
}
public override void OnDespawn()
{
base.OnDespawn();
Instance = null;
}
protected override void DeviceOff()
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
_visuals.m_scannerPlane.SetColor(_offColor);
_visuals.UpdateLightProps(_offColor, false);
_sentry.m_isSetup = false;
_sentry.m_isScanning = false;
_sentry.m_isFiring = false;
((ItemEquippable)_sentry).Sound.Post(EVENTS.SENTRYGUN_STOP_ALL_LOOPS, true);
}
protected override void DeviceOn()
{
_sentry.m_isSetup = true;
_sentry.m_visuals.SetVisualStatus((eSentryGunStatus)0, true);
_sentry.m_isScanning = false;
_sentry.m_startScanTimer = Clock.Time + _sentry.m_initialScanDelay;
((ItemEquippable)_sentry).Sound.Post(EVENTS.SENTRYGUN_LOW_AMMO_WARNING, true);
}
protected override void FlickerDevice()
{
int randomRange = Random.GetRandomRange(0, 3);
_sentry.StopFiring();
switch (randomRange)
{
case 0:
_visuals.SetVisualStatus((eSentryGunStatus)4, true);
break;
case 1:
_visuals.SetVisualStatus((eSentryGunStatus)1, true);
break;
case 2:
_visuals.SetVisualStatus((eSentryGunStatus)2, true);
break;
}
}
}
}
namespace EOSExt.EMP.Definition
{
public class ItemToDisable
{
public bool BioTracker { get; set; } = true;
public bool PlayerHUD { get; set; } = true;
public bool PlayerFlashLight { get; set; } = true;
public bool EnvLight { get; set; } = true;
public bool GunSight { get; set; } = true;
public bool Sentry { get; set; } = true;
public bool Map { get; set; } = true;
public override bool Equals(object obj)
{
if (obj is ItemToDisable itemToDisable && BioTracker == itemToDisable.BioTracker && PlayerHUD == itemToDisable.PlayerHUD && PlayerFlashLight == itemToDisable.PlayerFlashLight && EnvLight == itemToDisable.EnvLight && GunSight == itemToDisable.GunSight && Sentry == itemToDisable.Sentry)
{
return Map == itemToDisable.Map;
}
return false;
}
public override int GetHashCode()
{
return HashCode.Combine(BioTracker, PlayerHUD, PlayerFlashLight, EnvLight, GunSight, Sentry, Map);
}
public override string ToString()
{
return $"ItemToDisable:\nBioTracker: {BioTracker}, PlayerHUD: {PlayerHUD}, PlayerFlashLight: {PlayerFlashLight},\nEnvLight: {EnvLight}, GunSight: {GunSight}, Sentry: {Sentry}, Map: {Map}";
}
}
public class pEMPDefinition
{
public uint pEMPIndex { get; set; }
public Vec3 Position { get; set; } = new Vec3();
public float Range { get; set; }
public ItemToDisable ItemToDisable { get; set; } = new ItemToDisable();
public pEMPDefinition()
{
}//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
public pEMPDefinition(pEMPDefinition other)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
pEMPIndex = other.pEMPIndex;
Position = new Vec3
{
x = other.Position.x,
y = other.Position.y,
z = other.Position.z
};
Range = other.Range;
ItemToDisable = new ItemToDisable
{
BioTracker = other.ItemToDisable.BioTracker,
PlayerHUD = other.ItemToDisable.PlayerHUD,
PlayerFlashLight = other.ItemToDisable.PlayerFlashLight,
EnvLight = other.ItemToDisable.EnvLight,
GunSight = other.ItemToDisable.GunSight,
Sentry = other.ItemToDisable.Sentry,
Map = other.ItemToDisable.Map
};
}
public override bool Equals(object obj)
{
//IL_001e: 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 (obj is pEMPDefinition pEMPDefinition2 && pEMPIndex == pEMPDefinition2.pEMPIndex && Position.ToVector3() == pEMPDefinition2.Position.ToVector3() && Range == pEMPDefinition2.Range)
{
return ItemToDisable.Equals(pEMPDefinition2.ItemToDisable);
}
return false;
}
public override int GetHashCode()
{
return HashCode.Combine<uint, Vec3, float, ItemToDisable>(pEMPIndex, Position, Range, ItemToDisable);
}
}
}