Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of RepoMutantEnemies v1.1.0
Matsu.MergedEnemyMod.dll
Decompiled 2 weeks 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.Globalization; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using Photon.Pun; using REPOLib.Modules; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.InputSystem; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("Matsu.MergedEnemyMod")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.0.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: AssemblyProduct("Matsu.MergedEnemyMod")] [assembly: AssemblyTitle("Matsu.MergedEnemyMod")] [assembly: AssemblyVersion("1.1.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Matsu.MergedEnemyMod { internal static class FusionShared { private static ParticleScriptExplosion? _sharedExplosion; private static GameObject? _explosionPrefab; private static readonly List<PlayerAvatar> _noPlayers = new List<PlayerAvatar>(); private static FieldInfo? _healthCurrentField; private static FieldInfo? _impactDetectorField; private static MethodInfo? _hurtMultiplierMethod; private static FieldInfo? _explSizeField; private static FieldInfo? _explDmgField; private static FieldInfo? _explDmgEnemyField; private const string AuraLightName = "MatsuMutationAura"; private static PropertyInfo? _navAgentProp; private static FieldInfo? _navAgentField; private static MethodInfo? _navDisableMethod; private static FieldInfo? _wrapAgentField; private static FieldInfo? _damageResistanceField; private static FieldInfo? _damageResistanceTimerField; private static FieldInfo? _tumbleField; private static FieldInfo? _tumblePhysGrabObjectField; private static FieldInfo? _clientPositionField; private static FieldInfo? _clientPositionCurrentField; private static FieldInfo? _visualPositionField; private static FieldInfo? _isDisabledField; public static List<PlayerAvatar> AllPlayers() { GameDirector instance = GameDirector.instance; if (!((Object)(object)instance != (Object)null) || instance.PlayerList == null) { return _noPlayers; } return instance.PlayerList; } public static bool NearestPlayerWithin(Vector3 from, float range) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) foreach (PlayerAvatar item in AllPlayers()) { if (!((Object)(object)item == (Object)null) && Vector3.Distance(from, ((Component)item).transform.position) <= range) { return true; } } return false; } public static List<PlayerAvatar> PlayersInRadius(Vector3 center, float radius) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) List<PlayerAvatar> list = new List<PlayerAvatar>(); foreach (PlayerAvatar item in AllPlayers()) { if (!((Object)(object)item == (Object)null) && Vector3.Distance(center, ((Component)item).transform.position) <= radius) { list.Add(item); } } return list; } public static PlayerAvatar? NearestPlayer(Vector3 from, float maxDistance) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar result = null; float num = maxDistance; foreach (PlayerAvatar item in AllPlayers()) { if (!((Object)(object)item == (Object)null)) { float num2 = Vector3.Distance(from, ((Component)item).transform.position); if (num2 <= num) { num = num2; result = item; } } } return result; } public static List<PhysGrabObject> PhysObjectsInRadius(Vector3 center, float radius) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) HashSet<PhysGrabObject> hashSet = new HashSet<PhysGrabObject>(); Collider[] array = Physics.OverlapSphere(center, radius); foreach (Collider val in array) { if (!((Object)(object)val == (Object)null)) { PhysGrabObject componentInParent = ((Component)val).GetComponentInParent<PhysGrabObject>(); if ((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent.rb != (Object)null && !componentInParent.grabbed && (Object)(object)((Component)componentInParent).GetComponentInParent<EnemyParent>() == (Object)null) { hashSet.Add(componentInParent); } } } return new List<PhysGrabObject>(hashSet); } private static void SetExplField(ParticlePrefabExplosion pe, ref FieldInfo? cache, string name, object val) { try { if ((object)cache == null) { cache = typeof(ParticlePrefabExplosion).GetField(name, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } cache?.SetValue(pe, val); } catch { } } public static ParticlePrefabExplosion? ExplodeAuthoritative(Vector3 pos, float size, int playerDmg, int enemyDmg, PhysGrabObject? ignoreSelf = null, Enemy? enemyHost = null, float force = 1f) { //IL_002c: 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_0084: Unknown result type (might be due to invalid IL or missing references) ParticlePrefabExplosion val = null; if ((Object)(object)_sharedExplosion == (Object)null) { _sharedExplosion = Object.FindObjectOfType<ParticleScriptExplosion>(true); } if ((Object)(object)_sharedExplosion != (Object)null) { try { val = _sharedExplosion.Spawn(pos, size, playerDmg, enemyDmg, force, false, false, 1f); } catch { val = null; } } if ((Object)(object)val == (Object)null) { if ((Object)(object)_explosionPrefab == (Object)null) { _explosionPrefab = Resources.Load<GameObject>("Effects/Part Prefab Explosion"); } if ((Object)(object)_explosionPrefab != (Object)null) { val = Object.Instantiate<GameObject>(_explosionPrefab, pos, Quaternion.identity).GetComponent<ParticlePrefabExplosion>(); if ((Object)(object)val != (Object)null) { SetExplField(val, ref _explSizeField, "explosionSize", size); SetExplField(val, ref _explDmgField, "explosionDamage", playerDmg); SetExplField(val, ref _explDmgEnemyField, "explosionDamageEnemy", enemyDmg); try { ParticleSystem particleFire = val.particleFire; if (particleFire != null) { particleFire.Play(); } ParticleSystem particleSmoke = val.particleSmoke; if (particleSmoke != null) { particleSmoke.Play(); } if ((Object)(object)val.light != (Object)null) { ((Behaviour)val.light).enabled = true; } } catch { } } } } if ((Object)(object)val != (Object)null && (Object)(object)val.HurtCollider != (Object)null) { try { if ((Object)(object)ignoreSelf != (Object)null && val.HurtCollider.ignoreObjects != null) { val.HurtCollider.ignoreObjects.Add(ignoreSelf); } if ((Object)(object)enemyHost != (Object)null) { val.HurtCollider.enemyHost = enemyHost; } } catch { } } return val; } public static void ApplyMutationGlow(Transform root, Color color) { //IL_00bb: 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_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: 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_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)root == (Object)null) { return; } try { Transform val = root.Find("MatsuMutationAura"); Light val2; if ((Object)(object)val != (Object)null) { val2 = ((Component)val).GetComponent<Light>(); } else { GameObject val3 = new GameObject("MatsuMutationAura"); val3.transform.SetParent(root, false); val3.transform.localPosition = Vector3.zero; val2 = val3.AddComponent<Light>(); val2.type = (LightType)2; val2.shadows = (LightShadows)0; } if ((Object)(object)val2 != (Object)null) { val2.color = color; val2.range = Plugin.MutationAuraRange.Value; val2.intensity = Plugin.MutationAuraIntensity.Value; val2.renderMode = (LightRenderMode)1; } } catch { } float num = Mathf.Max(1f, Plugin.MutationAuraIntensity.Value * 0.6f); Color val4 = color * num; Renderer[] componentsInChildren = ((Component)root).GetComponentsInChildren<Renderer>(true); foreach (Renderer val5 in componentsInChildren) { if ((Object)(object)val5 == (Object)null || ((Object)((Component)val5).gameObject).name == "MatsuMutationAura") { continue; } Material[] materials = val5.materials; foreach (Material val6 in materials) { if ((Object)(object)val6 == (Object)null) { continue; } try { if (val6.HasProperty("_EmissionColor")) { val6.EnableKeyword("_EMISSION"); val6.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1; val6.SetColor("_EmissionColor", val4); } val6.SetFloat("_FresnelAmount", 1f); val6.SetFloat("_FresnelScale", 1f); val6.SetFloat("_FresnelPower", 5f); val6.SetFloat("_FresnelBias", 0f); val6.SetColor("_FresnelColor", color); val6.SetFloat("_FresnelEmission", 1f); } catch { } } } } public static void SetHealthCurrent(EnemyHealth health, int value) { try { if (_healthCurrentField == null) { _healthCurrentField = typeof(EnemyHealth).GetField("healthCurrent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } _healthCurrentField?.SetValue(health, value); } catch { } } public static void ProtectValuable(PhysGrabObject pgo, float seconds) { try { if (pgo != null) { pgo.OverrideIndestructible(Mathf.Max(0.1f, seconds)); } } catch { } } public static void ExplodePlayerOnly(Vector3 pos, float size, int playerDamage, float force, Enemy? source = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ParticlePrefabExplosion val = ExplodeAuthoritative(pos, size, playerDamage, 0, null, source, force); try { if ((Object)(object)val == (Object)null || (Object)(object)val.HurtCollider == (Object)null || val.HurtCollider.ignoreObjects == null) { return; } EnemyDirector instance = EnemyDirector.instance; if ((Object)(object)instance == (Object)null || instance.enemiesSpawned == null) { return; } foreach (EnemyParent item2 in instance.enemiesSpawned) { if (!((Object)(object)item2 == (Object)null)) { PhysGrabObject[] componentsInChildren = ((Component)item2).GetComponentsInChildren<PhysGrabObject>(true); foreach (PhysGrabObject item in componentsInChildren) { val.HurtCollider.ignoreObjects.Add(item); } } } } catch { } } public static void ExplodeGrenadePlayerOnly(Vector3 pos) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) ExplodePlayerOnly(pos, 0.8f, 50, 2f); } public static void FreezeAgent(Enemy enemy) { try { if ((Object)(object)enemy == (Object)null) { return; } object obj = null; if ((object)_navAgentProp == null) { _navAgentProp = typeof(Enemy).GetProperty("NavMeshAgent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_navAgentProp != null) { obj = _navAgentProp.GetValue(enemy); } if (obj == null) { if ((object)_navAgentField == null) { _navAgentField = typeof(Enemy).GetField("NavMeshAgent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } obj = _navAgentField?.GetValue(enemy); } if (obj != null) { if ((object)_navDisableMethod == null) { _navDisableMethod = obj.GetType().GetMethod("Disable", new Type[1] { typeof(float) }); } _navDisableMethod?.Invoke(obj, new object[1] { 0.3f }); } } catch { } } public static NavMeshAgent? GetUnityAgent(Enemy? enemy) { try { if ((Object)(object)enemy == (Object)null) { return null; } object obj = null; if ((object)_navAgentProp == null) { _navAgentProp = typeof(Enemy).GetProperty("NavMeshAgent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if (_navAgentProp != null) { obj = _navAgentProp.GetValue(enemy); } if (obj == null) { if ((object)_navAgentField == null) { _navAgentField = typeof(Enemy).GetField("NavMeshAgent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } obj = _navAgentField?.GetValue(enemy); } if (obj == null) { return null; } NavMeshAgent val = (NavMeshAgent)((obj is NavMeshAgent) ? obj : null); if (val != null) { return val; } if (_wrapAgentField == null) { FieldInfo[] fields = obj.GetType().GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { if (typeof(NavMeshAgent).IsAssignableFrom(fieldInfo.FieldType)) { _wrapAgentField = fieldInfo; break; } } } object? obj2 = _wrapAgentField?.GetValue(obj); return (NavMeshAgent?)((obj2 is NavMeshAgent) ? obj2 : null); } catch { return null; } } public static int GetHealthCurrent(EnemyHealth health) { try { if (_healthCurrentField == null) { _healthCurrentField = typeof(EnemyHealth).GetField("healthCurrent", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } return (_healthCurrentField != null) ? ((int)(_healthCurrentField.GetValue(health) ?? ((object)0))) : 0; } catch { return 0; } } public static void ApplyDamageResistanceAtLeast(EnemyHealth health, float resistance, float seconds) { try { if (!((Object)(object)health == (Object)null)) { if ((object)_damageResistanceField == null) { _damageResistanceField = typeof(EnemyHealth).GetField("damageResistance", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } if ((object)_damageResistanceTimerField == null) { _damageResistanceTimerField = typeof(EnemyHealth).GetField("overrideDamageResistanceTimer", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } float num = (float)(_damageResistanceField?.GetValue(health) ?? ((object)0f)); float num2 = (float)(_damageResistanceTimerField?.GetValue(health) ?? ((object)0f)); health.OverrideDamageResistance(Mathf.Max(num, Mathf.Clamp(resistance, 0f, 0.9f)), Mathf.Max(num2, Mathf.Max(0.1f, seconds))); } } catch { } } public static void BoostThrownImpact(PhysGrabObject obj, float multiplier, float time) { try { if (_impactDetectorField == null) { _impactDetectorField = typeof(PhysGrabObject).GetField("impactDetector", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } object obj2 = _impactDetectorField?.GetValue(obj); if (obj2 != null) { if (_hurtMultiplierMethod == null) { _hurtMultiplierMethod = obj2.GetType().GetMethod("PlayerHurtMultiplier", BindingFlags.Instance | BindingFlags.Public); } _hurtMultiplierMethod?.Invoke(obj2, new object[2] { multiplier, time }); } } catch { } } public static bool TryGetSafeRandomPoint(Vector3 from, out Vector3 point) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_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_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0099: 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_00a8: 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_00b2: Unknown result type (might be due to invalid IL or missing references) int mask = LayerMask.GetMask(new string[1] { "Default" }); NavMeshHit val2 = default(NavMeshHit); RaycastHit val3 = default(RaycastHit); for (int i = 0; i < 16; i++) { LevelPoint val = SemiFunc.LevelPointGet(from, 0f, 9999f); if (!((Object)(object)val == (Object)null) && NavMesh.SamplePosition(((Component)val).transform.position + Random.insideUnitSphere * 3f, ref val2, 5f, -1) && Physics.Raycast(((NavMeshHit)(ref val2)).position + Vector3.up * 0.5f, Vector3.down, ref val3, 3f, mask, (QueryTriggerInteraction)1)) { point = ((RaycastHit)(ref val3)).point + Vector3.up * 0.6f; return true; } } point = from; return false; } public static PhysGrabObject? GetPlayerPhysGrabObject(PlayerAvatar player) { try { if ((object)_tumbleField == null) { _tumbleField = typeof(PlayerAvatar).GetField("tumble", BindingFlags.Instance | BindingFlags.NonPublic); } object obj = _tumbleField?.GetValue(player); if (obj == null) { return null; } if ((object)_tumblePhysGrabObjectField == null) { _tumblePhysGrabObjectField = obj.GetType().GetField("physGrabObject", BindingFlags.Instance | BindingFlags.NonPublic); } object? obj2 = _tumblePhysGrabObjectField?.GetValue(obj); return (PhysGrabObject?)((obj2 is PhysGrabObject) ? obj2 : null); } catch { return null; } } public static void SetPlayerClientPosition(PlayerAvatar player, Vector3 pos) { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) try { if ((object)_clientPositionField == null) { _clientPositionField = typeof(PlayerAvatar).GetField("clientPosition", BindingFlags.Instance | BindingFlags.NonPublic); } if ((object)_clientPositionCurrentField == null) { _clientPositionCurrentField = typeof(PlayerAvatar).GetField("clientPositionCurrent", BindingFlags.Instance | BindingFlags.NonPublic); } _clientPositionField?.SetValue(player, pos); _clientPositionCurrentField?.SetValue(player, pos); } catch { } } public static void SetPlayerVisualPosition(PlayerAvatarVisuals visuals, Vector3 pos) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) try { if ((object)_visualPositionField == null) { _visualPositionField = typeof(PlayerAvatarVisuals).GetField("visualPosition", BindingFlags.Instance | BindingFlags.NonPublic); } _visualPositionField?.SetValue(visuals, pos); } catch { } } public static bool IsPlayerDisabled(PlayerAvatar player) { try { if ((object)_isDisabledField == null) { _isDisabledField = typeof(PlayerAvatar).GetField("isDisabled", BindingFlags.Instance | BindingFlags.NonPublic); } return _isDisabledField != null && (bool)(_isDisabledField.GetValue(player) ?? ((object)false)); } catch { return false; } } public static bool IsLocalPlayer(PlayerAvatar player) { if ((Object)(object)player != (Object)null) { if (SemiFunc.IsMultiplayer()) { if ((Object)(object)player.photonView != (Object)null) { return player.photonView.IsMine; } return false; } return true; } return false; } public static void HurtOwnedPlayer(PlayerAvatar player, int damage, Vector3 source, Enemy? enemy = null) { if ((Object)(object)player == (Object)null || damage <= 0 || !IsLocalPlayer(player) || IsPlayerDisabled(player)) { return; } int num = -1; try { EnemyParent val = (((Object)(object)enemy != (Object)null) ? ((Component)enemy).GetComponentInParent<EnemyParent>() : null); if ((Object)(object)val != (Object)null && (Object)(object)EnemyDirector.instance != (Object)null) { num = EnemyDirector.instance.enemiesSpawned.IndexOf(val); } } catch { } try { PlayerHealth playerHealth = player.playerHealth; if (playerHealth != null) { playerHealth.Hurt(damage, false, num, false); } } catch { } } public static float DistanceToSegment(Vector3 point, Vector3 start, Vector3 end) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) Vector3 val = end - start; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude < 0.0001f) { return Vector3.Distance(point, start); } float num = Mathf.Clamp01(Vector3.Dot(point - start, val) / sqrMagnitude); return Vector3.Distance(point, start + val * num); } public static void SpawnWarningRing(Vector3 position, Color color, float startRadius, float endRadius, float seconds) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) try { GameObject val = new GameObject("MatsuMutationWarningRing"); val.transform.position = position + Vector3.up * 0.06f; LineRenderer val2 = val.AddComponent<LineRenderer>(); val2.useWorldSpace = false; val2.loop = true; val2.positionCount = 49; val2.widthMultiplier = 0.065f; ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; for (int i = 0; i < val2.positionCount; i++) { float num = (float)i / 48f * (float)Math.PI * 2f; val2.SetPosition(i, new Vector3(Mathf.Cos(num), 0f, Mathf.Sin(num))); } Shader val3 = Shader.Find("Sprites/Default") ?? Shader.Find("Legacy Shaders/Particles/Alpha Blended") ?? Shader.Find("Unlit/Color"); Material val4 = ((!((Object)(object)val3 != (Object)null)) ? ((Material)null) : new Material(val3)); if ((Object)(object)val4 != (Object)null) { ((Renderer)val2).material = val4; } val.AddComponent<MutationWarningRing>().Initialize(val2, val4, color, Mathf.Max(0.05f, startRadius), Mathf.Max(0.05f, endRadius), Mathf.Max(0.05f, seconds)); } catch { } } public static Vector3 ProjectToGround(Vector3 position) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) try { int mask = LayerMask.GetMask(new string[1] { "Default" }); RaycastHit val = default(RaycastHit); if (Physics.Raycast(position + Vector3.up * 4f, Vector3.down, ref val, 10f, mask, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val)).point + Vector3.up * 0.08f; } } catch { } return position; } } public class MutationWarningRing : MonoBehaviour { private LineRenderer? _line; private Material? _material; private Color _color; private float _startRadius; private float _endRadius; private float _duration; private float _elapsed; public void Initialize(LineRenderer line, Material? material, Color color, float startRadius, float endRadius, float duration) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) _line = line; _material = material; _color = color; _startRadius = startRadius; _endRadius = endRadius; _duration = duration; Apply(0f); } private void Update() { _elapsed += Time.deltaTime; float num = Mathf.Clamp01(_elapsed / _duration); Apply(num); if (num >= 1f) { Object.Destroy((Object)(object)((Component)this).gameObject); } } private void Apply(float t) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)_line == (Object)null)) { float num = Mathf.Lerp(_startRadius, _endRadius, t); ((Component)this).transform.localScale = new Vector3(num, 1f, num); Color val = default(Color); ((Color)(ref val))..ctor(_color.r, _color.g, _color.b, Mathf.Lerp(0.95f, 0.05f, t)); _line.startColor = val; _line.endColor = val; } } private void OnDestroy() { if ((Object)(object)_material != (Object)null) { Object.Destroy((Object)(object)_material); } } } public class BoomdayBoyFusion : MonoBehaviour { internal static readonly Color AuraColor = new Color(1f, 0.4f, 0f); private EnemyBirthdayBoy _birthday; private EnemyHealth? _health; private EnemyParent? _self; private Enemy? _enemy; private PhysGrabObject? _selfPhys; private PhotonView? _pv; private bool _fuseLit; private bool _deathDetonated; private bool _hpDone; private float _fuseTimer; private float _explodeCooldown; private float _balloonTimer; private float _proximityTimer; private float _glowTimer; private readonly List<Vector3> _orderedKeys = new List<Vector3>(); private readonly HashSet<Vector3> _seen = new HashSet<Vector3>(); private void Awake() { //IL_00b4: Unknown result type (might be due to invalid IL or missing references) _birthday = ((Component)this).GetComponent<EnemyBirthdayBoy>(); _self = ((Component)this).GetComponentInParent<EnemyParent>(); _health = ((Component)this).GetComponentInParent<EnemyHealth>() ?? ((Component)this).GetComponentInChildren<EnemyHealth>(); _enemy = ((Component)this).GetComponent<Enemy>() ?? ((Component)this).GetComponentInParent<Enemy>(); _selfPhys = ((Component)this).GetComponentInParent<PhysGrabObject>() ?? ((Component)this).GetComponentInChildren<PhysGrabObject>(true); _pv = ((Component)this).GetComponentInParent<PhotonView>() ?? ((Component)this).GetComponentInChildren<PhotonView>(); if (SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)_health != (Object)null) { _health.health = Mathf.Max(1, Mathf.RoundToInt((float)_health.health * Plugin.CurrentHealthMultiplier())); } FusionShared.ApplyMutationGlow(((Component)this).transform, AuraColor); } private void Update() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) _glowTimer -= Time.deltaTime; if (_glowTimer <= 0f) { _glowTimer = 2f; FusionShared.ApplyMutationGlow(((Component)this).transform, AuraColor); } _balloonTimer -= Time.deltaTime; if (_balloonTimer <= 0f) { _balloonTimer = 0.2f; SyncAndTintBalloons(); } if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } EnsureHpDoubled(); if (_deathDetonated || (Object)(object)_birthday == (Object)null) { return; } HostBalloonContacts(); if (_explodeCooldown > 0f) { _explodeCooldown -= Time.deltaTime; } _proximityTimer -= Time.deltaTime; if (!_fuseLit && _explodeCooldown <= 0f && _proximityTimer <= 0f) { _proximityTimer = 0.25f; if (FusionShared.NearestPlayerWithin(((Component)this).transform.position, Plugin.BoomdayFuseRange.Value)) { _fuseLit = true; _fuseTimer = Plugin.BoomdayFuseTime.Value; } } if (_fuseLit) { _fuseTimer -= Time.deltaTime; if (_fuseTimer <= 0f) { ProximityExplode(); } } } private void EnsureHpDoubled() { if (!_hpDone && !((Object)(object)_health == (Object)null)) { _hpDone = true; FusionShared.SetHealthCurrent(_health, _health.health); } } private void SyncAndTintBalloons() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_birthday == (Object)null || _birthday.balloons == null) { return; } foreach (KeyValuePair<Vector3, GameObject> balloon in _birthday.balloons) { if (!((Object)(object)balloon.Value == (Object)null) && _seen.Add(balloon.Key)) { _orderedKeys.Add(balloon.Key); TintBalloon(balloon.Value); } } } private void HostBalloonContacts() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0089: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_0111: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_birthday == (Object)null || _birthday.balloons == null || _orderedKeys.Count == 0) { return; } float value = Plugin.BoomdayBalloonTouchRadius.Value; List<Vector3> list = null; foreach (Vector3 orderedKey in _orderedKeys) { if (!_birthday.balloons.TryGetValue(orderedKey, out var value2) || (Object)(object)value2 == (Object)null) { (list ?? (list = new List<Vector3>())).Add(orderedKey); continue; } Vector3 position = value2.transform.position; if (AnyPlayerWithin(position, value)) { ExplodeBalloon(value2, position); (list ?? (list = new List<Vector3>())).Add(orderedKey); } else if (AnyOtherEnemyWithin(position, value)) { PopBalloon(value2, position); (list ?? (list = new List<Vector3>())).Add(orderedKey); } } if (list == null) { return; } foreach (Vector3 item in list) { ForgetBalloon(item); } } private static bool AnyPlayerWithin(Vector3 pos, float radius) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) foreach (PlayerAvatar item in FusionShared.AllPlayers()) { if (!((Object)(object)item == (Object)null) && Vector3.Distance(pos, ((Component)item).transform.position) <= radius) { return true; } } return false; } private bool AnyOtherEnemyWithin(Vector3 pos, float radius) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) EnemyDirector instance = EnemyDirector.instance; if ((Object)(object)instance == (Object)null || instance.enemiesSpawned == null) { return false; } foreach (EnemyParent item in instance.enemiesSpawned) { if (!((Object)(object)item == (Object)null) && !((Object)(object)item == (Object)(object)_self) && Vector3.Distance(pos, ((Component)item).transform.position) <= radius) { return true; } } return false; } private void ProximityExplode() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer() && (Object)(object)_pv != (Object)null) { _pv.RPC("BoomdayExplodeRPC", (RpcTarget)0, new object[3] { ((Component)this).transform.position, 1.3f, Plugin.BoomdayCoreDamage.Value }); } else { BoomdayExplodeRPC(((Component)this).transform.position, 1.3f, Plugin.BoomdayCoreDamage.Value); } AggroNearestPlayer(); StartBalloonChain(); _fuseLit = false; _explodeCooldown = Plugin.BoomdayExplodeCooldown.Value; } public void Detonate() { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) if (!_deathDetonated) { _deathDetonated = true; if (SemiFunc.IsMultiplayer() && (Object)(object)_pv != (Object)null) { _pv.RPC("BoomdayExplodeRPC", (RpcTarget)0, new object[3] { ((Component)this).transform.position, 1.6f, Plugin.BoomdayCoreDamage.Value }); } else { BoomdayExplodeRPC(((Component)this).transform.position, 1.6f, Plugin.BoomdayCoreDamage.Value); } StartBalloonChain(); } } [PunRPC] private void BoomdayExplodeRPC(Vector3 pos, float size, int damage) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) try { FusionShared.ExplodeAuthoritative(pos, size, damage, 0, _selfPhys, _enemy); } catch { } } public void ExplodeBalloonAt(Vector3 pos) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer() && (Object)(object)_pv != (Object)null) { _pv.RPC("BoomdayExplodeRPC", (RpcTarget)0, new object[3] { pos, 0.7f, Plugin.BoomdayBalloonDamage.Value }); } else { BoomdayExplodeRPC(pos, 0.7f, Plugin.BoomdayBalloonDamage.Value); } } private void AggroNearestPlayer() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) try { if (!((Object)(object)_birthday == (Object)null)) { PlayerAvatar val = FusionShared.NearestPlayer(((Component)this).transform.position, Plugin.BoomdayFuseRange.Value * 3f); if (!((Object)(object)val == (Object)null)) { _birthday.playerTarget = val; _birthday.UpdateState((State)6); } } } catch { } } private void StartBalloonChain() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_birthday == (Object)null || _orderedKeys.Count == 0) { return; } List<GameObject> list = new List<GameObject>(); foreach (Vector3 orderedKey in _orderedKeys) { if (_birthday.balloons != null && _birthday.balloons.TryGetValue(orderedKey, out var value) && (Object)(object)value != (Object)null) { list.Add(value); _birthday.balloons.Remove(orderedKey); } } _orderedKeys.Clear(); _seen.Clear(); Plugin.Instance.StartBalloonChain(list, Plugin.BoomdayBalloonDamage.Value, ((Object)(object)_birthday != (Object)null) ? _birthday.balloonPopEffect : null, _pv); } private void ForgetBalloon(Vector3 key) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) _birthday?.balloons?.Remove(key); _orderedKeys.Remove(key); _seen.Remove(key); } private void ExplodeBalloon(GameObject balloon, Vector3 bp) { //IL_0057: 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_0029: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer() && (Object)(object)_pv != (Object)null) { _pv.RPC("BoomdayExplodeRPC", (RpcTarget)0, new object[3] { bp, 0.7f, Plugin.BoomdayBalloonDamage.Value }); } else { BoomdayExplodeRPC(bp, 0.7f, Plugin.BoomdayBalloonDamage.Value); } BroadcastBoomdayVfx(bp, hasBalloonPop: true); Object.Destroy((Object)(object)balloon); } private void PopBalloon(GameObject balloon, Vector3 bp) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) BroadcastBoomdayVfx(bp, hasBalloonPop: true); Object.Destroy((Object)(object)balloon); } private void BroadcastBoomdayVfx(Vector3 pos, bool hasBalloonPop) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) if (hasBalloonPop) { if (SemiFunc.IsMultiplayer() && (Object)(object)_pv != (Object)null) { _pv.RPC("BoomdayVfxRPC", (RpcTarget)0, new object[1] { pos }); } else { BoomdayVfxRPC(pos); } } } [PunRPC] private void BoomdayVfxRPC(Vector3 pos) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)_birthday != (Object)null && (Object)(object)_birthday.balloonPopEffect != (Object)null) { Object.Instantiate<GameObject>(_birthday.balloonPopEffect, pos, Quaternion.identity); } } catch { } } private void TintBalloon(GameObject balloon) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_003b: 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_0064: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = balloon.GetComponentsInChildren<Renderer>(true); foreach (Renderer val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { MaterialPropertyBlock val2 = new MaterialPropertyBlock(); val.GetPropertyBlock(val2); val2.SetColor("_Color", new Color(1f, 0.45f, 0f)); val2.SetColor("_EmissionColor", new Color(1f, 0.35f, 0f) * 1.5f); val.SetPropertyBlock(val2); } } } } public class PoltergeistFusion : MonoBehaviour { internal static readonly Color AuraColor = new Color(0.35f, 0.8f, 1f); private EnemyHealth? _health; private bool _hpDone; private float _throwCooldown; private float _playerFloatCooldown; private float _fieldTimer; private float _glowTimer; private float _inversionCooldown; private float _inversionUntil; private bool _inversionWasActive; private GameObject? _fieldSphere; private PhotonView? _pv; private Enemy? _enemy; private void Awake() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) _health = ((Component)this).GetComponentInParent<EnemyHealth>() ?? ((Component)this).GetComponentInChildren<EnemyHealth>(); _pv = ((Component)this).GetComponent<PhotonView>(); _enemy = ((Component)this).GetComponent<Enemy>() ?? ((Component)this).GetComponentInParent<Enemy>(); if (SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)_health != (Object)null) { _health.health = Mathf.Max(1, Mathf.RoundToInt((float)_health.health * Plugin.CurrentHealthMultiplier())); } FusionShared.ApplyMutationGlow(((Component)this).transform, AuraColor); _throwCooldown = Plugin.PoltergeistThrowInterval.Value; _inversionCooldown = Plugin.PoltergeistInversionInterval.Value; _playerFloatCooldown = Plugin.PoltergeistPlayerFloatInterval.Value; } private void Update() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) _glowTimer -= Time.deltaTime; if (_glowTimer <= 0f) { _glowTimer = 2f; FusionShared.ApplyMutationGlow(((Component)this).transform, AuraColor); } EnsureFieldSphere(); bool flag = Time.time < _inversionUntil; if (_inversionWasActive && !flag) { ResolveGravitySlam(); } _inversionWasActive = flag; if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } EnsureHpDoubled(); _inversionCooldown -= Time.deltaTime; if (_inversionCooldown <= 0f) { _inversionCooldown = Mathf.Max(2f, Plugin.PoltergeistInversionInterval.Value); float num = Mathf.Max(0.25f, Plugin.PoltergeistInversionSeconds.Value); if (SemiFunc.IsMultiplayer() && (Object)(object)_pv != (Object)null) { _pv.RPC("GravityInversionRPC", (RpcTarget)0, new object[1] { num }); } else { GravityInversionRPC(num); } } bool flag2 = Time.time < _inversionUntil; _fieldTimer -= Time.deltaTime; if (_fieldTimer <= 0f && !flag2) { _fieldTimer = 0.25f; foreach (PhysGrabObject item in FusionShared.PhysObjectsInRadius(((Component)this).transform.position, Plugin.PoltergeistRange.Value)) { if (!((Object)(object)item == (Object)null)) { try { item.OverrideZeroGravity(0.35f); item.OverrideDrag(1f, 0.35f); item.OverrideAngularDrag(1.5f, 0.35f); } catch { } } } } _playerFloatCooldown -= Time.deltaTime; if (_playerFloatCooldown <= 0f && !flag2) { _playerFloatCooldown = Plugin.PoltergeistPlayerFloatInterval.Value; foreach (PlayerAvatar item2 in FusionShared.PlayersInRadius(((Component)this).transform.position, Plugin.PoltergeistRange.Value)) { if (!((Object)(object)item2 == (Object)null)) { try { item2.ForceImpulse(Vector3.up * Plugin.PoltergeistPlayerFloatForce.Value); } catch { } } } } _throwCooldown -= Time.deltaTime; if (_throwCooldown <= 0f) { _throwCooldown = Plugin.PoltergeistThrowInterval.Value; ThrowValuableAtPlayer(); } } [PunRPC] private void GravityInversionRPC(float duration) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) _inversionUntil = Time.time + Mathf.Max(0.25f, duration); FusionShared.SpawnWarningRing(FusionShared.ProjectToGround(((Component)this).transform.position), Color.white, Mathf.Max(0.2f, Plugin.PoltergeistRange.Value), 0.15f, duration); } private void FixedUpdate() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) if (Time.time >= _inversionUntil) { return; } Vector3 position = ((Component)this).transform.position; float radius = Mathf.Max(0.5f, Plugin.PoltergeistRange.Value); float num = Mathf.Max(0f, Plugin.PoltergeistSlamForce.Value); foreach (PlayerAvatar item in FusionShared.PlayersInRadius(position, radius)) { if (FusionShared.IsLocalPlayer(item) && !FusionShared.IsPlayerDisabled(item)) { PhysGrabObject playerPhysGrabObject = FusionShared.GetPlayerPhysGrabObject(item); if ((Object)(object)playerPhysGrabObject?.rb != (Object)null) { playerPhysGrabObject.rb.AddForce(Vector3.down * num, (ForceMode)5); } } } if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } foreach (PhysGrabObject item2 in FusionShared.PhysObjectsInRadius(position, radius)) { if ((Object)(object)item2?.rb != (Object)null) { item2.rb.AddForce(Vector3.down * num, (ForceMode)5); } } } private void ResolveGravitySlam() { //IL_0006: 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) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; float radius = Mathf.Max(0.5f, Plugin.PoltergeistRange.Value); foreach (PlayerAvatar item in FusionShared.PlayersInRadius(position, radius)) { if (FusionShared.IsLocalPlayer(item) && !FusionShared.IsPlayerDisabled(item)) { FusionShared.HurtOwnedPlayer(item, Mathf.Max(0, Plugin.PoltergeistSlamDamage.Value), position, _enemy); FusionShared.SpawnWarningRing(FusionShared.ProjectToGround(((Component)item).transform.position), Color.white, 1.4f, 0.1f, 0.25f); } } } private void EnsureHpDoubled() { if (!_hpDone && !((Object)(object)_health == (Object)null)) { _hpDone = true; FusionShared.SetHealthCurrent(_health, _health.health); } } private void EnsureFieldSphere() { //IL_00c0: 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_00e5: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_fieldSphere != (Object)null) { return; } try { EnemyParent componentInParent = ((Component)this).GetComponentInParent<EnemyParent>(); EnemyFloaterSphereEffect val = ((componentInParent != null) ? ((Component)componentInParent).GetComponentInChildren<EnemyFloaterSphereEffect>(true) : null) ?? ((Component)this).GetComponentInChildren<EnemyFloaterSphereEffect>(true); MeshRenderer val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<MeshRenderer>() : null); Material val3 = (((Object)(object)val2 != (Object)null) ? ((Renderer)val2).sharedMaterial : null); if (!((Object)(object)val3 == (Object)null)) { GameObject val4 = GameObject.CreatePrimitive((PrimitiveType)0); ((Object)val4).name = "MatsuPoltergeistField"; Collider component = val4.GetComponent<Collider>(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } MeshRenderer component2 = val4.GetComponent<MeshRenderer>(); ((Renderer)component2).sharedMaterial = val3; ((Renderer)component2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)component2).receiveShadows = false; val4.transform.SetParent(((Component)this).transform, false); val4.transform.localPosition = Vector3.zero; val4.transform.localScale = Vector3.one * (Plugin.PoltergeistRange.Value * 2f); _fieldSphere = val4; } } catch { _fieldSphere = null; } } private void ThrowValuableAtPlayer() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01ac: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: 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_0099: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = FusionShared.NearestPlayer(((Component)this).transform.position, Plugin.PoltergeistRange.Value * 1.5f); if ((Object)(object)val == (Object)null) { return; } PhysGrabObject val2 = null; float num = float.MaxValue; foreach (PhysGrabObject item in FusionShared.PhysObjectsInRadius(((Component)this).transform.position, Plugin.PoltergeistRange.Value)) { if (!((Object)(object)item == (Object)null) && !((Object)(object)item.rb == (Object)null) && !((Object)(object)((Component)item).GetComponentInParent<ValuableObject>() == (Object)null)) { float num2 = Vector3.Distance(((Component)this).transform.position, ((Component)item).transform.position); if (num2 < num) { num = num2; val2 = item; } } } if ((Object)(object)val2 == (Object)null || (Object)(object)val2.rb == (Object)null) { return; } Rigidbody rb = val2.rb; EnemyParent componentInParent = ((Component)this).GetComponentInParent<EnemyParent>(); if ((Object)(object)componentInParent != (Object)null) { Collider[] componentsInChildren = ((Component)componentInParent).GetComponentsInChildren<Collider>(true); Collider[] componentsInChildren2 = ((Component)val2).GetComponentsInChildren<Collider>(true); Collider[] array = componentsInChildren; foreach (Collider val3 in array) { if ((Object)(object)val3 == (Object)null) { continue; } Collider[] array2 = componentsInChildren2; foreach (Collider val4 in array2) { if ((Object)(object)val4 != (Object)null) { try { Physics.IgnoreCollision(val3, val4, true); } catch { } } } } } try { val2.ResetMass(); } catch { } float num3 = Mathf.Min(20f * rb.mass, 100f); try { val2.ResetIndestructible(); } catch { } Vector3 val5 = ((Component)val).transform.position + Vector3.up * 1f; Vector3 val6 = Vector3.Lerp(((Component)this).transform.forward, val5 - val2.centerPoint, 0.5f); rb.AddForce(val6 * num3, (ForceMode)1); rb.AddTorque(((Component)val2).transform.right * 0.5f, (ForceMode)1); FusionShared.BoostThrownImpact(val2, 5f, 2f); } } public class CleanupCrewFusion : MonoBehaviour { internal static readonly Color AuraColor = new Color(0.4f, 1f, 0.15f); private static FieldInfo? _headStateField; private EnemyBombThrower _thrower; private EnemyHealth? _health; private bool _hpDone; private float _glowTimer; private int _prevHeadState = -1; private void Awake() { _thrower = ((Component)this).GetComponent<EnemyBombThrower>(); _health = ((Component)this).GetComponentInParent<EnemyHealth>() ?? ((Component)this).GetComponentInChildren<EnemyHealth>(); if (SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)_health != (Object)null) { _health.health = Mathf.Max(1, Mathf.RoundToInt((float)_health.health * Plugin.CurrentHealthMultiplier())); } ApplyGlow(); Plugin.GetMeltdownHeadPrefabRef(); } private void Update() { _glowTimer -= Time.deltaTime; if (_glowTimer <= 0f) { _glowTimer = 2f; ApplyGlow(); } if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } EnsureHpDoubled(); if (!((Object)(object)_thrower == (Object)null) && !((Object)(object)_thrower.head == (Object)null)) { int num = ReadHeadState(_thrower.head); if (_prevHeadState != -1 && num == 1 && _prevHeadState != 1) { SpawnExtraHeads(); } _prevHeadState = num; } } private void SpawnExtraHeads() { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) Transform headSpawnTransform = _thrower.headSpawnTransform; if ((Object)(object)headSpawnTransform == (Object)null) { Plugin.Log.LogWarning((object)"[MeltdownCrew] headSpawnTransform is null; can't spawn extras."); return; } Plugin.Log.LogInfo((object)"[MeltdownCrew] body launched its head — spawning 2 extra heads."); Plugin.SpawnMeltdownHead(headSpawnTransform.position, headSpawnTransform.rotation, headSpawnTransform.forward, Plugin.MeltdownSlowSpeed.Value); Plugin.SpawnMeltdownHead(headSpawnTransform.position, headSpawnTransform.rotation, headSpawnTransform.forward, Plugin.MeltdownFastSpeed.Value); } private void EnsureHpDoubled() { if (!_hpDone && !((Object)(object)_health == (Object)null)) { _hpDone = true; FusionShared.SetHealthCurrent(_health, _health.health); } } private void ApplyGlow() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) FusionShared.ApplyMutationGlow(((Component)this).transform, AuraColor); if ((Object)(object)_thrower != (Object)null && (Object)(object)_thrower.head != (Object)null) { FusionShared.ApplyMutationGlow(((Component)_thrower.head).transform, AuraColor); } } private static int ReadHeadState(EnemyBombThrowerHead head) { try { if (_headStateField == null) { _headStateField = typeof(EnemyBombThrowerHead).GetField("currentState", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); } object obj = _headStateField?.GetValue(head); return (obj != null) ? Convert.ToInt32(obj) : (-1); } catch { return -1; } } } public class MeltdownExtraHead : MonoBehaviour { private PhotonView? _pv; private Rigidbody? _rb; private ParticleScriptExplosion? _explosion; private float _factor = 1f; private bool _launched; private bool _exploding; private float _flightTimer; private float _destroyTimer; private void Awake() { _pv = ((Component)this).GetComponent<PhotonView>(); _rb = ((Component)this).GetComponent<PhysGrabObject>()?.rb ?? ((Component)this).GetComponent<Rigidbody>(); _explosion = ((Component)this).GetComponent<ParticleScriptExplosion>(); Animator component = ((Component)this).GetComponent<Animator>(); if ((Object)(object)component != (Object)null) { ((Behaviour)component).enabled = false; } } public void Launch(float factor, Vector3 forward) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) _factor = factor; _flightTimer = Plugin.MeltdownHeadFlightSeconds.Value; _launched = true; if ((Object)(object)_rb != (Object)null) { _rb.isKinematic = false; Vector3 val = Vector3.Lerp(((Vector3)(ref forward)).normalized, Vector3.up, 0.3f); _rb.AddForce(val * 20f, (ForceMode)1); _rb.AddTorque(Vector3.right * 0.25f, (ForceMode)1); } } private void FixedUpdate() { //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0140: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } if (_exploding) { _destroyTimer -= Time.fixedDeltaTime; if (_destroyTimer <= 0f) { DestroySelf(); } } else { if (!_launched || (Object)(object)_rb == (Object)null) { return; } PlayerAvatar val = FusionShared.NearestPlayer(_rb.position, 40f); if ((Object)(object)val != (Object)null) { Vector3 val2 = ((Component)val).transform.position - _rb.position; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude > 0.01f) { _rb.AddForce(((Vector3)(ref val2)).normalized * Plugin.MeltdownHomingForce.Value * Mathf.Max(0.5f, _factor), (ForceMode)0); } } float num = Plugin.MeltdownBaseSpeed.Value * _factor; Vector3 velocity = _rb.velocity; Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(velocity.x, 0f, velocity.z); if (((Vector3)(ref val3)).magnitude > num) { val3 = ((Vector3)(ref val3)).normalized * num; _rb.velocity = new Vector3(val3.x, velocity.y, val3.z); } _flightTimer -= Time.fixedDeltaTime; if (_flightTimer <= 0f) { _exploding = true; _destroyTimer = 0.3f; if (SemiFunc.IsMultiplayer() && (Object)(object)_pv != (Object)null) { _pv.RPC("ExplodeRPC", (RpcTarget)0, new object[1] { _rb.position }); } else { ExplodeRPC(_rb.position); } } } } [PunRPC] private void ExplodeRPC(Vector3 pos) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) try { ParticleScriptExplosion? explosion = _explosion; if (explosion != null) { explosion.Spawn(pos, 2f, Plugin.MeltdownHeadDamage.Value, 30, 4f, false, false, 1f); } } catch { } Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } } private void DestroySelf() { try { if (SemiFunc.IsMultiplayer() && (Object)(object)_pv != (Object)null && _pv.IsMine) { PhotonNetwork.Destroy(((Component)this).gameObject); } else { Object.Destroy((Object)(object)((Component)this).gameObject); } } catch { Object.Destroy((Object)(object)((Component)this).gameObject); } } } public class PlayerTeleportHelper : MonoBehaviour { private PhotonView? _pv; private PlayerAvatar? _avatar; private void Awake() { _pv = ((Component)this).GetComponent<PhotonView>(); _avatar = ((Component)this).GetComponent<PlayerAvatar>(); } public static void Trigger(PlayerAvatar player, Vector3 pos, int damage, int enemyIndex) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) PlayerTeleportHelper component = ((Component)player).GetComponent<PlayerTeleportHelper>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component._pv == (Object)null)) { if (SemiFunc.IsMultiplayer()) { component._pv.RPC("TeleportAndHurtRPC", (RpcTarget)0, new object[3] { pos, damage, enemyIndex }); } else { component.TeleportAndHurtRPC(pos, damage, enemyIndex); } } } public static void TriggerWithImpulse(PlayerAvatar player, Vector3 pos, int damage, int enemyIndex, Vector3 exitImpulse) { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_003a: 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) PlayerTeleportHelper component = ((Component)player).GetComponent<PlayerTeleportHelper>(); if (!((Object)(object)component == (Object)null) && !((Object)(object)component._pv == (Object)null)) { if (SemiFunc.IsMultiplayer()) { component._pv.RPC("TeleportHurtImpulseRPC", (RpcTarget)0, new object[4] { pos, damage, enemyIndex, exitImpulse }); } else { component.TeleportHurtImpulseRPC(pos, damage, enemyIndex, exitImpulse); } } } [PunRPC] private void TeleportHurtImpulseRPC(Vector3 pos, int damage, int enemyIndex, Vector3 exitImpulse) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) TeleportAndHurtRPC(pos, damage, enemyIndex); if ((Object)(object)_avatar == (Object)null || !FusionShared.IsLocalPlayer(_avatar)) { return; } try { _avatar.ForceImpulse(exitImpulse); } catch { } } [PunRPC] private void TeleportAndHurtRPC(Vector3 pos, int damage, int enemyIndex) { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_006a: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)_avatar == (Object)null) { return; } if (SemiFunc.IsMasterClientOrSingleplayer()) { PhysGrabObject playerPhysGrabObject = FusionShared.GetPlayerPhysGrabObject(_avatar); if ((Object)(object)playerPhysGrabObject != (Object)null) { playerPhysGrabObject.Teleport(pos, ((Component)_avatar).transform.rotation); if ((Object)(object)playerPhysGrabObject.rb != (Object)null) { playerPhysGrabObject.rb.velocity = Vector3.zero; playerPhysGrabObject.rb.angularVelocity = Vector3.zero; } } } ((Component)_avatar).transform.position = pos; FusionShared.SetPlayerClientPosition(_avatar, pos); if ((Object)(object)_avatar.playerAvatarVisuals != (Object)null) { ((Component)_avatar.playerAvatarVisuals).transform.position = pos; FusionShared.SetPlayerVisualPosition(_avatar.playerAvatarVisuals, pos); } if (SemiFunc.IsMasterClientOrSingleplayer()) { _avatar.playerHealth.HurtOther(damage, pos, false, enemyIndex, false); } } catch (Exception arg) { Plugin.Log.LogError((object)$"[Snatcher] teleport RPC error: {arg}"); } } } [HarmonyPatch(typeof(PlayerAvatar), "Start")] internal static class PlayerAvatar_Start_Patch { private static void Postfix(PlayerAvatar __instance) { try { if ((Object)(object)__instance != (Object)null && (Object)(object)((Component)__instance).GetComponent<PlayerTeleportHelper>() == (Object)null) { ((Component)__instance).gameObject.AddComponent<PlayerTeleportHelper>(); } } catch (Exception arg) { Plugin.Log.LogError((object)$"[Snatcher] PlayerAvatar_Start_Patch error: {arg}"); } } } public class SnatcherFusion : MonoBehaviour { internal static readonly Color AuraColor = new Color(0.6f, 0f, 0.85f); private static FieldInfo? _playerTargetField; private EnemyHidden _hidden; private EnemyParent? _self; private EnemyHealth? _health; private bool _hpDone; private float _glowTimer; private State _prevState; private bool _stateInitialized; private void Awake() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) _hidden = ((Component)this).GetComponent<EnemyHidden>(); _self = ((Component)this).GetComponentInParent<EnemyParent>(); _health = ((Component)this).GetComponentInParent<EnemyHealth>() ?? ((Component)this).GetComponentInChildren<EnemyHealth>(); if (SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)_health != (Object)null) { _health.health = Mathf.Max(1, Mathf.RoundToInt((float)_health.health * Plugin.CurrentHealthMultiplier())); } FusionShared.ApplyMutationGlow(((Component)this).transform, AuraColor); } private void Update() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Invalid comparison between Unknown and I4 //IL_0114: 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_00b0: 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) _glowTimer -= Time.deltaTime; if (_glowTimer <= 0f) { _glowTimer = 2f; FusionShared.ApplyMutationGlow(((Component)this).transform, AuraColor); } if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } EnsureHpDoubled(); if ((Object)(object)_hidden == (Object)null) { return; } State currentState = _hidden.currentState; if (!_stateInitialized) { _prevState = currentState; _stateInitialized = true; } else { if (currentState == _prevState) { return; } if ((int)currentState == 7) { PlayerAvatar playerTarget = GetPlayerTarget(_hidden); if ((Object)(object)playerTarget != (Object)null && !FusionShared.IsPlayerDisabled(playerTarget) && FusionShared.TryGetSafeRandomPoint(((Component)playerTarget).transform.position, out var point)) { int enemyIndex = (((Object)(object)_self != (Object)null && (Object)(object)EnemyDirector.instance != (Object)null) ? EnemyDirector.instance.enemiesSpawned.IndexOf(_self) : (-1)); PlayerTeleportHelper.Trigger(playerTarget, point, Plugin.SnatcherDamage.Value, enemyIndex); Plugin.Log.LogInfo((object)"[Snatcher] Snatched a player to a random spot."); } } _prevState = currentState; } } private void EnsureHpDoubled() { if (!_hpDone && !((Object)(object)_health == (Object)null)) { _hpDone = true; FusionShared.SetHealthCurrent(_health, _health.health); } } private static PlayerAvatar? GetPlayerTarget(EnemyHidden hidden) { try { if ((object)_playerTargetField == null) { _playerTargetField = typeof(EnemyHidden).GetField("playerTarget", BindingFlags.Instance | BindingFlags.NonPublic); } object? obj = _playerTargetField?.GetValue(hidden); return (PlayerAvatar?)((obj is PlayerAvatar) ? obj : null); } catch { return null; } } } public class PeeperFusion : MonoBehaviour { internal static readonly Color AuraColor = new Color(1f, 0.1f, 0.1f); private static FieldInfo? _targetPlayerField; private EnemyCeilingEye _eye; private EnemyHealth? _health; private bool _hpDone; private float _glowTimer; private PlayerAvatar? _lastTarget; private float _stareTimer; private int _consecutiveShots; private void Awake() { //IL_0065: Unknown result type (might be due to invalid IL or missing references) _eye = ((Component)this).GetComponent<EnemyCeilingEye>(); _health = ((Component)this).GetComponentInParent<EnemyHealth>() ?? ((Component)this).GetComponentInChildren<EnemyHealth>(); if (SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)_health != (Object)null) { _health.health = Mathf.Max(1, Mathf.RoundToInt((float)_health.health * Plugin.CurrentHealthMultiplier())); } FusionShared.ApplyMutationGlow(((Component)this).transform, AuraColor); } private void Update() { //IL_0030: 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_005b: Invalid comparison between Unknown and I4 _glowTimer -= Time.deltaTime; if (_glowTimer <= 0f) { _glowTimer = 2f; FusionShared.ApplyMutationGlow(((Component)this).transform, AuraColor); } EnsureHpDoubled(); if ((Object)(object)_eye == (Object)null) { return; } PlayerAvatar val = (((int)_eye.currentState == 3) ? GetTarget(_eye) : null); if ((Object)(object)val == (Object)null) { _lastTarget = null; _stareTimer = 0f; _consecutiveShots = 0; return; } if ((Object)(object)val != (Object)(object)_lastTarget) { _lastTarget = val; _stareTimer = 0f; _consecutiveShots = 0; } _stareTimer += Time.deltaTime; float num = Mathf.Max(0.5f, Plugin.DeathgazeStareSeconds.Value); float num2 = Mathf.Clamp(Plugin.DeathgazeRepeatChargeMultiplier.Value, 0.25f, 1f); float num3 = Mathf.Max(Mathf.Clamp(Plugin.DeathgazeMinimumStareSeconds.Value, 0.5f, num), num * Mathf.Pow(num2, (float)_consecutiveShots)); if (_stareTimer >= num3) { _stareTimer = 0f; _consecutiveShots++; FireBeam(val); } } private void EnsureHpDoubled() { if (!_hpDone && !((Object)(object)_health == (Object)null) && SemiFunc.IsMasterClientOrSingleplayer()) { _hpDone = true; FusionShared.SetHealthCurrent(_health, _health.health); } } private void FireBeam(PlayerAvatar target) { try { SemiLaser clownLaserPrefab = Plugin.GetClownLaserPrefab(); if ((Object)(object)clownLaserPrefab == (Object)null) { return; } Transform source = (((Object)(object)_eye.eyeTransform != (Object)null) ? _eye.eyeTransform : ((Component)this).transform); GameObject val = Object.Instantiate<GameObject>(((Component)clownLaserPrefab).gameObject); val.SetActive(true); SemiLaser component = val.GetComponent<SemiLaser>(); if ((Object)(object)component == (Object)null) { Object.Destroy((Object)(object)val); return; } HurtCollider componentInChildren = val.GetComponentInChildren<HurtCollider>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.enemyHost = ((Component)_eye).GetComponent<Enemy>(); componentInChildren.playerKill = false; componentInChildren.playerDamage = Plugin.DeathgazeBeamDamage.Value; componentInChildren.playerDamageCooldown = Plugin.DeathgazeBeamSeconds.Value + 1f; } EnemyParent componentInParent = ((Component)_eye).GetComponentInParent<EnemyParent>(); Transform ignoreRoot = ((componentInParent != null) ? ((Component)componentInParent).transform : null) ?? ((Component)this).transform; val.AddComponent<PeeperBeam>().Init(component, source, target, Plugin.DeathgazeBeamSeconds.Value, ignoreRoot); } catch (Exception arg) { Plugin.Log.LogError((object)$"[Deathgaze] fire error: {arg}"); } } private static PlayerAvatar? GetTarget(EnemyCeilingEye eye) { try { if ((object)_targetPlayerField == null) { _targetPlayerField = typeof(EnemyCeilingEye).GetField("targetPlayer", BindingFlags.Instance | BindingFlags.NonPublic); } object? obj = _targetPlayerField?.GetValue(eye); return (PlayerAvatar?)((obj is PlayerAvatar) ? obj : null); } catch { return null; } } } public class PeeperBeam : MonoBehaviour { private static readonly int DefaultMask = LayerMask.GetMask(new string[1] { "Default" }); private SemiLaser _laser; private Transform _source; private PlayerAvatar? _target; private float _duration; private float _elapsed; private Transform? _ignoreRoot; private int _explicitDamage; private Enemy? _damageSource; private bool _damageApplied; public void Init(SemiLaser laser, Transform source, PlayerAvatar target, float duration, Transform? ignoreRoot, int explicitDamage = 0, Enemy? damageSource = null) { _laser = laser; _source = source; _target = target; _duration = duration; _ignoreRoot = ignoreRoot; _explicitDamage = explicitDamage; _damageSource = damageSource; } private void LateUpdate() { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_008e: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00ae: 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_00c7: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) _elapsed += Time.deltaTime; if ((Object)(object)_laser == (Object)null || (Object)(object)_source == (Object)null || (Object)(object)_target == (Object)null || _elapsed >= _duration) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } Vector3 position = _source.position; Vector3 val = ((Component)_target).transform.position + Vector3.up * 1f; Vector3 val2 = val - position; float magnitude = ((Vector3)(ref val2)).magnitude; if (magnitude < 0.01f) { return; } val2 /= magnitude; Vector3 val3 = val; float num = magnitude; RaycastHit[] array = Physics.RaycastAll(position, val2, magnitude, DefaultMask, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val4 = array[i]; if (!((Object)(object)((RaycastHit)(ref val4)).collider == (Object)null) && !(((RaycastHit)(ref val4)).distance < 0.6f) && (!((Object)(object)_ignoreRoot != (Object)null) || !((Component)((RaycastHit)(ref val4)).collider).transform.IsChildOf(_ignoreRoot)) && ((RaycastHit)(ref val4)).distance < num) { num = ((RaycastHit)(ref val4)).distance; val3 = ((RaycastHit)(ref val4)).point; } } _laser.LaserActive(position, val3, true); if (!_damageApplied && _explicitDamage > 0 && _elapsed >= 0.12f && num >= magnitude - 0.2f && FusionShared.IsLocalPlayer(_target)) { _damageApplied = true; FusionShared.HurtOwnedPlayer(_target, _explicitDamage, position, _damageSource); } } } public class DeadeyeFusion : MonoBehaviour { internal static readonly Color AuraColor = new Color(0.2f, 0.6f, 1f); private EnemyHunter _hunter; private EnemyHealth? _health; private PhotonView? _pv; private bool _hpDone; private float _glowTimer; private State _prevState; private bool _stateInit; private GameObject? _activeBeam; private void Awake() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) _hunter = ((Component)this).GetComponent<EnemyHunter>(); _health = ((Component)this).GetComponentInParent<EnemyHealth>() ?? ((Component)this).GetComponentInChildren<EnemyHealth>(); _pv = ((Component)this).GetComponent<PhotonView>(); if (SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)_health != (Object)null) { _health.health = Mathf.Max(1, Mathf.RoundToInt((float)_health.health * Plugin.CurrentHealthMultiplier())); } FusionShared.ApplyMutationGlow(((Component)this).transform, AuraColor); Plugin.GetPhotonBlasterLaserPrefab(); } private void Update() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00a0: Invalid comparison between Unknown and I4 //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) _glowTimer -= Time.deltaTime; if (_glowTimer <= 0f) { _glowTimer = 2f; FusionShared.ApplyMutationGlow(((Component)this).transform, AuraColor); } if ((Object)(object)_activeBeam != (Object)null && ((object)_activeBeam).Equals((object?)null)) { _activeBeam = null; } EnsureHpDoubled(); if ((Object)(object)_hunter == (Object)null) { return; } State currentState = _hunter.currentState; if (!_stateInit) { _prevState = currentState; _stateInit = true; } else if (currentState != _prevState) { if ((int)currentState == 6 && SemiFunc.IsMasterClientOrSingleplayer()) { SendBlaster(); } _prevState = currentState; } } private void EnsureHpDoubled() { if (!_hpDone && !((Object)(object)_health == (Object)null) && SemiFunc.IsMasterClientOrSingleplayer()) { _hpDone = true; FusionShared.SetHealthCurrent(_health, _health.health); } } private void SendBlaster() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) PlayerAvatar val = FusionShared.NearestPlayer((((Object)(object)_hunter.gunTipTransform != (Object)null) ? _hunter.gunTipTransform : ((Component)this).transform).position, 60f); if (!((Object)(object)val == (Object)null)) { if (SemiFunc.IsMultiplayer() && (Object)(object)_pv != (Object)null && (Object)(object)val.photonView != (Object)null) { _pv.RPC("FireBlasterRPC", (RpcTarget)0, new object[1] { val.photonView.ViewID }); } else { FireBlaster(val); } } } [PunRPC] private void FireBlasterRPC(int playerViewId) { try { PhotonView val = PhotonView.Find(playerViewId); PlayerAvatar val2 = (((Object)(object)val != (Object)null) ? (((Component)val).GetComponent<PlayerAvatar>() ?? ((Component)val).GetComponentInParent<PlayerAvatar>() ?? ((Component)val).GetComponentInChildren<PlayerAvatar>()) : null); if ((Object)(object)val2 != (Object)null) { FireBlaster(val2); } } catch (Exception arg) { Plugin.Log.LogError((object)$"[Deadeye] target RPC error: {arg}"); } } private void FireBlaster(PlayerAvatar target) { try { if ((Object)(object)_activeBeam != (Object)null) { return; } SemiLaser photonBlasterLaserPrefab = Plugin.GetPhotonBlasterLaserPrefab(); if ((Object)(object)photonBlasterLaserPrefab == (Object)null) { return; } Transform source = (((Object)(object)_hunter.gunTipTransform != (Object)null) ? _hunter.gunTipTransform : ((Component)this).transform); GameObject val = (_activeBeam = Object.Instantiate<GameObject>(((Component)photonBlasterLaserPrefab).gameObject)); val.SetActive(true); SemiLaser component = val.GetComponent<SemiLaser>(); if ((Object)(object)component == (Object)null) { Object.Destroy((Object)(object)val); return; } HurtCollider componentInChildren = val.GetComponentInChildren<HurtCollider>(true); if ((Object)(object)componentInChildren != (Object)null) { componentInChildren.enemyHost = ((Component)_hunter).GetComponent<Enemy>(); componentInChildren.playerKill = false; componentInChildren.playerDamage = 0; componentInChildren.playerDamageCooldown = Plugin.DeadeyeBeamSeconds.Value + 1f; } EnemyParent componentInParent = ((Component)_hunter).GetComponentInParent<EnemyParent>(); Transform ignoreRoot = ((componentInParent != null) ? ((Component)componentInParent).transform : null) ?? ((Component)this).transform; Enemy damageSource = ((Component)_hunter).GetComponent<Enemy>() ?? ((Component)_hunter).GetComponentInParent<Enemy>(); val.AddComponent<PeeperBeam>().Init(component, source, target, Plugin.DeadeyeBeamSeconds.Value, ignoreRoot, Plugin.DeadeyeBeamDamage.Value, damageSource); } catch (Exception arg) { Plugin.Log.LogError((object)$"[Deadeye] fire error: {arg}"); } } } public class TricksterFusion : MonoBehaviour { private sealed class SplitBatch { internal Vector3 Position; internal float Expires; internal int Remaining; } internal static readonly Color AuraColor = new Color(0.6f, 0.3f, 0.9f); internal static readonly List<TricksterFusion> ActiveDisguises = new List<TricksterFusion>(); private static readonly List<SplitBatch> PendingSplitChildren = new List<SplitBatch>(); private EnemyHealth? _health; private EnemyGnome? _gnome; private PhotonView? _pv; private PhysGrabObject? _pgo; private bool _hpDone; private float _glowTimer; private bool _disguised; private float _calmTimer; private float _redisguiseAt; private int _lastHealthSeen = -1; private bool _splitUsed; private readonly List<Renderer> _hiddenRenderers = new List<Renderer>(); private GameObject? _shell; private void Awake() { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) _health = ((Component)this).GetComponentInParent<EnemyHealth>() ?? ((Component)this).GetComponentInChildren<EnemyHealth>(); _gnome = ((Component)this).GetComponent<EnemyGnome>(); _pv = ((Component)this).GetComponent<PhotonView>(); EnemyParent componentInParent = ((Component)this).GetComponentInParent<EnemyParent>(); _pgo = ((Component)this).GetComponentInParent<PhysGrabObject>() ?? (((Object)(object)componentInParent != (Object)null) ? ((Component)componentInParent).GetComponentInChildren<PhysGrabObject>() : null); if (SemiFunc.IsMasterClientOrSingleplayer() && (Object)(object)_health != (Object)null) { _health.health = Mathf.Max(1, Mathf.RoundToInt((float)_health.health * Plugin.CurrentHealthMultiplier())); } try { HurtCollider[] componentsInChildren = ((Component)(((Object)(object)componentInParent != (Object)null && (Object)(object)componentInParent.EnableObject != (Object)null) ? componentInParent.EnableObject.transform : ((Component)this).transform)).GetComponentsInChildren<HurtCollider>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].playerDamage = Plugin.TricksterAttackDamage.Value; } } catch { } FusionShared.ApplyMutationGlow(((Component)this).transform, AuraColor); } private void Update() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Invalid comparison between Unknown and I4 //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) _glowTimer -= Time.deltaTime; if (_glowTimer <= 0f) { _glowTimer = 2f; if (!_disguised) { FusionShared.ApplyMutationGlow(((Component)this).transform, AuraColor); } } if (!SemiFunc.IsMasterClientOrSingleplayer()) { return; } EnsureHpDoubled(); if ((Object)(object)_gnome == (Object)null) { return; } if (_disguised) { FusionShared.FreezeAgent(_gnome.enemy); bool flag = false; if ((Object)(object)_health != (Object)null) { int healthCurrent = FusionShared.GetHealthCurrent(_health); if (_lastHealthSeen >= 0 && healthCurrent < _lastHealthSeen) { flag = true; } _lastHealthSeen = healthCurrent; } bool flag2 = (Object)(object)_pgo != (Object)null && _pgo.grabbed; PlayerAvatar val = FusionShared.NearestPlayer(((Component)this).transform.position, Plugin.TricksterRevealRange.Value); if (!((Object)(object)val != (Object)null || flag2 || flag)) { return; } SendMimic(on: false, ""); _redisguiseAt = Time.time + Plugin.TricksterRedisguiseSeconds.Value; EnemyParent componentInParent = ((Component)this).GetComponentInParent<EnemyParent>(); EnemyStateInvestigate val2 = (((Object)(object)componentInParent != (Object)null) ? ((Component)componentInParent).GetComponentInChildren<EnemyStateInvestigate>() : null); Vector3 val3 = (((Object)(object)val != (Object)null && (Object)(object)val.playerTransform != (Object)null) ? val.playerTransform.position : ((Component)this).transform.position); if (!((Object)(object)val2 != (Object)null)) { return; } try { val2.Set(val3, false); return; } catch { return; } } bool num = (int)_gnome.currentState == 1; bool flag3 = (Object)(object)FusionShared.NearestPlayer(((Component)this).transform.position, Plugin.TricksterHideRange.Value) == (Object)null; if (num && flag3 && Time.time >= _redisguiseAt) { _calmTimer += Time.deltaTime; if (!(_calmTimer >= 2f)) { return; } string text = PickDisguiseValuable(); if (!string.IsNullOrEmpty(text)) { if ((Object)(object)_health != (Object)null) { _lastHealthSeen = FusionShared.GetHealthCurrent(_health); } SendMimic(on: true, text); } _calmTimer = 0f; } else { _calmTimer = 0f; } } private void SendMimic(bool on, string valuableName) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMultiplayer() && (Object)(object)_pv != (Object)null) { _pv.RPC("MimicRPC", (RpcTarget)0, new object[2] { on, valuableName }); } else { MimicRPC(on, valuableName); } } internal void SplitOnDeath() { //IL_002b: 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_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) if (SemiFunc.IsMasterClientOrSingleplayer() && !_splitUsed && !((Object)(object)((Component)this).GetComponent<TricksterSplitChildMarker>() != (Object)null)) { _splitUsed = true; Vector3 val = ((Component)this).transform.position + Vector3.up * 0.15f; if (SemiFunc.IsMultiplayer() && (Object)(object)_pv != (Object)null) { _pv.RPC("ArmSplitChildrenRPC", (RpcTarget)0, new object[1] { val }); } else { ArmSplitChildrenRPC(val); } Plugin.SpawnTricksterPair(val); Plugin.Log.LogInfo((object)"[Trickster] Split into two children."); } } [PunRPC] private void ArmSplitChildrenRPC(Vector3 position) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) PendingSplitChildren.Add(new SplitBatch { Position = position, Expires = Time.time + 5f, Remaining = 2 }); } internal static bool ConsumeSplitSpawn(Vector3 position) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) for (int num = PendingSplitChildren.Count - 1; num >= 0; num--) { SplitBatch splitBatch = PendingSplitChildren[num]; if (Time.time > splitBatch.Expires || splitBatch.Remaining <= 0) { PendingSplitChildren.RemoveAt(num); } else if (!(Vector3.Distance(position, splitBatch.Position) > 3.5f)) { splitBatch.Remaining--; if (splitBatch.Remaining <= 0) { PendingSplitChildren.RemoveAt(num); } return true; } } return false; } internal void ResetSplitForRespawn() { TricksterSplitChildMarker component = ((Component)this).GetComponent<TricksterSplitChildMarker>(); if (!((Object)(object)component != (Object)null) || !(Time.time - component.CreatedAt < 1f)) { _splitUsed = false; if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } } } private static string PickDisguiseValuable() { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004a: 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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) try { List<string> list = new List<string>(); foreach (PrefabRef allValuable in Valuables.AllValuables) { GameObject val = ((PrefabRef<GameObject>)(object)allValuable)?.Prefab; if ((Object)(object)val == (Object)null) { continue; } MeshRenderer componentInChildren = val.GetComponentInChildren<MeshRenderer>(true); if (!((Object)(object)componentInChildren == (Object)null)) { Bounds bounds = ((Renderer)componentInChildren).bounds; Vector3 size = ((Bounds)(ref bounds)).size; float num = Mathf.Max(size.x, Mathf.Max(size.y, size.z)); if (num > 0.05f && num <= 1f) { list.Add(((Object)val).name); } } } if (list.Count == 0) { return ""; } return list[Random.Range(0, list.Count)]; } catch { return ""; } } [PunRPC] private void MimicRPC(bool on, string valuableName, PhotonMessageInfo _info = default(PhotonMessageInfo)) { try { if (on) { Disguise(valuableNam