using System;
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.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LegaFusionCore;
using LegaFusionCore.Behaviours;
using LegaFusionCore.Managers;
using LegaFusionCore.Managers.NetworkManagers;
using LegaFusionCore.Registries;
using LegaFusionCore.Utilities;
using LethalLib.Modules;
using LethalStatus.Managers;
using LethalStatus.NetcodePatcher;
using LethalStatus.Patches;
using LethalStatus.StatusEffects;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LethalStatus")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalStatus")]
[assembly: AssemblyCopyright("Copyright © 2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5bce09cd-b6d2-4d04-bfe7-0ad46e4d55f8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("ClientNetworkTransform")]
[assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")]
[assembly: IgnoresAccessChecksTo("DissonanceVoip")]
[assembly: IgnoresAccessChecksTo("DunGen")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")]
[assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")]
[assembly: IgnoresAccessChecksTo("EasyTextEffects")]
[assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")]
[assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")]
[assembly: IgnoresAccessChecksTo("Unity.Burst")]
[assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")]
[assembly: IgnoresAccessChecksTo("Unity.Collections")]
[assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Jobs")]
[assembly: IgnoresAccessChecksTo("Unity.Mathematics")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")]
[assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")]
[assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")]
[assembly: IgnoresAccessChecksTo("Unity.Services.QoS")]
[assembly: IgnoresAccessChecksTo("Unity.Services.Relay")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")]
[assembly: IgnoresAccessChecksTo("Unity.XR.Management")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")]
[assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")]
[assembly: 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]
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 LethalStatus
{
[BepInPlugin("Lega.LethalStatus", "Lethal Status", "1.0.0")]
public class LethalStatus : BaseUnityPlugin
{
internal const string modGUID = "Lega.LethalStatus";
internal const string modName = "Lethal Status";
internal const string modVersion = "1.0.0";
private readonly Harmony harmony = new Harmony("Lega.LethalStatus");
internal static readonly AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lethalstatus"));
internal static ManualLogSource mls;
public static GameObject managerPrefab = NetworkPrefabs.CreateNetworkPrefab("LethalStatusNetworkManager");
public static Material bloodShaderObj;
public static Material frostShaderObj;
public static Material poisonShaderObj;
public static Material lightningShaderObj;
public static Material fireShaderObj;
public static GameObject frostAuraObj;
public static GameObject poisonAuraObj;
public static GameObject lightningAuraObj;
public static GameObject fireAuraObj;
public void Awake()
{
mls = Logger.CreateLogSource("StrangerThings");
LoadManager();
NetcodePatcher();
LoadPrefabs();
LoadNetworkPrefabs();
harmony.PatchAll(typeof(LFCEnemyDamageBehaviourPatch));
harmony.PatchAll(typeof(MenuManagerPatch));
harmony.PatchAll(typeof(PlayerControllerBPatch));
harmony.PatchAll(typeof(StartOfRoundPatch));
}
public static void LoadManager()
{
Utilities.FixMixerGroups(managerPrefab);
managerPrefab.AddComponent<LSNetworkManager>();
}
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 void LoadPrefabs()
{
bloodShaderObj = bundle.LoadAsset<Material>("Assets/Shaders/Blood.mat");
frostShaderObj = bundle.LoadAsset<Material>("Assets/Shaders/Frost.mat");
poisonShaderObj = bundle.LoadAsset<Material>("Assets/Shaders/Poison.mat");
lightningShaderObj = bundle.LoadAsset<Material>("Assets/Shaders/Lightning.mat");
fireShaderObj = bundle.LoadAsset<Material>("Assets/Shaders/Fire.mat");
}
public void LoadNetworkPrefabs()
{
HashSet<GameObject> hashSet = new HashSet<GameObject>
{
frostAuraObj = bundle.LoadAsset<GameObject>("Assets/Particles/Frost.prefab"),
poisonAuraObj = bundle.LoadAsset<GameObject>("Assets/Particles/Poison.prefab"),
lightningAuraObj = bundle.LoadAsset<GameObject>("Assets/Particles/Lightning.prefab"),
fireAuraObj = bundle.LoadAsset<GameObject>("Assets/Particles/Fire.prefab")
};
foreach (GameObject item in hashSet)
{
NetworkPrefabs.RegisterNetworkPrefab(item);
Utilities.FixMixerGroups(item);
}
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "LethalStatus";
public const string PLUGIN_NAME = "LethalStatus";
public const string PLUGIN_VERSION = "1.0.0";
}
}
namespace LethalStatus.StatusEffects
{
public class BleedingEffect : LSStatusEffectRegistry.StatusEffect
{
public BleedingEffect(int playerWhoHit, int duration, int totalDamage, EnemyAI enemyWhoHit = null, Action onApply = null, Action onExpire = null, Action onTick = null)
: base(LSStatusEffectRegistry.StatusEffectType.BLEEDING, playerWhoHit, duration, totalDamage, enemyWhoHit, onApply, onExpire, onTick)
{
}
public override void Apply(GameObject entity)
{
base.Apply(entity);
PlayerControllerB safeComponent = LFCUtilities.GetSafeComponent<PlayerControllerB>(entity);
if (LFCUtilities.ShouldBeLocalPlayer(safeComponent))
{
LFCCustomPassManager.SetupScreenFilter(LethalStatus.bloodShaderObj, "Lethal Status" + ((Object)LethalStatus.bloodShaderObj).name);
}
}
public override void Tick(GameObject entity)
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
base.Tick(entity);
LFCGlobalManager.PlayParticle("Lethal StatusBloodParticle", entity.transform.position, Quaternion.identity, true, 1f, true);
}
public override void Expire(GameObject entity)
{
base.Expire(entity);
PlayerControllerB safeComponent = LFCUtilities.GetSafeComponent<PlayerControllerB>(entity);
if (LFCUtilities.ShouldBeLocalPlayer(safeComponent))
{
LFCCustomPassManager.RemoveFiltersByTag("Lethal Status" + ((Object)LethalStatus.bloodShaderObj).name);
}
}
}
public class FrostEffect : LSStatusEffectRegistry.StatusEffect
{
public FrostEffect(int playerWhoHit, int duration, int totalDamage, EnemyAI enemyWhoHit = null, Action onApply = null, Action onExpire = null, Action onTick = null)
: base(LSStatusEffectRegistry.StatusEffectType.FROST, playerWhoHit, duration, totalDamage, enemyWhoHit, onApply, onExpire, onTick)
{
}
public override void Apply(GameObject entity)
{
base.Apply(entity);
EnemyAI safeComponent = LFCUtilities.GetSafeComponent<EnemyAI>(entity);
if ((Object)(object)safeComponent != (Object)null && !safeComponent.isEnemyDead)
{
LFCEnemySpeedBehaviour component = ((Component)safeComponent).GetComponent<LFCEnemySpeedBehaviour>();
if (component != null)
{
component.AddSpeedData(LSStatusEffectRegistry.StatusEffectType.FROST.ToString(), -0.67f, safeComponent.agent.speed);
}
LSManager.PlayAuraParticle(entity, LethalStatus.frostAuraObj, base.Duration);
return;
}
PlayerControllerB safeComponent2 = LFCUtilities.GetSafeComponent<PlayerControllerB>(entity);
if ((Object)(object)safeComponent2 != (Object)null && !safeComponent2.isPlayerDead)
{
if (LFCUtilities.ShouldBeLocalPlayer(safeComponent2))
{
LFCStatRegistry.AddModifier("Speed", "Lethal Status" + ((Object)LethalStatus.frostShaderObj).name, -100f);
LFCCustomPassManager.SetupScreenFilter(LethalStatus.frostShaderObj, "Lethal Status" + ((Object)LethalStatus.frostShaderObj).name);
}
else
{
LSManager.PlayAuraParticle(entity, LethalStatus.frostAuraObj, base.Duration);
}
}
}
public override void Expire(GameObject entity)
{
base.Expire(entity);
EnemyAI safeComponent = LFCUtilities.GetSafeComponent<EnemyAI>(entity);
if ((Object)(object)safeComponent != (Object)null)
{
LFCEnemySpeedBehaviour component = ((Component)safeComponent).GetComponent<LFCEnemySpeedBehaviour>();
if (component != null)
{
component.RemoveSpeedData(LSStatusEffectRegistry.StatusEffectType.FROST.ToString());
}
return;
}
PlayerControllerB safeComponent2 = LFCUtilities.GetSafeComponent<PlayerControllerB>(entity);
if (LFCUtilities.ShouldBeLocalPlayer(safeComponent2))
{
LFCStatRegistry.RemoveModifier("Speed", "Lethal Status" + ((Object)LethalStatus.frostShaderObj).name);
LFCCustomPassManager.RemoveFiltersByTag("Lethal Status" + ((Object)LethalStatus.frostShaderObj).name);
}
}
}
public class LightningEffect : LSStatusEffectRegistry.StatusEffect
{
private readonly HashSet<ulong> affectedIds = new HashSet<ulong>();
private readonly Collider[] overlapBuffer = (Collider[])(object)new Collider[64];
public float AoERadius = 3f;
public int AoEMask = 1084754248;
public LightningEffect(int playerWhoHit, int duration, int totalDamage, EnemyAI enemyWhoHit = null, Action onApply = null, Action onExpire = null, Action onTick = null)
: base(LSStatusEffectRegistry.StatusEffectType.LIGHTNING, playerWhoHit, duration, totalDamage, enemyWhoHit, onApply, onExpire, onTick)
{
}
public override void Apply(GameObject entity)
{
PlayerControllerB safeComponent = LFCUtilities.GetSafeComponent<PlayerControllerB>(entity);
if (LFCUtilities.ShouldBeLocalPlayer(safeComponent))
{
LFCCustomPassManager.SetupScreenFilter(LethalStatus.lightningShaderObj, "Lethal Status" + ((Object)LethalStatus.lightningShaderObj).name);
}
else
{
LSManager.PlayAuraParticle(entity, LethalStatus.lightningAuraObj, base.Duration);
}
}
public override void Tick(GameObject entity)
{
//IL_0042: 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)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
//IL_0282: Unknown result type (might be due to invalid IL or missing references)
//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
//IL_02c4: Unknown result type (might be due to invalid IL or missing references)
base.Tick(entity);
if (base.PassedTime != base.Duration / 2 && base.PassedTime != base.Duration)
{
return;
}
LFCGlobalManager.PlayParticle("Lethal Status" + ((Object)LegaFusionCore.lightningExplosionParticle).name, entity.transform.position, entity.transform.rotation, true, 1f, true);
LFCGlobalManager.PlayAudio("Lethal Status" + ((Object)LegaFusionCore.lightningExplosionAudio).name, entity.transform.position, true);
if (!LFCUtilities.IsServer)
{
return;
}
PlayerControllerB safeComponent = LFCUtilities.GetSafeComponent<PlayerControllerB>(entity);
PlayerControllerB val = ((base.PlayerWhoHit != -1) ? StartOfRound.Instance.allPlayerObjects[base.PlayerWhoHit].GetComponent<PlayerControllerB>() : null);
int num = Physics.OverlapSphereNonAlloc(entity.transform.position, AoERadius, overlapBuffer, AoEMask, (QueryTriggerInteraction)2);
PlayerControllerB val3 = default(PlayerControllerB);
EnemyAICollisionDetect val4 = default(EnemyAICollisionDetect);
for (int i = 0; i < num; i++)
{
Collider val2 = overlapBuffer[i];
if ((Object)(object)val2 == (Object)null)
{
continue;
}
if (LFCUtilities.TryGetComponentInParent<PlayerControllerB>(((Component)val2).gameObject, ref val3) && !val3.isPlayerDead)
{
if ((Object)(object)val3 != (Object)(object)safeComponent && (Object)(object)val3 != (Object)(object)val && affectedIds.Add(0x8000000000000000uL | val3.playerClientId))
{
if (!LSStatusEffectRegistry.HasStatus(((Component)val3).gameObject, LSStatusEffectRegistry.StatusEffectType.LIGHTNING))
{
LSNetworkManager.Instance.ApplyStatusEveryoneRpc(((Object)(object)val != (Object)null) ? ((int)val.playerClientId) : (-1), (int)val3.playerClientId, 3, base.Duration, ((Object)(object)safeComponent != (Object)null) ? base.TotalDamage : (base.TotalDamage / 10), NetworkObjectReference.op_Implicit(((Object)(object)EnemyWhoHit != (Object)null) ? ((NetworkBehaviour)EnemyWhoHit).NetworkObject : null));
}
LFCNetworkManager.Instance.DamagePlayerEveryoneRpc((int)val3.playerClientId, 10, true, true, 11);
}
}
else
{
if (!LFCUtilities.TryGetComponentInParent<EnemyAICollisionDetect>(((Component)val2).gameObject, ref val4))
{
continue;
}
EnemyAI mainScript = val4.mainScript;
if ((Object)(object)mainScript != (Object)null && !mainScript.isEnemyDead && (Object)(object)((NetworkBehaviour)mainScript).NetworkObject != (Object)null && (Object)(object)mainScript != (Object)(object)EnemyWhoHit && affectedIds.Add(((NetworkBehaviour)mainScript).NetworkObjectId))
{
if (!LSStatusEffectRegistry.HasStatus(((Component)mainScript).gameObject, LSStatusEffectRegistry.StatusEffectType.LIGHTNING))
{
LSNetworkManager.Instance.ApplyStatusEveryoneRpc(((Object)(object)val != (Object)null) ? ((int)val.playerClientId) : (-1), NetworkObjectReference.op_Implicit(((NetworkBehaviour)mainScript).NetworkObject), 3, base.Duration, ((Object)(object)safeComponent != (Object)null) ? (base.TotalDamage * 10) : base.TotalDamage, NetworkObjectReference.op_Implicit(((Object)(object)EnemyWhoHit != (Object)null) ? ((NetworkBehaviour)EnemyWhoHit).NetworkObject : null));
}
PlayerControllerB val5 = val;
mainScript.HitEnemyOnLocalClient(1, default(Vector3), val5, true, -1);
}
}
}
}
public override void Expire(GameObject entity)
{
base.Expire(entity);
PlayerControllerB safeComponent = LFCUtilities.GetSafeComponent<PlayerControllerB>(entity);
if (LFCUtilities.ShouldBeLocalPlayer(safeComponent))
{
LFCCustomPassManager.RemoveFiltersByTag("Lethal Status" + ((Object)LethalStatus.lightningShaderObj).name);
}
}
}
public class LSStatusEffectRegistry : MonoBehaviour
{
public enum StatusEffectType
{
BLEEDING,
FROST,
POISON,
LIGHTNING,
FEAR
}
public abstract class StatusEffect
{
public EnemyAI EnemyWhoHit;
public Action OnApply;
public Action OnExpire;
public Action OnTick;
public StatusEffectType EffectType { get; }
public int PlayerWhoHit { get; }
public int Duration { get; }
public float EndTime { get; private set; }
public int TotalDamage { get; }
public int DamagePerTick { get; }
public int PassedTime { get; private set; }
public float NextTickTime { get; private set; }
public float RemainingTime => EndTime - Time.time;
protected StatusEffect(StatusEffectType effectType, int playerWhoHit, int duration, int totalDamage, EnemyAI enemyWhoHit, Action onApply, Action onExpire, Action onTick)
{
EffectType = effectType;
PlayerWhoHit = playerWhoHit;
Duration = duration;
EndTime = Time.time + (float)duration;
TotalDamage = totalDamage;
EnemyWhoHit = enemyWhoHit;
OnApply = onApply;
OnExpire = onExpire;
OnTick = onTick;
DamagePerTick = ((duration > 0) ? (totalDamage / duration) : 0);
PassedTime = 0;
NextTickTime = Time.time + 1f;
}
public virtual void Apply(GameObject entity)
{
OnApply?.Invoke();
}
public virtual void Tick(GameObject entity)
{
OnTick?.Invoke();
if (DamagePerTick != 0)
{
ApplyDamage(entity, DamagePerTick, PlayerWhoHit);
}
PassedTime++;
NextTickTime += 1f;
}
public virtual void Expire(GameObject entity)
{
OnExpire?.Invoke();
}
public bool ShouldTick()
{
return Time.time >= NextTickTime;
}
public bool IsExpired()
{
return Time.time >= EndTime;
}
protected void ApplyDamage(GameObject entity, int damage, int playerWhoHit)
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)entity != (Object)null)
{
EnemyAI safeComponent = LFCUtilities.GetSafeComponent<EnemyAI>(entity);
if ((Object)(object)safeComponent != (Object)null && !safeComponent.isEnemyDead && LFCEnemyManager.CanDie(safeComponent))
{
LFCEnemyDamageBehaviour.DamageEnemy(safeComponent, damage, playerWhoHit, true, -1, true);
}
PlayerControllerB safeComponent2 = LFCUtilities.GetSafeComponent<PlayerControllerB>(entity);
if ((Object)(object)safeComponent2 != (Object)null && !safeComponent2.isPlayerDead)
{
safeComponent2.DamagePlayer(damage, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
}
}
}
}
private static readonly Dictionary<GameObject, Dictionary<StatusEffectType, StatusEffect>> activeEffects = new Dictionary<GameObject, Dictionary<StatusEffectType, StatusEffect>>();
private static LSStatusEffectRegistry _instance;
public static LSStatusEffectRegistry Instance
{
get
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
if ((Object)(object)_instance == (Object)null)
{
GameObject val = new GameObject("StatusEffect");
_instance = val.AddComponent<LSStatusEffectRegistry>();
Object.DontDestroyOnLoad((Object)(object)val);
}
return _instance;
}
}
private void Update()
{
List<(GameObject, StatusEffectType)> list = new List<(GameObject, StatusEffectType)>();
List<GameObject> list2 = new List<GameObject>();
foreach (KeyValuePair<GameObject, Dictionary<StatusEffectType, StatusEffect>> item in activeEffects.ToList())
{
GameObject key = item.Key;
if ((Object)(object)key == (Object)null)
{
list2.Add(key);
continue;
}
Dictionary<StatusEffectType, StatusEffect> value = item.Value;
foreach (KeyValuePair<StatusEffectType, StatusEffect> item2 in value.ToList())
{
StatusEffect value2 = item2.Value;
if (value2.ShouldTick())
{
value2.Tick(key);
}
if (value2.IsExpired())
{
list.Add((key, item2.Key));
}
}
}
list2.ForEach(delegate(GameObject e)
{
activeEffects.Remove(e);
});
list.ForEach(delegate((GameObject, StatusEffectType) e)
{
RemoveStatus(e.Item1, e.Item2);
});
}
public static void ApplyStatus(GameObject entity, StatusEffectType type, int playerWhoHit, int duration, int totalDamage = 0, EnemyAI enemyWhoHit = null, Action onApply = null, Action onExpire = null, Action onTick = null)
{
StatusEffect statusEffect = type switch
{
StatusEffectType.BLEEDING => new BleedingEffect(playerWhoHit, duration, totalDamage, enemyWhoHit, onApply, onExpire, onTick),
StatusEffectType.FROST => new FrostEffect(playerWhoHit, duration, totalDamage, enemyWhoHit, onApply, onExpire, onTick),
StatusEffectType.POISON => new PoisonEffect(playerWhoHit, duration, totalDamage, enemyWhoHit, onApply, onExpire, onTick),
StatusEffectType.LIGHTNING => new LightningEffect(playerWhoHit, duration, totalDamage, enemyWhoHit, onApply, onExpire, onTick),
_ => null,
};
if (statusEffect != null)
{
ApplyStatus(entity, statusEffect);
}
}
public static void ApplyStatus(GameObject entity, StatusEffect effect)
{
_ = Instance;
if (!activeEffects.ContainsKey(entity))
{
activeEffects[entity] = new Dictionary<StatusEffectType, StatusEffect>();
}
Dictionary<StatusEffectType, StatusEffect> dictionary = activeEffects[entity];
if (dictionary.TryGetValue(effect.EffectType, out var value))
{
if (effect.RemainingTime > value.RemainingTime)
{
value.Expire(entity);
dictionary[effect.EffectType] = effect;
effect.Apply(entity);
}
}
else
{
dictionary[effect.EffectType] = effect;
effect.Apply(entity);
}
}
public static void RemoveStatus(GameObject entity, StatusEffectType effectType)
{
if (activeEffects.TryGetValue(entity, out var value) && value.TryGetValue(effectType, out var value2))
{
value2.Expire(entity);
value.Remove(effectType);
}
}
public static bool HasStatus(GameObject target, StatusEffectType effectType)
{
if (activeEffects.TryGetValue(target, out var value))
{
return value.ContainsKey(effectType);
}
return false;
}
public static void ClearStatus()
{
foreach (GameObject entity in activeEffects.Keys.ToList())
{
if (activeEffects.TryGetValue(entity, out var value))
{
value.Keys.ToList().ForEach(delegate(StatusEffectType e)
{
RemoveStatus(entity, e);
});
activeEffects.Remove(entity);
}
}
}
}
public class PoisonEffect : LSStatusEffectRegistry.StatusEffect
{
public PoisonEffect(int playerWhoHit, int duration, int totalDamage, EnemyAI enemyWhoHit = null, Action onApply = null, Action onExpire = null, Action onTick = null)
: base(LSStatusEffectRegistry.StatusEffectType.POISON, playerWhoHit, duration, totalDamage, enemyWhoHit, onApply, onExpire, onTick)
{
}
public override void Apply(GameObject entity)
{
base.Apply(entity);
PlayerControllerB safeComponent = LFCUtilities.GetSafeComponent<PlayerControllerB>(entity);
if (LFCUtilities.ShouldBeLocalPlayer(safeComponent))
{
LFCCustomPassManager.SetupScreenFilter(LethalStatus.poisonShaderObj, "Lethal Status" + ((Object)LethalStatus.poisonShaderObj).name);
}
else
{
LSManager.PlayAuraParticle(entity, LethalStatus.poisonAuraObj, base.Duration);
}
}
public override void Expire(GameObject entity)
{
base.Expire(entity);
PlayerControllerB safeComponent = LFCUtilities.GetSafeComponent<PlayerControllerB>(entity);
if (LFCUtilities.ShouldBeLocalPlayer(safeComponent))
{
LFCCustomPassManager.RemoveFiltersByTag("Lethal Status" + ((Object)LethalStatus.poisonShaderObj).name);
}
}
}
}
namespace LethalStatus.Patches
{
public class LFCEnemyDamageBehaviourPatch
{
[HarmonyPatch(typeof(LFCEnemyDamageBehaviour), "DamageEnemy")]
[HarmonyPrefix]
public static void DamageEnemy(EnemyAI enemy, ref int force, int playerWhoHit)
{
if (LSStatusEffectRegistry.HasStatus(((Component)enemy).gameObject, LSStatusEffectRegistry.StatusEffectType.POISON))
{
force = (int)((double)force * 1.5);
}
PlayerControllerB val = ((playerWhoHit == -1) ? null : StartOfRound.Instance.allPlayerObjects[playerWhoHit].GetComponent<PlayerControllerB>());
if ((Object)(object)val != (Object)null && LSStatusEffectRegistry.HasStatus(((Component)enemy).gameObject, LSStatusEffectRegistry.StatusEffectType.BLEEDING))
{
int num = Mathf.CeilToInt((float)force / 10f);
LFCPlayerManager.HealPlayerOnLocalClient(val, num);
}
}
}
public class MenuManagerPatch
{
[HarmonyPatch(typeof(MenuManager), "Awake")]
[HarmonyPostfix]
private static void AwakeMenu()
{
LSStatusEffectRegistry.ClearStatus();
}
}
public class PlayerControllerBPatch
{
[HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")]
[HarmonyPrefix]
private static void DamagePlayer(PlayerControllerB __instance, ref int damageNumber)
{
if (LFCUtilities.ShouldBeLocalPlayer(__instance) && LSStatusEffectRegistry.HasStatus(((Component)__instance).gameObject, LSStatusEffectRegistry.StatusEffectType.POISON))
{
damageNumber = Mathf.CeilToInt((float)damageNumber * 1.5f);
}
}
}
public class StartOfRoundPatch
{
[HarmonyPatch(typeof(StartOfRound), "Start")]
[HarmonyBefore(new string[] { "evaisa.lethallib" })]
[HarmonyPostfix]
private static void StartRound(StartOfRound __instance)
{
if (NetworkManager.Singleton.IsHost && (Object)(object)LSNetworkManager.Instance == (Object)null)
{
GameObject val = Object.Instantiate<GameObject>(LethalStatus.managerPrefab, ((Component)__instance).transform.parent);
val.GetComponent<NetworkObject>().Spawn(false);
LethalStatus.mls.LogInfo((object)"Spawning LSNetworkManager");
}
}
[HarmonyPatch(typeof(StartOfRound), "ShipLeave")]
[HarmonyPostfix]
public static void EndRound()
{
LSStatusEffectRegistry.ClearStatus();
}
[HarmonyPatch(typeof(StartOfRound), "OnDisable")]
[HarmonyPostfix]
public static void OnDisable()
{
LSNetworkManager.Instance = null;
}
}
}
namespace LethalStatus.Managers
{
public class LSManager
{
public static void PlayAuraParticle(GameObject entity, GameObject prefab, int duration)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
BoxCollider val = default(BoxCollider);
if (LFCUtilities.TryGetComponentInChildren<BoxCollider>(entity, ref val))
{
Bounds bounds = ((Collider)val).bounds;
Vector3 size = ((Bounds)(ref bounds)).size;
bounds = ((Collider)val).bounds;
GameObject val2 = Object.Instantiate<GameObject>(prefab, ((Bounds)(ref bounds)).center, Quaternion.identity, entity.transform);
val2.transform.localScale = prefab.transform.localScale * Mathf.Max(new float[3] { size.x, size.y, size.z });
Object.Destroy((Object)(object)val2, (float)duration);
}
}
}
public class LSNetworkManager : NetworkBehaviour
{
public static LSNetworkManager Instance;
public void Awake()
{
Instance = this;
}
[Rpc(/*Could not decode attribute arguments.*/)]
public void ApplyStatusEveryoneRpc(int playerId, NetworkObjectReference enemyObj, int type, int duration, int totalDamage = 0, NetworkObjectReference enemyWhoHitObj = default(NetworkObjectReference))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010e: Invalid comparison between Unknown and I4
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_008f: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: 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_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
if (networkManager == null || !networkManager.IsListening)
{
return;
}
if ((int)base.__rpc_exec_stage != 1)
{
RpcAttributeParams val = new RpcAttributeParams
{
RequireOwnership = false
};
RpcParams val2 = default(RpcParams);
FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(737427483u, val2, val, (SendTo)6, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val3, playerId);
((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref enemyObj, default(ForNetworkSerializable));
BytePacker.WriteValueBitPacked(val3, type);
BytePacker.WriteValueBitPacked(val3, duration);
BytePacker.WriteValueBitPacked(val3, totalDamage);
((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref enemyWhoHitObj, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendRpc(ref val3, 737427483u, val2, val, (SendTo)6, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1)
{
base.__rpc_exec_stage = (__RpcExecStage)0;
NetworkObject val4 = default(NetworkObject);
if (((NetworkObjectReference)(ref enemyObj)).TryGet(ref val4, (NetworkManager)null))
{
EnemyAI componentInChildren = ((Component)val4).gameObject.GetComponentInChildren<EnemyAI>();
NetworkObject val5 = default(NetworkObject);
EnemyAI enemyWhoHit = (((NetworkObjectReference)(ref enemyWhoHitObj)).TryGet(ref val5, (NetworkManager)null) ? ((Component)val5).gameObject.GetComponentInChildren<EnemyAI>() : null);
LSStatusEffectRegistry.ApplyStatus(((Component)componentInChildren).gameObject, (LSStatusEffectRegistry.StatusEffectType)type, playerId, duration, totalDamage, enemyWhoHit);
}
}
}
[Rpc(/*Could not decode attribute arguments.*/)]
public void ApplyStatusEveryoneRpc(int playerId, int targetId, int type, int duration, int totalDamage = 0, NetworkObjectReference enemyWhoHitObj = default(NetworkObjectReference))
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Invalid comparison between Unknown and I4
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Invalid comparison between Unknown and I4
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: 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)
{
RpcAttributeParams val = new RpcAttributeParams
{
RequireOwnership = false
};
RpcParams val2 = default(RpcParams);
FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(3145769591u, val2, val, (SendTo)6, (RpcDelivery)0);
BytePacker.WriteValueBitPacked(val3, playerId);
BytePacker.WriteValueBitPacked(val3, targetId);
BytePacker.WriteValueBitPacked(val3, type);
BytePacker.WriteValueBitPacked(val3, duration);
BytePacker.WriteValueBitPacked(val3, totalDamage);
((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref enemyWhoHitObj, default(ForNetworkSerializable));
((NetworkBehaviour)this).__endSendRpc(ref val3, 3145769591u, val2, val, (SendTo)6, (RpcDelivery)0);
}
if ((int)base.__rpc_exec_stage == 1)
{
base.__rpc_exec_stage = (__RpcExecStage)0;
PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[targetId].GetComponent<PlayerControllerB>();
NetworkObject val4 = default(NetworkObject);
EnemyAI enemyWhoHit = (((NetworkObjectReference)(ref enemyWhoHitObj)).TryGet(ref val4, (NetworkManager)null) ? ((Component)val4).gameObject.GetComponentInChildren<EnemyAI>() : null);
LSStatusEffectRegistry.ApplyStatus(((Component)component).gameObject, (LSStatusEffectRegistry.StatusEffectType)type, playerId, duration, totalDamage, enemyWhoHit);
}
}
}
protected override void __initializeVariables()
{
((NetworkBehaviour)this).__initializeVariables();
}
protected override void __initializeRpcs()
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Expected O, but got Unknown
((NetworkBehaviour)this).__registerRpc(737427483u, new RpcReceiveHandler(__rpc_handler_737427483), "ApplyStatusEveryoneRpc");
((NetworkBehaviour)this).__registerRpc(3145769591u, new RpcReceiveHandler(__rpc_handler_3145769591), "ApplyStatusEveryoneRpc");
((NetworkBehaviour)this).__initializeRpcs();
}
private static void __rpc_handler_737427483(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int playerId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
NetworkObjectReference enemyObj = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref enemyObj, default(ForNetworkSerializable));
int type = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref type);
int duration = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref duration);
int totalDamage = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref totalDamage);
NetworkObjectReference enemyWhoHitObj = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref enemyWhoHitObj, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)1;
((LSNetworkManager)(object)target).ApplyStatusEveryoneRpc(playerId, enemyObj, type, duration, totalDamage, enemyWhoHitObj);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
private static void __rpc_handler_3145769591(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
NetworkManager networkManager = target.NetworkManager;
if (networkManager != null && networkManager.IsListening)
{
int playerId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
int targetId = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref targetId);
int type = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref type);
int duration = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref duration);
int totalDamage = default(int);
ByteUnpacker.ReadValueBitPacked(reader, ref totalDamage);
NetworkObjectReference enemyWhoHitObj = default(NetworkObjectReference);
((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref enemyWhoHitObj, default(ForNetworkSerializable));
target.__rpc_exec_stage = (__RpcExecStage)1;
((LSNetworkManager)(object)target).ApplyStatusEveryoneRpc(playerId, targetId, type, duration, totalDamage, enemyWhoHitObj);
target.__rpc_exec_stage = (__RpcExecStage)0;
}
}
[MethodImpl(MethodImplOptions.NoInlining)]
protected internal override string __getTypeName()
{
return "LSNetworkManager";
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}
namespace __GEN
{
internal class NetworkVariableSerializationHelper
{
[RuntimeInitializeOnLoadMethod]
internal static void InitializeSerialization()
{
}
}
}
namespace LethalStatus.NetcodePatcher
{
[AttributeUsage(AttributeTargets.Module)]
internal class NetcodePatchedAssemblyAttribute : Attribute
{
}
}