Decompiled source of HazardChaos v0.1.16
plugins/HazardChaos.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.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using ExitGames.Client.Photon; using Microsoft.CodeAnalysis; using Photon.Pun; using Photon.Realtime; using UnityEngine; using UnityEngine.AI; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.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] [Microsoft.CodeAnalysis.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] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace BepInEx { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class BepInAutoPluginAttribute : Attribute { public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace BepInEx.Preloader.Core.Patching { [AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)] [Conditional("CodeGeneration")] internal sealed class PatcherAutoPluginAttribute : Attribute { public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null) { } } } namespace HazardChaos { public class AggressiveTumbleweedMover : MonoBehaviour { public Plugin plugin; public Func<Transform> AnchorProvider; public float speedMult = 1f; public float retargetSec = 2.5f; public float maxHorizSpeed = 7.5f; public float torqueMag = 15f; public float keepDownForce = 2f; private Rigidbody rb; private Vector3 desiredDir = Vector3.forward; private float nextRetargetAt = -1f; private void Awake() { //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_0090: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) rb = ((Component)this).GetComponent<Rigidbody>() ?? ((Component)this).gameObject.AddComponent<Rigidbody>(); rb.isKinematic = false; rb.useGravity = true; rb.mass = 4f; rb.drag = 1.6f; rb.angularDrag = 2f; rb.collisionDetectionMode = (CollisionDetectionMode)2; rb.constraints = (RigidbodyConstraints)0; RaycastHit val = default(RaycastHit); if (Physics.Raycast(((Component)this).transform.position + Vector3.up * 50f, Vector3.down, ref val, 200f, -1, (QueryTriggerInteraction)1)) { ((Component)this).transform.position = new Vector3(((Component)this).transform.position.x, ((RaycastHit)(ref val)).point.y + 0.12f, ((Component)this).transform.position.z); } nextRetargetAt = Time.time; } private void FixedUpdate() { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0054: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0072: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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 (Time.time >= nextRetargetAt) { desiredDir = ComputeDesiredDir(); nextRetargetAt = Time.time + Mathf.Max(0.25f, retargetSec); } if (((Vector3)(ref desiredDir)).sqrMagnitude > 0.0001f) { Vector3 val = desiredDir; rb.AddForce(val * (20f * speedMult), (ForceMode)5); Vector3 val2 = Vector3.Cross(Vector3.up, val); Vector3 normalized = ((Vector3)(ref val2)).normalized; rb.AddTorque(normalized * (torqueMag * speedMult), (ForceMode)5); } Vector3 velocity = rb.velocity; Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(velocity.x, 0f, velocity.z); float num = maxHorizSpeed * Mathf.Max(0.2f, speedMult); if (((Vector3)(ref val3)).magnitude > num) { Vector3 val4 = ((Vector3)(ref val3)).normalized * num; rb.velocity = new Vector3(val4.x, velocity.y, val4.z); } rb.AddForce(Vector3.down * keepDownForce, (ForceMode)5); } private Vector3 ComputeDesiredDir() { //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00a2: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Expected O, but got Unknown //IL_00c5: 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) Transform val = null; if (AnchorProvider != null) { val = AnchorProvider(); } if (!Object.op_Implicit((Object)(object)val) && (Object)(object)plugin != (Object)null) { MethodInfo method = typeof(Plugin).GetMethod("PickAnchorByMode", BindingFlags.Instance | BindingFlags.Public); if (method != null) { val = (Transform)method.Invoke(plugin, null); } } if (!Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)Camera.main)) { val = ((Component)Camera.main).transform; } if (!Object.op_Implicit((Object)(object)val)) { return Vector3.forward; } Vector3 val2 = val.position - ((Component)this).transform.position; val2.y = 0f; if (((Vector3)(ref val2)).sqrMagnitude < 0.0001f) { return Vector3.zero; } return ((Vector3)(ref val2)).normalized; } } [BepInPlugin("com.hazardchaos.mod", "HazardChaos", "0.1.16")] public class Plugin : BaseUnityPlugin { private enum GameMode { Off, NormalOnly, ChallengeOnly, TroublemakerOnly, Both, All } public enum ChallengeKind { Tumbleweed, Tornado, BothRandom } private enum Corner { TopLeft, TopRight, BottomLeft, BottomRight } private enum AnchorMode { HostOnly, RandomPlayer, RoundRobin, NearestToHostCamera } private enum HazardKind { Dynamite, Tornado, Tumbleweed, Zombie, Scoutmaster, BeeSwarm, Scorpion } [CompilerGenerated] private sealed class <DespawnAfter>d__192 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float seconds; public GameObject go; public Plugin <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DespawnAfter>d__192(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Expected O, but got Unknown int num = <>1__state; Plugin plugin = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(seconds); <>1__state = 1; return true; case 1: { <>1__state = -1; if ((Object)(object)go != (Object)null) { PhotonView component = go.GetComponent<PhotonView>(); if ((Object)(object)component != (Object)null && component.IsMine) { PhotonNetwork.Destroy(go); } else { Object.Destroy((Object)(object)go); } } if ((Object)(object)go != (Object)null && plugin._kindOf.TryGetValue(go, out var value)) { if (value == HazardKind.Dynamite) { plugin.liveDyn.Remove(go); } if (value == HazardKind.Tornado) { plugin.liveTor.Remove(go); } if (value == HazardKind.Tumbleweed) { plugin.liveTum.Remove(go); } plugin._kindOf.Remove(go); } plugin.liveAll.Remove(go); return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <SpawnBurst>d__193 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float totalSpreadSec; public int count; public Plugin <>4__this; public HazardKind kind; private float <step>5__2; private int <i>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SpawnBurst>d__193(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_01b8: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Expected O, but got Unknown int num = <>1__state; Plugin plugin = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <step>5__2 = ((totalSpreadSec > 0f && count > 1) ? (totalSpreadSec / (float)(count - 1)) : 0f); <i>5__3 = 0; break; case 1: <>1__state = -1; goto IL_027a; case 2: { <>1__state = -1; goto IL_027a; } IL_027a: <i>5__3++; break; } if (<i>5__3 < count) { int num2 = ((PhotonNetwork.CurrentRoom == null) ? 1 : PhotonNetwork.CurrentRoom.PlayerCount); int num3 = Math.Max(0, num2 - 1) * Math.Max(0, plugin.mpPerPlayerExtraSlots.Value); int num4 = plugin.maxSimultaneousGlobal.Value + num3; int num5 = plugin.maxDynamite.Value + num3; int num6 = plugin.maxTornado.Value + num3; int num7 = plugin.maxTumbleweed.Value + num3; if (plugin.liveAll.Count >= num4) { return false; } if (kind == HazardKind.Dynamite && plugin.liveDyn.Count >= num5) { return false; } if (kind == HazardKind.Tornado && plugin.liveTor.Count >= num6) { return false; } if (kind == HazardKind.Tumbleweed && plugin.liveTum.Count >= num7) { return false; } Vector3? val = null; for (int i = 0; i < 3; i++) { if (val.HasValue) { break; } Transform anchor = plugin.PickAnchorByMode(); float minDist = ((kind == HazardKind.Tornado) ? 10f : 8f); float maxDist = ((kind == HazardKind.Tornado) ? 22f : 18f); val = plugin.PickSpawnPosNear(anchor, minDist, maxDist, plugin.requireLineOfSight.Value); } if (val.HasValue) { GameObject val2 = plugin.Spawn(kind, val.Value); if ((Object)(object)val2 != (Object)null) { plugin.liveAll.Add(val2); plugin._kindOf[val2] = kind; if (kind == HazardKind.Dynamite) { plugin.liveDyn.Add(val2); } if (kind == HazardKind.Tornado) { plugin.liveTor.Add(val2); } if (kind == HazardKind.Tumbleweed) { plugin.liveTum.Add(val2); } } } if (<step>5__2 > 0f) { <>2__current = (object)new WaitForSeconds(<step>5__2); <>1__state = 1; return true; } <>2__current = null; <>1__state = 2; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <SpawnChallengeTornadoAfterDelay>d__177 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Plugin <>4__this; private int <extra>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SpawnChallengeTornadoAfterDelay>d__177(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028b: Unknown result type (might be due to invalid IL or missing references) //IL_028f: Unknown result type (might be due to invalid IL or missing references) //IL_0296: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0276: Unknown result type (might be due to invalid IL or missing references) //IL_0192: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_02c2: Unknown result type (might be due to invalid IL or missing references) int num = <>1__state; Plugin plugin = <>4__this; switch (num) { default: return false; case 0: { <>1__state = -1; plugin._activeChallengeTornados?.RemoveWhere((GameObject o) => (Object)(object)o == (Object)null); if (plugin._activeChallengeTornados != null && plugin._activeChallengeTornados.Count > 0) { return false; } int num2 = ((PhotonNetwork.CurrentRoom == null) ? 1 : PhotonNetwork.CurrentRoom.PlayerCount); <extra>5__2 = Mathf.Max(0, num2 - 1) * Mathf.Max(0, plugin.mpPerPlayerExtraSlots.Value); if (plugin.liveAll.Count >= plugin.maxSimultaneousGlobal.Value + <extra>5__2) { Log.LogWarning((object)$"[Challenge] Cannot spawn tornado - global cap reached ({plugin.liveAll.Count}/{plugin.maxSimultaneousGlobal.Value + <extra>5__2})"); return false; } if (plugin.liveTor.Count >= plugin.maxTornado.Value + <extra>5__2) { Log.LogWarning((object)$"[Challenge] Cannot spawn tornado - tornado cap reached ({plugin.liveTor.Count}/{plugin.maxTornado.Value + <extra>5__2})"); return false; } SimpleAnnounce.ShowAll("Tornado incoming.", Mathf.Max(0f, plugin.chTorBannerSeconds.Value)); <>2__current = (object)new WaitForSeconds(Mathf.Max(0f, plugin.chTorPreSpawnDelaySec.Value)); <>1__state = 1; return true; } case 1: { <>1__state = -1; if (!PhotonNetwork.IsMasterClient && !PhotonNetwork.OfflineMode) { return false; } if (plugin.liveAll.Count >= plugin.maxSimultaneousGlobal.Value + <extra>5__2) { Log.LogWarning((object)"[Challenge] Global cap reached during delay - aborting tornado spawn"); return false; } Transform anchor = plugin.GetAnchorForAI(); if (!Object.op_Implicit((Object)(object)anchor)) { anchor = (Object.op_Implicit((Object)(object)Camera.main) ? ((Component)Camera.main).transform : plugin.worldRoot); } if (!Object.op_Implicit((Object)(object)anchor)) { return false; } if (!plugin.TryPickChallengeSpawnNearAnchor(anchor, out var pos)) { pos = plugin.ForceSpawnNearAnchor(anchor, Mathf.Clamp(plugin.chTorCloseSpawnMin.Value, 10f, 200f), Mathf.Clamp(plugin.chTorCloseSpawnMax.Value, plugin.chTorCloseSpawnMin.Value + 1f, 220f)); } pos = plugin.EnforceNearAnchor(anchor, pos); pos = plugin.ClampToLevelBand(pos); pos = plugin.PushOutFromAnchor(anchor, pos, 6f); if (!plugin.EnforceHostProximity(ref anchor, ref pos, plugin.chTorCloseSpawnMin.Value, plugin.chTorCloseSpawnMax.Value)) { return false; } plugin.SpawnChallengeTornadoOnce(pos); return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <SpawnScorpionsWithDelay>d__200 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Plugin <>4__this; public int count; public Transform anchor; private float <delay>5__2; private int <i>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SpawnScorpionsWithDelay>d__200(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Expected O, but got Unknown int num = <>1__state; Plugin plugin = <>4__this; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_027a; } <>1__state = -1; <delay>5__2 = Mathf.Clamp(plugin.tmScorpionSpawnDelay.Value, 1f, 3f); <i>5__3 = 0; goto IL_028c; IL_027a: <i>5__3++; goto IL_028c; IL_028c: if (<i>5__3 < count) { int num2 = ((PhotonNetwork.CurrentRoom == null) ? 1 : PhotonNetwork.CurrentRoom.PlayerCount); int num3 = Mathf.Max(0, num2 - 1) * Mathf.Max(0, plugin.mpPerPlayerExtraSlots.Value); if (plugin.liveAll.Count >= plugin.maxSimultaneousGlobal.Value + num3) { Log.LogInfo((object)$"[Troublemaker] Global cap reached - stopping scorpion spawns at {<i>5__3}/{count}"); return false; } if (plugin.liveScorpion.Count >= plugin.tmMaxScorpion.Value) { Log.LogInfo((object)$"[Troublemaker] Scorpion cap reached - stopping spawns at {<i>5__3}/{count}"); return false; } if (!plugin.TryPickChallengeSpawnNearAnchor(anchor, out var pos)) { pos = plugin.ForceSpawnNearAnchor(anchor, Mathf.Clamp(plugin.tmScorpionCloseSpawnMin.Value, 3f, 200f), Mathf.Clamp(plugin.tmScorpionCloseSpawnMax.Value, plugin.tmScorpionCloseSpawnMin.Value + 1f, 220f)); } pos = plugin.EnforceNearAnchor(anchor, pos); pos = plugin.ClampToLevelBand(pos); GameObject val = null; try { val = PhotonNetwork.Instantiate("0_Items/Scorpion", pos, Random.rotation, (byte)0, (object[])null); } catch (Exception ex) { Log.LogWarning((object)("[Troublemaker] Failed to spawn Scorpion: " + ex.Message)); goto IL_027a; } if ((Object)(object)val != (Object)null) { plugin.liveAll.Add(val); plugin._kindOf[val] = HazardKind.Scorpion; plugin.liveScorpion.Add(val); ((MonoBehaviour)plugin).StartCoroutine(plugin.WakeUpScorpion(val)); ((MonoBehaviour)plugin).StartCoroutine(plugin.DespawnAfter(val, 45f)); Log.LogInfo((object)$"[Troublemaker] Scorpion {<i>5__3 + 1}/{count} spawned at {pos}"); } if (<i>5__3 < count - 1) { <>2__current = (object)new WaitForSeconds(<delay>5__2); <>1__state = 1; return true; } goto IL_027a; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <SpawnerLoop>d__194 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Plugin <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SpawnerLoop>d__194(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Expected O, but got Unknown //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_0993: Unknown result type (might be due to invalid IL or missing references) //IL_099d: Expected O, but got Unknown int num = <>1__state; Plugin plugin = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(1f); <>1__state = 1; return true; case 1: <>1__state = -1; break; case 2: <>1__state = -1; break; case 3: <>1__state = -1; break; case 4: <>1__state = -1; break; case 5: <>1__state = -1; break; case 6: <>1__state = -1; break; case 7: <>1__state = -1; break; case 8: <>1__state = -1; break; } plugin._blockReason = ""; if (!ShouldRunInScene(plugin._currentScene)) { plugin._blockReason = "Scene blocked"; <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 2; return true; } if (!PhotonNetwork.InRoom) { plugin._blockReason = "Not in room"; <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 3; return true; } if (!PhotonNetwork.IsMasterClient) { plugin._blockReason = "Only host spawns"; <>2__current = (object)new WaitForSeconds(0.25f); <>1__state = 4; return true; } float num2 = Mathf.Max(0f, plugin._sceneEnteredAt + plugin.startProtectionSec.Value - Time.time); if (num2 > 0f) { plugin._blockReason = $"Protection {num2:0.0}s"; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 5; return true; } if (plugin.worldRoot == null) { plugin.worldRoot = plugin.FindWorldRoot(); } if (!Object.op_Implicit((Object)(object)plugin.worldRoot)) { plugin._blockReason = "WorldRoot missing"; <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 6; return true; } plugin.liveAll.RemoveWhere((GameObject g) => (Object)(object)g == (Object)null); plugin.liveDyn.RemoveWhere((GameObject g) => (Object)(object)g == (Object)null); plugin.liveTor.RemoveWhere((GameObject g) => (Object)(object)g == (Object)null); plugin.liveTum.RemoveWhere((GameObject g) => (Object)(object)g == (Object)null); plugin._activeChallengeTornados.RemoveWhere((GameObject g) => (Object)(object)g == (Object)null); plugin.liveZombie.RemoveWhere((GameObject g) => (Object)(object)g == (Object)null); plugin.liveBeeSwarm.RemoveWhere((GameObject g) => (Object)(object)g == (Object)null); plugin.liveScorpion.RemoveWhere((GameObject g) => (Object)(object)g == (Object)null); int num3 = ((PhotonNetwork.CurrentRoom == null) ? 1 : PhotonNetwork.CurrentRoom.PlayerCount); int num4 = Math.Max(0, num3 - 1) * Math.Max(0, plugin.mpPerPlayerExtraSlots.Value); int num5 = plugin.maxSimultaneousGlobal.Value + num4; int num6 = plugin.maxDynamite.Value + num4; int num7 = plugin.maxTornado.Value + num4; int num8 = plugin.maxTumbleweed.Value + num4; float time = Time.time; bool flag = false; GameMode value = plugin.gameMode.Value; bool flag2 = value == GameMode.NormalOnly || value == GameMode.Both || value == GameMode.All; bool flag3 = value == GameMode.ChallengeOnly || value == GameMode.Both || value == GameMode.All; bool flag4 = value == GameMode.TroublemakerOnly || value == GameMode.All; bool flag5 = plugin.perfThrottleWhileWindowOpen.Value && plugin.IsGameWindowOpen(); if (flag5 && flag2) { plugin._blockReason = "UI open (normal paused)"; } if (flag2 && !flag5) { if (time >= plugin._nextDynaAt) { int num9 = Mathf.Max(0, num5 - plugin.liveAll.Count); int num10 = Mathf.Max(0, num6 - plugin.liveDyn.Count); int num11 = Mathf.Min(new int[3] { plugin.burstDynamite.Value, num9, num10 }); if (num11 > 0) { ((MonoBehaviour)plugin).StartCoroutine(plugin.SpawnBurst(HazardKind.Dynamite, num11, plugin.burstSpreadSeconds.Value)); plugin._nextDynaAt = time + plugin.intervalDynamiteSec.Value; flag = true; } else { plugin._nextDynaAt = time + plugin.intervalDynamiteSec.Value; } } if (time >= plugin._nextTornAt) { int num12 = Mathf.Max(0, num5 - plugin.liveAll.Count); int num13 = Mathf.Max(0, num7 - plugin.liveTor.Count); if (num12 > 0 && num13 > 0) { int num14 = ((!plugin.moreTornados.Value) ? 1 : Mathf.Clamp(plugin.burstTornado.Value, 1, 5)); num14 = Mathf.Min(new int[3] { num14, num12, num13 }); if (num14 > 0) { float totalSpreadSec = (plugin.moreTornados.Value ? plugin.burstSpreadSeconds.Value : 0f); ((MonoBehaviour)plugin).StartCoroutine(plugin.SpawnBurst(HazardKind.Tornado, num14, totalSpreadSec)); plugin._nextTornAt = time + plugin.intervalTornadoSec.Value; flag = true; } else { plugin._nextTornAt = time + plugin.intervalTornadoSec.Value; } } else { plugin._nextTornAt = time + plugin.intervalTornadoSec.Value; } } if (time >= plugin._nextTumbAt) { int num15 = Mathf.Max(0, num5 - plugin.liveAll.Count); int num16 = Mathf.Max(0, num8 - plugin.liveTum.Count); int num17 = Mathf.Min(new int[3] { plugin.burstTumbleweed.Value, num15, num16 }); if (num17 > 0) { ((MonoBehaviour)plugin).StartCoroutine(plugin.SpawnBurst(HazardKind.Tumbleweed, num17, plugin.burstSpreadSeconds.Value)); plugin._nextTumbAt = time + plugin.intervalTumbleweedSec.Value; flag = true; } else { plugin._nextTumbAt = time + plugin.intervalTumbleweedSec.Value; } } } else if (!flag2) { plugin._blockReason = "paused (normal spawns disabled)"; } if (flag3) { if (plugin._nextChallengeAt < 0f) { plugin._nextChallengeAt = plugin.NextChallengeTime(plugin.challengeIntervalSec.Value, plugin.challengeRandomJitterSec.Value); } if (Time.time >= plugin._nextChallengeAt) { bool flag6 = plugin.challengeKind.Value switch { ChallengeKind.Tornado => true, ChallengeKind.BothRandom => Random.value < 0.5f, _ => false, }; if (flag6 && plugin.challengeKind.Value == ChallengeKind.BothRandom && plugin._activeChallengeTornados != null && plugin._activeChallengeTornados.Count > 0) { flag6 = false; } if (flag6) { ((MonoBehaviour)plugin).StartCoroutine(plugin.SpawnChallengeTornadoAfterDelay()); } else { plugin.SpawnChallengeTumbleweedOnce(); } plugin._nextChallengeAt = plugin.NextChallengeTime(plugin.challengeIntervalSec.Value, plugin.challengeRandomJitterSec.Value); } } if (flag4) { if (plugin._nextTroublemakerAt < 0f) { plugin._nextTroublemakerAt = plugin.NextChallengeTime(plugin.troublemakerIntervalSec.Value, plugin.troublemakerRandomJitterSec.Value); } if (Time.time >= plugin._nextTroublemakerAt) { bool flag7 = false; List<int> list = new List<int>(); if (plugin.tmZombieEnabled.Value) { list.Add(0); } if (plugin.tmScoutmasterEnabled.Value) { list.Add(1); } if (plugin.tmBeeSwarmEnabled.Value) { list.Add(2); } if (plugin.tmScorpionEnabled.Value) { list.Add(3); } if (list.Count > 0) { for (int i = 0; i < list.Count; i++) { int value2 = list[i]; int index = Random.Range(i, list.Count); list[i] = list[index]; list[index] = value2; } foreach (int item in list) { int num18 = Random.Range(0, 100); bool flag8 = false; switch (item) { case 0: if (num18 < plugin.tmZombieSpawnChance.Value) { plugin.SpawnTroublemakerZombies(); flag7 = true; } break; case 1: if (num18 < plugin.tmScoutmasterSpawnChance.Value) { plugin.SpawnTroublemakerScoutmaster(); flag7 = true; } break; case 2: if (num18 < plugin.tmBeeSwarmSpawnChance.Value) { plugin.SpawnTroublemakerBeeSwarm(); flag7 = true; } break; case 3: if (num18 < plugin.tmScorpionSpawnChance.Value) { plugin.SpawnTroublemakerScorpions(); flag7 = true; } break; } if (flag7) { break; } } if (!flag7) { Log.LogWarning((object)"[Troublemaker] All spawn chances failed - nothing spawned this cycle"); } } else { Log.LogWarning((object)"[Troublemaker] No troublemaker types enabled!"); } plugin._nextTroublemakerAt = plugin.NextChallengeTime(plugin.troublemakerIntervalSec.Value, plugin.troublemakerRandomJitterSec.Value); } } if (flag) { <>2__current = (object)new WaitForSeconds(0.03f); <>1__state = 7; return true; } <>2__current = null; <>1__state = 8; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <TeleportScoutmasterSimple>d__197 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public Vector3 position; public Plugin <>4__this; private Scoutmaster <scoutmaster>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TeleportScoutmasterSimple>d__197(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <scoutmaster>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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) //IL_0151: Expected O, but got Unknown int num = <>1__state; Plugin plugin = <>4__this; switch (num) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; case 1: { <>1__state = -1; <scoutmaster>5__2 = null; bool flag = false; try { flag = Scoutmaster.GetPrimaryScoutmaster(ref <scoutmaster>5__2) && (Object)(object)<scoutmaster>5__2 != (Object)null; } catch (Exception ex2) { Log.LogWarning((object)("[Troublemaker] Failed to get Scoutmaster: " + ex2.Message)); return false; } if (!flag) { Log.LogWarning((object)"[Troublemaker] Scoutmaster not found in game"); return false; } PhotonView component = ((Component)<scoutmaster>5__2).GetComponent<PhotonView>(); if ((Object)(object)component == (Object)null) { Log.LogWarning((object)"[Troublemaker] Scoutmaster found but no PhotonView"); return false; } try { Log.LogInfo((object)$"[Troublemaker] Teleporting Scoutmaster to {position}"); component.RPC("WarpPlayerRPC", (RpcTarget)0, new object[2] { position, false }); } catch (Exception ex3) { Log.LogWarning((object)("[Troublemaker] Failed to teleport Scoutmaster: " + ex3.Message)); return false; } <>2__current = (object)new WaitForSeconds(0.3f); <>1__state = 2; return true; } case 2: { <>1__state = -1; Character val = null; float num2 = float.MaxValue; foreach (Character allCharacter in Character.AllCharacters) { if (Object.op_Implicit((Object)(object)allCharacter) && !allCharacter.isBot) { float num3 = Vector3.Distance(allCharacter.Center, position); if (num3 < num2) { num2 = num3; val = allCharacter; } } } if ((Object)(object)val != (Object)null) { try { MethodInfo method = typeof(Scoutmaster).GetMethod("SetCurrentTarget", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); if (method != null) { method.Invoke(<scoutmaster>5__2, new object[2] { val, plugin.tmScoutmasterChaseTime.Value }); Log.LogInfo((object)("[Troublemaker] Scoutmaster targeting " + val.characterName)); } } catch (Exception ex) { Log.LogWarning((object)("[Troublemaker] Could not set Scoutmaster target: " + ex.Message)); } } return false; } } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <WakeUpScorpion>d__201 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public GameObject scorpion; private Rigidbody <rb>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WakeUpScorpion>d__201(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <rb>5__2 = null; <>1__state = -2; } private bool MoveNext() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: 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_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 1; return true; case 1: <>1__state = -1; if (!Object.op_Implicit((Object)(object)scorpion)) { return false; } <rb>5__2 = scorpion.GetComponent<Rigidbody>(); if ((Object)(object)<rb>5__2 != (Object)null) { <rb>5__2.isKinematic = false; <rb>5__2.WakeUp(); <rb>5__2.useGravity = true; <rb>5__2.AddForce(Vector3.up * 2f, (ForceMode)1); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Random.Range(-0.5f, 0.5f), 0f, Random.Range(-0.5f, 0.5f)); <rb>5__2.AddForce(val, (ForceMode)1); Log.LogInfo((object)"[Troublemaker] Scorpion woken up with physics impulses"); } <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 2; return true; case 2: <>1__state = -1; if (!Object.op_Implicit((Object)(object)scorpion)) { return false; } if ((Object)(object)<rb>5__2 != (Object)null) { <rb>5__2.WakeUp(); <rb>5__2.AddForce(Vector3.up * 0.5f, (ForceMode)1); } return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private readonly Collider[] _spawnOverlapBuf = (Collider[])(object)new Collider[32]; public const string PLUGIN_GUID = "com.hazardchaos.mod"; public const string PLUGIN_NAME = "HazardChaos"; public const string PLUGIN_VERSION = "0.1.16"; private ConfigEntry<ChallengeKind> challengeKind; private ConfigEntry<GameMode> gameMode; private ConfigEntry<float> challengeIntervalSec; private ConfigEntry<float> challengeRandomJitterSec; private ConfigEntry<float> chTumScale; private ConfigEntry<float> chTumSpeedMult; private ConfigEntry<float> chTumRetargetSec; private float _nextChallengeAt = -1f; private GameMode _lastGameMode = (GameMode)(-1); private ConfigEntry<float> intervalDynamiteSec; private ConfigEntry<float> intervalTornadoSec; private ConfigEntry<float> intervalTumbleweedSec; private ConfigEntry<int> maxSimultaneousGlobal; private ConfigEntry<int> maxDynamite; private ConfigEntry<int> maxTornado; private ConfigEntry<int> maxTumbleweed; private ConfigEntry<int> burstDynamite; private ConfigEntry<int> burstTumbleweed; private ConfigEntry<float> burstSpreadSeconds; private ConfigEntry<bool> moreTornados; private ConfigEntry<int> burstTornado; private ConfigEntry<float> ttlDynamite; private ConfigEntry<float> ttlTornado; private ConfigEntry<float> ttlTumbleweed; private ConfigEntry<float> tornadoSpeed; private ConfigEntry<float> tornadoRetargetSec; private ConfigEntry<bool> tornadoUseVanillaAIWhenAvailable; private ConfigEntry<bool> tornadoForceModMover; private ConfigEntry<bool> requireLineOfSight; private ConfigEntry<float> startProtectionSec; private ConfigEntry<bool> uiEnabled; private ConfigEntry<KeyboardShortcut> uiToggleKey; private ConfigEntry<bool> uiVersionWatermarkEnabled; private ConfigEntry<KeyboardShortcut> uiVersionToggleKey; private ConfigEntry<Corner> uiVersionCorner; private ConfigEntry<int> uiVersionFontSize; private ConfigEntry<float> uiVersionAlpha; private ConfigEntry<int> uiVersionMargin; private ConfigEntry<AnchorMode> mpAnchorMode; private ConfigEntry<int> mpPerPlayerExtraSlots; private const string TORNADO_PREFAB_NAME = "Tornado"; private const string TUMBLEWEED_PREFAB_NAME = "TumbleWeed"; private const string DYNAMITE_ITEM_NAME = "Dynamite"; private ConfigEntry<KeyboardShortcut> keyTornado; private ConfigEntry<KeyboardShortcut> keyDynamite; private ConfigEntry<KeyboardShortcut> keyTumbleweed; private Transform worldRoot; private readonly HashSet<GameObject> liveAll = new HashSet<GameObject>(); private readonly HashSet<GameObject> liveDyn = new HashSet<GameObject>(); private readonly HashSet<GameObject> liveTor = new HashSet<GameObject>(); private readonly HashSet<GameObject> liveTum = new HashSet<GameObject>(); private readonly Dictionary<GameObject, HazardKind> _kindOf = new Dictionary<GameObject, HazardKind>(); private Coroutine _loop; private string _currentScene = ""; private string _blockReason = ""; private readonly List<Transform> _cachedAnchors = new List<Transform>(); private float _lastAnchorRefreshAt = -999f; private int _lastKnownPlayerCount = -1; private int _roundRobinIndex; private float _nextDynaAt = -1f; private float _nextTornAt = -1f; private float _nextTumbAt = -1f; private float _nextTroublemakerAt = -1f; private readonly HashSet<GameObject> liveZombie = new HashSet<GameObject>(); private readonly HashSet<GameObject> liveBeeSwarm = new HashSet<GameObject>(); private readonly HashSet<GameObject> liveScorpion = new HashSet<GameObject>(); private readonly HashSet<GameObject> _ourSpawnedZombies = new HashSet<GameObject>(); private float _sceneEnteredAt; private ConfigEntry<KeyboardShortcut> uiSettingsKey; private bool _showSettings; private Rect _settingsRect = new Rect(80f, 80f, 560f, 560f); private Vector2 _settingsScroll; private readonly Dictionary<string, bool> _fold = new Dictionary<string, bool>(); private ConfigEntry<float> settingsDimAlpha; private ConfigEntry<float> chTorScale; private ConfigEntry<float> chTorSpeedMult; private ConfigEntry<float> chTorRetargetSec; private ConfigEntry<float> chTorPullRadius; private ConfigEntry<float> chTorPullForce; private ConfigEntry<string> chTorPullLayers; private ConfigEntry<float> chTorVerticalPullBias; private ConfigEntry<float> chTorMaxClimbSpeed; private ConfigEntry<bool> chTorLiberateKinematic; private ConfigEntry<float> chTorLiberateMaxMass; private ConfigEntry<float> chTorCloseSpawnMin; private ConfigEntry<float> chTorCloseSpawnMax; private ConfigEntry<float> chTorMaxVerticalDelta; private ConfigEntry<float> chTorPreSpawnDelaySec; private ConfigEntry<float> chTorBannerSeconds; private ConfigEntry<string> chTorBannerFontName; private ConfigEntry<bool> perfThrottleWhileWindowOpen; private ConfigEntry<string> perfWindowKeywords; private HashSet<GameObject> _activeChallengeTornados = new HashSet<GameObject>(); private ConfigEntry<bool> chRequireHostNear; private ConfigEntry<float> chHostNearMeters; private ConfigEntry<float> perfUiProbeHz; private ConfigEntry<int> perfUiMaxScan; private ConfigEntry<bool> perfUiUseStrictScan; private ConfigEntry<bool> perfHardPauseHazardsWhileWindowOpen; private ConfigEntry<bool> perfAlsoPauseHazardLogic; private float _uiScanNextAtUnscaled; private bool _uiLikelyOpenCached; private bool _hazardsPaused; private ConfigEntry<float> troublemakerIntervalSec; private ConfigEntry<float> troublemakerRandomJitterSec; private ConfigEntry<bool> tmZombieEnabled; private ConfigEntry<int> tmZombieSpawnChance; private ConfigEntry<int> tmZombieCountMin; private ConfigEntry<int> tmZombieCountMax; private ConfigEntry<float> tmZombieLifetime; private ConfigEntry<float> tmZombieCloseSpawnMin; private ConfigEntry<float> tmZombieCloseSpawnMax; private ConfigEntry<bool> tmScoutmasterEnabled; private ConfigEntry<int> tmScoutmasterSpawnChance; private ConfigEntry<float> tmScoutmasterChaseTime; private ConfigEntry<bool> tmBeeSwarmEnabled; private ConfigEntry<int> tmBeeSwarmSpawnChance; private ConfigEntry<float> tmBeeSwarmAngerTime; private ConfigEntry<float> tmBeeSwarmCloseSpawnMin; private ConfigEntry<float> tmBeeSwarmCloseSpawnMax; private ConfigEntry<bool> tmScorpionEnabled; private ConfigEntry<int> tmScorpionSpawnChance; private ConfigEntry<int> tmScorpionCountMin; private ConfigEntry<int> tmScorpionCountMax; private ConfigEntry<float> tmScorpionCloseSpawnMin; private ConfigEntry<float> tmScorpionCloseSpawnMax; private ConfigEntry<float> tmScorpionSpawnDelay; private ConfigEntry<int> tmMaxZombie; private ConfigEntry<int> tmMaxScorpion; private ConfigEntry<int> tmMaxBeeSwarm; private float _perfNextTickAt; private bool _logicPaused; public static Plugin Instance { get; private set; } internal static ManualLogSource Log { get; private set; } public bool HazardsPaused => _hazardsPaused; private void RefreshAnchorsIfNeeded() { //IL_004b: 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_0084: 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_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) int num = ((PhotonNetwork.CurrentRoom == null) ? 1 : PhotonNetwork.CurrentRoom.PlayerCount); if (Time.time - _lastAnchorRefreshAt < 1f && num == _lastKnownPlayerCount && _cachedAnchors.Count > 0) { return; } _cachedAnchors.Clear(); Scene activeScene = SceneManager.GetActiveScene(); MonoBehaviour[] array = Object.FindObjectsOfType<MonoBehaviour>(); MonoBehaviour[] array2 = array; foreach (MonoBehaviour val in array2) { if (Object.op_Implicit((Object)(object)val) && ((Component)val).gameObject.activeInHierarchy && !(((Component)val).gameObject.scene != activeScene) && !(((object)val).GetType().Name != "Character")) { _cachedAnchors.Add(((Component)val).transform); } } Camera main = Camera.main; if (Object.op_Implicit((Object)(object)main) && ((Component)main).gameObject.activeInHierarchy && ((Component)main).gameObject.scene == activeScene && !_cachedAnchors.Contains(((Component)main).transform)) { _cachedAnchors.Add(((Component)main).transform); } _lastAnchorRefreshAt = Time.time; _lastKnownPlayerCount = num; if (_roundRobinIndex >= _cachedAnchors.Count) { _roundRobinIndex = 0; } } public Transform GetAnchorForAI() { int num = ((PhotonNetwork.CurrentRoom == null) ? 1 : PhotonNetwork.CurrentRoom.PlayerCount); if (num <= 1 && Object.op_Implicit((Object)(object)Camera.main)) { return ((Component)Camera.main).transform; } Transform val = null; try { val = PickAnchorByMode(); } catch { } if (Object.op_Implicit((Object)(object)val)) { return val; } if (Object.op_Implicit((Object)(object)Camera.main)) { return ((Component)Camera.main).transform; } if (!Object.op_Implicit((Object)(object)worldRoot)) { return null; } return worldRoot; } public Transform PickAnchorByMode() { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) RefreshAnchorsIfNeeded(); switch (mpAnchorMode.Value) { case AnchorMode.HostOnly: return LocalCam() ?? _cachedAnchors.FirstOrDefault(); case AnchorMode.RandomPlayer: if (_cachedAnchors.Count == 0) { return LocalCam(); } return _cachedAnchors[Random.Range(0, _cachedAnchors.Count)]; case AnchorMode.RoundRobin: { if (_cachedAnchors.Count == 0) { return LocalCam(); } Transform result2 = _cachedAnchors[_roundRobinIndex]; _roundRobinIndex = (_roundRobinIndex + 1) % _cachedAnchors.Count; return result2; } default: { Transform val = LocalCam(); if (!Object.op_Implicit((Object)(object)val) || _cachedAnchors.Count == 0) { return val; } float num = float.MaxValue; Transform result = val; { foreach (Transform cachedAnchor in _cachedAnchors) { if (Object.op_Implicit((Object)(object)cachedAnchor)) { Vector3 val2 = cachedAnchor.position - val.position; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = cachedAnchor; } } } return result; } } } static Transform LocalCam() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_002c: Unknown result type (might be due to invalid IL or missing references) Scene activeScene = SceneManager.GetActiveScene(); Camera main = Camera.main; if (!Object.op_Implicit((Object)(object)main) || !((Component)main).gameObject.activeInHierarchy || !(((Component)main).gameObject.scene == activeScene)) { return null; } return ((Component)main).transform; } } public Vector3? PickSpawnPosNear(Transform anchor, float minDist = 8f, float maxDist = 18f, bool requireLOS = true) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_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_002c: 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_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01dc: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0117: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_013e: 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_0191: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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) if (!Object.op_Implicit((Object)(object)anchor)) { return null; } Vector3 val = anchor.position + Vector3.up * 1.6f; Vector3 forward = anchor.forward; bool flag = ((Vector3)(ref forward)).sqrMagnitude > 0.05f; Vector3 val3; RaycastHit val5 = default(RaycastHit); RaycastHit val8 = default(RaycastHit); for (int i = 0; i < 28; i++) { float num = (flag ? Random.Range(-90f, 90f) : Random.Range(-180f, 180f)); Vector3 val2 = (flag ? (Quaternion.Euler(0f, num, 0f) * forward) : (Quaternion.Euler(0f, num, 0f) * Vector3.forward)); float num2 = Random.Range(minDist, maxDist); Vector3 position = anchor.position; val3 = new Vector3(val2.x, 0f, val2.z); Vector3 val4 = position + ((Vector3)(ref val3)).normalized * num2; if (!Physics.Raycast(val4 + Vector3.up * 60f, Vector3.down, ref val5, 200f, -1, (QueryTriggerInteraction)1)) { continue; } Vector3 val6 = ((RaycastHit)(ref val5)).point + Vector3.up * 0.1f; if (Physics.CheckSphere(val6 + Vector3.up * 0.5f, 0.35f, -1, (QueryTriggerInteraction)1)) { continue; } if (requireLOS) { Vector3 val7 = val6 - val; float magnitude = ((Vector3)(ref val7)).magnitude; if (magnitude > 0.5f && Physics.Raycast(val, ((Vector3)(ref val7)).normalized, ref val8, magnitude - 0.5f, -1, (QueryTriggerInteraction)1)) { continue; } } return val6; } RaycastHit val11 = default(RaycastHit); for (int j = 0; j < 10; j++) { float num3 = Random.Range(-180f, 180f); Vector3 val9 = Quaternion.Euler(0f, num3, 0f) * Vector3.forward; float num4 = Random.Range(minDist, maxDist); Vector3 position2 = anchor.position; val3 = new Vector3(val9.x, 0f, val9.z); Vector3 val10 = position2 + ((Vector3)(ref val3)).normalized * num4; if (Physics.Raycast(val10 + Vector3.up * 60f, Vector3.down, ref val11, 200f, -1, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val11)).point + Vector3.up * 0.1f; } } return null; } public Vector3? PickSpawnPosNearPlayer(float minDist = 10f, float maxDist = 22f, bool requireLOS = false) { Transform anchor = (Object.op_Implicit((Object)(object)Camera.main) ? ((Component)Camera.main).transform : PickAnchorByMode()); return PickSpawnPosNear(anchor, minDist, maxDist, requireLOS); } private Transform FindWorldRoot() { //IL_0066: 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) string[] array = new string[6] { "WorldRoot", "DynamicRoot", "LevelRoot", "Environment", "Hazards", "Map" }; string[] array2 = array; foreach (string text in array2) { GameObject val = GameObject.Find(text); if (Object.op_Implicit((Object)(object)val)) { return val.transform; } } Scene activeScene = SceneManager.GetActiveScene(); GameObject[] rootGameObjects = ((Scene)(ref activeScene)).GetRootGameObjects(); GameObject? obj = ((IEnumerable<GameObject>)rootGameObjects).FirstOrDefault((Func<GameObject, bool>)((GameObject r) => r.activeInHierarchy && !Object.op_Implicit((Object)(object)r.GetComponentInChildren<Canvas>()))); if (obj == null) { return null; } return obj.transform; } private bool TryPickChallengeSpawnNearAnchor(Transform anchor, out Vector3 pos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0109: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012a: 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_0139: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) pos = default(Vector3); if (!Object.op_Implicit((Object)(object)anchor)) { return false; } float num = Mathf.Clamp(chTorCloseSpawnMin.Value, 10f, 200f); float num2 = Mathf.Clamp(chTorCloseSpawnMax.Value, num + 1f, 220f); float num3 = Mathf.Clamp(chTorMaxVerticalDelta.Value, 4f, 80f); int num4 = 18; float num5 = Random.value * (float)Math.PI * 2f; float y = anchor.position.y; Vector3 val = default(Vector3); for (int i = 0; i < num4; i++) { float num6 = num5 + (float)i * ((float)Math.PI * 2f / (float)num4); float num7 = Random.Range(num, num2); ((Vector3)(ref val))..ctor(Mathf.Cos(num6), 0f, Mathf.Sin(num6)); Vector3 p = anchor.position + val * num7 + Vector3.up * 2f; if (GroundSnapEx(p, out var snapped, out var normal) && !(normal.y < 0.5f) && !(Mathf.Abs(snapped.y - y) > num3) && IsCapsuleFreeLight(snapped)) { pos = snapped + ((Vector3)(ref normal)).normalized * 0.35f; return true; } } return false; } private Vector3 ForceSpawnNearAnchor(Transform anchor, float min, float max) { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: 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_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0022: 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_0027: 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) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)anchor)) { return (Object.op_Implicit((Object)(object)worldRoot) ? worldRoot.position : Vector3.zero) + Vector3.up * 2f; } float num = Random.Range(Mathf.Clamp(min, 10f, 200f), Mathf.Clamp(max, Mathf.Max(min + 1f, 11f), 220f)); float num2 = Random.Range(0f, (float)Math.PI * 2f); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(Mathf.Cos(num2), 0f, Mathf.Sin(num2)); Vector3 val2 = anchor.position + val * num + Vector3.up * 2f; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val2 + Vector3.up * 80f, Vector3.down, ref val3, 200f, -1, (QueryTriggerInteraction)1)) { Vector3 point = ((RaycastHit)(ref val3)).point; Vector3 normal = ((RaycastHit)(ref val3)).normal; return point + ((Vector3)(ref normal)).normalized * 0.25f; } return val2; } private Vector3 EnforceNearAnchor(Transform anchor, Vector3 pos) { //IL_0060: 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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0097: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)anchor)) { return pos; } float num = Mathf.Clamp(chTorCloseSpawnMin.Value, 10f, 200f); float num2 = Mathf.Clamp(chTorCloseSpawnMax.Value, num + 1f, 220f); float num3 = Mathf.Clamp(chTorMaxVerticalDelta.Value, 4f, 80f); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(anchor.position.x, 0f, anchor.position.z); Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(pos.x, 0f, pos.z); Vector3 val3 = val2 - val; float magnitude = ((Vector3)(ref val3)).magnitude; if (magnitude < 0.001f) { Vector3 forward = anchor.forward; val3 = ((((Vector3)(ref forward)).sqrMagnitude > 0.01f) ? anchor.forward : Vector3.forward); } Vector3 val4 = ((magnitude < num) ? (val + ((Vector3)(ref val3)).normalized * num) : ((magnitude > num2) ? (val + ((Vector3)(ref val3)).normalized * num2) : val2)); float num4 = Mathf.Clamp(pos.y, anchor.position.y - num3, anchor.position.y + num3); Vector3 val5 = new Vector3(val4.x, num4, val4.z) + Vector3.up * 2f; if (!GroundSnapEx(val5, out var snapped, out var normal)) { return val5; } return snapped + ((Vector3)(ref normal)).normalized * 0.35f; } private bool GroundSnapEx(Vector3 p, out Vector3 snapped, out Vector3 normal) { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0046: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: 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_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_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) RaycastHit val = default(RaycastHit); if (Physics.Raycast(p + Vector3.up * 80f, Vector3.down, ref val, 200f, -1, (QueryTriggerInteraction)1)) { snapped = ((RaycastHit)(ref val)).point + Vector3.up * 0.05f; normal = ((RaycastHit)(ref val)).normal; return true; } if (Physics.Raycast(p + Vector3.down * 5f, Vector3.up, ref val, 40f, -1, (QueryTriggerInteraction)1)) { snapped = ((RaycastHit)(ref val)).point + Vector3.up * 0.05f; normal = ((RaycastHit)(ref val)).normal; return true; } snapped = p; normal = Vector3.up; return false; } private bool IsCapsuleFreeLight(Vector3 pos) { //IL_0049: 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_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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0060: 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_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Max(1f, (chTorScale != null) ? chTorScale.Value : 1f); float num2 = Mathf.Max(0.7f, 0.6f * num); float num3 = Mathf.Max(3f, 2.4f * num); Vector3 val = pos + Vector3.up * 0.5f; Vector3 val2 = pos + Vector3.up * (0.5f + num3); int num4 = Physics.OverlapCapsuleNonAlloc(val, val2, num2, _spawnOverlapBuf, -1, (QueryTriggerInteraction)1); for (int i = 0; i < num4; i++) { Collider val3 = _spawnOverlapBuf[i]; if (Object.op_Implicit((Object)(object)val3) && !val3.isTrigger) { Rigidbody attachedRigidbody = val3.attachedRigidbody; if ((Object)(object)attachedRigidbody == (Object)null || attachedRigidbody.isKinematic) { return false; } } } return true; } private Vector3 ClampToLevelBand(Vector3 p) { //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: 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_0051: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0038: 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_0045: 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_00a0: 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_0083: 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_008b: 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_009a: Unknown result type (might be due to invalid IL or missing references) RaycastHit val = default(RaycastHit); Vector3 normal; if (Physics.Raycast(p + Vector3.up * 80f, Vector3.down, ref val, 200f, -1, (QueryTriggerInteraction)1)) { Vector3 point = ((RaycastHit)(ref val)).point; normal = ((RaycastHit)(ref val)).normal; return point + ((Vector3)(ref normal)).normalized * 0.25f; } if (Physics.Raycast(p + Vector3.down * 5f, Vector3.up, ref val, 40f, -1, (QueryTriggerInteraction)1)) { Vector3 point2 = ((RaycastHit)(ref val)).point; normal = ((RaycastHit)(ref val)).normal; return point2 + ((Vector3)(ref normal)).normalized * 0.25f; } return p; } private Transform GetHostAnchor() { try { if ((PhotonNetwork.OfflineMode || PhotonNetwork.IsMasterClient) && Object.op_Implicit((Object)(object)Camera.main)) { return ((Component)Camera.main).transform; } Transform val = null; PhotonView[] array = Object.FindObjectsOfType<PhotonView>(true); foreach (PhotonView val2 in array) { if (!Object.op_Implicit((Object)(object)val2) || val2.Owner == null || !val2.Owner.IsMasterClient) { continue; } Transform transform = ((Component)val2).transform; if (Object.op_Implicit((Object)(object)transform) && ((Component)transform).gameObject.activeInHierarchy) { if ((Object)(object)((Component)transform).GetComponent<CharacterController>() != (Object)null || (Object)(object)((Component)transform).GetComponentInChildren<CharacterController>(true) != (Object)null || ((Component)transform).CompareTag("Player")) { return transform; } if (val == null) { val = transform; } } } if (Object.op_Implicit((Object)(object)val)) { return val; } if (Object.op_Implicit((Object)(object)Camera.main)) { return ((Component)Camera.main).transform; } return Object.op_Implicit((Object)(object)worldRoot) ? worldRoot : null; } catch { return Object.op_Implicit((Object)(object)Camera.main) ? ((Component)Camera.main).transform : worldRoot; } } private static float PlanarDistance(Vector3 a, Vector3 b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) float num = a.x - b.x; float num2 = a.z - b.z; return Mathf.Sqrt(num * num + num2 * num2); } private bool EnforceHostProximity(ref Transform anchor, ref Vector3 pos, float ringMin, float ringMax) { //IL_004e: 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_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_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) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: 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_00a5: 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_00d0: Unknown result type (might be due to invalid IL or missing references) if (chRequireHostNear == null || !chRequireHostNear.Value) { return true; } Transform hostAnchor = GetHostAnchor(); if (!Object.op_Implicit((Object)(object)hostAnchor)) { return true; } float num = Mathf.Max(1f, (chHostNearMeters != null) ? chHostNearMeters.Value : 150f); if (PlanarDistance(hostAnchor.position, pos) <= num) { return true; } anchor = hostAnchor; if (!TryPickChallengeSpawnNearAnchor(hostAnchor, out var pos2)) { pos2 = ForceSpawnNearAnchor(hostAnchor, Mathf.Clamp(ringMin, 10f, 200f), Mathf.Clamp(ringMax, Mathf.Max(ringMin + 1f, 11f), 220f)); } pos2 = EnforceNearAnchor(hostAnchor, pos2); pos2 = ClampToLevelBand(pos2); if (PlanarDistance(hostAnchor.position, pos2) > num * 1.1f) { return false; } pos = pos2; return true; } private void ResetTimersForMode(GameMode mode) { float now = Time.time; _nextDynaAt = -1f; _nextTornAt = -1f; _nextTumbAt = -1f; _nextChallengeAt = -1f; _nextTroublemakerAt = -1f; int num; switch (mode) { case GameMode.Off: return; default: num = ((mode == GameMode.All) ? 1 : 0); break; case GameMode.NormalOnly: case GameMode.Both: num = 1; break; } bool flag = (byte)num != 0; bool flag2 = mode == GameMode.ChallengeOnly || mode == GameMode.Both || mode == GameMode.All; bool flag3 = mode == GameMode.TroublemakerOnly || mode == GameMode.All; if (flag) { _nextDynaAt = Seed(intervalDynamiteSec.Value); _nextTornAt = Seed(intervalTornadoSec.Value); _nextTumbAt = Seed(intervalTumbleweedSec.Value); } if (flag2) { _nextChallengeAt = NextChallengeTime(challengeIntervalSec.Value, challengeRandomJitterSec.Value); } if (flag3) { _nextTroublemakerAt = NextChallengeTime(troublemakerIntervalSec.Value, troublemakerRandomJitterSec.Value); } Log.LogInfo((object)$"[HazardChaos] Timers reset for mode: {mode}"); float Seed(float baseInterval) { return now + Random.Range(0.4f, 1.2f) * Mathf.Max(0.01f, baseInterval); } } private void Awake() { //IL_0b38: Unknown result type (might be due to invalid IL or missing references) //IL_0b88: Unknown result type (might be due to invalid IL or missing references) //IL_0bdc: Unknown result type (might be due to invalid IL or missing references) //IL_0cf7: Unknown result type (might be due to invalid IL or missing references) //IL_0d26: Unknown result type (might be due to invalid IL or missing references) //IL_0d55: Unknown result type (might be due to invalid IL or missing references) Log = ((BaseUnityPlugin)this).Logger; Instance = this; intervalDynamiteSec = ((BaseUnityPlugin)this).Config.Bind<float>("Intervals", "IntervalDynamiteSec", 15f, "Spawn interval for Dynamite (seconds)"); intervalTornadoSec = ((BaseUnityPlugin)this).Config.Bind<float>("Intervals", "IntervalTornadoSec", 90f, "Spawn interval for Tornado (seconds)"); intervalTumbleweedSec = ((BaseUnityPlugin)this).Config.Bind<float>("Intervals", "IntervalTumbleweedSec", 12f, "Spawn interval for Tumbleweed (seconds)"); maxSimultaneousGlobal = ((BaseUnityPlugin)this).Config.Bind<int>("Spawning", "MaxSimultaneousGlobal", 6, "Global cap across all hazards"); maxDynamite = ((BaseUnityPlugin)this).Config.Bind<int>("Spawning", "MaxDynamite", 2, "Max simultaneous Dynamite"); maxTornado = ((BaseUnityPlugin)this).Config.Bind<int>("Spawning", "MaxTornado", 1, "Max simultaneous Tornado"); maxTumbleweed = ((BaseUnityPlugin)this).Config.Bind<int>("Spawning", "MaxTumbleweed", 3, "Max simultaneous Tumbleweed"); tmMaxZombie = ((BaseUnityPlugin)this).Config.Bind<int>("Spawning", "Max Zombie", 2, "Maximum concurrent zombies"); tmMaxScorpion = ((BaseUnityPlugin)this).Config.Bind<int>("Spawning", "Max Scorpion", 3, "Maximum concurrent scorpions"); tmMaxBeeSwarm = ((BaseUnityPlugin)this).Config.Bind<int>("Spawning", "Max BeeSwarm", 1, "Maximum concurrent bee swarms"); burstDynamite = ((BaseUnityPlugin)this).Config.Bind<int>("Spawning", "BurstDynamite", 2, "How many Dynamite to spawn per tick"); burstTumbleweed = ((BaseUnityPlugin)this).Config.Bind<int>("Spawning", "BurstTumbleweed", 3, "How many Tumbleweeds to spawn per tick"); burstSpreadSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Spawning", "BurstSpreadSeconds", 3f, "Distribute a burst across this duration (0 = spawn instantly)"); requireLineOfSight = ((BaseUnityPlugin)this).Config.Bind<bool>("Spawning", "RequireLineOfSight", false, "Require LoS from anchor to spawn point"); startProtectionSec = ((BaseUnityPlugin)this).Config.Bind<float>("Spawning", "StartProtectionSec", 60f, "Protection window after level load (seconds)"); gameMode = ((BaseUnityPlugin)this).Config.Bind<GameMode>("Mode", "GameMode", GameMode.NormalOnly, "Off | NormalOnly | ChallengeOnly | Both"); challengeKind = ((BaseUnityPlugin)this).Config.Bind<ChallengeKind>("Mode", "ChallengeMode", ChallengeKind.Tornado, "Tumbleweed, Tornado or BothRandom."); challengeIntervalSec = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge", "IntervalSeconds", 30f, "Base interval (s)"); challengeRandomJitterSec = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge", "RandomJitterSeconds", 0f, "Random +/- jitter (s)"); chRequireHostNear = ((BaseUnityPlugin)this).Config.Bind<bool>("Challenge", "RequireHostNear", true, "Only if Host is nearby."); chHostNearMeters = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge", "HostNearMeters", 150f, "Host near Anchor in Meters."); chTumScale = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge.Tumbleweed", "Scale", 4f, "Visual scale multiplier"); chTumSpeedMult = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge.Tumbleweed", "SpeedMult", 3f, "Chase speed multiplier"); chTumRetargetSec = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge.Tumbleweed", "RetargetSeconds", 1.5f, "Retarget cadence (s)"); chTorScale = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge.Tornado", "Scale", 3f, "Visual scale of the tornado (2–5 recommended)."); chTorSpeedMult = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge.Tornado", "SpeedMult", 2f, "Movement speed multiplier for the challenge tornado."); chTorRetargetSec = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge.Tornado", "RetargetSec", 2f, "Seconds between retargeting (1.5–3 recommended)."); chTorPullRadius = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge.Tornado", "PullRadius", 50f, "Pull radius (m)"); chTorPullForce = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge.Tornado", "PullForce", 100f, "Pull force (acceleration)"); chTorPullLayers = ((BaseUnityPlugin)this).Config.Bind<string>("Challenge.Tornado", "PullLayers", "Default;Player;Item;Interactable;Grabbable", "Layer list"); chTorVerticalPullBias = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge.Tornado", "VerticalPullBias", 0.35f, "Vertical pull factor (0..1)"); chTorMaxClimbSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge.Tornado", "MaxClimbSpeed", 10f, "Max climb speed (m/s, 0 = off)"); chTorLiberateKinematic = ((BaseUnityPlugin)this).Config.Bind<bool>("Challenge.Tornado", "LiberateKinematic", true, "Toggle kinematic"); chTorLiberateMaxMass = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge.Tornado", "LiberateMaxMass", 150f, "Max Mass"); chTorCloseSpawnMin = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge.Tornado", "CloseSpawnMin", 40f, "Minimum distance to anchor (m)"); chTorCloseSpawnMax = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge.Tornado", "CloseSpawnMax", 50f, "Maximum distance to anchor (m)"); chTorMaxVerticalDelta = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge.Tornado", "MaxVerticalDelta", 20f, "Max vertical delta to anchor (m)"); chTorPreSpawnDelaySec = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge.Tornado", "PreSpawnDelaySec", 8f, "Delay after banner (s)"); chTorBannerSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Challenge.Tornado", "BannerSeconds", 6f, "Banner display time (s)"); chTorBannerFontName = ((BaseUnityPlugin)this).Config.Bind<string>("Challenge.Tornado", "BannerFont", "Darumadrop One", "Banner font (if available)"); troublemakerIntervalSec = ((BaseUnityPlugin)this).Config.Bind<float>("Troublemaker", "Interval", 90f, "Seconds between troublemaker spawns"); troublemakerRandomJitterSec = ((BaseUnityPlugin)this).Config.Bind<float>("Troublemaker", "Random Jitter", 20f, "Random time variance for troublemaker spawns"); tmZombieEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Troublemaker.Zombie", "Enabled", true, "Enable mushroom zombie spawns"); tmZombieSpawnChance = ((BaseUnityPlugin)this).Config.Bind<int>("Troublemaker.Zombie", "Spawn Chance", 100, "Percentage chance (0-100) to spawn zombies"); tmZombieCountMin = ((BaseUnityPlugin)this).Config.Bind<int>("Troublemaker.Zombie", "Count Min", 1, "Minimum zombies to spawn"); tmZombieCountMax = ((BaseUnityPlugin)this).Config.Bind<int>("Troublemaker.Zombie", "Count Max", 2, "Maximum zombies to spawn"); tmZombieLifetime = ((BaseUnityPlugin)this).Config.Bind<float>("Troublemaker.Zombie", "Lifetime", 120f, "Seconds before zombie auto-dies"); tmZombieCloseSpawnMin = ((BaseUnityPlugin)this).Config.Bind<float>("Troublemaker.Zombie", "Close Spawn Min", 5f, "Minimum spawn distance from player"); tmZombieCloseSpawnMax = ((BaseUnityPlugin)this).Config.Bind<float>("Troublemaker.Zombie", "Close Spawn Max", 12f, "Maximum spawn distance from player"); tmScoutmasterEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Troublemaker.Scoutmaster", "Enabled", true, "Enable scoutmaster summon"); tmScoutmasterSpawnChance = ((BaseUnityPlugin)this).Config.Bind<int>("Troublemaker.Scoutmaster", "Spawn Chance", 100, "Percentage chance (0-100) to summon scoutmaster"); tmScoutmasterChaseTime = ((BaseUnityPlugin)this).Config.Bind<float>("Troublemaker.Scoutmaster", "Chase Time", 12f, "Seconds scoutmaster chases target player"); tmBeeSwarmEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Troublemaker.BeeSwarm", "Enabled", true, "Enable bee swarm spawns"); tmBeeSwarmSpawnChance = ((BaseUnityPlugin)this).Config.Bind<int>("Troublemaker.BeeSwarm", "Spawn Chance", 100, "Percentage chance (0-100) to spawn bee swarm"); tmBeeSwarmAngerTime = ((BaseUnityPlugin)this).Config.Bind<float>("Troublemaker.BeeSwarm", "Anger Time", 20f, "Seconds bees stay angry"); tmBeeSwarmCloseSpawnMin = ((BaseUnityPlugin)this).Config.Bind<float>("Troublemaker.BeeSwarm", "Close Spawn Min", 4f, "Minimum spawn distance from player"); tmBeeSwarmCloseSpawnMax = ((BaseUnityPlugin)this).Config.Bind<float>("Troublemaker.BeeSwarm", "Close Spawn Max", 10f, "Maximum spawn distance from player"); tmScorpionEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Troublemaker.Scorpion", "Enabled", true, "Enable scorpion spawns"); tmScorpionSpawnChance = ((BaseUnityPlugin)this).Config.Bind<int>("Troublemaker.Scorpion", "Spawn Chance", 100, "Percentage chance (0-100) to spawn scorpions"); tmScorpionCountMin = ((BaseUnityPlugin)this).Config.Bind<int>("Troublemaker.Scorpion", "Count Min", 1, "Minimum scorpions to spawn"); tmScorpionCountMax = ((BaseUnityPlugin)this).Config.Bind<int>("Troublemaker.Scorpion", "Count Max", 3, "Maximum scorpions to spawn"); tmScorpionSpawnDelay = ((BaseUnityPlugin)this).Config.Bind<float>("Troublemaker.Scorpion", "Spawn Delay", 1.5f, "Delay in seconds between spawning multiple scorpions (1-3s)"); tmScorpionCloseSpawnMin = ((BaseUnityPlugin)this).Config.Bind<float>("Troublemaker.Scorpion", "Close Spawn Min", 3f, "Minimum spawn distance from player"); tmScorpionCloseSpawnMax = ((BaseUnityPlugin)this).Config.Bind<float>("Troublemaker.Scorpion", "Close Spawn Max", 8f, "Maximum spawn distance from player"); perfThrottleWhileWindowOpen = ((BaseUnityPlugin)this).Config.Bind<bool>("Performance", "ThrottleWhileWindowOpen", true, "Throttle spawns while a UI window is open"); perfWindowKeywords = ((BaseUnityPlugin)this).Config.Bind<string>("Performance", "WindowKeywords", "Passport;Terminal;Boarding;Ticket;Popup;Window;opening window", "Root canvas names to detect in-game windows"); perfUiProbeHz = ((BaseUnityPlugin)this).Config.Bind<float>("Performance", "UIProbeHz", 2f, "How often to scan for in-game windows (Hz). Lower = cheaper. 0 = every 0.5s fallback."); perfUiMaxScan = ((BaseUnityPlugin)this).Config.Bind<int>("Performance", "UIMaxScan", 800, "Hard cap for inspected objects during UI scan (safety against huge UIs)."); perfUiUseStrictScan = ((BaseUnityPlugin)this).Config.Bind<bool>("Performance", "UIUseStrictScan", false, "If true, also checks for active 'Selectable' controls via reflection (slower)."); perfHardPauseHazardsWhileWindowOpen = ((BaseUnityPlugin)this).Config.Bind<bool>("Performance", "HardPauseHazardsWhenWindowOpen", true, "If true, all hazard Renderers/Particles are disabled while an in-game UI window is open (huge GPU win)."); perfAlsoPauseHazardLogic = ((BaseUnityPlugin)this).Config.Bind<bool>("Performance", "AlsoPauseHazardLogic", false, "If true, movement and puller logic are paused while UI is open (CPU win). Off keeps hazards dangerous."); ttlDynamite = ((BaseUnityPlugin)this).Config.Bind<float>("TTL", "DynamiteDespawn", 10f, "Lifetime Dynamite (s)"); ttlTornado = ((BaseUnityPlugin)this).Config.Bind<float>("TTL", "TornadoDespawn", 120f, "Lifetime Tornado (s)"); ttlTumbleweed = ((BaseUnityPlugin)this).Config.Bind<float>("TTL", "TumbleweedDespawn", 20f, "Lifetime Tumbleweed (s)"); tornadoSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Tornado", "MoveSpeed", 10f, "Tornado speed (m/s)"); tornadoRetargetSec = ((BaseUnityPlugin)this).Config.Bind<float>("Tornado", "RetargetSeconds", 3f, "Seconds until new target"); tornadoUseVanillaAIWhenAvailable = ((BaseUnityPlugin)this).Config.Bind<bool>("Tornado", "UseVanillaWhenAvailable", true, "If a TornadoSpawner exists and can init, use the game's AI"); tornadoForceModMover = ((BaseUnityPlugin)this).Config.Bind<bool>("Tornado", "ForceModMover", false, "Force using mod's mover even if Vanilla AI is available"); moreTornados = ((BaseUnityPlugin)this).Config.Bind<bool>("Tornado", "MoreTornados", false, "If ON, Tornado spawns can use burst logic (up to 5 per tick, subject to caps). If OFF, only one per tick."); burstTornado = ((BaseUnityPlugin)this).Config.Bind<int>("Tornado", "BurstTornado", 1, "How many Tornados to spawn per tick when MoreTornados is ON (1..5)."); uiToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Overlay", "HotkeyOverlay", new KeyboardShortcut((KeyCode)290, Array.Empty<KeyCode>()), "Toggle UI"); uiEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Overlay", "SpawnTimerUI", false, "Show per-hazard timers UI"); uiSettingsKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Overlay", "HotkeySettings", new KeyboardShortcut((KeyCode)292, Array.Empty<KeyCode>()), "Open/close the in-game HazardChaos settings window"); settingsDimAlpha = ((BaseUnityPlugin)this).Config.Bind<float>("Overlay", "SettingsDimAlpha", 0.55f, "Background dim alpha when settings are open (0..1)"); uiVersionToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("Version", "HotkeyVersion", new KeyboardShortcut((KeyCode)291, Array.Empty<KeyCode>()), "Toggle version watermark"); uiVersionWatermarkEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Version", "WatermarkEnabled", false, "Show version watermark in all scenes"); uiVersionCorner = ((BaseUnityPlugin)this).Config.Bind<Corner>("Version", "Corner", Corner.TopRight, "Corner for version watermark"); uiVersionFontSize = ((BaseUnityPlugin)this).Config.Bind<int>("Version", "FontSize", 10, "Font size of version watermark"); uiVersionAlpha = ((BaseUnityPlugin)this).Config.Bind<float>("Version", "Alpha", 0.65f, "Background alpha (0..1) of version watermark"); uiVersionMargin = ((BaseUnityPlugin)this).Config.Bind<int>("Version", "Margin", 8, "Margin to screen edges (px)"); mpAnchorMode = ((BaseUnityPlugin)this).Config.Bind<AnchorMode>("Multiplayer", "AnchorMode", AnchorMode.RandomPlayer, "How t