Decompiled source of LegaFusionCore v1.0.3
LegaFusionCore.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.Logging; using GameNetcodeStuff; using HarmonyLib; using LegaFusionCore.Behaviours; using LegaFusionCore.Behaviours.Addons; using LegaFusionCore.Behaviours.Shaders; using LegaFusionCore.CustomInputs; using LegaFusionCore.Managers; using LegaFusionCore.Managers.NetworkManagers; using LegaFusionCore.NetcodePatcher; using LegaFusionCore.Patches; using LegaFusionCore.Registries; using LegaFusionCore.Utilities; using LethalCompanyInputUtils.Api; using LethalLib.Modules; using Microsoft.CodeAnalysis; using TMPro; using Unity.Netcode; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.Rendering.HighDefinition; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyTitle("LegaFusionCore")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("LegaFusionCore")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("7dc7a313-3468-48ad-8189-4f22764cd9ee")] [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("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("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] 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 LegaFusionCore { public class Constants { public const string STAT_SPEED = "Speed"; public const string KNIFE_ITEM = "Kitchen knife"; } [BepInPlugin("Lega.LegaFusionCore", "Lega Fusion Core", "1.0.3")] public class LegaFusionCore : BaseUnityPlugin { public const string modGUID = "Lega.LegaFusionCore"; public const string modName = "Lega Fusion Core"; public const string modVersion = "1.0.3"; private readonly Harmony harmony = new Harmony("Lega.LegaFusionCore"); private static readonly AssetBundle bundle = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "legafusioncore")); internal static ManualLogSource mls; public static GameObject managerPrefab = NetworkPrefabs.CreateNetworkPrefab("LFCNetworkManager"); public static Material wallhackShader; public static Material transparentShader; public static Material bloodShader; public static Material frostShader; public static Material poisonShader; public static GameObject smokeParticle; public static GameObject darkExplosionParticle; public static GameObject bluePortalParticle; public static GameObject redPortalParticle; public static GameObject bloodParticle; public static GameObject darkExplosionAudio; public static GameObject hitProjectileAudio; public void Awake() { mls = Logger.CreateLogSource("LegaFusionCore"); LoadManager(); NetcodePatcher(); LoadShaders(); LoadParticles(); LoadAudios(); harmony.PatchAll(typeof(StartOfRoundPatch)); harmony.PatchAll(typeof(RoundManagerPatch)); harmony.PatchAll(typeof(NetworkBehaviourPatch)); harmony.PatchAll(typeof(PlayerControllerBPatch)); harmony.PatchAll(typeof(GrabbableObjectPatch)); harmony.PatchAll(typeof(EnemyAIPatch)); } public static void LoadManager() { Utilities.FixMixerGroups(managerPrefab); managerPrefab.AddComponent<LFCNetworkManager>(); } 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.ContainsGenericParameters) { methodInfo.Invoke(null, null); } } } } public static void LoadShaders() { wallhackShader = bundle.LoadAsset<Material>("Assets/Shaders/WallhackMaterial.mat"); transparentShader = bundle.LoadAsset<Material>("Assets/Shaders/TransparentMaterial.mat"); bloodShader = bundle.LoadAsset<Material>("Assets/Shaders/BloodMaterial.mat"); frostShader = bundle.LoadAsset<Material>("Assets/Shaders/FrostMaterial.mat"); poisonShader = bundle.LoadAsset<Material>("Assets/Shaders/PoisonMaterial.mat"); } public void LoadParticles() { HashSet<GameObject> hashSet = new HashSet<GameObject> { smokeParticle = bundle.LoadAsset<GameObject>("Assets/Particles/SmokeParticle.prefab"), darkExplosionParticle = bundle.LoadAsset<GameObject>("Assets/Particles/DarkExplosionParticle.prefab"), bluePortalParticle = bundle.LoadAsset<GameObject>("Assets/Particles/BluePortalParticle.prefab"), redPortalParticle = bundle.LoadAsset<GameObject>("Assets/Particles/RedPortalParticle.prefab") }; foreach (GameObject item in hashSet) { NetworkPrefabs.RegisterNetworkPrefab(item); Utilities.FixMixerGroups(item); LFCPrefabRegistry.RegisterPrefab("Lega Fusion Core" + ((Object)item).name, item); } } public void LoadAudios() { HashSet<GameObject> hashSet = new HashSet<GameObject> { darkExplosionAudio = bundle.LoadAsset<GameObject>("Assets/Audios/DarkExplosionAudio.prefab"), hitProjectileAudio = bundle.LoadAsset<GameObject>("Assets/Audios/HitProjectileAudio.prefab") }; foreach (GameObject item in hashSet) { NetworkPrefabs.RegisterNetworkPrefab(item); Utilities.FixMixerGroups(item); LFCPrefabRegistry.RegisterPrefab("Lega Fusion Core" + ((Object)item).name, item); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "LegaFusionCore"; public const string PLUGIN_NAME = "LegaFusionCore"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace LegaFusionCore.Utilities { public static class LFCUtilities { public static bool IsServer { get { if (!((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsServer) { return ((NetworkBehaviour)GameNetworkManager.Instance.localPlayerController).IsHost; } return true; } } public static bool ShouldBeLocalPlayer(PlayerControllerB player) { if ((Object)(object)player != (Object)null) { return (Object)(object)player == (Object)(object)GameNetworkManager.Instance?.localPlayerController; } return false; } public static bool ShouldNotBeLocalPlayer(PlayerControllerB player) { if ((Object)(object)player != (Object)null) { return (Object)(object)player != (Object)(object)GameNetworkManager.Instance?.localPlayerController; } return false; } public static void Shuffle<T>(IList<T> list) { for (int num = list.Count - 1; num > 0; num--) { int num2 = Random.Range(0, num + 1); int index = num2; int index2 = num; T value = list[num]; T value2 = list[num2]; list[index] = value; list[index2] = value2; } } public static GameObject GetPrefabFromName(string name) { GameObject val = null; IEnumerable<NetworkPrefabsList> networkPrefabsLists = NetworkManager.Singleton.NetworkConfig.Prefabs.NetworkPrefabsLists; foreach (NetworkPrefabsList item in networkPrefabsLists ?? Enumerable.Empty<NetworkPrefabsList>()) { IEnumerable<NetworkPrefab> prefabList = item.PrefabList; foreach (NetworkPrefab item2 in prefabList ?? Enumerable.Empty<NetworkPrefab>()) { GrabbableObject component = item2.Prefab.GetComponent<GrabbableObject>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component.itemProperties == (Object)null) && component.itemProperties.itemName.Equals(name)) { val = item2.Prefab; if ((Object)(object)val != (Object)null) { break; } } } } return val; } public static T GetSafeComponent<T>(GameObject gameObject) where T : Component { if (!((Object)(object)gameObject == (Object)null)) { if (gameObject != null && Object.op_Implicit((Object)(object)gameObject)) { return gameObject.GetComponent<T>(); } } return default(T); } public static void SetAddonComponent<T>(GrabbableObject grabbableObject, string addonName, bool isPassive = false) where T : AddonComponent { T val = ((Component)grabbableObject).gameObject.AddComponent<T>(); val.grabbableObject = grabbableObject; val.addonName = addonName; val.isPassive = isPassive; ScanNodeProperties componentInChildren = ((Component)grabbableObject).gameObject.GetComponentInChildren<ScanNodeProperties>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.subText = componentInChildren.subText + ((componentInChildren.subText != null) ? "\n" : "") + "Addon: " + addonName; } } public static T GetAddonComponent<T>(PlayerControllerB player) where T : AddonComponent { if ((Object)(object)player == (Object)null) { return null; } T val = null; for (int i = 0; i < player.ItemSlots.Length; i++) { val = GetAddonComponent<T>(player.ItemSlots[i]); if ((Object)(object)val != (Object)null) { break; } } return val; } public static T GetAddonComponent<T>(GrabbableObject grabbableObject) where T : AddonComponent { if (grabbableObject == null) { return null; } return ((Component)grabbableObject).GetComponent<T>(); } } } namespace LegaFusionCore.Registries { public static class LFCPlayerActionRegistry { private static readonly Dictionary<string, HashSet<string>> lockRegistry = new Dictionary<string, HashSet<string>>(); public static void AddLock(string actionName, string tag) { if (!lockRegistry.TryGetValue(actionName, out var value)) { value = new HashSet<string>(); lockRegistry[actionName] = value; } if (value.Add(tag) && value.Count == 1) { SetActionEnabled(actionName, enabled: false); } } public static void RemoveLock(string actionName, string tag) { if (lockRegistry.TryGetValue(actionName, out var value) && value.Remove(tag) && value.Count == 0) { SetActionEnabled(actionName, enabled: true); } } public static bool IsLocked(string actionName) { if (lockRegistry.TryGetValue(actionName, out var value)) { return value.Count > 0; } return false; } private static void SetActionEnabled(string actionName, bool enabled) { InputAction val = IngamePlayerSettings.Instance.playerInput.actions.FindAction(actionName, false); if (val == null) { LegaFusionCore.mls.LogWarning((object)("Action '" + actionName + "' not found")); } else if (enabled) { val.Enable(); } else { val.Disable(); } } } public static class LFCPrefabRegistry { private static readonly Dictionary<string, GameObject> registry = new Dictionary<string, GameObject>(); public static void RegisterPrefab(string tag, GameObject prefab) { if (!registry.ContainsKey(tag)) { registry.Add(tag, prefab); } } public static GameObject GetPrefab(string tag) { registry.TryGetValue(tag, out var value); return value; } } public static class LFCSpawnableItemRegistry { public class SpawnableItem { public Type Type { get; } public Item Item { get; } public int MinSpawn { get; } public int MaxSpawn { get; } public int Rarity { get; } public int Value { get; } public SpawnableItem(Type type, Item item, int minSpawn, int maxSpawn, int rarity, int value) { Type = type; Item = item; MinSpawn = minSpawn; MaxSpawn = maxSpawn; Rarity = rarity; Value = value; base..ctor(); } public override bool Equals(object obj) { if (obj is SpawnableItem spawnableItem) { return (Object)(object)spawnableItem.Item == (Object)(object)Item; } return false; } public override int GetHashCode() { return ((object)Item)?.GetHashCode() ?? 0; } } private static readonly HashSet<SpawnableItem> spawnableItems = new HashSet<SpawnableItem>(); public static void Add(Type type, Item item, int minSpawn, int maxSpawn, int rarity, int value = 0) { LFCObjectsManager.RegisterObject(type, item); spawnableItems.Add(new SpawnableItem(type, item, minSpawn, maxSpawn, rarity, value)); } public static IReadOnlyCollection<SpawnableItem> GetAll() { return spawnableItems; } } public static class LFCSpawnRegistry { private static readonly Dictionary<Type, HashSet<Component>> registry = new Dictionary<Type, HashSet<Component>>(); public static void Add<T>(T obj) where T : Component { if (!((Object)(object)obj == (Object)null)) { Type typeFromHandle = typeof(T); if (!registry.TryGetValue(typeFromHandle, out var value)) { value = new HashSet<Component>(); registry[typeFromHandle] = value; } if (!value.Contains((Component)(object)obj)) { value.Add((Component)(object)obj); } } } public static void Remove<T>(T obj) where T : Component { if ((Object)(object)obj == (Object)null) { return; } Type typeFromHandle = typeof(T); if (registry.TryGetValue(typeFromHandle, out var value)) { value.RemoveWhere((Component c) => (Object)(object)c == (Object)null || (Object)(object)c == (Object)(object)obj); } } public static List<T> GetAllAs<T>() where T : Component { List<T> list = new List<T>(); foreach (KeyValuePair<Type, HashSet<Component>> item in registry) { item.Value.RemoveWhere((Component c) => (Object)(object)c == (Object)null); foreach (Component item2 in item.Value) { if ((Object)(object)item2 != (Object)null) { T val = (T)(object)((item2 is T) ? item2 : null); if (val != null) { list.Add(val); } } } } return list; } public static void Clear() { registry.Clear(); } } public static class LFCStatRegistry { private class StatEntry { public float baseValue; public float? minValue; public float? maxValue; public readonly Dictionary<string, float> modifiers = new Dictionary<string, float>(); public float FinalValue { get { float num = 1f + modifiers.Values.Sum(); float num2 = baseValue * num; if (minValue.HasValue) { num2 = Mathf.Max(minValue.Value, num2); } if (maxValue.HasValue) { num2 = Mathf.Min(maxValue.Value, num2); } return num2; } } } private static readonly Dictionary<string, StatEntry> stats = new Dictionary<string, StatEntry>(); public static void RegisterStat(string id, float baseValue, float? min = null, float? max = null) { stats[id] = new StatEntry { baseValue = baseValue, minValue = min, maxValue = max }; } public static void SetBaseValue(string id, float newBase) { if (stats.TryGetValue(id, out var value)) { value.baseValue = newBase; } } public static void AddModifier(string id, string tag, float value) { if (stats.TryGetValue(id, out var value2)) { value2.modifiers[tag] = value; } } public static void RemoveModifier(string id, string tag) { if (stats.TryGetValue(id, out var value)) { value.modifiers.Remove(tag); } } public static float? GetFinalValue(string id) { if (!stats.TryGetValue(id, out var value)) { return null; } return value.FinalValue; } public static bool HasModifier(string id, string sourceTag) { if (stats.TryGetValue(id, out var value)) { return value.modifiers.ContainsKey(sourceTag); } return false; } public static float GetSumModifier(string id) { if (!stats.TryGetValue(id, out var value)) { return 0f; } return value.modifiers.Values.Sum(); } public static void ClearModifiers(string id) { if (stats.TryGetValue(id, out var value)) { value.modifiers.Clear(); } } } public class LFCStatusEffectRegistry : MonoBehaviour { public enum StatusEffectType { BLEEDING, FROST, POISON, FEAR } public abstract class StatusEffect { 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 float NextTickTime { get; private set; } public float RemainingTime => EndTime - Time.time; protected StatusEffect(StatusEffectType effectType, int playerWhoHit, int duration, int totalDamage, Action onApply, Action onExpire, Action onTick) { EffectType = effectType; PlayerWhoHit = playerWhoHit; Duration = duration; EndTime = Time.time + (float)duration; TotalDamage = totalDamage; OnApply = onApply; OnExpire = onExpire; OnTick = onTick; DamagePerTick = ((duration > 0) ? (totalDamage / duration) : 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); } 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_0056: 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) if (!((Object)(object)entity == (Object)null)) { EnemyAI safeComponent = LFCUtilities.GetSafeComponent<EnemyAI>(entity); if ((Object)(object)safeComponent != (Object)null && !safeComponent.isEnemyDead && LFCEnemyManager.CanDie(safeComponent)) { EnemyAIPatch.DamageEnemy(safeComponent, damage, playerWhoHit, playHitSFX: 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)); } } } } public class BleedingEffect : StatusEffect { public BleedingEffect(int playerWhoHit, int duration, int totalDamage, Action onApply = null, Action onExpire = null, Action onTick = null) : base(StatusEffectType.BLEEDING, playerWhoHit, duration, totalDamage, onApply, onExpire, onTick) { } public override void Apply(GameObject entity) { //IL_0040: 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) base.Apply(entity); PlayerControllerB safeComponent = LFCUtilities.GetSafeComponent<PlayerControllerB>(entity); if (LFCUtilities.ShouldNotBeLocalPlayer(safeComponent)) { CustomPassManager.SetupAuraForObjects((GameObject[])(object)new GameObject[1] { entity.gameObject }, LegaFusionCore.bloodShader, "Lega Fusion Core" + ((Object)LegaFusionCore.bloodShader).name); } } public override void Tick(GameObject entity) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) base.Tick(entity); LFCGlobalManager.PlayParticle("Lega Fusion Core" + ((Object)LegaFusionCore.bloodParticle).name, entity.transform.position, Quaternion.identity); } public override void Expire(GameObject entity) { base.Expire(entity); CustomPassManager.RemoveAuraFromObjects((GameObject[])(object)new GameObject[1] { entity.gameObject }, "Lega Fusion Core" + ((Object)LegaFusionCore.bloodShader).name); } } public class FrostEffect : StatusEffect { public FrostEffect(int playerWhoHit, int duration, int totalDamage, Action onApply = null, Action onExpire = null, Action onTick = null) : base(StatusEffectType.FROST, playerWhoHit, duration, totalDamage, onApply, onExpire, onTick) { } public override void Apply(GameObject entity) { //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) base.Apply(entity); EnemyAI safeComponent = LFCUtilities.GetSafeComponent<EnemyAI>(entity); if ((Object)(object)safeComponent != (Object)null && !safeComponent.isEnemyDead) { ((Component)safeComponent).GetComponent<EnemySpeedBehaviour>()?.AddSpeedData(StatusEffectType.FROST.ToString(), -0.67f, safeComponent.agent.speed); return; } PlayerControllerB safeComponent2 = LFCUtilities.GetSafeComponent<PlayerControllerB>(entity); if (!((Object)(object)safeComponent2 == (Object)null) && !safeComponent2.isPlayerDead) { if (LFCUtilities.ShouldBeLocalPlayer(safeComponent2)) { LFCStatRegistry.AddModifier("Speed", "Lega Fusion Core" + ((Object)LegaFusionCore.frostShader).name, -100f); return; } CustomPassManager.SetupAuraForObjects((GameObject[])(object)new GameObject[1] { entity.gameObject }, LegaFusionCore.frostShader, "Lega Fusion Core" + ((Object)LegaFusionCore.frostShader).name); } } public override void Expire(GameObject entity) { base.Expire(entity); CustomPassManager.RemoveAuraFromObjects((GameObject[])(object)new GameObject[1] { entity.gameObject }, "Lega Fusion Core" + ((Object)LegaFusionCore.frostShader).name); EnemyAI safeComponent = LFCUtilities.GetSafeComponent<EnemyAI>(entity); if ((Object)(object)safeComponent != (Object)null) { ((Component)safeComponent).GetComponent<EnemySpeedBehaviour>()?.RemoveSpeedData(StatusEffectType.FROST.ToString()); return; } PlayerControllerB safeComponent2 = LFCUtilities.GetSafeComponent<PlayerControllerB>(entity); if (LFCUtilities.ShouldBeLocalPlayer(safeComponent2)) { LFCStatRegistry.RemoveModifier("Speed", "Lega Fusion Core" + ((Object)LegaFusionCore.frostShader).name); } } } public class PoisonEffect : StatusEffect { public PoisonEffect(int playerWhoHit, int duration, int totalDamage, Action onApply = null, Action onExpire = null, Action onTick = null) : base(StatusEffectType.POISON, playerWhoHit, duration, totalDamage, onApply, onExpire, onTick) { } public override void Apply(GameObject entity) { //IL_0040: 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) base.Apply(entity); PlayerControllerB safeComponent = LFCUtilities.GetSafeComponent<PlayerControllerB>(entity); if (LFCUtilities.ShouldNotBeLocalPlayer(safeComponent)) { CustomPassManager.SetupAuraForObjects((GameObject[])(object)new GameObject[1] { entity.gameObject }, LegaFusionCore.poisonShader, "Lega Fusion Core" + ((Object)LegaFusionCore.poisonShader).name); } } public override void Expire(GameObject entity) { base.Expire(entity); CustomPassManager.RemoveAuraFromObjects((GameObject[])(object)new GameObject[1] { entity.gameObject }, "Lega Fusion Core" + ((Object)LegaFusionCore.poisonShader).name); } } private static readonly Dictionary<GameObject, Dictionary<StatusEffectType, StatusEffect>> activeEffects = new Dictionary<GameObject, Dictionary<StatusEffectType, StatusEffect>>(); private static LFCStatusEffectRegistry _instance; public static LFCStatusEffectRegistry 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<LFCStatusEffectRegistry>(); 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>> activeEffect in activeEffects) { GameObject key = activeEffect.Key; if ((Object)(object)key == (Object)null) { list2.Add(key); continue; } Dictionary<StatusEffectType, StatusEffect> value = activeEffect.Value; foreach (KeyValuePair<StatusEffectType, StatusEffect> item in value) { StatusEffect value2 = item.Value; if (value2.ShouldTick()) { value2.Tick(key); } if (value2.IsExpired()) { list.Add((key, item.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, Action onApply = null, Action onExpire = null, Action onTick = null) { StatusEffect statusEffect = type switch { StatusEffectType.BLEEDING => new BleedingEffect(playerWhoHit, duration, totalDamage, onApply, onExpire, onTick), StatusEffectType.FROST => new FrostEffect(playerWhoHit, duration, totalDamage, onApply, onExpire, onTick), StatusEffectType.POISON => new PoisonEffect(playerWhoHit, duration, totalDamage, 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); } } } } } namespace LegaFusionCore.Patches { public class EnemyAIPatch { private static readonly Dictionary<EnemyAI, int> extendedEnemyHP = new Dictionary<EnemyAI, int>(); private static readonly int rateHP = 100; [HarmonyPatch(typeof(EnemyAI), "Start")] [HarmonyPostfix] public static void PostStart(EnemyAI __instance) { AddSpeedBehaviour(__instance); InitExtendedHP(__instance); } public static void AddSpeedBehaviour(EnemyAI __instance) { EnemySpeedBehaviour enemySpeedBehaviour = default(EnemySpeedBehaviour); if (!((Component)__instance).TryGetComponent<EnemySpeedBehaviour>(ref enemySpeedBehaviour)) { EnemySpeedBehaviour enemySpeedBehaviour2 = ((Component)__instance).gameObject.AddComponent<EnemySpeedBehaviour>(); enemySpeedBehaviour2.enemy = __instance; } } public static void InitExtendedHP(EnemyAI __instance) { if (!extendedEnemyHP.ContainsKey(__instance)) { extendedEnemyHP[__instance] = __instance.enemyHP * rateHP; } } public static int GetExtendedHP(EnemyAI enemy) { if (!extendedEnemyHP.ContainsKey(enemy)) { InitExtendedHP(enemy); } return extendedEnemyHP[enemy]; } public static void SetExtendedHP(EnemyAI enemy, int value) { extendedEnemyHP[enemy] = Mathf.Max(0, value); } public static void DamageEnemy(EnemyAI enemy, int force, int playerWhoHit = -1, bool playHitSFX = false, int hitID = -1, bool callHitEnemy = true) { //IL_0082: 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) InitExtendedHP(enemy); PlayerControllerB val = ((playerWhoHit == -1) ? null : StartOfRound.Instance.allPlayerObjects[playerWhoHit].GetComponent<PlayerControllerB>()); if (LFCStatusEffectRegistry.HasStatus(((Component)enemy).gameObject, LFCStatusEffectRegistry.StatusEffectType.POISON)) { force = (int)((double)force * 1.5); } int num = GetExtendedHP(enemy) - force; SetExtendedHP(enemy, num); int num2 = Mathf.CeilToInt((float)num / (float)rateHP); if (callHitEnemy) { if (num2 < enemy.enemyHP) { int num3 = enemy.enemyHP - num2; PlayerControllerB val2 = val; bool flag = playHitSFX; enemy.HitEnemyOnLocalClient(num3, default(Vector3), val2, flag, hitID); } else if (playHitSFX && (Object)(object)enemy.enemyType?.hitBodySFX != (Object)null && !enemy.isEnemyDead) { enemy.creatureSFX.PlayOneShot(enemy.enemyType.hitBodySFX); WalkieTalkie.TransmitOneShotAudio(enemy.creatureSFX, enemy.enemyType.hitBodySFX, 1f); } } if ((Object)(object)val != (Object)null && LFCStatusEffectRegistry.HasStatus(((Component)enemy).gameObject, LFCStatusEffectRegistry.StatusEffectType.BLEEDING)) { int regenHP = Mathf.CeilToInt((float)force / 10f); LFCPlayerManager.HealPlayerOnLocalClient(val, regenHP); } } [HarmonyPatch(typeof(EnemyAI), "HitEnemy")] [HarmonyPostfix] public static void HitEnemyPostfix(EnemyAI __instance, int force = 1, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1) { int num = Mathf.CeilToInt((float)(GetExtendedHP(__instance) / rateHP)); if (num >= __instance.enemyHP) { int playerWhoHit2 = (((Object)(object)playerWhoHit != (Object)null) ? ((int)playerWhoHit.playerClientId) : (-1)); DamageEnemy(__instance, force * rateHP, playerWhoHit2, playHitSFX, hitID, callHitEnemy: false); } } [HarmonyPatch(typeof(EnemyAI), "OnDestroy")] [HarmonyPostfix] public static void OnDestroyPostfix(EnemyAI __instance) { extendedEnemyHP.Remove(__instance); } } public class GrabbableObjectPatch { [HarmonyPatch(typeof(GrabbableObject), "SetScrapValue")] [HarmonyPostfix] private static void SetAddonScanNode(ref GrabbableObject __instance) { AddonComponent component = ((Component)__instance).gameObject.GetComponent<AddonComponent>(); if (!((Object)(object)component == (Object)null)) { ScanNodeProperties componentInChildren = ((Component)__instance).gameObject.GetComponentInChildren<ScanNodeProperties>(); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.subText = componentInChildren.subText + ((componentInChildren.subText != null) ? "\n" : "") + "Addon: " + component.addonName; } } } [HarmonyPatch(typeof(GrabbableObject), "GrabItem")] [HarmonyPostfix] private static void GrabObject(ref GrabbableObject __instance) { if (LFCUtilities.ShouldBeLocalPlayer(__instance.playerHeldBy)) { ((Component)__instance).gameObject.GetComponent<AddonComponent>()?.StartCooldown(30); } } [HarmonyPatch(typeof(GrabbableObject), "SetControlTipsForItem")] [HarmonyPostfix] private static void SetControlTipsForAddon(ref GrabbableObject __instance) { AddonComponent component = ((Component)__instance).gameObject.GetComponent<AddonComponent>(); if (!((Object)(object)component == (Object)null) && !component.isPassive) { component.SetTipsForItem(new string[1] { AddonInput.Instance.GetAddonToolTip() }); } } [HarmonyPatch(typeof(GrabbableObject), "DestroyObjectInHand")] [HarmonyPostfix] private static void DestroyObjectRenderers(ref GrabbableObject __instance) { Renderer[] componentsInChildren = ((Component)__instance).gameObject.GetComponentsInChildren<Renderer>(); foreach (Renderer val in componentsInChildren) { Object.Destroy((Object)(object)val); } } } public class NetworkBehaviourPatch { private static readonly Type[] trackedTypes = new Type[3] { typeof(GrabbableObject), typeof(EnemyAI), typeof(EntranceTeleport) }; [HarmonyPatch(typeof(NetworkBehaviour), "InternalOnNetworkSpawn")] [HarmonyPostfix] private static void SpawnNetworkBehaviour(ref NetworkBehaviour __instance) { Type[] array = trackedTypes; foreach (Type type in array) { if (type.IsInstanceOfType(__instance)) { LFCSpawnRegistry.Add<NetworkBehaviour>(__instance); break; } } } [HarmonyPatch(typeof(NetworkBehaviour), "InternalOnNetworkDespawn")] [HarmonyPostfix] private static void DestroyNetworkBehaviour(ref NetworkBehaviour __instance) { Type[] array = trackedTypes; foreach (Type type in array) { if (type.IsInstanceOfType(__instance)) { LFCSpawnRegistry.Remove<NetworkBehaviour>(__instance); break; } } } } public class PlayerControllerBPatch { [HarmonyPatch(typeof(PlayerControllerB), "ConnectClientToPlayerObject")] [HarmonyPostfix] private static void ConnectPlayer(ref PlayerControllerB __instance) { if (LFCUtilities.ShouldBeLocalPlayer(__instance)) { LFCStatRegistry.RegisterStat("Speed", __instance.movementSpeed, __instance.movementSpeed / 10f); } } [HarmonyPatch(typeof(PlayerControllerB), "Update")] [HarmonyPrefix] private static void UpdatePlayer(ref PlayerControllerB __instance) { if (LFCUtilities.ShouldBeLocalPlayer(__instance)) { __instance.movementSpeed = LFCStatRegistry.GetFinalValue("Speed") ?? __instance.movementSpeed; } } [HarmonyPatch(typeof(PlayerControllerB), "DamagePlayer")] [HarmonyPrefix] private static void DamagePlayer(ref PlayerControllerB __instance, ref int damageNumber) { if (LFCUtilities.ShouldBeLocalPlayer(__instance) && LFCStatusEffectRegistry.HasStatus(((Component)__instance).gameObject, LFCStatusEffectRegistry.StatusEffectType.POISON)) { damageNumber = Mathf.CeilToInt((float)damageNumber * 1.5f); } } } public class RoundManagerPatch { [HarmonyPatch(typeof(RoundManager), "SpawnScrapInLevel")] [HarmonyPostfix] private static void SpawnNewItems(ref RoundManager __instance) { foreach (LFCSpawnableItemRegistry.SpawnableItem item in LFCSpawnableItemRegistry.GetAll()) { for (int i = 0; i < item.MaxSpawn; i++) { if (i < item.MinSpawn || new Random().Next(1, 100) <= item.Rarity) { LFCObjectsManager.SpawnNewObject(__instance, item.Item); } } } } } public class StartOfRoundPatch { [HarmonyPatch(typeof(StartOfRound), "Start")] [HarmonyBefore(new string[] { "evaisa.lethallib" })] [HarmonyPostfix] private static void StartRound(ref StartOfRound __instance) { LoadVanillaPrefabs(); AddonInput.Instance.EnableInput(); if (NetworkManager.Singleton.IsHost && !((Object)(object)LFCNetworkManager.Instance != (Object)null)) { GameObject val = Object.Instantiate<GameObject>(LegaFusionCore.managerPrefab, ((Component)__instance).transform.parent); val.GetComponent<NetworkObject>().Spawn(false); LegaFusionCore.mls.LogInfo((object)"Spawning LFCNetworkManager"); } } public static void LoadVanillaPrefabs() { GameObject prefabFromName = LFCUtilities.GetPrefabFromName("Kitchen knife"); if ((Object)(object)prefabFromName != (Object)null) { GameObject val = Object.Instantiate<GameObject>(prefabFromName); val.SetActive(false); ParticleSystem componentInChildren = val.GetComponentInChildren<ParticleSystem>(true); if ((Object)(object)componentInChildren != (Object)null) { LegaFusionCore.bloodParticle = Object.Instantiate<GameObject>(((Component)componentInChildren).gameObject); LegaFusionCore.bloodParticle.SetActive(false); Object.DontDestroyOnLoad((Object)(object)LegaFusionCore.bloodParticle); } Object.Destroy((Object)(object)val); LFCPrefabRegistry.RegisterPrefab("Lega Fusion Core" + ((Object)LegaFusionCore.bloodParticle).name, LegaFusionCore.bloodParticle); } } [HarmonyPatch(typeof(StartOfRound), "ShipLeave")] [HarmonyPostfix] public static void EndRound() { LFCStatusEffectRegistry.ClearStatus(); foreach (AddonComponent item in from g in Object.FindObjectsOfType<GrabbableObject>() select ((Component)g).GetComponent<AddonComponent>()) { if (!((Object)(object)item == (Object)null)) { item.StopCooldown(); } } } [HarmonyPatch(typeof(StartOfRound), "OnDisable")] [HarmonyPostfix] public static void OnDisable() { LFCNetworkManager.Instance = null; LFCSpawnRegistry.Clear(); } } } namespace LegaFusionCore.Managers { public static class LFCEnemyManager { public static bool CanDie(EnemyAI enemy) { if ((Object)(object)enemy?.enemyType == (Object)null) { return false; } string[] source = new string[11] { "Spring", "Jester", "Clay Surgeon", "Red Locust Bees", "Earth Leviathan", "Girl", "Blob", "Butler Bees", "RadMech", "Docile Locust Bees", "Puffer" }; if (enemy.enemyType.canDie) { return !source.Contains(enemy.enemyType.enemyName); } return false; } } public static class LFCGlobalManager { public static void PlayParticle(string tag, Vector3 position, Quaternion rotation) { //IL_0027: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) GameObject prefab = LFCPrefabRegistry.GetPrefab(tag); if ((Object)(object)prefab == (Object)null) { LegaFusionCore.mls.LogWarning((object)("[PlayParticle] No prefab found for the tag: " + tag)); return; } GameObject val = Object.Instantiate<GameObject>(prefab, position, rotation); val.SetActive(true); ParticleSystem component = val.GetComponent<ParticleSystem>(); MainModule main = component.main; if (!((MainModule)(ref main)).playOnAwake) { component.Play(); } main = component.main; float duration = ((MainModule)(ref main)).duration; main = component.main; MinMaxCurve startLifetime = ((MainModule)(ref main)).startLifetime; Object.Destroy((Object)(object)val, duration + ((MinMaxCurve)(ref startLifetime)).constantMax); } public static void PlayAudio(string tag, Vector3 position) { //IL_0027: 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) GameObject prefab = LFCPrefabRegistry.GetPrefab(tag); if ((Object)(object)prefab == (Object)null) { LegaFusionCore.mls.LogWarning((object)("[PlayAudio] No prefab found for the tag: " + tag)); return; } GameObject val = Object.Instantiate<GameObject>(prefab, position, Quaternion.identity); AudioSource component = val.GetComponent<AudioSource>(); if ((Object)(object)component == (Object)null || (Object)(object)component.clip == (Object)null) { LegaFusionCore.mls.LogWarning((object)("[PlayAudio] The prefab " + tag + " does not have an AudioSource or clip assigned to it.")); Object.Destroy((Object)(object)val); return; } if (!component.playOnAwake) { component.Play(); } Object.Destroy((Object)(object)val, component.clip.length); } } public static class LFCObjectsManager { public static void RegisterObject(Type type, Item item) { 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); } public static void SpawnNewObject(RoundManager roundManager, Item itemToSpawn) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) try { Random random = new Random(); List<RandomScrapSpawn> list = (from s in Object.FindObjectsOfType<RandomScrapSpawn>() where !s.spawnUsed select s).ToList(); if (list.Any()) { int index = random.Next(0, list.Count); RandomScrapSpawn val = list[index]; if (val.spawnedItemsCopyPosition) { val.spawnUsed = true; list.RemoveAt(index); } else { ((Component)val).transform.position = roundManager.GetRandomNavMeshPositionInBoxPredictable(((Component)val).transform.position, val.itemSpawnRange, roundManager.navHit, roundManager.AnomalyRandom, -1, 1f) + Vector3.up * itemToSpawn.verticalOffset; } Vector3 position = ((Component)val).transform.position + Vector3.up * 0.5f; SpawnObjectForServer(itemToSpawn.spawnPrefab, position); } } catch (Exception arg) { LegaFusionCore.mls.LogError((object)$"Error in SpawnNewItem: {arg}"); } } public static GrabbableObject SpawnObjectForServer(GameObject spawnPrefab, Vector3 position) { //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) return SpawnObjectForServer(spawnPrefab, position, Quaternion.identity); } public static GrabbableObject SpawnObjectForServer(GameObject spawnPrefab, Vector3 position, Quaternion rotation) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (!LFCUtilities.IsServer) { return null; } GameObject val = Object.Instantiate<GameObject>(spawnPrefab, position, rotation, StartOfRound.Instance.propsContainer); GrabbableObject component = val.GetComponent<GrabbableObject>(); component.fallTime = 0f; val.GetComponent<NetworkObject>().Spawn(false); return component; } public static IEnumerator ForceGrabObjectCoroutine(GrabbableObject grabbableObject, PlayerControllerB player) { if (player.FirstEmptyItemSlot() == -1) { player.DropAllHeldItemsAndSync(); } yield return (object)new WaitForSeconds(0.2f); float timePassed = 0f; while (player.isGrabbingObjectAnimation && timePassed < 2f) { yield return (object)new WaitForSeconds(0.1f); timePassed += 0.1f; } if (!player.isGrabbingObjectAnimation) { ForceGrabObject(grabbableObject, player); } } public static void ForceGrabObject(GrabbableObject grabbableObject, PlayerControllerB player) { //IL_0133: Unknown result type (might be due to invalid IL or missing references) player.currentlyGrabbingObject = grabbableObject; player.grabInvalidated = false; player.currentlyGrabbingObject.InteractItem(); if (player.currentlyGrabbingObject.grabbable && player.FirstEmptyItemSlot() != -1) { player.playerBodyAnimator.SetBool("GrabInvalidated", false); player.playerBodyAnimator.SetBool("GrabValidated", false); player.playerBodyAnimator.SetBool("cancelHolding", false); player.playerBodyAnimator.ResetTrigger("Throw"); player.SetSpecialGrabAnimationBool(true, (GrabbableObject)null); player.isGrabbingObjectAnimation = true; ((Behaviour)player.cursorIcon).enabled = false; ((TMP_Text)player.cursorTip).text = ""; player.twoHanded = player.currentlyGrabbingObject.itemProperties.twoHanded; player.carryWeight = Mathf.Clamp(player.carryWeight + (player.currentlyGrabbingObject.itemProperties.weight - 1f), 1f, 10f); player.grabObjectAnimationTime = ((player.currentlyGrabbingObject.itemProperties.grabAnimationTime > 0f) ? player.currentlyGrabbingObject.itemProperties.grabAnimationTime : 0.4f); if (!player.isTestingPlayer) { player.GrabObjectServerRpc(NetworkObjectReference.op_Implicit(((NetworkBehaviour)player.currentlyGrabbingObject).NetworkObject)); } if (player.grabObjectCoroutine != null) { ((MonoBehaviour)player).StopCoroutine(player.grabObjectCoroutine); } player.grabObjectCoroutine = ((MonoBehaviour)player).StartCoroutine(player.GrabObject()); } } public static void DestroyObjectsOfTypeAllForServer<T>() where T : GrabbableObject { LFCSpawnRegistry.GetAllAs<GrabbableObject>().ForEach(delegate(GrabbableObject g) { T val = (T)(object)((g is T) ? g : null); if (val != null) { DestroyObjectOfTypeForServer(val); } }); } public static void DestroyObjectOfTypeForServer<T>(T grabbableObject) where T : GrabbableObject { //IL_002b: Unknown result type (might be due to invalid IL or missing references) object obj = grabbableObject; NetworkObject val = ((obj != null) ? ((Component)obj).GetComponent<NetworkObject>() : null); if (!((Object)(object)val == (Object)null) && val.IsSpawned) { LFCNetworkManager.Instance.DestroyObjectEveryoneRpc(NetworkObjectReference.op_Implicit(val)); } } } public static class LFCPlayerManager { public static void HealPlayerOnLocalClient(PlayerControllerB player, int regenHP) { if (LFCUtilities.ShouldBeLocalPlayer(player) && player.isPlayerDead) { player.health = Mathf.Min(player.health + regenHP, 100); HUDManager.Instance.UpdateHealthUI(player.health, false); player.DamagePlayerClientRpc(-regenHP, player.health); if (player.criticallyInjured && player.health >= 10) { player.MakeCriticallyInjured(false); } } } } } namespace LegaFusionCore.Managers.NetworkManagers { public class LFCNetworkManager : NetworkBehaviour { public static LFCNetworkManager Instance; public void Awake() { Instance = this; } [Rpc(/*Could not decode attribute arguments.*/)] public void PlayParticleEveryoneRpc(string tag, Vector3 position, Quaternion rotation) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: 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_008d: 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_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: 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) 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(2672368661u, val2, val, (SendTo)6, (RpcDelivery)0); bool flag = tag != null; ((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val3)).WriteValueSafe(tag, false); } ((FastBufferWriter)(ref val3)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val3)).WriteValueSafe(ref rotation); ((NetworkBehaviour)this).__endSendRpc(ref val3, 2672368661u, val2, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; LFCGlobalManager.PlayParticle(tag, position, rotation); } } [Rpc(/*Could not decode attribute arguments.*/)] public void PlayAudioEveryoneRpc(string tag, Vector3 position) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_008d: 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_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: 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(810399084u, val2, val, (SendTo)6, (RpcDelivery)0); bool flag = tag != null; ((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref flag, default(ForPrimitives)); if (flag) { ((FastBufferWriter)(ref val3)).WriteValueSafe(tag, false); } ((FastBufferWriter)(ref val3)).WriteValueSafe(ref position); ((NetworkBehaviour)this).__endSendRpc(ref val3, 810399084u, val2, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; LFCGlobalManager.PlayAudio(tag, position); } } [Rpc(/*Could not decode attribute arguments.*/)] public void SetScrapValueEveryoneRpc(NetworkObjectReference obj, int value) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_0082: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) 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(3836679240u, val2, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val3, value); ((NetworkBehaviour)this).__endSendRpc(ref val3, 3836679240u, val2, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val4 = default(NetworkObject); if (((NetworkObjectReference)(ref obj)).TryGet(ref val4, (NetworkManager)null)) { GrabbableObject componentInChildren = ((Component)val4).gameObject.GetComponentInChildren<GrabbableObject>(); if (componentInChildren != null) { componentInChildren.SetScrapValue(value); } } } [Rpc(/*Could not decode attribute arguments.*/)] public void ForceGrabObjectEveryoneRpc(NetworkObjectReference obj, 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_0082: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) 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(822975632u, val2, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable)); BytePacker.WriteValueBitPacked(val3, playerId); ((NetworkBehaviour)this).__endSendRpc(ref val3, 822975632u, val2, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val4 = default(NetworkObject); if (((NetworkObjectReference)(ref obj)).TryGet(ref val4, (NetworkManager)null)) { PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>(); if (LFCUtilities.ShouldBeLocalPlayer(component)) { ((MonoBehaviour)this).StartCoroutine(LFCObjectsManager.ForceGrabObjectCoroutine(((Component)val4).gameObject.GetComponentInChildren<GrabbableObject>(), component)); } } } [Rpc(/*Could not decode attribute arguments.*/)] public void DestroyObjectEveryoneRpc(NetworkObjectReference obj) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: 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_0082: 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_009c: 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) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager; if (networkManager == null || !networkManager.IsListening) { return; } if ((int)base.__rpc_exec_stage != 1) { RpcAttributeParams val = new RpcAttributeParams { RequireOwnership = false }; RpcParams val2 = default(RpcParams); FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(2451031075u, val2, val, (SendTo)6, (RpcDelivery)0); ((FastBufferWriter)(ref val3)).WriteValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable)); ((NetworkBehaviour)this).__endSendRpc(ref val3, 2451031075u, val2, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; NetworkObject val4 = default(NetworkObject); if (!((NetworkObjectReference)(ref obj)).TryGet(ref val4, (NetworkManager)null)) { return; } GrabbableObject componentInChildren = ((Component)val4).gameObject.GetComponentInChildren<GrabbableObject>(); if ((Object)(object)componentInChildren == (Object)null) { return; } FlashlightItem val5 = (FlashlightItem)(object)((componentInChildren is FlashlightItem) ? componentInChildren : null); if (val5 != null && ((GrabbableObject)val5).isBeingUsed) { ((GrabbableObject)val5).isBeingUsed = false; val5.usingPlayerHelmetLight = false; ((Behaviour)val5.flashlightBulbGlow).enabled = false; val5.SwitchFlashlight(false); } else { BeltBagItem val6 = (BeltBagItem)(object)((componentInChildren is BeltBagItem) ? componentInChildren : null); if (val6 != null) { SkinnedMeshRenderer[] componentsInChildren = ((Component)val6).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>(); foreach (SkinnedMeshRenderer item in componentsInChildren.ToList()) { Object.Destroy((Object)(object)item); } } } componentInChildren.DestroyObjectInHand(componentInChildren.playerHeldBy); } [Rpc(/*Could not decode attribute arguments.*/)] public void TeleportPlayerEveryoneRpc(int playerId, Vector3 position, bool isInElevator, bool isInHangarShipRoom, bool isInsideFactory, bool withRotation = false, float rotation = 0f, bool withSpawnAnimation = false) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0160: 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_009c: 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_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: 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(1566431813u, val2, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val3, playerId); ((FastBufferWriter)(ref val3)).WriteValueSafe(ref position); ((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref isInElevator, default(ForPrimitives)); ((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref isInHangarShipRoom, default(ForPrimitives)); ((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref isInsideFactory, default(ForPrimitives)); ((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref withRotation, default(ForPrimitives)); ((FastBufferWriter)(ref val3)).WriteValueSafe<float>(ref rotation, default(ForPrimitives)); ((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref withSpawnAnimation, default(ForPrimitives)); ((NetworkBehaviour)this).__endSendRpc(ref val3, 1566431813u, val2, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage != 1) { return; } base.__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>(); component.averageVelocity = 0f; component.velocityLastFrame = Vector3.zero; component.isInElevator = isInElevator; component.isInHangarShipRoom = isInHangarShipRoom; component.isInsideFactory = isInsideFactory; component.TeleportPlayer(position, withRotation, rotation, false, true); if (withSpawnAnimation) { component.SpawnPlayerAnimation(); } for (int i = 0; i < component.ItemSlots.Length; i++) { if (!((Object)(object)component.ItemSlots[i] == (Object)null)) { component.ItemSlots[i].isInFactory = isInsideFactory; } } } [Rpc(/*Could not decode attribute arguments.*/)] public void DamagePlayerEveryoneRpc(int playerId, int damageNumber) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Invalid comparison between Unknown and I4 //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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(2923753351u, val2, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val3, playerId); BytePacker.WriteValueBitPacked(val3, damageNumber); ((NetworkBehaviour)this).__endSendRpc(ref val3, 2923753351u, val2, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>(); if (LFCUtilities.ShouldBeLocalPlayer(component)) { component.DamagePlayer(damageNumber, true, true, (CauseOfDeath)0, 0, false, default(Vector3)); } } } [Rpc(/*Could not decode attribute arguments.*/)] public void KillPlayerEveryoneRpc(int playerId, Vector3 velocity, bool spawnBody, int causeOfDeath) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: 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_009c: 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_00ab: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_0122: 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(744021449u, val2, val, (SendTo)6, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val3, playerId); ((FastBufferWriter)(ref val3)).WriteValueSafe(ref velocity); ((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref spawnBody, default(ForPrimitives)); BytePacker.WriteValueBitPacked(val3, causeOfDeath); ((NetworkBehaviour)this).__endSendRpc(ref val3, 744021449u, val2, val, (SendTo)6, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1) { base.__rpc_exec_stage = (__RpcExecStage)0; PlayerControllerB component = StartOfRound.Instance.allPlayerObjects[playerId].GetComponent<PlayerControllerB>(); if (LFCUtilities.ShouldBeLocalPlayer(component)) { component.KillPlayer(velocity, spawnBody, (CauseOfDeath)causeOfDeath, 0, default(Vector3)); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } protected override void __initializeRpcs() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Expected O, but got Unknown //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Expected O, but got Unknown //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Expected O, but got Unknown ((NetworkBehaviour)this).__registerRpc(2672368661u, new RpcReceiveHandler(__rpc_handler_2672368661), "PlayParticleEveryoneRpc"); ((NetworkBehaviour)this).__registerRpc(810399084u, new RpcReceiveHandler(__rpc_handler_810399084), "PlayAudioEveryoneRpc"); ((NetworkBehaviour)this).__registerRpc(3836679240u, new RpcReceiveHandler(__rpc_handler_3836679240), "SetScrapValueEveryoneRpc"); ((NetworkBehaviour)this).__registerRpc(822975632u, new RpcReceiveHandler(__rpc_handler_822975632), "ForceGrabObjectEveryoneRpc"); ((NetworkBehaviour)this).__registerRpc(2451031075u, new RpcReceiveHandler(__rpc_handler_2451031075), "DestroyObjectEveryoneRpc"); ((NetworkBehaviour)this).__registerRpc(1566431813u, new RpcReceiveHandler(__rpc_handler_1566431813), "TeleportPlayerEveryoneRpc"); ((NetworkBehaviour)this).__registerRpc(2923753351u, new RpcReceiveHandler(__rpc_handler_2923753351), "DamagePlayerEveryoneRpc"); ((NetworkBehaviour)this).__registerRpc(744021449u, new RpcReceiveHandler(__rpc_handler_744021449), "KillPlayerEveryoneRpc"); ((NetworkBehaviour)this).__initializeRpcs(); } private static void __rpc_handler_2672368661(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_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_008e: 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 tag = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref tag, false); } Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); Quaternion rotation = default(Quaternion); ((FastBufferReader)(ref reader)).ReadValueSafe(ref rotation); target.__rpc_exec_stage = (__RpcExecStage)1; ((LFCNetworkManager)(object)target).PlayParticleEveryoneRpc(tag, position, rotation); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_810399084(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_006e: 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_008c: 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 tag = null; if (flag) { ((FastBufferReader)(ref reader)).ReadValueSafe(ref tag, false); } Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); target.__rpc_exec_stage = (__RpcExecStage)1; ((LFCNetworkManager)(object)target).PlayAudioEveryoneRpc(tag, position); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_3836679240(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 value = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref value); target.__rpc_exec_stage = (__RpcExecStage)1; ((LFCNetworkManager)(object)target).SetScrapValueEveryoneRpc(obj, value); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_822975632(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 playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); target.__rpc_exec_stage = (__RpcExecStage)1; ((LFCNetworkManager)(object)target).ForceGrabObjectEveryoneRpc(obj, playerId); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2451031075(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_004f: 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) { NetworkObjectReference obj = default(NetworkObjectReference); ((FastBufferReader)(ref reader)).ReadValueSafe<NetworkObjectReference>(ref obj, default(ForNetworkSerializable)); target.__rpc_exec_stage = (__RpcExecStage)1; ((LFCNetworkManager)(object)target).DestroyObjectEveryoneRpc(obj); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1566431813(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_009a: 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) //IL_00b5: 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_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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); Vector3 position = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref position); bool isInElevator = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isInElevator, default(ForPrimitives)); bool isInHangarShipRoom = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isInHangarShipRoom, default(ForPrimitives)); bool isInsideFactory = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref isInsideFactory, default(ForPrimitives)); bool withRotation = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref withRotation, default(ForPrimitives)); float rotation = default(float); ((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref rotation, default(ForPrimitives)); bool withSpawnAnimation = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref withSpawnAnimation, default(ForPrimitives)); target.__rpc_exec_stage = (__RpcExecStage)1; ((LFCNetworkManager)(object)target).TeleportPlayerEveryoneRpc(playerId, position, isInElevator, isInHangarShipRoom, isInsideFactory, withRotation, rotation, withSpawnAnimation); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2923753351(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_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) NetworkManager networkManager = target.NetworkManager; if (networkManager != null && networkManager.IsListening) { int playerId = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref playerId); int damageNumber = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref damageNumber); target.__rpc_exec_stage = (__RpcExecStage)1; ((LFCNetworkManager)(object)target).DamagePlayerEveryoneRpc(playerId, damageNumber); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_744021449(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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); Vector3 velocity = default(Vector3); ((FastBufferReader)(ref reader)).ReadValueSafe(ref velocity); bool spawnBody = default(bool); ((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref spawnBody, default(ForPrimitives)); int causeOfDeath = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref causeOfDeath); target.__rpc_exec_stage = (__RpcExecStage)1; ((LFCNetworkManager)(object)target).KillPlayerEveryoneRpc(playerId, velocity, spawnBody, causeOfDeath); target.__rpc_exec_stage = (__RpcExecStage)0; } } [MethodImpl(MethodImplOptions.NoInlining)] protected internal override string __getTypeName() { return "LFCNetworkManager"; } } } namespace LegaFusionCore.CustomInputs { public class AddonInput : LcInputActions { private static AddonInput instance; public static AddonInput Instance { get { if (instance == null) { instance = new AddonInput(); } return instance; } private set { instance = value; } } [InputAction(/*Could not decode attribute arguments.*/)] public InputAction AddonKey { get; set; } public void EnableInput() { AddonKey.performed += ActivateAddonAbility; } public void DisableInput() { AddonKey.performed -= ActivateAddonAbility; } public void ActivateAddonAbility(CallbackContext context) { if (!((CallbackContext)(ref context)).performed) { return; } GameNetworkManager obj = GameNetworkManager.Instance; object obj2; if (obj == null) { obj2 = null; } else { PlayerControllerB localPlayerController = obj.localPlayerController; if (localPlayerController == null) { obj2 = null; } else { GrabbableObject currentlyHeldObjectServer = localPlayerController.currentlyHeldObjectServer; obj2 = ((currentlyHeldObjectServer != null) ? ((Component)currentlyHeldObjectServer).GetComponent<AddonComponent>() : null); } } AddonComponent addonComponent = (AddonComponent)obj2; if (!((Object)(object)addonComponent == (Object)null) && !addonComponent.isPassive) { addonComponent.ActivateAddonAbility(); } } public string GetAddonToolTip() { return $"Addon Ability : [{InputActionRebindingExtensions.GetBindingDisplayString(AddonKey, (DisplayStringOptions)0, (string)null).First()}]"; } } } namespace LegaFusionCore.Behaviours { public class EnemySpeedBehaviour : MonoBehaviour { private struct EnemySpeedData { public float speedFactor; public float originalSpeed; public EnemySpeedData(float speedFactor, float originalSpeed) { this.speedFactor = speedFactor; this.originalSpeed = originalSpeed; } } public EnemyAI enemy; private readonly Dictionary<string, EnemySpeedData> enemySpeedFactor = new Dictionary<string, EnemySpeedData>(); private float FinalSpeed { get { float num = 1f + enemySpeedFactor.Values.Select((EnemySpeedData e) => e.speedFactor).Sum(); float num2 = enemySpeedFactor.Values.Select((EnemySpeedData e) => e.originalSpeed).Max(); return Mathf.Max(0.5f, num2 * num); } } public void AddSpeedData(string id, float speedFactor, float originalSpeed) { if (!enemySpeedFactor.TryGetValue(id, out var _)) { enemySpeedFactor[id] = new EnemySpeedData(speedFactor, originalSpeed); } } public void RemoveSpeedData(string id) { enemySpeedFactor.Remove(id); } private void ApplySpeedData() { if (!((Object)(object)enemy == (Object)null) && !((Object)(object)enemy.agent == (Object)null) && enemySpeedFactor.Count != 0) { enemy.agent.speed = FinalSpeed; EnemyAI obj = enemy; SandSpiderAI val = (SandSpiderAI)(object)((obj is SandSpiderAI) ? obj : null); if (val != null) { val.spiderSpeed = enemy.agent.speed; } } } private void Update() { ApplySpeedData(); } private void LateUpdate() { ApplySpeedData(); } } } namespace LegaFusionCore.Behaviours.Shaders { public class CustomPassManager : MonoBehaviour { public static ShaderCustomPass shaderCustomPass; public static CustomPassVolume customPassVolume; public static CustomPassVolume CustomPassVolume { get { //IL_004a: 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>(); customPassVolume.targetCamera = GameNetworkManager.Instance.localPlayerController.gameplayCamera; customPassVolume.injectionPoint = (CustomPassInjectionPoint)1; customPassVolume.isGlobal = true; shaderCustomPass = new ShaderCustomPass(); customPassVolume.customPasses.Add((CustomPass)(object)shaderCustomPass); } return customPassVolume; } } public static void SetupAuraForObjects(GameObject[] objects, Material material, string tag, Color color = default(Color)) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) Renderer[] filteredRenderersFromObjects = GetFilteredRenderersFromObjects(objects); if (filteredRenderersFromObjects.Length != 0) { SetupCustomPass(filteredRenderersFromObjects, material, tag, color); } } public static void SetupCustomPass(Renderer[] renderers, Material material, string tag, Color color) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)CustomPassVolume == (Object)null) { LegaFusionCore.mls.LogError((object)"CustomPassVolume is not assigned."); return; } if (shaderCustomPass == null) { shaderCustomPass = CustomPassVolume.customPasses.Find((CustomPass pass) => pass is ShaderCustomPass) as ShaderCustomPass; } if (shaderCustomPass == null) { LegaFusionCore.mls.LogError((object)"ShaderCustomPass could not be found in CustomPassVolume."); } else { shaderCustomPass.AddRenderers(renderers, material, tag, color); } } public static void RemoveAuraFromObjects(GameObject[] objects, string tag = "default") { Renderer[] filteredRenderersFromObjects = GetFilteredRenderersFromObjects(objects); if (filteredRenderersFromObjects.Length != 0) { shaderCustomPass?.RemoveRenderers(filteredRenderersFromObjects, tag); } } public static void RemoveAuraByTag(string tag) { shaderCustomPass?.RemoveRenderersByTag(tag); } public static void ClearAllAuras() { shaderCustomPass?.ClearAll(); } private static Renderer[] GetFilteredRenderersFromObjects(GameObject[] objects) { List<Renderer> list = new List<Renderer>(); EnemyAI val2 = default(EnemyAI); PlayerControllerB val3 = default(PlayerControllerB); foreach (GameObject val in objects) { if ((Object)(object)val == (Object)null) { continue; } List<Renderer> list2 = val.GetComponentsInChildren<Renderer>().ToList(); if (list2.Count == 0) { continue; } if (val.TryGetComponent<EnemyAI>(ref val2) || val.TryGetComponent<PlayerControllerB>(ref val3)) { list2 = list2.Where((Renderer r) => r is SkinnedMeshRenderer).ToList(); } if (list2.Count == 0) { LegaFusionCore.mls.LogError((object)("No renderer could be found on " + ((Object)val).name + ".")); } else { list.AddRange(list2); } } return list.ToArray(); } } public class ShaderCustomPass : CustomPass { private readonly Dictionary<string, Dictionary<Renderer, (Material, Color)>> targetRenderers = new Dictionary<string, Dictionary<Renderer, (Material, Color)>>(); public void AddRenderers(Renderer[] renderers, Material material, string tag, Color color) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) if (string.IsNullOrEmpty(tag)) { tag = "default"; } if (!targetRenderers.ContainsKey(tag)) { targetRenderers[tag] = new Dictionary<Renderer, (Material, Color)>(); } foreach (Renderer val in renderers) { if (!((Object)(object)val == (Object)null) && !targetRenderers[tag].ContainsKey(val)) { targetRenderers[tag].Add(val, (material, color)); } } } public void RemoveRenderers(Renderer[] renderers, string tag) { if (string.IsNullOrEmpty(tag) || !targetRenderers.ContainsKey(tag)) { return; } foreach (Renderer val in renderers) { if ((Object)(object)val != (Object)null && targetRenderers[tag].ContainsKey(val)) { val.SetPropertyBlock((MaterialPropertyBlock)null); targetRenderers[tag].Remove(val); } } if (targetRenderers[tag].Count == 0) { targetRenderers.Remove(tag); } } public void RemoveRenderersByTag(string tag) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown if (string.IsNullOrEmpty(tag) || !targetRenderers.ContainsKey(tag)) { return; } foreach (KeyValuePair<Renderer, (Material, Color)> item in targetRenderers[tag].ToList()) { if (!((Object)(object)item.Key == (Object)null)) { item.Key.SetPropertyBlock(new MaterialPropertyBlock()); } } targetRenderers.Remove(tag); } public void ClearAll() { targetRenderers.Clear(); } public override void Execute(CustomPassContext ctx) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_0089: Expected O, but got Unknown //IL_0090: 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_009e: 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) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) if (targetRenderers.Count == 0) { return; } foreach (KeyValuePair<string, Dictionary<Renderer, (Material, Color)>> targetRenderer in targetRenderers) { foreach (KeyValuePair<Renderer, (Material, Color)> item in targetRenderer.Value) { Renderer key = item.Key; var (val, val2) = item.Value; if (!((Object)(object)key == (Object)null) && !((Object)(object)val == (Object)null)) { if (val.HasProperty("_BaseColor")) { MaterialPropertyBlock val3 = new MaterialPropertyBlock(); val3.SetColor("_BaseColor", new Color(val2.r, val2.g, val2.b, val.GetColor("_BaseColor").a)); key.SetPropertyBlock(val3); } ctx.cmd.DrawRenderer(key, val, 0, 0); } } } } } } namespace LegaFusionCore.Behaviours.Addons { public abstract class AddonComponent : MonoBehaviour { public GrabbableObject grabbableObject; public string addonName; public bool isPassive; public bool onCooldown; private Coroutine cooldownCoroutine; public virtual void ActivateAddonAbility() { } public void StartCooldown(int cooldown) { if (!onCooldown) { onCooldown = true; cooldownCoroutine = ((MonoBehaviour)this).StartCoroutine(StartCooldownCoroutine(cooldown)); } } public void StopCooldown() { if (onCooldown && cooldownCoroutine != null) { ((MonoBehaviour)this).StopCoroutine(cooldownCoroutine); cooldownCoroutine = null; onCooldown = false; SetCooldownTipsForItem(0); } } private IEnumerator StartCooldownCoroutine(int cooldown) { while (cooldown > 0) { yield return (object)new WaitForSecondsRealtime(1f); if (!((Object)(object)grabbableObject == (Object)null) && grabbableObject.isHeld) { cooldown--; SetCooldownTipsForItem(cooldown);