Decompiled source of WavesAcrossAllMaps v1.0.0
Mods/WAAM.dll
Decompiled 3 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using HarmonyLib; using Il2Cpp; using Il2CppCoreNet.Utils; using Il2CppFemur; using Il2CppGB.Core; using Il2CppGB.Core.Loading; using Il2CppGB.Data.Loading; using Il2CppGB.Game; using Il2CppGB.Game.Data; using Il2CppGB.Game.Escalation; using Il2CppGB.Game.Tool; using Il2CppGB.Gamemodes; using Il2CppGB.Networking.Components.Server; using Il2CppGB.Networking.Utils.Spawn; using Il2CppGB.UI; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Reflection; using MelonLoader; using MelonLoader.Preferences; using MelonLoader.Utils; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.AI; using UnityEngine.AddressableAssets; using UnityEngine.ResourceManagement.AsyncOperations; using UnityEngine.SceneManagement; using WAAMP; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(WaampMod), "Waves Across All Maps (WAAM)", "1.0.0", "KillerTank", null)] [assembly: HarmonyDontPatchAll] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("WAAM")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WAAM")] [assembly: AssemblyTitle("WAAM")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace WAAMP { internal static class SpawnDirector { internal struct Door { public Vector3 spawn; public Vector3 exit; } private class Push { public Actor actor; public Rigidbody[] rbs; public Door door; public Vector3 dir; public float until; public bool done; } internal enum Mode { Off, Own, Player } private static readonly List<Door> _doors = new List<Door>(); private static int _doorNext; private const float PushTime = 2.5f; private const float PushAccel = 30f; private const float PushMaxSpeed = 3.5f; private const float ExitReached = 0.8f; private static readonly Dictionary<IntPtr, Push> _pushes = new Dictionary<IntPtr, Push>(); private static int _pushLogged; internal static Mode Current = Mode.Off; private static readonly HashSet<IntPtr> _handled = new HashSet<IntPtr>(); private static readonly Dictionary<IntPtr, int> _pending = new Dictionary<IntPtr, int>(); private static readonly List<GBSpawnCircle> _circles = new List<GBSpawnCircle>(); private static int _placed; private static float _roundStart; private static bool _watchdogFired; private static bool _sawEnemy; private static readonly Dictionary<IntPtr, bool> _humans = new Dictionary<IntPtr, bool>(); private static readonly Dictionary<IntPtr, float> _respawnPending = new Dictionary<IntPtr, float>(); private static float _respawnScan; private static readonly HashSet<IntPtr> _teamFreed = new HashSet<IntPtr>(); private static readonly Dictionary<IntPtr, (float time, bool big, Vector3 at)> _placedAt = new Dictionary<IntPtr, (float, bool, Vector3)>(); private static readonly Dictionary<IntPtr, float> _maxSpeed = new Dictionary<IntPtr, float>(); private static int _earlyDeaths; private static Vector3 _carry; private static int _stack; private static readonly Vector3[] Dirs8 = (Vector3[])(object)new Vector3[8] { new Vector3(1f, 0f, 0f), new Vector3(-1f, 0f, 0f), new Vector3(0f, 0f, 1f), new Vector3(0f, 0f, -1f), new Vector3(0.707f, 0f, 0.707f), new Vector3(-0.707f, 0f, 0.707f), new Vector3(0.707f, 0f, -0.707f), new Vector3(-0.707f, 0f, -0.707f) }; private static int _playersFrame = -1; private static readonly List<Vector3> _players = new List<Vector3>(); private static readonly List<Vector3> _playersEx = new List<Vector3>(); private static readonly Dictionary<IntPtr, (int frame, Vector3 dir, bool apply)> _steerCache = new Dictionary<IntPtr, (int, Vector3, bool)>(); private static bool _steerError; private static readonly float[] Fan = new float[9] { 0f, 30f, -30f, 60f, -60f, 90f, -90f, 135f, -135f }; private static readonly Dictionary<IntPtr, (int frame, bool onMesh)> _meshCache = new Dictionary<IntPtr, (int, bool)>(); private static int _steerLogged; private static Rigidbody _currentPlatform; private static bool _alwaysSteer; private static readonly Dictionary<IntPtr, Vector3> _gameDir = new Dictionary<IntPtr, Vector3>(); private static readonly Dictionary<IntPtr, int> _gameOverwrites = new Dictionary<IntPtr, int>(); private static readonly Dictionary<IntPtr, (Vector3 pos, float since, float until, int side, int episodes)> _detour = new Dictionary<IntPtr, (Vector3, float, float, int, int)>(); private static int _detourLogged; private static readonly float[] DetourAngles = new float[4] { 90f, 60f, 120f, 135f }; private static readonly Dictionary<IntPtr, (Vector3 pos, float since, bool told)> _stuck = new Dictionary<IntPtr, (Vector3, float, bool)>(); private static int _stuckReports; private const int MaxStuckReports = 8; private static void SetupDoors(string map) { //IL_00bd: 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_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0133: 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_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_0165: Unknown result type (might be due to invalid IL or missing references) _doors.Clear(); _doorNext = Random.Range(0, 100); if (!MapState.Same(MapState.Norm(map ?? ""), "chute")) { return; } List<GBSpawnPoint> spawnPoints = GBServerSpawnManager._spawnPoints; List<Vector3> list = new List<Vector3>(); List<Vector3> list2 = new List<Vector3>(); if (spawnPoints != null) { for (int i = 0; i < spawnPoints.Count; i++) { GBSpawnPoint val = spawnPoints[i]; if (!((Object)(object)val == (Object)null)) { SpawnPointTypes spawnPointType = val._spawnPointType; if ((spawnPointType & 4) != 0) { list2.Add(((Component)val).transform.position); } else if ((spawnPointType & 8) != 0) { list.Add(((Component)val).transform.position); } } } } Vector3 val2 = ((list2.Count > 0) ? (list2.Aggregate(Vector3.zero, (Vector3 s, Vector3 v) => s + v) / (float)list2.Count) : Vector3.zero); foreach (Vector3 item in list) { Vector3 val3 = val2 - item; val3.y = 0f; val3 = ((((Vector3)(ref val3)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val3)).normalized : Vector3.forward); _doors.Add(new Door { spawn = item, exit = item + val3 * 2.5f }); } if (_doors.Count > 0) { WaampMod.Log.Msg($"'{map}': enemies come in through the {_doors.Count} red door(s)."); } } private static bool TryDoor(out Door door, out string why) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) door = default(Door); why = ""; for (int i = 0; i < _doors.Count; i++) { int num = _doorNext++ % _doors.Count; Door door2 = _doors[num]; if (Ground(door2.spawn + Vector3.up * 1.5f, 5f, out var hit) && !KillZoneAtFloor(((RaycastHit)(ref hit)).point)) { Vector2 val = Random.insideUnitCircle * 0.25f; door = new Door { spawn = ((RaycastHit)(ref hit)).point + new Vector3(val.x, 1.2f, val.y), exit = door2.exit }; why = $"door #{num}"; return true; } } why = "no usable door"; return false; } private static void StartDoorPush(Actor a, Door door) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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) Vector3 val = door.exit - door.spawn; val.y = 0f; if (!(((Vector3)(ref val)).sqrMagnitude < 0.01f)) { Rigidbody[] rbs = ((IEnumerable<Rigidbody>)((Component)a).gameObject.GetComponentsInChildren<Rigidbody>(true)).Where((Rigidbody r) => (Object)(object)r != (Object)null).ToArray(); _pushes[((Il2CppObjectBase)a).Pointer] = new Push { actor = a, rbs = rbs, door = door, dir = ((Vector3)(ref val)).normalized, until = Time.time + 2.5f }; } } private static bool DoorPushDir(Actor a, out Vector3 dir) { //IL_0001: 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) dir = default(Vector3); if (!_pushes.TryGetValue(((Il2CppObjectBase)a).Pointer, out var value) || value.done) { return false; } dir = value.dir; return true; } internal static void PushDoors() { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Invalid comparison between Unknown and I4 //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_009e: 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_00aa: 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_00c0: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: 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_020f: Unknown result type (might be due to invalid IL or missing references) if (_pushes.Count == 0) { return; } foreach (KeyValuePair<IntPtr, Push> item in _pushes.ToList()) { Push value = item.Value; if (value.done) { _pushes.Remove(item.Key); continue; } try { if ((Object)(object)value.actor == (Object)null || ((Il2CppObjectBase)value.actor).WasCollected || (int)value.actor.actorState == 1) { _pushes.Remove(item.Key); continue; } Vector3 val = Hips(value.actor); float num = Vector3.Dot(val - value.door.spawn, value.dir); float num2 = Vector3.Dot(value.door.exit - value.door.spawn, value.dir); if (num >= num2 - 0.8f) { value.done = true; continue; } if (Time.time > value.until) { Teleport(value.actor, value.door.exit + Vector3.up * 1.2f, null, Vector3.zero); value.done = true; if (_pushLogged++ < 6) { WaampMod.V($"Enemy stuck behind a door at {Vec(val)}; moved out to {Vec(value.door.exit)}."); } continue; } Rigidbody[] rbs = value.rbs; foreach (Rigidbody val2 in rbs) { if (!((Object)(object)val2 == (Object)null) && !val2.isKinematic) { Vector3 velocity = val2.velocity; velocity.y = 0f; if (Vector3.Dot(velocity, value.dir) < 3.5f) { val2.AddForce(value.dir * 30f, (ForceMode)5); } } } } catch { _pushes.Remove(item.Key); } } } internal static void NewRound() { Current = Mode.Off; _handled.Clear(); _pending.Clear(); _circles.Clear(); _teamFreed.Clear(); _meshCache.Clear(); _steerCache.Clear(); _steerLogged = 0; _stuck.Clear(); _detour.Clear(); _pushes.Clear(); _gameDir.Clear(); _gameOverwrites.Clear(); _detourLogged = 0; _stuckReports = 0; _placed = 0; _watchdogFired = false; _sawEnemy = false; _humans.Clear(); _respawnPending.Clear(); _placedAt.Clear(); _maxSpeed.Clear(); _earlyDeaths = 0; } internal static void Setup(bool ownSpawns) { //IL_0085: 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) NewRound(); _roundStart = Time.time; string currentMap = MapState.CurrentMap; if (ownSpawns) { Current = Mode.Own; WaampMod.Log.Msg("'" + currentMap + "' has its own enemy spawn points; using them."); return; } Current = Mode.Player; _alwaysSteer = MapState.InList(WaampMod.AlwaysSteerMaps.Value, currentMap); SetupDoors(currentMap); List<GBSpawnPoint> spawnPoints = GBServerSpawnManager._spawnPoints; if (spawnPoints != null) { for (int i = 0; i < spawnPoints.Count; i++) { GBSpawnPoint obj = spawnPoints[i]; GBSpawnCircle val = ((obj != null) ? ((Il2CppObjectBase)obj).TryCast<GBSpawnCircle>() : null); if ((Object)(object)val != (Object)null && (((GBSpawnPoint)val)._spawnPointType & 2) != 0) { _circles.Add(val); } } } WaampMod.Log.Msg($"'{currentMap}': enemies drop in {Fmt(WaampMod.ScatterMinHeight.Value)}-{Fmt(WaampMod.ScatterMaxHeight.Value)} m above players" + ((_circles.Count > 0) ? $" ({_circles.Count} spawn circle(s) will grow as needed)." : ".")); } internal static void Tick() { //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Invalid comparison between Unknown and I4 //IL_016a: Unknown result type (might be due to invalid IL or missing references) if (Current == Mode.Off) { return; } GameManagerNew instance = GameManagerNew.Instance; object obj; if (instance == null) { obj = null; } else { GameMode activeGameMode = instance.ActiveGameMode; obj = ((activeGameMode != null) ? ((Il2CppObjectBase)activeGameMode).TryCast<GameMode_Waves>() : null); } GameMode_Waves val = (GameMode_Waves)obj; List<Actor> val2 = ((val != null) ? val._aiActors : null); if (Current == Mode.Player) { GrowCircles(); } if (val2 == null) { return; } if (val2.Count > 0) { _sawEnemy = true; } Watchdog(val, _sawEnemy ? 1 : 0); if (Current == Mode.Own) { return; } if (WaampMod.Verbose.Value) { StuckReport(val2); } WatchRespawns(); WatchEarlyDeaths(val2); for (int i = 0; i < val2.Count; i++) { Actor val3 = val2[i]; if ((Object)(object)val3 == (Object)null) { continue; } IntPtr pointer = ((Il2CppObjectBase)val3).Pointer; if (_handled.Contains(pointer)) { continue; } if (!_pending.TryGetValue(pointer, out var value)) { _pending[pointer] = Time.frameCount; } else { if (Time.frameCount - value < 1) { continue; } _pending.Remove(pointer); _handled.Add(pointer); try { if ((int)val3.actorState == 1) { WaampMod.V($"[early] '{MapState.CurrentMap}' {(IsBig(val3) ? "big " : "")}enemy was already dead where the game spawned it, at {Vec(Hips(val3))}."); } } catch { } try { Place(val3); } catch (Exception ex) { WaampMod.Log.Warning("Enemy placement failed: " + ex.Message); } } } } private static void WatchRespawns() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Invalid comparison between Unknown and I4 //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Invalid comparison between Unknown and I4 //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) if (Current != Mode.Player || !MapState.InList(WaampMod.RespawnNearPlayerMaps.Value, MapState.CurrentMap)) { return; } float time = Time.time; if (time >= _respawnScan) { _respawnScan = time + 0.1f; bool flag = time - _roundStart > 5f; foreach (Actor item in Object.FindObjectsOfType<Actor>()) { try { if (!((Object)(object)item == (Object)null) && !item.IsAI) { bool flag2 = (int)item.actorState == 1; IntPtr pointer = ((Il2CppObjectBase)item).Pointer; bool value; bool flag3 = _humans.TryGetValue(pointer, out value); _humans[pointer] = flag2; if (!flag2 && flag && (!flag3 || value) && !_respawnPending.ContainsKey(pointer)) { _respawnPending[pointer] = time + 0.3f; } } } catch { } } } if (_respawnPending.Count == 0) { return; } foreach (IntPtr item2 in _respawnPending.Keys.ToList()) { if (time < _respawnPending[item2]) { continue; } _respawnPending.Remove(item2); try { Actor val = null; foreach (Actor item3 in Object.FindObjectsOfType<Actor>()) { if ((Object)(object)item3 != (Object)null && ((Il2CppObjectBase)item3).Pointer == item2) { val = item3; break; } } if (!((Object)(object)val == (Object)null) && (int)val.actorState != 1) { if (!TryAbovePlayer(item2, 0.8f, low: false, out var target, out var platform, out var why)) { WaampMod.V("Player respawn left where the game put it (" + why + ")."); continue; } Teleport(val, target, platform, _carry); WaampMod.V($"Player respawned next to a teammate at {Vec(target)} ({why})."); } } catch (Exception ex) { WaampMod.Log.Warning("Respawn move failed: " + ex.Message); } } } private static void GrowCircles() { foreach (GBSpawnCircle circle in _circles) { try { if ((Object)(object)circle != (Object)null && ((GBSpawnPoint)circle).TeamIndex != -1) { int teamIndex = ((GBSpawnPoint)circle).TeamIndex; ((GBSpawnPoint)circle).TeamIndex = -1; if (_teamFreed.Add(((Il2CppObjectBase)circle).Pointer)) { WaampMod.Log.Msg($"Spawn circle '{((Object)((Component)circle).gameObject).name}' was reserved for team {teamIndex}; opened it to enemies too."); } } if (!((Object)(object)circle == (Object)null) && ((GBSpawnPoint)circle).Used >= ((GBSpawnPoint)circle).Size && ((GBSpawnPoint)circle).Size < 32) { int num = Math.Max(8, ((GBSpawnPoint)circle).Size + 4); if (circle._maxSize < num) { circle._maxSize = num; } circle.Setup(num); WaampMod.V($"Spawn circle '{((Object)((Component)circle).gameObject).name}' was full; grown to {((GBSpawnPoint)circle).Size} (used {((GBSpawnPoint)circle).Used})."); } } catch (Exception ex) { WaampMod.Log.Warning("Grow spawn circle: " + ex.Message); } } } private static void Watchdog(GameMode_Waves waves, int aiCount) { //IL_0219: Unknown result type (might be due to invalid IL or missing references) //IL_0294: 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) if (_watchdogFired || aiCount > 0 || Time.time - _roundStart < 15f) { return; } _watchdogFired = true; WaampMod.Log.Warning($"No enemies spawned on '{MapState.CurrentMap}' after 15 s (round {SafeRound(waves)}). Spawn points:"); try { GBServerSpawnManager obj = Object.FindObjectOfType<GBServerSpawnManager>(); Pattern val = ((obj != null) ? obj._activePattern : null); WaampMod.Log.Warning((val == null) ? " active spawn pattern: none" : $" active spawn pattern: mode={val.Mode} gangs={val.MinGangs}-{val.MaxGangs} options={val.SpawnOptions?.Count ?? 0}"); } catch (Exception ex) { WaampMod.Log.Warning(" active spawn pattern: " + ex.Message); } List<GBSpawnPoint> spawnPoints = GBServerSpawnManager._spawnPoints; if (spawnPoints == null) { return; } for (int i = 0; i < spawnPoints.Count; i++) { GBSpawnPoint val2 = spawnPoints[i]; if (!((Object)(object)val2 == (Object)null)) { try { WaampMod.Log.Warning($" {((Object)((Component)val2).gameObject).name} [{((MemberInfo)((Object)val2).GetIl2CppType()).Name}] id={val2.ID} group={val2.GroupIndex} team={val2.TeamIndex} type={val2._spawnPointType} free={val2.Free} used={val2.Used}/{val2.Size}{LockInfo(val2)} at {Vec(((Component)val2).transform.position)}"); } catch (Exception ex2) { WaampMod.Log.Warning(" " + ((Object)((Component)val2).gameObject).name + ": " + ex2.Message); } } } } private static string LockInfo(GBSpawnPoint p) { try { GBMultiSpawnPoint val = ((Il2CppObjectBase)p).TryCast<GBMultiSpawnPoint>(); object result; if (!((Object)(object)val == (Object)null)) { DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(19, 2); defaultInterpolatedStringHandler.AppendLiteral(" locked="); GBSpawnCircle obj = ((Il2CppObjectBase)val).TryCast<GBSpawnCircle>(); defaultInterpolatedStringHandler.AppendFormatted(obj != null && ((CoreNetSpawnPosition)obj).Locked); defaultInterpolatedStringHandler.AppendLiteral(" lockCount="); defaultInterpolatedStringHandler.AppendFormatted(val._lockCount); result = defaultInterpolatedStringHandler.ToStringAndClear(); } else { result = ""; } return (string)result; } catch { return ""; } } private static string SafeRound(GameMode_Waves w) { try { return w._roundCounter.ToString(); } catch { return "?"; } } private static void Place(Actor a) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) if (_doors.Count > 0 && TryDoor(out var door, out var why)) { Teleport(a, door.spawn, null, Vector3.zero); StartDoorPush(a, door); if (++_placed <= 6) { WaampMod.V($"Enemy {_placed} came in at {Vec(door.spawn)} ({why})."); } return; } bool flag = IsBig(a); bool low = flag || MapState.InList(WaampMod.LowDropMaps.Value, MapState.CurrentMap); float margin = (flag ? 1.5f : 0.8f); if (!TryAbovePlayer(IntPtr.Zero, margin, low, out var target, out var platform, out var why2)) { WaampMod.V("Enemy left where the game put it (" + why2 + ")."); return; } Teleport(a, target, platform, _carry); _placedAt[((Il2CppObjectBase)a).Pointer] = (Time.time, flag, target); if (++_placed <= 6 || flag) { WaampMod.V($"{(flag ? "Big enemy" : ("Enemy " + _placed))} dropped in at {Vec(target)} ({why2}){((((Vector3)(ref _carry)).sqrMagnitude > 0.01f) ? $", moving with the player at {((Vector3)(ref _carry)).magnitude:0.0} m/s" : "")}."); } } private static void WatchEarlyDeaths(List<Actor> ai) { //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) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Invalid comparison between Unknown and I4 //IL_0429: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Invalid comparison between Unknown and I4 //IL_0142: 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_0149: 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_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_0223: Unknown result type (might be due to invalid IL or missing references) //IL_025b: 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_02b3: Unknown result type (might be due to invalid IL or missing references) if (_placedAt.Count == 0) { return; } float time = Time.time; HashSet<IntPtr> seen = new HashSet<IntPtr>(); for (int i = 0; i < ai.Count; i++) { Actor val = ai[i]; if ((Object)(object)val == (Object)null || ((Il2CppObjectBase)val).WasCollected) { continue; } IntPtr pointer = ((Il2CppObjectBase)val).Pointer; seen.Add(pointer); if (!_placedAt.TryGetValue(pointer, out (float, bool, Vector3) value)) { continue; } if (time - value.Item1 > 6f) { _placedAt.Remove(pointer); _maxSpeed.Remove(pointer); continue; } try { BodyHandeler bodyHandeler = val.bodyHandeler; object obj; if (bodyHandeler == null) { obj = null; } else { BodyPart hips = bodyHandeler.Hips; obj = ((hips != null) ? hips.PartRigidbody : null); } Rigidbody val2 = (Rigidbody)obj; if ((Object)(object)val2 != (Object)null) { Dictionary<IntPtr, float> maxSpeed = _maxSpeed; float value2; float num = (_maxSpeed.TryGetValue(pointer, out value2) ? value2 : 0f); Vector3 velocity = val2.velocity; maxSpeed[pointer] = Mathf.Max(num, ((Vector3)(ref velocity)).magnitude); } ActorState actorState = val.actorState; if ((int)actorState == 1 || (int)actorState == 2) { _placedAt.Remove(pointer); if (_earlyDeaths++ < 10) { Vector3 val3 = Hips(val); RaycastHit hit; string value3 = (Ground(val3, 4f, out hit) ? $"'{Name(((RaycastHit)(ref hit)).collider)}' {val3.y - ((RaycastHit)(ref hit)).point.y:0.0} m below" : "no floor within 4 m"); WaampMod.V($"[early] '{MapState.CurrentMap}' {(value.Item2 ? "big " : "")}enemy went {actorState} {time - value.Item1:0.0} s after dropping in at {Vec(value.Item3)}. Now at {Vec(val3)}, floor {value3}, kill zone near: {KillZoneNear(val3, 1.5f)}, top hip speed {(_maxSpeed.TryGetValue(pointer, out var value4) ? value4 : 0f):0.0} m/s."); } } } catch { } } foreach (IntPtr item in _placedAt.Keys.Where((IntPtr k) => !seen.Contains(k)).ToList()) { (float, bool, Vector3) tuple = _placedAt[item]; _placedAt.Remove(item); if (time - tuple.Item1 < 6f && _earlyDeaths++ < 10) { WaampMod.V($"[early] '{MapState.CurrentMap}' {(tuple.Item2 ? "big " : "")}enemy removed by the game {time - tuple.Item1:0.0} s after dropping in at {Vec(tuple.Item3)}."); } } } private static Vector3 PlayerVelocity(Vector3 pos) { //IL_00c1: 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_0031: 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_0037: 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) //IL_007e: 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_0074: 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_0099: 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_00a1: Unknown result type (might be due to invalid IL or missing references) Vector3 result; try { foreach (Actor item in Object.FindObjectsOfType<Actor>()) { if ((Object)(object)item == (Object)null || item.IsAI) { continue; } result = Hips(item) - pos; if (((Vector3)(ref result)).sqrMagnitude > 0.01f) { continue; } BodyHandeler bodyHandeler = item.bodyHandeler; object obj; if (bodyHandeler == null) { obj = null; } else { BodyPart hips = bodyHandeler.Hips; obj = ((hips != null) ? hips.PartRigidbody : null); } Rigidbody val = (Rigidbody)obj; if ((Object)(object)val == (Object)null) { result = Vector3.zero; } else { Vector3 velocity = val.velocity; velocity.y = 0f; result = ((((Vector3)(ref velocity)).magnitude > 0.5f) ? velocity : Vector3.zero); } goto IL_00c7; } } catch { } return Vector3.zero; IL_00c7: return result; } private static bool TryAbovePlayer(IntPtr exclude, float margin, bool low, out Vector3 target, out Rigidbody platform, out string why) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: 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_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) target = default(Vector3); platform = null; why = ""; _carry = Vector3.zero; try { Physics.SyncTransforms(); } catch { } List<Vector3> list = LivingPlayers(exclude); if (list.Count == 0) { why = "no living players"; return false; } Vector3 val = list[Random.Range(0, list.Count)]; float value = WaampMod.ScatterMinRadius.Value; float num = Math.Max(value, WaampMod.ScatterMaxRadius.Value); float num2 = WaampMod.ScatterMinHeight.Value; float num3 = Math.Max(num2, WaampMod.ScatterMaxHeight.Value); if (low) { num2 = 1f; num3 = 1.5f; } if (!Ground(val, 6f, out var hit)) { target = val + Vector3.up * ((num2 + num3) * 0.5f); why = "player in the air; straight above"; return true; } platform = ((RaycastHit)(ref hit)).collider.attachedRigidbody; if (((Object)(object)platform == (Object)null || platform.isKinematic) && MapState.InList(WaampMod.LowDropMaps.Value, MapState.CurrentMap)) { _carry = PlayerVelocity(val); } for (int i = 0; i < 20; i++) { float num4 = ((i < 10) ? 1f : 0.5f); float num5 = Random.Range(0f, (float)Math.PI * 2f); float num6 = Random.Range(value, num) * num4; Vector3 val2 = val + new Vector3(Mathf.Cos(num5) * num6, Random.Range(num2, num3), Mathf.Sin(num5) * num6); if (SafeLanding(val2, val, hit, platform, (i < 10) ? margin : (margin * 0.6f))) { target = val2; why = (((Object)(object)platform != (Object)null) ? "near player, same platform" : "near player"); return true; } } Vector2 val3 = Random.insideUnitCircle * 0.6f; target = val + new Vector3(val3.x, (num2 + num3) * 0.5f + (float)(_stack++ % 4) * 0.9f, val3.y); why = "above player (fallback)"; return true; } private static bool SafeLanding(Vector3 p, Vector3 player, RaycastHit playerFloor, Rigidbody platform, float margin) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_005f: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: 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_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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_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_0137: 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_011e: 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) if (Physics.CheckSphere(p, 0.4f, -1, (QueryTriggerInteraction)1)) { return false; } if (!Ground(p, 8f, out var hit)) { return false; } if (!SameFloor(hit, playerFloor, platform)) { return false; } Vector3 val = ((RaycastHit)(ref hit)).point + Vector3.up * 0.5f; Vector3[] dirs = Dirs8; foreach (Vector3 val2 in dirs) { if (!Ground(val + val2 * margin, 2f, out var hit2) || !SameFloor(hit2, playerFloor, platform)) { return false; } } Vector3 point = ((RaycastHit)(ref playerFloor)).point; Vector3 point2 = ((RaycastHit)(ref hit)).point; float num = Vector2.Distance(new Vector2(point.x, point.z), new Vector2(point2.x, point2.z)); int num2 = Mathf.Max(1, Mathf.CeilToInt(num / 0.3f)); for (int j = 1; j < num2; j++) { if (!Ground(Vector3.Lerp(point, point2, (float)j / (float)num2) + Vector3.up * 0.5f, 2f, out var hit3) || !SameFloor(hit3, playerFloor, platform)) { return false; } } if (KillZoneNear(((RaycastHit)(ref hit)).point, margin) || InKillZone(p)) { return false; } return true; } private static bool KillZoneNear(Vector3 floor, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (KillZoneAtFloor(floor)) { return true; } Vector3[] dirs = Dirs8; foreach (Vector3 val in dirs) { if (KillZoneAtFloor(floor + val * radius)) { return true; } } return false; } private static bool IsBig(Actor a) { try { return ((Object)((Component)a).gameObject).name.IndexOf("Big", StringComparison.OrdinalIgnoreCase) >= 0; } catch { return false; } } private static bool SameFloor(RaycastHit floor, RaycastHit playerFloor, Rigidbody platform) { //IL_0002: 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) if (Mathf.Abs(((RaycastHit)(ref floor)).point.y - ((RaycastHit)(ref playerFloor)).point.y) > 1.5f) { return false; } if ((Object)(object)platform != (Object)null && (Object)(object)((RaycastHit)(ref floor)).collider.attachedRigidbody != (Object)(object)platform) { return false; } return true; } private static bool Ground(Vector3 from, float maxDist, out RaycastHit hit) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) hit = default(RaycastHit); Il2CppStructArray<RaycastHit> val = Physics.RaycastAll(from, Vector3.down, maxDist, -1, (QueryTriggerInteraction)1); if (val == null) { return false; } bool flag = false; foreach (RaycastHit item in (Il2CppArrayBase<RaycastHit>)(object)val) { RaycastHit current = item; if (!((Object)(object)((RaycastHit)(ref current)).collider == (Object)null) && !((Object)(object)((Component)((RaycastHit)(ref current)).collider).GetComponentInParent<Actor>() != (Object)null) && (!flag || ((RaycastHit)(ref current)).distance < ((RaycastHit)(ref hit)).distance)) { hit = current; flag = true; } } return flag; } private static bool InKillZone(Vector3 p) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) Il2CppReferenceArray<Collider> val = Physics.OverlapSphere(p, 1f, -1, (QueryTriggerInteraction)2); if (val == null) { return false; } foreach (Collider item in (Il2CppArrayBase<Collider>)(object)val) { if ((Object)(object)item != (Object)null && (Object)(object)((Component)item).GetComponentInParent<KillVolume>() != (Object)null) { return true; } } return false; } private static List<Vector3> LivingPlayers(IntPtr exclude) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Invalid comparison between Unknown and I4 //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Invalid comparison between Unknown and I4 //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_006b: 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) if (exclude == IntPtr.Zero) { return LivingPlayers(); } _playersEx.Clear(); foreach (Actor item in Object.FindObjectsOfType<Actor>()) { try { if (!((Object)(object)item == (Object)null) && !item.IsAI && !(((Il2CppObjectBase)item).Pointer == exclude) && (int)item.actorState != 1 && (int)item.actorState != 2) { Vector3 val = Hips(item); if (Ground(val, 6f, out var _)) { _playersEx.Add(val); } } } catch { } } return _playersEx; } private static List<Vector3> LivingPlayers() { //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Invalid comparison between Unknown and I4 //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (_playersFrame == Time.frameCount) { return _players; } _playersFrame = Time.frameCount; _players.Clear(); foreach (Actor item in Object.FindObjectsOfType<Actor>()) { try { if (!((Object)(object)item == (Object)null) && !item.IsAI && (int)item.actorState != 1) { _players.Add(Hips(item)); } } catch { } } return _players; } private static Vector3 Hips(Actor a) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) try { BodyHandeler bodyHandeler = a.bodyHandeler; object obj; if (bodyHandeler == null) { obj = null; } else { BodyPart hips = bodyHandeler.Hips; obj = ((hips != null) ? hips.PartRigidbody : null); } Rigidbody val = (Rigidbody)obj; if ((Object)(object)val != (Object)null) { return val.position; } } catch { } return ((Component)a).transform.position; } internal static void SteerAll() { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Invalid comparison between Unknown and I4 if (Current != Mode.Player || !WaampMod.ChaseClosest.Value) { return; } try { GameManagerNew instance = GameManagerNew.Instance; object obj; if (instance == null) { obj = null; } else { GameMode activeGameMode = instance.ActiveGameMode; if (activeGameMode == null) { obj = null; } else { GameMode_Waves obj2 = ((Il2CppObjectBase)activeGameMode).TryCast<GameMode_Waves>(); obj = ((obj2 != null) ? obj2._aiActors : null); } } List<Actor> val = (List<Actor>)obj; if (val == null) { return; } for (int i = 0; i < val.Count; i++) { Actor val2 = val[i]; if (!((Object)(object)val2 == (Object)null) && !((Il2CppObjectBase)val2).WasCollected && (int)val2.actorState != 1) { Steer(val2); } } } catch (Exception ex) { if (!_steerError) { _steerError = true; WaampMod.Log.Warning("Steering: " + ex.Message); } } } internal static void Steer(Actor ai) { //IL_0034: 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_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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_00f7: 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_013c: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_015c: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: 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_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022c: 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_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_0309: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0299: 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) if (Current != Mode.Player || (Object)(object)ai == (Object)null || !WaampMod.ChaseClosest.Value) { return; } ControlHandeler controlHandeler = ai.controlHandeler; if (controlHandeler == null) { return; } if (DoorPushDir(ai, out var dir)) { controlHandeler.direction = dir; controlHandeler.rawDirection = dir; return; } Vector3 item; if (_steerCache.TryGetValue(((Il2CppObjectBase)ai).Pointer, out (int, Vector3, bool) value) && value.Item3) { Vector3 direction = controlHandeler.direction; item = direction - value.Item2; if (((Vector3)(ref item)).sqrMagnitude > 0.01f) { _gameDir[((Il2CppObjectBase)ai).Pointer] = direction; _gameOverwrites[((Il2CppObjectBase)ai).Pointer] = (_gameOverwrites.TryGetValue(((Il2CppObjectBase)ai).Pointer, out var value2) ? value2 : 0) + 1; } } if (_steerCache.TryGetValue(((Il2CppObjectBase)ai).Pointer, out (int, Vector3, bool) value3) && value3.Item1 == Time.frameCount) { if (value3.Item3) { controlHandeler.direction = value3.Item2; controlHandeler.rawDirection = value3.Item2; } return; } Vector3 val = Hips(ai); List<Vector3> list = LivingPlayers(); if (list.Count == 0) { return; } Vector3 val2 = default(Vector3); float num = float.MaxValue; foreach (Vector3 item2 in list) { item = item2 - val; float sqrMagnitude = ((Vector3)(ref item)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; val2 = item2; } } if (!_alwaysSteer && OnNavMesh(ai, val)) { Dictionary<IntPtr, (int frame, Vector3 dir, bool apply)> steerCache = _steerCache; IntPtr pointer = ((Il2CppObjectBase)ai).Pointer; int frameCount = Time.frameCount; item = default(Vector3); steerCache[pointer] = (frameCount, item, false); return; } Vector3 val3 = val2 - val; val3.y = 0f; if (((Vector3)(ref val3)).sqrMagnitude < 0.36f) { Dictionary<IntPtr, (int frame, Vector3 dir, bool apply)> steerCache2 = _steerCache; IntPtr pointer2 = ((Il2CppObjectBase)ai).Pointer; int frameCount2 = Time.frameCount; item = default(Vector3); steerCache2[pointer2] = (frameCount2, item, false); return; } Vector3 direction2 = controlHandeler.direction; _currentPlatform = (Ground(val, 4f, out var hit) ? ((RaycastHit)(ref hit)).collider.attachedRigidbody : null); Vector3 dir2 = Vector3.zero; bool flag = false; if (Detouring(ai, val, ((Vector3)(ref val3)).magnitude, out var side)) { flag = PickDetour(val, ((Vector3)(ref val3)).normalized, side, out dir2); } if (!flag) { float[] fan = Fan; foreach (float num2 in fan) { Vector3 val4 = Quaternion.Euler(0f, num2, 0f) * ((Vector3)(ref val3)).normalized; if (SafeStep(val, val4)) { dir2 = val4; break; } } } _steerCache[((Il2CppObjectBase)ai).Pointer] = (Time.frameCount, dir2, true); controlHandeler.direction = dir2; controlHandeler.rawDirection = dir2; if (_steerLogged < 3) { _steerLogged++; WaampMod.V($"Steering enemy off-navmesh: game wanted {Vec(direction2)}, now {Vec(dir2)} toward player {Mathf.Sqrt(num):0.0} m away."); } } private static bool OnNavMesh(Actor ai, Vector3 at) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) IntPtr pointer = ((Il2CppObjectBase)ai).Pointer; if (_meshCache.TryGetValue(pointer, out (int, bool) value) && Time.frameCount - value.Item1 < 15) { return value.Item2; } NavMeshHit val = default(NavMeshHit); bool flag = NavMesh.SamplePosition(at, ref val, 1.5f, -1); _meshCache[pointer] = (Time.frameCount, flag); return flag; } private static bool Detouring(Actor ai, Vector3 me, float distToPlayer, out int side) { //IL_0025: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_012a: Unknown result type (might be due to invalid IL or missing references) side = 0; IntPtr pointer = ((Il2CppObjectBase)ai).Pointer; float time = Time.time; if (!_detour.TryGetValue(pointer, out (Vector3, float, float, int, int) value)) { _detour[pointer] = (me, time, 0f, 1, 0); return false; } if (time < value.Item3) { side = value.Item4; return true; } Vector3 val = me - value.Item1; if (((Vector3)(ref val)).sqrMagnitude > 0.25f || distToPlayer < 1.5f) { _detour[pointer] = (me, time, 0f, value.Item4, (!(distToPlayer < 1.5f)) ? value.Item5 : 0); return false; } if (time - value.Item2 < 1.5f) { return false; } int num = value.Item5 + 1; side = ((num % 2 == 1) ? 1 : (-1)); float num2 = Mathf.Min(1.5f + 0.5f * (float)(num - 1), 3.5f); _detour[pointer] = (me, time + num2, time + num2, side, num); if (_detourLogged++ < 6) { WaampMod.V($"Enemy blocked at {Vec(me)} ({distToPlayer:0.0} m from a player); walking {((side > 0) ? "right" : "left")} for {num2:0.0} s."); } return true; } private static bool PickDetour(Vector3 me, Vector3 toPlayer, int side, out Vector3 dir) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); bool flag = false; float[] detourAngles = DetourAngles; foreach (float num in detourAngles) { Vector3 val2 = Quaternion.Euler(0f, num * (float)side, 0f) * toPlayer; if (SafeStep(me, val2)) { if (!Blocked(me, val2)) { dir = val2; return true; } if (!flag) { val = val2; flag = true; } } } dir = val; return flag; } private static bool Blocked(Vector3 me, Vector3 dir) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_004b: Unknown result type (might be due to invalid IL or missing references) float[] array = new float[2] { -0.3f, 0.4f }; foreach (float num in array) { foreach (RaycastHit item in (Il2CppArrayBase<RaycastHit>)(object)Physics.RaycastAll(me + Vector3.up * num, dir, 0.8f, -1, (QueryTriggerInteraction)1)) { RaycastHit current = item; if ((Object)(object)((RaycastHit)(ref current)).collider != (Object)null && (Object)(object)((Component)((RaycastHit)(ref current)).collider).GetComponentInParent<Actor>() == (Object)null) { return true; } } } return false; } private static bool SafeStep(Vector3 from, Vector3 dir) { //IL_0000: 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_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: 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_0066: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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) if (!Ground(from, 4f, out var hit)) { return true; } float[] array = ((!_alwaysSteer) ? new float[1] { 1f } : new float[2] { 0.6f, 1.2f }); foreach (float num in array) { if (!Ground(from + dir * num + Vector3.up * 0.5f, 4f, out var hit2)) { return false; } if (((RaycastHit)(ref hit)).point.y - ((RaycastHit)(ref hit2)).point.y > 1.2f) { return false; } if (_alwaysSteer && (Object)(object)_currentPlatform != (Object)null && (Object)(object)((RaycastHit)(ref hit2)).collider.attachedRigidbody != (Object)(object)_currentPlatform) { return false; } if (KillZoneAtFloor(((RaycastHit)(ref hit2)).point)) { return false; } } return true; } private static bool KillZoneAtFloor(Vector3 floor) { //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) Il2CppReferenceArray<Collider> val = Physics.OverlapSphere(floor + Vector3.up * 0.6f, 0.35f, -1, (QueryTriggerInteraction)2); if (val == null) { return false; } foreach (Collider item in (Il2CppArrayBase<Collider>)(object)val) { if ((Object)(object)item != (Object)null && (Object)(object)((Component)item).GetComponentInParent<KillVolume>() != (Object)null) { return true; } } return false; } private static void Teleport(Actor a, Vector3 target, Rigidbody platform, Vector3 extraCarry) { //IL_0040: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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_0074: 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_00a1: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_0120: 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_0135: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) Rigidbody[] array = ((IEnumerable<Rigidbody>)((Component)a).gameObject.GetComponentsInChildren<Rigidbody>(true)).Where((Rigidbody r) => (Object)(object)r != (Object)null).ToArray(); if (array.Length == 0) { ((Component)a).transform.position = target; return; } Vector3[] array2 = array.Select((Rigidbody r) => r.position).ToArray(); Vector3 val = target - array2.Aggregate(Vector3.zero, (Vector3 s, Vector3 p) => s + p) / (float)array2.Length; Vector3 velocity = Vector3.zero; try { if ((Object)(object)platform != (Object)null && !platform.isKinematic) { velocity = platform.GetPointVelocity(target); } } catch { } if (((Vector3)(ref velocity)).sqrMagnitude < 0.01f) { velocity = extraCarry; } Transform transform = ((Component)a).transform; transform.position += val; for (int num = 0; num < array.Length; num++) { Vector3 position = array2[num] + val; ((Component)array[num]).transform.position = position; array[num].position = position; array[num].velocity = velocity; array[num].angularVelocity = Vector3.zero; } BodyHandeler componentInChildren = ((Component)a).gameObject.GetComponentInChildren<BodyHandeler>(true); NavMeshHit val2 = default(NavMeshHit); if ((Object)(object)componentInChildren != (Object)null && (Object)(object)componentInChildren.agent != (Object)null && NavMesh.SamplePosition(target, ref val2, 4f, -1) && Mathf.Abs(((NavMeshHit)(ref val2)).position.x - target.x) < 1.5f && Mathf.Abs(((NavMeshHit)(ref val2)).position.z - target.z) < 1.5f) { componentInChildren.agent.Warp(((NavMeshHit)(ref val2)).position); componentInChildren.ResetAgent(); } } private static void StuckReport(List<Actor> ai) { //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) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between Unknown and I4 //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_0056: 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_0098: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) if (_stuckReports >= 8) { return; } for (int i = 0; i < ai.Count; i++) { Actor val = ai[i]; if ((Object)(object)val == (Object)null || ((Il2CppObjectBase)val).WasCollected) { continue; } try { ActorState actorState = val.actorState; if ((int)actorState == 1 || (int)actorState == 2) { _stuck.Remove(((Il2CppObjectBase)val).Pointer); continue; } Vector3 val2 = Hips(val); if (!_stuck.TryGetValue(((Il2CppObjectBase)val).Pointer, out (Vector3, float, bool) value)) { goto IL_008d; } Vector3 val3 = val2 - value.Item1; if (((Vector3)(ref val3)).sqrMagnitude > 0.25f) { goto IL_008d; } if (value.Item3 || Time.time - value.Item2 < 4f) { continue; } List<Vector3> list = LivingPlayers(); if (list.Count == 0) { continue; } Vector3 val4 = default(Vector3); float num = float.MaxValue; foreach (Vector3 item in list) { val3 = item - val2; float sqrMagnitude = ((Vector3)(ref val3)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; val4 = item; } } Vector3 val5 = val4 - val2; val5.y = 0f; if (!(((Vector3)(ref val5)).magnitude < 1.5f)) { _stuck[((Il2CppObjectBase)val).Pointer] = (value.Item1, value.Item2, true); _stuckReports++; WriteStuck(val, actorState, val2, val4); } goto end_IL_0030; IL_008d: _stuck[((Il2CppObjectBase)val).Pointer] = (val2, Time.time, false); end_IL_0030:; } catch (Exception ex) { WaampMod.V("Stuck report failed: " + ex.Message); } } } private static void WriteStuck(Actor a, ActorState st, Vector3 me, Vector3 player) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000f: 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_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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_04e5: Unknown result type (might be due to invalid IL or missing references) //IL_04eb: Unknown result type (might be due to invalid IL or missing references) //IL_04f0: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Unknown result type (might be due to invalid IL or missing references) //IL_0536: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_0237: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0314: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) string currentMap = MapState.CurrentMap; NavMeshHit val = default(NavMeshHit); bool flag = NavMesh.SamplePosition(me, ref val, 1.5f, -1); bool flag2 = _alwaysSteer || !flag; Vector3 val2 = player - me; float y = val2.y; val2.y = 0f; Vector3 dir = ((Vector3)(ref val2)).normalized; ControlHandeler controlHandeler = a.controlHandeler; string value = ((controlHandeler != null) ? Vec(controlHandeler.direction) : "?"); RaycastHit hit; string value2 = (Ground(me, 4f, out hit) ? $"'{Name(((RaycastHit)(ref hit)).collider)}' {me.y - ((RaycastHit)(ref hit)).point.y:0.0} m below hips" : "nothing within 4 m"); Instance log = WaampMod.Log; log.Msg($"[stuck] '{currentMap}' enemy hasn't moved for 4 s at {Vec(me)} (state {st}). Driven by: {(flag2 ? "WAAMP steering" : "the game's navmesh AI")} (navmesh within 1.5 m: {flag}). Input now {value}."); log.Msg($"[stuck] closest player {((Vector3)(ref val2)).magnitude:0.0} m away, {((y >= 0f) ? "+" : "")}{y:0.0} m higher, at {Vec(player)}. Floor under enemy: {value2}."); log.Msg($"[stuck] toward player: knee {Front(-0.5f)}, chest {Front(0.4f)}."); try { BodyHandeler bodyHandeler = a.bodyHandeler; object obj; if (bodyHandeler == null) { obj = null; } else { BodyPart hips = bodyHandeler.Hips; obj = ((hips != null) ? hips.PartRigidbody : null); } Rigidbody val3 = (Rigidbody)obj; object obj2; if (!((Object)(object)val3 != (Object)null)) { obj2 = "?"; } else { DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(4, 1); Vector3 velocity = val3.velocity; defaultInterpolatedStringHandler.AppendFormatted(((Vector3)(ref velocity)).magnitude, "0.00"); defaultInterpolatedStringHandler.AppendLiteral(" m/s"); obj2 = defaultInterpolatedStringHandler.ToStringAndClear(); } string value3 = (string)obj2; Vector3 value5; string value4 = (_gameDir.TryGetValue(((Il2CppObjectBase)a).Pointer, out value5) ? Vec(value5) : "never seen overriding"); int value7; int value6 = (_gameOverwrites.TryGetValue(((Il2CppObjectBase)a).Pointer, out value7) ? value7 : 0); string value8 = ((controlHandeler != null) ? $"grab L={controlHandeler.leftGrab} R={controlHandeler.rightGrab}, run={controlHandeler.run}, onGround={controlHandeler.onGround}, jump={controlHandeler.jump}" : "?"); log.Msg($"[stuck] hip speed {value3}; game's own input last seen {value4} (overwrote WAAMP {value6} times); {value8}."); } catch (Exception ex) { log.Msg("[stuck] (extra state unavailable: " + ex.Message + ")"); } if (flag2) { StringBuilder stringBuilder = new StringBuilder(); float[] fan = Fan; foreach (float num in fan) { Vector3 dir2 = Quaternion.Euler(0f, num, 0f) * dir; StringBuilder stringBuilder2 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(2, 2, stringBuilder2); handler.AppendLiteral(" "); handler.AppendFormatted(num, "+0;-0;0"); handler.AppendLiteral(":"); handler.AppendFormatted(WhyNot(me, dir2)); stringBuilder2.Append(ref handler); } log.Msg($"[stuck] WAAMP directions (angle:result):{stringBuilder}"); } string Front(float h) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) foreach (RaycastHit item in (Il2CppArrayBase<RaycastHit>)(object)Physics.RaycastAll(me + Vector3.up * h, dir, 1.5f, -1, (QueryTriggerInteraction)1)) { RaycastHit current = item; if ((Object)(object)((RaycastHit)(ref current)).collider != (Object)null && (Object)(object)((Component)((RaycastHit)(ref current)).collider).GetComponentInParent<Actor>() == (Object)null) { return $"'{Name(((RaycastHit)(ref current)).collider)}' at {((RaycastHit)(ref current)).distance:0.0} m"; } } return "clear"; } } private static string WhyNot(Vector3 from, Vector3 dir) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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) //IL_0094: 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_00cb: 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_0120: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) if (!Ground(from, 4f, out var hit)) { return "ok(airborne)"; } Rigidbody attachedRigidbody = ((RaycastHit)(ref hit)).collider.attachedRigidbody; float[] array = ((!_alwaysSteer) ? new float[1] { 1f } : new float[2] { 0.6f, 1.2f }); foreach (float num in array) { if (!Ground(from + dir * num + Vector3.up * 0.5f, 4f, out var hit2)) { return "no-floor"; } if (((RaycastHit)(ref hit)).point.y - ((RaycastHit)(ref hit2)).point.y > 1.2f) { return $"drop{((RaycastHit)(ref hit)).point.y - ((RaycastHit)(ref hit2)).point.y:0.0}"; } if (_alwaysSteer && (Object)(object)attachedRigidbody != (Object)null && (Object)(object)((RaycastHit)(ref hit2)).collider.attachedRigidbody != (Object)(object)attachedRigidbody) { return "other-platform"; } if (KillZoneAtFloor(((RaycastHit)(ref hit2)).point)) { return "killzone"; } if (((RaycastHit)(ref hit2)).point.y - ((RaycastHit)(ref hit)).point.y > 0.6f) { return $"ok(but {((RaycastHit)(ref hit2)).point.y - ((RaycastHit)(ref hit)).point.y:0.0} m up onto '{Name(((RaycastHit)(ref hit2)).collider)}')"; } } return "ok"; } private static string Name(Collider c) { try { return ((Object)(object)((Component)c).transform.parent != (Object)null) ? (((Object)((Component)c).transform.parent).name + "/" + ((Object)c).name) : ((Object)c).name; } catch { return "?"; } } private static string Vec(Vector3 v) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) return $"({v.x:0.0}, {v.y:0.0}, {v.z:0.0})"; } private static string Fmt(float f) { return f.ToString("0.#"); } } internal static class MapPrep { private static readonly HashSet<IntPtr> _widenedEarly = new HashSet<IntPtr>(); private static readonly HashSet<IntPtr> _patternsDone = new HashSet<IntPtr>(); internal static void NewRound() { _widenedEarly.Clear(); } internal static bool Widen(GamemodeEnabled ge, bool early) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) GameModeEnum neededMode = ge._neededMode; if ((neededMode & 1) == 0 || (neededMode & 4) != 0) { return false; } ge._neededMode = (GameModeEnum)(neededMode | 4); if (early) { _widenedEarly.Add(((Il2CppObjectBase)ge).Pointer); } return true; } internal static bool Widen(DisableByGamemode d) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //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) //IL_0016: Unknown result type (might be due to invalid IL or missing references) GameModeEnum activeModes = d.ActiveModes; if ((activeModes & 1) == 0 || (activeModes & 4) != 0) { return false; } d.ActiveModes = (GameModeEnum)(activeModes | 4); return true; } internal static void Prepare() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) try { FixModeObjects(); } catch (Exception ex) { WaampMod.Log.Warning("Mode objects: " + ex.Message); } bool own = false; Vector3 centre = Vector3.zero; try { FixSpawnPatterns(); } catch (Exception ex2) { WaampMod.Log.Warning("Spawn patterns: " + ex2.Message); } try { FixSpawnPoints(out own, out centre); } catch (Exception ex3) { WaampMod.Log.Warning("Spawn points: " + ex3.Message); } try { CheckNavMesh(centre); } catch (Exception ex4) { WaampMod.Log.Warning("Navmesh check: " + ex4.Message); } try { SpawnDirector.Setup(own); } catch (Exception ex5) { WaampMod.Log.Warning("Spawn setup: " + ex5.Message); } } private static void FixModeObjects() { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) int num = 0; int num2 = 0; int num3 = 0; foreach (GamemodeEnabled item in Resources.FindObjectsOfTypeAll<GamemodeEnabled>()) { if ((Object)(object)item == (Object)null) { continue; } Scene scene = ((Component)item).gameObject.scene; if (((Scene)(ref scene)).IsValid()) { num3++; if (_widenedEarly.Contains(((Il2CppObjectBase)item).Pointer)) { num2++; } else if (Widen(item, early: false)) { num++; SetActive(item._bothSides); SetActive(item._serverSide); SetActive(item._clientSide); SetActive(item._clientLocalSide); } } } WaampMod.V($"Mode-gated objects: {num3} in scene, {num2} widened at Awake, {num} widened now."); } private static void SetActive(Il2CppReferenceArray<GameObject> arr) { if (arr == null) { return; } for (int i = 0; i < ((Il2CppArrayBase<GameObject>)(object)arr).Length; i++) { if ((Object)(object)((Il2CppArrayBase<GameObject>)(object)arr)[i] != (Object)null) { ((Il2CppArrayBase<GameObject>)(object)arr)[i].SetActive(true); } } } private static List<GBSpawnPoint> AllPoints() { //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) List<GBSpawnPoint> list = new List<GBSpawnPoint>(); List<GBSpawnPoint> spawnPoints = GBServerSpawnManager._spawnPoints; if (spawnPoints != null) { for (int i = 0; i < spawnPoints.Count; i++) { if ((Object)(object)spawnPoints[i] != (Object)null) { list.Add(spawnPoints[i]); } } } if (list.Count == 0) { foreach (GBSpawnPoint item in Resources.FindObjectsOfTypeAll<GBSpawnPoint>()) { if ((Object)(object)item != (Object)null) { Scene scene = ((Component)item).gameObject.scene; if (((Scene)(ref scene)).IsValid()) { list.Add(item); } } } } return list; } private static string Summary(List<GBSpawnPoint> pts) { return $"{pts.Count} total: Player={Num((SpawnPointTypes)1)} AI={Num((SpawnPointTypes)2)} Start={Num((SpawnPointTypes)4)} Respawn={Num((SpawnPointTypes)8)}"; int Num(SpawnPointTypes t) { //IL_0007: 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) return pts.Count((GBSpawnPoint p) => (p._spawnPointType & t) > 0); } } private static void FixSpawnPatterns() { //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: 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_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0240: 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_024e: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Expected O, but got Unknown List<SpawnPatternCarrier> list = new List<SpawnPatternCarrier>(); try { GBServerSpawnManager val = Object.FindObjectOfType<GBServerSpawnManager>(); if ((Object)(object)val != (Object)null && (Object)(object)val._spawnInfo != (Object)null) { list.Add(val._spawnInfo); } } catch { } try { SceneData sceneData = MonoSingleton<Global>.Instance.SceneLoader._sceneData; if ((Object)(object)sceneData != (Object)null && (Object)(object)sceneData.SpawnPattern != (Object)null) { list.Add(sceneData.SpawnPattern); } } catch { } if (list.Count == 0) { WaampMod.V("No spawn pattern carrier on this map."); return; } foreach (SpawnPatternCarrier item in list) { if (!_patternsDone.Add(((Il2CppObjectBase)item).Pointer)) { continue; } List<Pattern> options = item._options; if (options == null) { continue; } List<Pattern> list2 = new List<Pattern>(); bool flag = false; for (int i = 0; i < options.Count; i++) { Pattern val2 = options[i]; if (val2 == null) { continue; } List<int> list3 = new List<int>(); if (val2.SpawnOptions != null) { for (int j = 0; j < val2.SpawnOptions.Count; j++) { list3.Add(val2.SpawnOptions[j]); } } WaampMod.V($" pattern '{((Object)item).name}' #{i}: mode={val2.Mode} gangs={val2.MinGangs}-{val2.MaxGangs} options=[{string.Join(",", list3)}]"); if ((val2.Mode & 4) != 0) { flag = true; } if ((val2.Mode & 0x41) != 0) { list2.Add(val2); } } if (flag || list2.Count == 0) { continue; } foreach (Pattern item2 in list2) { Pattern val3 = new Pattern { Mode = (GameModeEnum)4, MinGangs = 0, MaxGangs = 99, SpawnOptions = item2.SpawnOptions }; options.Add(val3); } WaampMod.Log.Msg($"Spawn patterns '{((Object)item).name}': added {list2.Count} Waves pattern(s) copied from Melee."); } } private static bool Buried(GBSpawnPoint p) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) try { foreach (RaycastHit item in (Il2CppArrayBase<RaycastHit>)(object)Physics.RaycastAll(((Component)p).transform.position + Vector3.up * 0.1f, Vector3.up, 1.5f, -1, (QueryTriggerInteraction)1)) { RaycastHit current = item; if ((Object)(object)((RaycastHit)(ref current)).collider != (Object)null && (Object)(object)((Component)((RaycastHit)(ref current)).collider).GetComponentInParent<Actor>() == (Object)null && ((RaycastHit)(ref current)).normal.y < -0.5f) { return true; } } } catch { } return false; } private static void FixSpawnPoints(out bool own, out Vector3 centre) { //IL_0058: 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_007c: 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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_020f: 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_0203: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) List<GBSpawnPoint> list = AllPoints(); WaampMod.V("Spawn points before: " + Summary(list)); List<GBSpawnPoint> list2 = list.Where((GBSpawnPoint p) => (p._spawnPointType & 5) > 0).ToList(); centre = ((list2.Count > 0) ? (list2.Aggregate(Vector3.zero, (Vector3 s, GBSpawnPoint p) => s + ((Component)p).transform.position) / (float)list2.Count) : Vector3.zero); bool flag = list.Any((GBSpawnPoint p) => (p._spawnPointType & 2) > 0); own = flag && MapState.InList(WaampMod.UseMapWaves.Value, MapState.CurrentMap); if (own || !WaampMod.AddSpawnFlags.Value) { return; } bool flag2 = !list.Any((GBSpawnPoint p) => (p._spawnPointType & 8) > 0); List<GBSpawnPoint> list3 = list2.Where(Buried).ToList(); if (list3.Count == list2.Count) { list3.Clear(); } foreach (GBSpawnPoint item in list3) { WaampMod.V($"Spawn point '{((Object)((Component)item).gameObject).name}' at {((Component)item).transform.position} is under the floor; not used for enemies."); } foreach (GBSpawnPoint item2 in list2) { SpawnPointTypes val = item2._spawnPointType; if (!flag && !list3.Contains(item2)) { val = (SpawnPointTypes)(val | 2); } if (flag2) { val = (SpawnPointTypes)(val | 8); } item2._spawnPointType = val; } WaampMod.V("Spawn points after: " + Summary(list)); } private static bool CheckNavMesh(Vector3 centre) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) NavMeshHit val = default(NavMeshHit); if (NavMesh.SamplePosition(centre, ref val, 25f, -1)) { WaampMod.V($"Navmesh found {Vector3.Distance(centre, ((NavMeshHit)(ref val)).position):0.0} m from the spawn centre."); return true; } WaampMod.V("No navmesh near the spawns (fine; drop-in only needs solid floor)."); return false; } } internal static class MapState { internal static readonly HashSet<string> Known = new HashSet<string> { "roof", "rooftop", "grind", "incinerator", "subway", "billboard", "aquarium", "blimp", "buoy", "chute", "chutes", "containers", "crane", "elevators", "girders", "gondola", "lighthouse", "ring", "towers", "train", "trawler", "trucks", "vents", "wheel", "alley" }; internal static readonly HashSet<string> NativeWaves = new HashSet<string> { "roof", "rooftop", "grind", "incinerator", "subway" }; internal static readonly HashSet<string> Added = new HashSet<string>(); private static readonly HashSet<IntPtr> _extendedTrackers = new HashSet<IntPtr>(); internal static GameModeEnum? Mode; internal static string CurrentMap; internal static bool IsWavesMode { get { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Invalid comparison between Unknown and I4 if (Mode.HasValue) { return (Mode.Value & 4) > 0; } return false; } } internal static bool IsWaampRound { get { if (WaampMod.Enabled != null && WaampMod.Enabled.Value && IsWavesMode && CurrentMap != null && !IsNative(CurrentMap)) { return !IsExcluded(CurrentMap); } return false; } } internal static string Norm(string s) { if (string.IsNullOrEmpty(s)) { return ""; } StringBuilder stringBuilder = new StringBuilder(s.Length); string text = s.ToLowerInvariant(); foreach (char c in text) { if (char.IsLetterOrDigit(c)) { stringBuilder.Append(c); } } return stringBuilder.ToString(); } internal static bool Same(string a, string b) { if (a == b) { return true; } if (a.Length < 3 || b.Length < 3) { return false; } if (!a.Contains(b)) { return b.Contains(a); } return true; } internal static bool IsNative(string map) { string n = Norm(map); if (NativeWaves.Any((string x) => Same(n, x))) { return !Added.Contains(n); } return false; } internal static bool IsExcluded(string map) { string n = Norm(map); return (from x in (WaampMod.ExcludedMaps?.Value ?? "").Split(',').Select(Norm) where x.Length > 0 select x).Any((string x) => Same(n, x)); } internal static bool InList(string csv, string map) { if (string.IsNullOrEmpty(map)) {