Decompiled source of WaveExpansion v1.0.0
Mods/WaveExpansion.dll
Decompiled 21 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.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using HarmonyLib; using Il2Cpp; using Il2CppCoreNet.Objects; using Il2CppCostumes; using Il2CppFemur; using Il2CppGB.Core; using Il2CppGB.Core.Loading; using Il2CppGB.Data.Loading; using Il2CppGB.Game; using Il2CppGB.Game.Critters; using Il2CppGB.Game.Data; using Il2CppGB.Gamemodes; using Il2CppGB.Networking.Components.Client; using Il2CppGB.Networking.Components.Server; using Il2CppGB.Networking.Messages; using Il2CppGB.Networking.Objects; using Il2CppGB.UI; using Il2CppGB.Utils; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem.Collections.Generic; using Il2CppTMPro; using MelonLoader; using MelonLoader.Preferences; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.AI; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Localization.Components; using UnityEngine.Networking; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; using Wave5Mod; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: MelonInfo(typeof(global::Wave5Mod.Wave5Mod), "Wave Expansion", "1.0.0", "Jamie", null)] [assembly: HarmonyDontPatchAll] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("WaveExpansion")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WaveExpansion")] [assembly: AssemblyTitle("WaveExpansion")] [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 Wave5Mod { internal sealed class BonusMap { public string Id; public string Norm; public string Upper; public GameModeEnum[] Modes; public (string Display, string Key)[] Requirements; public string[] StarCategories; public string HowTo; public MelonPreferences_Entry<bool> Enabled; public MelonPreferences_Entry<string> Unlock; public MelonPreferences_Entry<string> StandIn; } public sealed class Wave5Mod : MelonMod { private sealed class Rail { public FixedJoint J; public Renderer[] R; public Collider[] C; public int Hits; public float NextHit; public float Base; } private sealed class Bubble { public Transform T; public float Life; public float Speed; } private sealed class Puff { public Transform T; public Material M; public float Life; public float Speed; public Color Base; } private sealed class LabActor { public Rigidbody[] Bodies; public Vector3 Last; public bool Placed; public bool WasDead; public int Slot = -1; public Vector3 StuckRef; public float StuckSince = -1f; public bool Nudged; } internal const string LabyrinthId = "Labyrinth"; private const string LabyrinthNorm = "labyrinth"; internal const string StadiumId = "Stadium"; private const string StadiumNorm = "stadium"; private BonusMap _bLab; private BonusMap _bStadium; private BonusMap[] _bonusMaps = new BonusMap[0]; private BonusMap _uiBonus; private static readonly (string Display, string Key)[] LabyrinthRequirements = new(string, string)[4] { ("Roof", "rooftop"), ("Grind", "grind"), ("Incinerator", "incinerator"), ("Subway", "subway") }; private MelonPreferences_Entry<bool> _labEnabled; private MelonPreferences_Entry<string> _labUnlockMode; private MelonPreferences_Entry<string> _labStandIn; private MelonPreferences_Entry<string> _labPanelOffset; private MelonPreferences_Entry<float> _labPanelSize; private MelonPreferences_Entry<float> _labLockGap; private MenuHandlerMaps _labHandler; private TextMeshProUGUI _labLabel; private RectTransform _labPanel; private TextMeshProUGUI _labPanelText; private Image _labLock; private Sprite _lockSprite; private bool _labUiFailed; private string _labLastState; private float _labNextBlockMsg; private LoadScreenDisplayHandler _loadScreen; private bool _loadTitlePaused; private const float RoomHalfW = 11f; private const float RoomDepth = 12f; private const float RoomHeight = 9f; private const float CatwalkY = 4.2f; private const float CatwalkZ = 9f; private const float PitX0 = -3f; private const float PitX1 = 5f; private const float PitZ0 = 1.5f; private const float PitZ1 = 8f; private const float PoolY = -1f; private const float PitBottomY = -3.2f; private const float StairX0 = 6.5f; private const float StairX1 = 9f; private const float StairZ0 = 1.5f; private const float FenceHeight = 1.1f; private static readonly Vector3[] DoorBase = (Vector3[])(object)new Vector3[4] { new Vector3(-7f, 0f, 12f), new Vector3(-5f, 4.2f, 12f), new Vector3(1.5f, 0f, 12f), new Vector3(2.5f, 4.2f, 12f) }; internal static bool LabyrinthMatch; internal static string LabyrinthStandInUsed; private MelonPreferences_Entry<string> _labOrigins; private MelonPreferences_Entry<float> _labBarrelMass; private MelonPreferences_Entry<float> _labFog; private MelonPreferences_Entry<int> _labRailHits; private MelonPreferences_Entry<float> _labRailHitForce; private readonly List<Rail> _labRails = new List<Rail>(); private int _labRailLogs; private Transform _labWpBottom; private Transform _labWpTop; private GameObject _labRoot; private Transform _labT; private float _labNextTry; private float _labNextTick; private float _labGmMissingSince = -1f; private bool _labWarnedScene; private int _labStaticLayer; private int _labDynLayer; private int _labBeastLayer; private string _labLayersFor; private int _labHumansPlaced; private Material _labPoolMat; private Color _labPoolEmit; private Light _labPitLight; private bool _labYawConfirmed; private float _labBuiltAt; private Vector3 _labCamSum; private int _labCamSamples; private readonly List<int> _labNavHandles = new List<int>(); private readonly List<Renderer>[] _labSide = new List<Renderer>[5] { new List<Renderer>(), new List<Renderer>(), new List<Renderer>(), new List<Renderer>(), new List<Renderer>() }; private readonly bool[] _labSideShown = new bool[5] { true, true, true, true, true }; private const int SideLeft = 0; private const int SideRight = 1; private const int SideBack = 2; private const int SideFront = 3; private const int SideCeiling = 4; private readonly List<Bubble> _labBubbles = new List<Bubble>(); private readonly List<Puff> _labPuffs = new List<Puff>(); private Material _labMistTemplate; private readonly List<Transform> _labFans = new List<Transform>(); private readonly Dictionary<IntPtr, LabActor> _labActors = new Dictionary<IntPtr, LabActor>(); private readonly Dictionary<string, Material> _labMats = new Dictionary<string, Material>(); private Material _labTemplate; private bool _labEnvChanged; private Color _envAmbient; private Color _envFogColor; private Color _envCamBg; private bool _envFog; private float _envFogDensity; private AmbientMode _envAmbientMode; private FogMode _envFogMode; private int _envPixelLights; private CameraClearFlags _envCamFlags; private Camera _envCam; private Material _envSkybox; private readonly Dictionary<IntPtr, KeyValuePair<Camera, CameraClearFlags>> _envCamFlagsAll = new Dictionary<IntPtr, KeyValuePair<Camera, CameraClearFlags>>(); private float _labNextCamFix; private static readonly Vector3[] LightPanels = (Vector3[])(object)new Vector3[3] { new Vector3(-6.5f, 0f, 3.5f), new Vector3(1.5f, 0f, 3.5f), new Vector3(7.5f, 0f, 6.5f) }; private TMP_FontAsset _labFont; private bool _fogApplied; private readonly List<KeyValuePair<OpaqueSurfaceFogRendererFeature, OpaqueSurfaceFogSettings>> _fogOriginal = new List<KeyValuePair<OpaqueSurfaceFogRendererFeature, OpaqueSurfaceFogSettings>>(); private readonly List<InteractableObjectData> _labInteract = new List<InteractableObjectData>(); private bool _interactWarned; internal static bool StadiumMatch; internal static string StadiumStandInUsed; private GameObject _stRoot; private Transform _stT; private bool _stWarnedScene; private bool _stWarnedGoals; private float _stNextTry; private float _stGmMissingSince = -1f; private float _stHL; private float _stHW; private bool _stEnvChanged; private Color _stEnvAmbient; private AmbientMode _stEnvAmbientMode; private readonly List<Renderer>[] _stSide = new List<Renderer>[4] { new List<Renderer>(), new List<Renderer>(), new List<Renderer>(), new List<Renderer>() }; private readonly bool[] _stShown = new bool[4] { true, true, true, true }; private MelonPreferences_Entry<bool> _starsEnabled; private MelonPreferences_Entry<string> _starsData; private readonly Dictionary<string, int> _stars = new Dictionary<string, int>(); private bool _debugUsedThisWave; private string _starGlyph; private readonly HashSet<string> _loggedLobbyIds = new HashSet<string>(); private readonly Dictionary<int, TextMeshProUGUI> _starOverlays = new Dictionary<int, TextMeshProUGUI>(); private bool _overlayLogged; private const int StarBronze = 1; private const int StarSilver = 2; private const int StarGold = 4; internal static Instance Log; private MelonPreferences_Entry<int> _mutantSpawnIndex; private MelonPreferences_Entry<int> _binSpawnIndex; private MelonPreferences_Entry<int> _confettiSpawnIndex; private MelonPreferences_Entry<int> _wavesModeBeastType; private MelonPreferences_Entry<int> _targetMutants; private MelonPreferences_Entry<float> _spawnInterval; private MelonPreferences_Entry<float> _mutantChance; private MelonPreferences_Entry<int> _confettiBursts; private MelonPreferences_Entry<float> _confettiInterval; private MelonPreferences_Entry<int> _maxConsecutiveFailures; private MelonPreferences_Entry<bool> _allowOnlineHost; private MelonPreferences_Entry<bool> _spawnAtCursor; private MelonPreferences_Entry<float> _fallbackSpawnHeight; private MelonPreferences_Entry<bool> _verbose; private MelonPreferences_Entry<bool> _showMessages; private MelonPreferences_Entry<string> _startMessage; private MelonPreferences_Entry<string> _completeMessage; private MelonPreferences_Entry<float> _messageOffsetX; private MelonPreferences_Entry<float> _messageOffsetY; private MelonPreferences_Entry<bool> _timerRealTime; private MelonPreferences_Entry<bool> _w6Enabled; private MelonPreferences_Entry<int> _w6Target; private MelonPreferences_Entry<int> _w6MediumIndex; private MelonPreferences_Entry<float> _w6MutantShare; private MelonPreferences_Entry<float> _w6Delay; private MelonPreferences_Entry<string> _w6StartMessage; private MelonPreferences_Entry<string> _w6CompleteMessage; private MelonPreferences_Entry<float> _w6GoldChance; private MelonPreferences_Entry<float> _w6Metallic; private MelonPreferences_Entry<float> _w6Smoothness; private MelonPreferences_Entry<float> _w6Shine; private MelonPreferences_Entry<string> _w6RecolourTimes; private MelonPreferences_Entry<bool> _wavesIntegration; private MelonPreferences_Entry<int> _wavesMutantType; private MelonPreferences_Entry<int> _wavesMediumType; private MelonPreferences_Entry<bool> _debugKillKey; private WaveState _state; private readonly List<TrackedMutant> _mutants = new List<TrackedMutant>(); private readonly Random _rng = new Random(); private int _mutantsSpawned; private int _binsSpawned; private int _consecutiveFailures; private int _confettiFired; private float _nextActionTime; private float _timerStart; private float _timerElapsed; private int _wave = 5; private bool _wave6Started; private float _intermissionEnd; private float[] _recolourTimes = new float[1]; private readonly HashSet<string> _loggedShaders = new HashSet<string>(); internal static Wave5Mod Instance; private static readonly HashSet<IntPtr> OurWavePtrs = new HashSet<IntPtr>(); private static readonly HashSet<string> OurWaveMarkers = new HashSet<string>(); private IntPtr _wavesGm = IntPtr.Zero; private string _w5Marker; private string _w6Marker; private bool _w5Begun; private bool _w6Begun; private int _waveTarget; private float _nextScan; private HashSet<int> _knownActorIds = new HashSet<int>(); private int _lastRoundCounter = int.MinValue; private bool _wavesPatched; private IntPtr _gmPointer = IntPtr.Zero; private IntPtr _lastSeenGmPointer = IntPtr.Zero; private GameState _lastGameState; private bool _tableLoggedForThisGm; private bool _inputSystemBroken; private bool _legacyInputBroken; private bool _authPatched; private MelonPreferences_Entry<bool> _w6ColourNames; private static readonly Dictionary<int, bool> FinishByGameObject = new Dictionary<int, bool>(); private bool _labelLogged; private bool _labelRefreshLogged; private float _labelRefreshUntil; private float _nextLabelRefresh; private MelonPreferences_Entry<string> _w6GoldLabel; private MelonPreferences_Entry<string> _w6SilverLabel; private static readonly Color GoldColor = new Color(1f, 0.77f, 0.22f, 1f); private static readonly Color SilverColor = new Color(0.8f, 0.82f, 0.86f, 1f); private const float FastColourWindow = 1.5f; private const int FastColourBudget = 24; private int _fastColourCursor; private float _lastVPress = -10f; private MelonPreferences_Entry<bool> _w7Enabled; private MelonPreferences_Entry<string> _w7SceneMatch; private MelonPreferences_Entry<float> _w7Duration; private MelonPreferences_Entry<float> _w7Delay; private MelonPreferences_Entry<string> _w7StartMsg; private MelonPreferences_Entry<string> _w7CompleteMsg; private MelonPreferences_Entry<string> _w7FailMsg; private MelonPreferences_Entry<bool> _w7ShowCountdown; private MelonPreferences_Entry<string> _w7Preset; private MelonPreferences_Entry<string> _w7BossName; private MelonPreferences_Entry<float> _w7Scale; private MelonPreferences_Entry<float> _w7BackDistance; private MelonPreferences_Entry<float> _w7HeadAbove; private MelonPreferences_Entry<float> _w7SideOffset; private MelonPreferences_Entry<float> _w7YawOffset; private MelonPreferences_Entry<string> _w7HeadBone; private MelonPreferences_Entry<string> _w7HeadAxis; private MelonPreferences_Entry<float> _w7HeadAngle; private MelonPreferences_Entry<float> _w7HeadSweepSeconds; private MelonPreferences_Entry<float> _w7FireMin; private MelonPreferences_Entry<float> _w7FireMax; private MelonPreferences_Entry<float> _w7Speed; private MelonPreferences_Entry<float> _w7BallSize; private MelonPreferences_Entry<float> _w7Knockback; private MelonPreferences_Entry<float> _w7BlastRadius; private MelonPreferences_Entry<float> _w7Uplift; private MelonPreferences_Entry<int> _w7MaxBalls; private MelonPreferences_Entry<float> _w7RandomShotChance; private MelonPreferences_Entry<string> _w7BossColor; private MelonPreferences_Entry<float> _w7LaunchOut; private MelonPreferences_Entry<float> _w7LaunchUp; private MelonPreferences_Entry<float> _w7AimLead; private MelonPreferences_Entry<string> _w7AnchorPos; private MelonPreferences_Entry<string> _w7AnchorDir; private MelonPreferences_Entry<float> _w7AnchorEdge; private MelonPreferences_Entry<float> _w7Gravity; private MelonPreferences_Entry<string> _w7Profiles; private MelonPreferences_Entry<bool> _w7TuningKeys; private readonly Dictionary<string, BossProfile> _profiles = new Dictionary<string, BossProfile>(); private BossProfile _prof = new BossProfile(); private string _activeMap = ""; private int _shotsLogged; private float _w7Elapsed; private bool _w7PauseLogged; private readonly Dictionary<int, float> _arcBoost = new Dictionary<int, float>(); private bool _wave7Started; private bool _w7InWavesMode; private bool _w7Appended; private bool _w7Begun; private string _w7Marker; private Actor _boss; private Transform _bossHead; private Quaternion _bossHeadBase; private float _bossRelayoutAt = -1f; private float _bossSearchUntil; private HashSet<int> _w7KnownIds = new HashSet<int>(); private float _w7EndTime; private float _w7StartTime; private float _nextFireTime; private float _nextHumanCheck; private int _lastAnnounced = int.MaxValue; private readonly List<Fireball> _fireballs = new List<Fireball>(); private Material _fireMat; private Vector3 _roofCentre; private float _roofY; private Vector3 _backDir = Vector3.forward; private float _backEdge; private GUIStyle _countStyle; private bool _guiFailed; private bool _fireExtrasWarned; private bool _trailUnavailable; internal static IntPtr BossStatusPtr = IntPtr.Zero; internal static IntPtr BossCostumePtr = IntPtr.Zero; internal static IntPtr BossActorPtr = IntPtr.Zero; internal static Color BossTint = new Color(0.25f, 0.7f, 0.2f, 1f); internal static bool BossProtected; private StatusHandeler _bossStatus; private readonly List<Transform> _pinT = new List<Transform>(); private readonly List<Vector3> _pinP = new List<Vector3>(); private readonly List<Quaternion> _pinR = new List<Quaternion>(); private readonly List<Rigidbody> _pinRb = new List<Rigidbody>(); private Vector3 _pinRootScale; private float _bossRecolourAt = -1f; private float _nextColliderSweep; private bool _bossHeadBaseSet; private static readonly string[] AllStageNames = new string[24] { "aquarium", "billboard", "blimp", "buoy", "chute", "containers", "crane", "elevators", "fans", "girders", "gondola", "grind", "incinerator", "lighthouse", "ring", "roof", "rooftop", "subway", "towers", "train", "trawler", "trucks", "vents", "wheel" }; internal static readonly HashSet<string> KnownMapIds = new HashSet<string>(); private string _bossPreset; private CostumeSaveEntry _bossDinoEntry; private int _bossSkinStep = -1; private int _bossColourStep = -1; private float _bossSpawnTime; private static readonly float[] BossSkinTimes = new float[3] { 0.6f, 1.5f, 3f }; private static readonly float[] BossColourTimes = new float[9] { 0.1f, 0.25f, 0.5f, 0.8f, 1.2f, 1.8f, 2.5f, 3.5f, 5f }; private MelonPreferences_Entry<bool> _scoutEnabled; private MelonPreferences_Entry<string> _scoutPreset; private MelonPreferences_Entry<float> _scoutScale; private MelonPreferences_Entry<string> _scoutPosition; private MelonPreferences_Entry<float> _scoutYaw; private MelonPreferences_Entry<string> _scoutHeadBone; private MelonPreferences_Entry<string> _scoutHeadAxis; private MelonPreferences_Entry<float> _scoutHeadAngle; private Actor _testBoss; private float _presetApplyAt = -1f; private float _hierarchyLogAt = -1f; private Transform _testHead; private Quaternion _testHeadBase; private bool _testFrozen; private bool LabyrinthBuilt { get { if ((Object)(object)_labRoot != (Object)null) { return SafeAlive(_labRoot); } return false; } } private bool StadiumBuilt { get { try { return (Object)(object)_stRoot != (Object)null && (Object)(object)_stRoot.transform != (Object)null; } catch { return false; } } } private float BoardX => _stHL + 3.5f; private float BoardZ => _stHW + 2f; private int CurrentTarget { get { if (_wave != 6) { return _targetMutants.Value; } return _w6Target.Value; } } private void InitLabyrinth(MelonPreferences_Category cat) { //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Expected O, but got Unknown //IL_031f: Unknown result type (might be due to invalid IL or missing references) //IL_032c: Expected O, but got Unknown //IL_034d: Unknown result type (might be due to invalid IL or missing references) //IL_035b: Expected O, but got Unknown //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Expected O, but got Unknown InitLabyrinthRoom(cat); _labEnabled = cat.CreateEntry<bool>("LabyrinthEnabled", true, "Labyrinth map", "Adds the Labyrinth bonus map to the lobby map list (Waves, Melee, Gang; local lobbies).", false, false, (ValueValidator)null, (string)null); _labUnlockMode = cat.CreateEntry<string>("LabyrinthUnlock", "auto", "Labyrinth unlock", "auto = unlocked by a Waves-mode bronze star on Roof, Grind, Incinerator and Subway. locked / unlocked = force it (for testing).", false, false, (ValueValidator)null, (string)null); _labStandIn = cat.CreateEntry<string>("LabyrinthStandInMap", "Rooftop", "Labyrinth base map", "Labyrinth is built at runtime on top of this map (which is hidden). Keep it a simple, flat map; Rooftop works.", false, false, (ValueValidator)null, (string)null); _labPanelOffset = cat.CreateEntry<string>("LabyrinthPanelPosition", "0,-15", "Labyrinth panel position", "Where the 'Bronze stars required' panel sits, as 'x,y' from just below the centre of the map name (lobby UI units; x+ right, y+ up).", false, false, (ValueValidator)null, (string)null); _labLockGap = cat.CreateEntry<float>("LabyrinthLockGap", 1.1f, "Labyrinth padlock gap", "Space between the end of LABYRINTH and the padlock, in padlock heights. Raise to move it right.", false, false, (ValueValidator)null, (string)null); _labPanelSize = cat.CreateEntry<float>("LabyrinthPanelTextSize", 0.55f, "Labyrinth panel text size", "Panel text size relative to the map name.", false, false, (ValueValidator)null, (string)null); BonusMap bonusMap = new BonusMap { Id = "Labyrinth", Norm = "labyrinth", Upper = "LABYRINTH" }; BonusMap bonusMap2 = bonusMap; GameModeEnum[] array = new GameModeEnum[3]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); bonusMap2.Modes = (GameModeEnum[])(object)array; bonusMap.Requirements = LabyrinthRequirements; bonusMap.StarCategories = new string[1] { "waves" }; bonusMap.HowTo = "Beat Wave 5 in Waves mode on:"; bonusMap.Enabled = _labEnabled; bonusMap.Unlock = _labUnlockMode; bonusMap.StandIn = _labStandIn; _bLab = bonusMap; _bStadium = new BonusMap { Id = "Stadium", Norm = "stadium", Upper = "STADIUM", Modes = (GameModeEnum[])(object)new GameModeEnum[1] { (GameModeEnum)16 }, Requirements = new(string, string)[1] { ("Labyrinth", "labyrinth") }, StarCategories = new string[1] { "waves" }, HowTo = "Beat Wave 5 in Waves mode on:", Enabled = cat.CreateEntry<bool>("StadiumEnabled", true, "Stadium map", "Adds the Stadium bonus map to the Football map list (local lobbies).", false, false, (ValueValidator)null, (string)null), Unlock = cat.CreateEntry<string>("StadiumUnlock", "auto", "Stadium unlock", "auto = unlocked by a Waves-mode bronze star on Labyrinth. locked / unlocked = force it (for testing).", false, false, (ValueValidator)null, (string)null), StandIn = cat.CreateEntry<string>("StadiumBaseMap", "Alley", "Stadium base map", "Stadium is built at runtime over this Football map (its goals are kept, everything else hidden).", false, false, (ValueValidator)null, (string)null) }; _bonusMaps = new BonusMap[2] { _bLab, _bStadium }; InitStadium(cat); try { Type? typeFromHandle = typeof(MenuHandlerMaps); MethodInfo methodInfo = AccessTools.Method(typeFromHandle, "UpdateMapList", (Type[])null, (Type[])null); MethodInfo methodInfo2 = AccessTools.Method(typeFromHandle, "GetCurrentSelectedLevels", (Type[])null, (Type[])null); MethodInfo methodInfo3 = AccessTools.Method(typeof(StartGameCountdown), "StartTimer", (Type[])null, (Type[])null); MethodInfo methodInfo4 = AccessTools.Method(typeof(MenuHandlerGamemodes), "StartGameLogic", (Type[])null, (Type[])null); if (methodInfo != null) { ((MelonBase)this).HarmonyInstance.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(LabyrinthPatches), "UpdateMapListPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } if (methodInfo2 != null) { ((MelonBase)this).HarmonyInstance.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(LabyrinthPatches), "SelectedLevelsPostfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } if (methodInfo3 != null) { ((MelonBase)this).HarmonyInstance.Patch((MethodBase)methodInfo3, new HarmonyMethod(typeof(LabyrinthPatches), "BlockStartPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } if (methodInfo4 != null) { ((MelonBase)this).HarmonyInstance.Patch((MethodBase)methodInfo4, new HarmonyMethod(typeof(LabyrinthPatches), "BlockStartPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } Log.Msg($"Labyrinth: patched map list={methodInfo != null}, level select={methodInfo2 != null}, countdown={methodInfo3 != null}, start={methodInfo4 != null}. Progress {LabyrinthEarned()}/{LabyrinthRequirements.Length} -> {(LabyrinthUnlocked() ? "UNLOCKED" : "locked")}. Stadium: {Earned(_bStadium)}/1 -> {(Unlocked(_bStadium) ? "UNLOCKED" : "locked")}."); } catch (Exception value) { Log.Error($"Labyrinth patch failed: {value}"); } } private bool HasWavesBronze(string key) { return (LookupStars("waves", key) & 1) != 0; } private bool HasBronze(BonusMap b, string key) { string[] starCategories = b.StarCategories; foreach (string category in starCategories) { if ((LookupStars(category, key) & 1) != 0) { return true; } } return false; } private int Earned(BonusMap b) { if (b == null) { return 0; } int num = 0; (string, string)[] requirements = b.Requirements; for (int i = 0; i < requirements.Length; i++) { (string, string) tuple = requirements[i]; if (HasBronze(b, tuple.Item2)) { num++; } } return num; } private bool Unlocked(BonusMap b) { if (b == null) { return false; } string text = (b.Unlock?.Value ?? "auto").Trim().ToLowerInvariant(); if (text == "unlocked") { return true; } if (text == "locked") { return false; } return Earned(b) >= b.Requirements.Length; } private int LabyrinthEarned() { return Earned(_bLab); } internal bool LabyrinthUnlocked() { return Unlocked(_bLab); } private static bool IsLabyrinth(string id) { return Norm(id) == "labyrinth"; } private BonusMap BonusFor(string id) { string text = Norm(id); BonusMap[] bonusMaps = _bonusMaps; foreach (BonusMap bonusMap in bonusMaps) { if (bonusMap.Norm == text) { return bonusMap; } } return null; } private static bool IsBonusNorm(string n) { if (!(n == "labyrinth")) { return n == "stadium"; } return true; } private BonusMap SelectedBonus(MenuHandlerMaps h) { try { List<string> mapList = h.mapList; int currentMapIndex = h.currentMapIndex; if (mapList != null && currentMapIndex >= 0 && currentMapIndex < mapList.Count) { return BonusFor(mapList[currentMapIndex]); } } catch { } return null; } internal void AddLabyrinthToList(MenuHandlerMaps handler) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Invalid comparison between Unknown and I4 //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00df: 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) if ((Object)(object)handler == (Object)null) { return; } try { List<string> mapList = handler.mapList; if (mapList == null) { return; } MenuHandlerGamemodes val = null; foreach (MenuHandlerGamemodes item in Object.FindObjectsOfType<MenuHandlerGamemodes>()) { try { if ((Object)(object)item != (Object)null && (Object)(object)item.mapSetup != (Object)null && ((Il2CppObjectBase)item.mapSetup).Pointer == ((Il2CppObjectBase)handler).Pointer) { val = item; break; } } catch { } } if ((Object)(object)val == (Object)null || (int)val.type == 1) { return; } GameModeEnum currentGamemode = val.CurrentGamemode; BonusMap[] bonusMaps = _bonusMaps; foreach (BonusMap bonusMap in bonusMaps) { if (bonusMap.Enabled == null || !bonusMap.Enabled.Value || Array.IndexOf(bonusMap.Modes, currentGamemode) < 0) { continue; } bool flag = false; for (int j = 0; j < mapList.Count; j++) { if (Norm(mapList[j]) == bonusMap.Norm) { flag = true; break; } } if (!flag) { mapList.Add(bonusMap.Id); if (_verbose.Value) { Log.Msg($"{bonusMap.Id}: added to the {currentGamemode} map list ({mapList.Count} maps)."); } } } } catch (Exception ex) { Log.Warning("Bonus maps: could not add to map list: " + ex.Message); } } private string ResolveStandIn(List<string> mapList) { return ResolveStandIn(mapList, _bLab); } private string ResolveStandIn(List<string> mapList, BonusMap b) { string text = Norm(b?.StandIn?.Value); string text2 = null; if (mapList != null) { for (int i = 0; i < mapList.Count; i++) { string text3 = mapList[i]; string text4 = Norm(text3); if (text4.Length != 0 && !(text4 == "random") && !(text4 == "modded") && !IsBonusNorm(text4)) { if (text2 == null) { text2 = text3; } if (text.Length > 0 && (text4 == text || text4.Contains(text) || text.Contains(text4))) { return text3; } } } } return text2; } internal void FixSelectedLevels(MenuHandlerMaps handler, List<string> levels) { LabyrinthMatch = false; StadiumMatch = false; if (levels == null) { return; } try { BonusMap bonusMap = SelectedBonus(handler); for (int num = levels.Count - 1; num >= 0; num--) { BonusMap bonusMap2 = BonusFor(levels[num]); if (bonusMap2 != null) { string text = ((bonusMap2 == bonusMap && Unlocked(bonusMap2)) ? ResolveStandIn(handler.mapList, bonusMap2) : null); if (text == null) { levels.RemoveAt(num); } else { levels[num] = text; if (bonusMap2 == _bLab) { LabyrinthMatch = true; LabyrinthStandInUsed = text; _labWarnedScene = false; Log.Msg("Labyrinth: starting - loading '" + text + "' underneath and building the Labyrinth room over it."); } else { StadiumMatch = true; StadiumStandInUsed = text; _stWarnedScene = false; Log.Msg("Stadium: starting - loading '" + text + "' underneath and building the stadium over it."); } } } } } catch (Exception ex) { Log.Warning("Bonus maps: level fix failed: " + ex.Message); } } private BonusMap LockedBonusSelected() { try { foreach (MenuHandlerMaps item in Object.FindObjectsOfType<MenuHandlerMaps>()) { if (!((Object)(object)item == (Object)null)) { BonusMap bonusMap = SelectedBonus(item); if (bonusMap != null && bonusMap.Enabled != null && bonusMap.Enabled.Value && !Unlocked(bonusMap)) { return bonusMap; } } } } catch { } return null; } internal bool AllowStart() { BonusMap bonusMap = LockedBonusSelected(); if (bonusMap == null) { return true; } Log.Msg($"{bonusMap.Id}: start blocked - locked ({Earned(bonusMap)}/{bonusMap.Requirements.Length} bronze stars)."); if (Time.unscaledTime >= _labNextBlockMsg) { _labNextBlockMsg = Time.unscaledTime + 1f; try { NotificationTicker instance = NotificationTicker.Instance; if ((Object)(object)instance != (Object)null) { instance.ShowMessage(GBUtils.RawTextWrap($"{bonusMap.Upper} IS LOCKED - {Earned(bonusMap)} / {bonusMap.Requirements.Length} BRONZE STARS. Pick another map, then ready up again."), true, 4f, false); } } catch (Exception ex) { if (_verbose.Value) { Log.Warning("Bonus maps: ticker: " + ex.Message); } } } return false; } internal void DecorateLabyrinthLabel(MenuHandlerMaps handler) { if ((Object)(object)handler == (Object)null) { return; } BonusMap bonusMap = SelectedBonus(handler); TextMeshProUGUI val = null; try { val = handler.mapValueText; } catch { } if (bonusMap == null || (Object)(object)val == (Object)null || bonusMap.Enabled == null || !bonusMap.Enabled.Value) { if ((Object)(object)_labHandler != (Object)null && ((Il2CppObjectBase)_labHandler).Pointer == ((Il2CppObjectBase)handler).Pointer) { HideLabyrinthUi(); } return; } bool flag = Unlocked(bonusMap); int num = Earned(bonusMap); string text = $"{bonusMap.Id} {(flag ? "unlocked" : "locked")} {num}/{bonusMap.Requirements.Length}"; if (_labLastState != text) { _labLastState = text; Log.Msg(bonusMap.Id + ": shown in the lobby - " + text + "."); } try { ((TMP_Text)val).richText = true; ((TMP_Text)val).text = (flag ? bonusMap.Upper : ("<color=#7C7C7C>" + bonusMap.Upper + "</color>")); } catch { } _uiBonus = bonusMap; _labHandler = handler; _labLabel = val; if (_labUiFailed) { return; } try { EnsureLabyrinthUi(handler, val); UpdateLockIcon(val, !flag); UpdateLabyrinthPanel(val, flag, num); } catch (Exception ex) { _labUiFailed = true; Log.Warning($"Labyrinth: lobby panel failed ({ex.GetType().Name}: {ex.Message}); the label still shows the lock state."); try { ((TMP_Text)val).text = (flag ? bonusMap.Upper : $"<color=#7C7C7C>{bonusMap.Upper} (LOCKED {num}/{bonusMap.Requirements.Length})</color>"); } catch { } } } private void HideLabyrinthUi() { try { if ((Object)(object)_labPanel != (Object)null) { ((Component)_labPanel).gameObject.SetActive(false); } } catch { } try { if ((Object)(object)_labLock != (Object)null) { ((Component)_labLock).gameObject.SetActive(false); } } catch { } } private static bool Alive(Component c) { try { return (Object)(object)c != (Object)null && (Object)(object)c.gameObject != (Object)null; } catch { return false; } } private void EnsureLabyrinthUi(MenuHandlerMaps handler, TextMeshProUGUI label) { //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018b: 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_019e: Expected O, but got Unknown //IL_01fd: 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_022b: Unknown result type (might be due to invalid IL or missing references) //IL_0236: 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_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) if (!Alive((Component)(object)_labLock) || (Object)(object)((Component)_labLock).transform.parent != (Object)(object)((TMP_Text)label).transform) { if (Alive((Component)(object)_labLock)) { Object.Destroy((Object)(object)((Component)_labLock).gameObject); } GameObject val = new GameObject("Wave5Mod_LabyrinthLock"); val.transform.SetParent(((TMP_Text)label).transform, false); _labLock = AddComp<Image>(val); _labLock.sprite = LockSprite(); _labLock.preserveAspect = true; ((Graphic)_labLock).raycastTarget = false; LayoutElement val2 = AddComp<LayoutElement>(val); if ((Object)(object)val2 != (Object)null) { val2.ignoreLayout = true; } } if (!Alive((Component)(object)_labPanel)) { Canvas val3 = (((Object)(object)((Graphic)label).canvas != (Object)null) ? ((Graphic)label).canvas.rootCanvas : null); if ((Object)(object)val3 == (Object)null) { throw new InvalidOperationException("map label has no canvas"); } GameObject val4 = new GameObject("Wave5Mod_LabyrinthPanel"); val4.transform.SetParent(((Component)val3).transform, false); Image obj = AddComp<Image>(val4); ((Graphic)obj).color = new Color(0.05f, 0.05f, 0.07f, 0.82f); ((Graphic)obj).raycastTarget = false; _labPanel = ((Il2CppObjectBase)val4.transform).TryCast<RectTransform>(); _labPanel.pivot = new Vector2(0.5f, 1f); RectTransform labPanel = _labPanel; RectTransform labPanel2 = _labPanel; Vector2 val5 = default(Vector2); ((Vector2)(ref val5))..ctor(0.5f, 0.5f); labPanel2.anchorMax = val5; labPanel.anchorMin = val5; GameObject val6 = new GameObject("Text"); val6.transform.SetParent(val4.transform, false); _labPanelText = AddComp<TextMeshProUGUI>(val6); ((TMP_Text)_labPanelText).font = ((TMP_Text)label).font; ((TMP_Text)_labPanelText).richText = true; ((TMP_Text)_labPanelText).enableWordWrapping = false; ((TMP_Text)_labPanelText).alignment = (TextAlignmentOptions)514; ((Graphic)_labPanelText).color = Color.white; ((Graphic)_labPanelText).raycastTarget = false; RectTransform obj2 = ((Il2CppObjectBase)val6.transform).TryCast<RectTransform>(); obj2.anchorMin = Vector2.zero; obj2.anchorMax = Vector2.one; val5 = (obj2.offsetMin = (obj2.offsetMax = Vector2.zero)); Log.Msg("Labyrinth: created the lock icon and requirements panel."); } } private void UpdateLockIcon(TextMeshProUGUI label, bool show) { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0077: 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_008e: 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_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_010a: 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_013d: 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_0143: 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) if (Alive((Component)(object)_labLock)) { ((Component)_labLock).gameObject.SetActive(show && ((Component)label).gameObject.activeInHierarchy); if (show) { ((TMP_Text)label).ForceMeshUpdate(false, false); Bounds textBounds = ((TMP_Text)label).textBounds; float num = Mathf.Max(8f, ((TMP_Text)label).fontSize * 0.85f); RectTransform rectTransform = ((Graphic)_labLock).rectTransform; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0.5f, 0.5f); rectTransform.anchorMax = val; rectTransform.anchorMin = val; rectTransform.pivot = new Vector2(0f, 0.5f); rectTransform.sizeDelta = new Vector2(num * 0.8f, num); float num2 = ((TMP_Text)label).rectTransform.pivot.x - 0.5f; Rect rect = ((TMP_Text)label).rectTransform.rect; float num3 = num2 * ((Rect)(ref rect)).width; float num4 = ((TMP_Text)label).rectTransform.pivot.y - 0.5f; rect = ((TMP_Text)label).rectTransform.rect; Vector2 val2 = default(Vector2); ((Vector2)(ref val2))..ctor(num3, num4 * ((Rect)(ref rect)).height); rectTransform.anchoredPosition = new Vector2(((Bounds)(ref textBounds)).max.x + num * Mathf.Clamp(_labLockGap.Value, -2f, 6f), ((Bounds)(ref textBounds)).center.y) + val2; ((Graphic)_labLock).color = new Color(0.78f, 0.78f, 0.78f, 1f); } } } private void UpdateLabyrinthPanel(TextMeshProUGUI label, bool unlocked, int earned) { //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: 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) if (!Alive((Component)(object)_labPanel) || (Object)(object)_labPanelText == (Object)null) { return; } string value = StarGlyph((TMP_Text)(object)label); StringBuilder stringBuilder = new StringBuilder(); if (unlocked) { ((Component)_labPanel).gameObject.SetActive(false); return; } stringBuilder.Append("<color=#DDDDDD><b>BRONZE STARS REQUIRED</b></color>\n"); BonusMap bonusMap = _uiBonus ?? _bLab; stringBuilder.Append("<size=140%><b><color=#CD7F32>").Append(earned).Append("</color> / ") .Append(bonusMap.Requirements.Length) .Append("</b></size>\n"); stringBuilder.Append("<size=70%><color=#999999>").Append(bonusMap.HowTo).Append("</color></size>"); (string, string)[] requirements = bonusMap.Requirements; for (int i = 0; i < requirements.Length; i++) { (string, string) tuple = requirements[i]; bool flag = HasBronze(bonusMap, tuple.Item2); stringBuilder.Append('\n'); stringBuilder.Append(flag ? "<color=#CD7F32>" : "<color=#4A4A4A>").Append(value).Append("</color> "); stringBuilder.Append(flag ? "<color=#FFFFFF>" : "<color=#8A8A8A>").Append(tuple.Item1).Append("</color>"); } ((TMP_Text)_labPanelText).fontSize = Mathf.Max(8f, ((TMP_Text)label).fontSize * Mathf.Clamp(_labPanelSize.Value, 0.2f, 2f)); ((TMP_Text)_labPanelText).text = stringBuilder.ToString(); Vector2 preferredValues = ((TMP_Text)_labPanelText).GetPreferredValues(((TMP_Text)_labPanelText).text); float num = ((TMP_Text)_labPanelText).fontSize * 0.8f; _labPanel.sizeDelta = new Vector2(preferredValues.x + num * 2f, preferredValues.y + num * 1.4f); ((Component)_labPanel).gameObject.SetActive(true); ((Transform)_labPanel).SetAsLastSibling(); FollowLabyrinthPanel(); } private void TickLabyrinthUi() { if ((Object)(object)_labHandler == (Object)null || (!Alive((Component)(object)_labPanel) && !Alive((Component)(object)_labLock))) { return; } if (!Alive((Component)(object)_labLabel)) { HideLabyrinthUi(); _labHandler = null; return; } bool flag = false; try { if ((Object)(object)_labHandler != (Object)null && (Object)(object)((Component)_labHandler).gameObject != (Object)null && ((Component)_labHandler).gameObject.activeInHierarchy) { List<string> mapList = _labHandler.mapList; int currentMapIndex = _labHandler.currentMapIndex; flag = mapList != null && currentMapIndex >= 0 && currentMapIndex < mapList.Count && IsBonusNorm(Norm(mapList[currentMapIndex])); } } catch { _labHandler = null; } if (!flag) { HideLabyrinthUi(); } else { FollowLabyrinthPanel(); } } private void FollowLabyrinthPanel() { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009b: 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_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: 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_0073: 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_0122: 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_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_00fa: 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_0108: 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) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_016a: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: Unknown result type (might be due to invalid IL or missing references) if (!Alive((Component)(object)_labPanel) || !Alive((Component)(object)_labLabel)) { return; } try { Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(0f, -15f); string text = (_labPanelOffset.Value ?? "").Trim(); if (text.Split(',').Length == 2) { text += ",0"; } if (TryParseVector(text, out var v)) { ((Vector2)(ref val))..ctor(v.x, v.y); } RectTransform rectTransform = ((TMP_Text)_labLabel).rectTransform; Bounds textBounds = ((TMP_Text)_labLabel).textBounds; Vector3 val2 = default(Vector3); ((Vector3)(ref val2))..ctor(((Bounds)(ref textBounds)).center.x + val.x, ((Bounds)(ref textBounds)).min.y + val.y, 0f); if (((Bounds)(ref textBounds)).size.x <= 0f) { Rect rect = rectTransform.rect; float num = ((Rect)(ref rect)).center.x + val.x; rect = rectTransform.rect; ((Vector3)(ref val2))..ctor(num, ((Rect)(ref rect)).yMin + val.y, 0f); } ((Transform)_labPanel).position = ((Transform)rectTransform).TransformPoint(val2); ((Transform)_labPanel).rotation = ((Transform)rectTransform).rotation; Transform parent = ((Transform)_labPanel).parent; Vector3 lossyScale = ((Transform)rectTransform).lossyScale; Vector3 val3 = (((Object)(object)parent != (Object)null) ? parent.lossyScale : Vector3.one); float num2 = ((val3.x != 0f) ? (lossyScale.x / val3.x) : 1f); ((Transform)_labPanel).localScale = new Vector3(num2, num2, 1f); } catch { } } private Sprite LockSprite() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_020b: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_lockSprite != (Object)null) { return _lockSprite; } Texture2D val = new Texture2D(48, 64, (TextureFormat)4, false); ((Texture)val).filterMode = (FilterMode)1; ((Texture)val).wrapMode = (TextureWrapMode)1; Color val2 = default(Color); ((Color)(ref val2))..ctor(1f, 1f, 1f, 0f); for (int i = 0; i < 64; i++) { for (int j = 0; j < 48; j++) { float num = (float)j + 0.5f; float num2 = (float)i + 0.5f; float num3 = 0f; float num4 = Mathf.Clamp(num, 9f, 39f); float num5 = Mathf.Clamp(num2, 8f, 32f); float num6 = Vector2.Distance(new Vector2(num, num2), new Vector2(num4, num5)); num3 = Mathf.Max(num3, Mathf.Clamp01(6f - num6 + 0.5f)); float num7 = num - 24f; float num8 = num2 - 46f; float num9 = Mathf.Sqrt(num7 * num7 + num8 * num8); if (num8 >= 0f) { num3 = Mathf.Max(num3, Mathf.Clamp01(Mathf.Min(num9 - 9.5f, 15.5f - num9))); } else if (num2 > 36f) { num3 = Mathf.Max(num3, Mathf.Clamp01(Mathf.Min(Mathf.Abs(num7) - 9.5f, 15.5f - Mathf.Abs(num7)))); } float num10 = num - 24f; float num11 = num2 - 23f; if (num10 * num10 + num11 * num11 < 20f || (Mathf.Abs(num10) < 1.8f && num11 < 0f && num11 > -10f)) { num3 = 0f; } val.SetPixel(j, i, (Color)((num3 <= 0f) ? val2 : new Color(1f, 1f, 1f, num3))); } } val.Apply(); _lockSprite = Sprite.Create(val, new Rect(0f, 0f, 48f, 64f), new Vector2(0.5f, 0.5f), 100f); try { ((Object)val).hideFlags = (HideFlags)32; ((Object)_lockSprite).hideFlags = (HideFlags)32; } catch { } return _lockSprite; } private void InitLabyrinthLoading() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown try { MethodInfo methodInfo = AccessTools.Method(typeof(LoadScreenDisplayHandler), "SelectSubTitle", (Type[])null, (Type[])null); if (methodInfo != null) { ((MelonBase)this).HarmonyInstance.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(LabyrinthLoadingPatch), "Postfix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } Log.Msg($"Labyrinth: patched loading screen title={methodInfo != null}."); } catch (Exception ex) { Log.Warning("Labyrinth: loading screen patch failed: " + ex.Message); } } private string BonusLoadingName() { if (StadiumMatch) { return "Stadium"; } if (LabyrinthMatch) { return "Labyrinth"; } try { foreach (MenuHandlerMaps item in Object.FindObjectsOfType<MenuHandlerMaps>()) { if (!((Object)(object)item == (Object)null)) { BonusMap bonusMap = SelectedBonus(item); if (bonusMap != null && Unlocked(bonusMap)) { return bonusMap.Id; } } } } catch { } return null; } private string MatchName() { if (!StadiumMatch) { if (!LabyrinthMatch) { return null; } return "Labyrinth"; } return "Stadium"; } internal void OnLoadSubTitle(LoadScreenDisplayHandler h) { _loadScreen = h; ApplyLoadTitle(BonusLoadingName()); } private void TickLoadingTitle() { if ((Object)(object)_loadScreen == (Object)null) { return; } try { if ((Object)(object)((Component)_loadScreen).gameObject == (Object)null) { _loadScreen = null; return; } string text = MatchName(); if (_loadTitlePaused || text != null) { ApplyLoadTitle(text); } } catch { _loadScreen = null; } } private void ApplyLoadTitle(string name) { try { LocalizeStringEvent val = (((Object)(object)_loadScreen != (Object)null) ? _loadScreen._subTitle : null); if ((Object)(object)val == (Object)null) { return; } if (name == null) { if (_loadTitlePaused) { ((Behaviour)val).enabled = true; _loadTitlePaused = false; val.RefreshString(); } return; } if (((Behaviour)val).enabled) { ((Behaviour)val).enabled = false; } _loadTitlePaused = true; TMP_Text componentInChildren = ((Component)val).gameObject.GetComponentInChildren<TMP_Text>(true); if ((Object)(object)componentInChildren != (Object)null && componentInChildren.text != name) { componentInChildren.text = name; } } catch (Exception ex) { if (_verbose.Value) { Log.Warning("Labyrinth: loading title: " + ex.Message); } } } private void InitLabyrinthRoom(MelonPreferences_Category cat) { _labOrigins = cat.CreateEntry<string>("LabyrinthOrigin", "rooftop=-3.429,-0.137,10.122,181,v2,c", "Labyrinth origin (managed by the mod)", "Where the Labyrinth room is built on each stand-in map: map=x,y,z,yaw;... Worked out the first time you play it. Delete to re-centre.", false, false, (ValueValidator)null, (string)null); _labBarrelMass = cat.CreateEntry<float>("LabyrinthBarrelKg", 8f, "Labyrinth barrel weight", "Mass of each toxic barrel (kg). Lower = easier to pick up and throw.", false, false, (ValueValidator)null, (string)null); _labRailHits = cat.CreateEntry<int>("LabyrinthRailHits", 4, "Labyrinth railing hits", "How many solid hits (punches, slams, thrown barrels) a railing section takes before it breaks off.", false, false, (ValueValidator)null, (string)null); _labRailHitForce = cat.CreateEntry<float>("LabyrinthRailHitForce", 1500f, "Labyrinth railing hit force", "Force (newtons) that counts as one hit on a railing. Raise if leaning on rails wears them down; lower if punches don't register.", false, false, (ValueValidator)null, (string)null); _labFog = cat.CreateEntry<float>("LabyrinthFog", 0.008f, "Labyrinth fog", "Density of the greenish haze in the room. 0 = off.", false, false, (ValueValidator)null, (string)null); InitLabyrinthLoading(); } private static bool SafeAlive(GameObject go) { try { return (Object)(object)go != (Object)null && (Object)(object)go.transform != (Object)null; } catch { return false; } } private void TickLabyrinthRoom() { TickLoadingTitle(); if (!LabyrinthMatch) { if (LabyrinthBuilt) { DestroyLabyrinth("Labyrinth no longer selected"); } if (_labEnvChanged) { RestoreLabyrinthEnv(); } return; } GameManagerNew val = null; try { val = GameManagerNew.Instance; } catch { } if ((Object)(object)val == (Object)null) { if (LabyrinthBuilt) { DestroyLabyrinth("match ended"); } if (_labEnvChanged) { RestoreLabyrinthEnv(); } if (_labGmMissingSince < 0f) { _labGmMissingSince = Time.unscaledTime; } else if (Time.unscaledTime - _labGmMissingSince > 20f) { LabyrinthMatch = false; _labGmMissingSince = -1f; } return; } _labGmMissingSince = -1f; if (!LabyrinthBuilt) { if (_labNavHandles.Count > 0) { RemoveLabyrinthNav(); } if (_labEnvChanged) { RestoreLabyrinthEnv(); } if (!(Time.unscaledTime < _labNextTry)) { _labNextTry = Time.unscaledTime + 0.25f; TryBuildLabyrinth(); } return; } float deltaTime = Time.deltaTime; foreach (Transform labFan in _labFans) { try { if ((Object)(object)labFan != (Object)null) { labFan.Rotate(0f, 140f * deltaTime, 0f, (Space)1); } } catch { } } AnimateAcid(deltaTime); TickRails(); if (Time.unscaledTime >= _labNextCamFix) { _labNextCamFix = Time.unscaledTime + 0.5f; BlackBackground(); ApplyBlackFog(); } UpdateSideVisibility(); if ((_labYawConfirmed || !CheckCameraSide()) && !(Time.time < _labNextTick)) { _labNextTick = Time.time + 0.05f; TickLabyrinthActors(); } } private Scene FindStandInScene(out bool found) { //IL_0026: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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) found = false; string text = Norm(LabyrinthStandInUsed ?? _labStandIn?.Value); Scene result = default(Scene); if (text.Length == 0) { return result; } int sceneCount = SceneManager.sceneCount; for (int i = 0; i < sceneCount; i++) { Scene sceneAt = SceneManager.GetSceneAt(i); string text2 = Norm(((Scene)(ref sceneAt)).name); if (text2.Length >= 3 && (text2 == text || text2.Contains(text) || (text.Contains(text2) && text2.Length >= 4))) { found = true; return sceneAt; } } return result; } private void TryBuildLabyrinth() { //IL_0003: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00db: 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_00f9: Expected O, but got Unknown //IL_0236: 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_027e: 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) bool found; Scene val = FindStandInScene(out found); if (!found) { if (!_labWarnedScene) { _labWarnedScene = true; Log.Warning("Labyrinth: stand-in map '" + LabyrinthStandInUsed + "' is not the loaded scene; not building the room."); } return; } List<Actor> list = new List<Actor>(); foreach (Actor item in Object.FindObjectsOfType<Actor>()) { try { if ((Object)(object)item != (Object)null && !item.IsAI) { list.Add(item); } } catch { } } Camera val2 = null; try { val2 = Camera.main; } catch { } if (list.Count == 0 || (Object)(object)val2 == (Object)null) { return; } try { _labBeastLayer = BeastLayer(list); if (GetOrCreateOrigin(val, list, val2, out var origin, out var yaw)) { PickTemplateAndLayers(val, origin, yaw, list); HideStandIn(val); ApplyLabyrinthEnv(val2); _labRoot = new GameObject("Wave5Mod_Labyrinth"); try { SceneManager.MoveGameObjectToScene(_labRoot, val); } catch { } _labT = _labRoot.transform; _labT.position = origin; _labT.rotation = Quaternion.Euler(0f, yaw, 0f); _labFans.Clear(); _labActors.Clear(); _labBubbles.Clear(); _labPuffs.Clear(); _labRails.Clear(); _labRailLogs = 0; _fogApplied = false; List<Renderer>[] labSide = _labSide; for (int i = 0; i < labSide.Length; i++) { labSide[i].Clear(); } for (int j = 0; j < _labSideShown.Length; j++) { _labSideShown[j] = true; } _labHumansPlaced = 0; BuildShell(); BuildPit(); BuildCatwalkAndStairs(); BuildDoors(); BuildProps(); BuildSigns(); BuildLights(); BuildAcidEffects(); BuildExteriorShell(); ClassifySides(); SeparateRails(); RegisterStaticGrabs(); BuildLabyrinthNav(); EnsureLabyrinthBossProfile(); _labBuiltAt = Time.time; _labCamSum = Vector3.zero; _labCamSamples = 0; Log.Msg($"Labyrinth: room built on '{((Scene)(ref val)).name}' at {Fmt(origin)}, facing {yaw:F0}° (static layer {_labStaticLayer}, props layer {_labDynLayer}, shader '{(((Object)(object)_labTemplate != (Object)null && (Object)(object)_labTemplate.shader != (Object)null) ? ((Object)_labTemplate.shader).name : "?")}')."); TickLabyrinthActors(); } } catch (Exception value) { Log.Error($"Labyrinth: building the room failed: {value}"); if ((Object)(object)_labRoot != (Object)null) { try { Object.Destroy((Object)(object)_labRoot); } catch { } } _labRoot = null; _labNextTry = Time.unscaledTime + 5f; } } private void DestroyLabyrinth(string why) { try { if ((Object)(object)_labRoot != (Object)null) { Object.Destroy((Object)(object)_labRoot); } } catch { } _labRoot = null; RemoveLabyrinthNav(); UnregisterGrabs(); _labFans.Clear(); _labActors.Clear(); _labBubbles.Clear(); _labPuffs.Clear(); _labRails.Clear(); List<Renderer>[] labSide = _labSide; for (int i = 0; i < labSide.Length; i++) { labSide[i].Clear(); } Log.Msg("Labyrinth: room removed (" + why + ")."); } private static int BeastLayer(List<Actor> humans) { Dictionary<int, int> dictionary = new Dictionary<int, int>(); foreach (Actor human in humans) { try { foreach (Rigidbody componentsInChild in ((Component)human).gameObject.GetComponentsInChildren<Rigidbody>()) { if (!((Object)(object)componentsInChild == (Object)null)) { int layer = ((Component)componentsInChild).gameObject.layer; dictionary.TryGetValue(layer, out var value); dictionary[layer] = value + 1; } } } catch { } } int result = 0; int num = -1; foreach (KeyValuePair<int, int> item in dictionary) { if (item.Value > num) { result = item.Key; num = item.Value; } } return result; } private bool HitsBeasts(int layer) { try { return !Physics.GetIgnoreLayerCollision(_labBeastLayer, layer); } catch { return true; } } private bool IsBeastFloor(RaycastHit h) { try { if ((Object)(object)((RaycastHit)(ref h)).collider == (Object)null || ((RaycastHit)(ref h)).collider.isTrigger) { return false; } if ((Object)(object)((Component)((RaycastHit)(ref h)).collider).GetComponentInParent<Actor>() != (Object)null) { return false; } return HitsBeasts(((Component)((RaycastHit)(ref h)).collider).gameObject.layer); } catch { return false; } } private static float LowestBodyY(Actor a) { //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) float num = float.MaxValue; try { foreach (Rigidbody componentsInChild in ((Component)a).gameObject.GetComponentsInChildren<Rigidbody>()) { if ((Object)(object)componentsInChild != (Object)null && componentsInChild.position.y < num) { num = componentsInChild.position.y; } } } catch { } if (num != float.MaxValue) { return num; } return ((Component)a).transform.position.y; } private bool GetOrCreateOrigin(Scene scene, List<Actor> humans, Camera cam, out Vector3 origin, out float yaw) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_0225: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0366: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_025d: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a1: Unknown result type (might be due to invalid IL or missing references) //IL_03a5: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03cb: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f4: Unknown result type (might be due to invalid IL or missing references) //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_029a: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) origin = Vector3.zero; yaw = 0f; string text = Norm(((Scene)(ref scene)).name); List<string> list = new List<string>(); bool flag = false; string[] array = (_labOrigins.Value ?? "").Split(';'); foreach (string text2 in array) { int num = text2.IndexOf('='); if (num <= 0) { continue; } string[] array2 = text2.Substring(num + 1).Split(','); if (array2.Length < 5 || !(array2[4].Trim() == "v2")) { continue; } list.Add(text2); if (!flag && !(Norm(text2.Substring(0, num)) != text)) { CultureInfo invariantCulture = CultureInfo.InvariantCulture; NumberStyles style = NumberStyles.Float; if (float.TryParse(array2[0], style, invariantCulture, out var result) && float.TryParse(array2[1], style, invariantCulture, out var result2) && float.TryParse(array2[2], style, invariantCulture, out var result3) && float.TryParse(array2[3], style, invariantCulture, out var result4)) { origin = new Vector3(result, result2, result3); yaw = result4; _labYawConfirmed = array2.Length >= 6 && array2[5].Trim() == "c"; flag = true; } } } if (flag) { return true; } _labOrigins.Value = string.Join(";", list); if (_profiles.Remove("labyrinth")) { SaveProfiles(); } Vector3 val = Vector3.zero; int num2 = 0; float num3 = float.MaxValue; foreach (Actor human in humans) { val += ActorCentre(human); num2++; num3 = Mathf.Min(num3, LowestBodyY(human)); } val /= (float)Mathf.Max(1, num2); float num4 = float.NaN; foreach (Actor human2 in humans) { foreach (RaycastHit item in (Il2CppArrayBase<RaycastHit>)(object)Physics.RaycastAll(ActorCentre(human2) + Vector3.up * 0.5f, Vector3.down, 30f)) { RaycastHit current2 = item; if (IsBeastFloor(current2) && !(((RaycastHit)(ref current2)).point.y > num3 + 0.5f) && (float.IsNaN(num4) || ((RaycastHit)(ref current2)).point.y > num4)) { num4 = ((RaycastHit)(ref current2)).point.y; } } } if (float.IsNaN(num4)) { num4 = num3 - 0.15f; } Log.Msg($"Labyrinth: players' feet at y {num3:F2}, ground found at y {num4:F2} (beast layer {_labBeastLayer})."); Vector3 forward = ((Component)cam).transform.forward; forward.y = 0f; if (((Vector3)(ref forward)).sqrMagnitude < 0.01f) { forward = Vector3.forward; } Quaternion val2 = Quaternion.LookRotation(((Vector3)(ref forward)).normalized, Vector3.up); yaw = Mathf.Round(((Quaternion)(ref val2)).eulerAngles.y); Quaternion val3 = Quaternion.Euler(0f, yaw, 0f); origin = new Vector3(val.x, num4, val.z) - val3 * new Vector3(0f, 0f, 6f); CultureInfo invariantCulture2 = CultureInfo.InvariantCulture; string text3 = $"{text}={origin.x.ToString("0.###", invariantCulture2)},{origin.y.ToString("0.###", invariantCulture2)},{origin.z.ToString("0.###", invariantCulture2)},{yaw.ToString("0", invariantCulture2)},v2"; _labOrigins.Value = (string.IsNullOrEmpty(_labOrigins.Value) ? text3 : (_labOrigins.Value + ";" + text3)); try { MelonPreferences.Save(); } catch { } _labYawConfirmed = false; Log.Msg($"Labyrinth: first build on '{((Scene)(ref scene)).name}' - room origin saved as {text3}."); return true; } private void PickTemplateAndLayers(Scene scene, Vector3 origin, float yaw, List<Actor> humans) { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0112: 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_0132: 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_0141: 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_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_0307: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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_00b2: 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_0182: Unknown result type (might be due to invalid IL or missing references) string text = Norm(((Scene)(ref scene)).name); if (_labLayersFor == text && _labStaticLayer >= 0 && _labDynLayer >= 0) { PickMaterials(scene); return; } _labStaticLayer = -1; _labDynLayer = -1; foreach (Actor human in humans) { float num = float.NegativeInfinity; foreach (RaycastHit item in (Il2CppArrayBase<RaycastHit>)(object)Physics.RaycastAll(ActorCentre(human) + Vector3.up * 0.5f, Vector3.down, 30f)) { RaycastHit current2 = item; if (IsBeastFloor(current2) && ((RaycastHit)(ref current2)).point.y > num) { num = ((RaycastHit)(ref current2)).point.y; _labStaticLayer = ((Component)((RaycastHit)(ref current2)).collider).gameObject.layer; } } if (_labStaticLayer >= 0) { break; } } Vector3 val = origin + Quaternion.Euler(0f, yaw, 0f) * new Vector3(0f, 0f, 6f); if (_labStaticLayer < 0) { foreach (RaycastHit item2 in (Il2CppArrayBase<RaycastHit>)(object)Physics.RaycastAll(val + Vector3.up * 3f, Vector3.down, 20f)) { RaycastHit current3 = item2; if (IsBeastFloor(current3)) { _labStaticLayer = ((Component)((RaycastHit)(ref current3)).collider).gameObject.layer; break; } } } if (_labStaticLayer < 0 && HitsBeasts(0)) { _labStaticLayer = 0; } for (int i = 0; i < 32; i++) { if (_labStaticLayer >= 0) { break; } if (HitsBeasts(i)) { _labStaticLayer = i; } } if (_labStaticLayer < 0) { _labStaticLayer = 0; } foreach (GameObject item3 in (Il2CppArrayBase<GameObject>)(object)((Scene)(ref scene)).GetRootGameObjects()) { if ((Object)(object)item3 == (Object)null || _labDynLayer >= 0) { continue; } foreach (Rigidbody componentsInChild in item3.GetComponentsInChildren<Rigidbody>(true)) { try { if (!((Object)(object)componentsInChild == (Object)null) && !componentsInChild.isKinematic && !((Object)(object)((Component)componentsInChild).GetComponentInParent<Actor>() != (Object)null)) { int layer = ((Component)componentsInChild).gameObject.layer; if (HitsBeasts(layer) && !Physics.GetIgnoreLayerCollision(layer, _labStaticLayer)) { _labDynLayer = layer; break; } } } catch { } } } if (_labDynLayer < 0) { _labDynLayer = _labStaticLayer; } _labLayersFor = text; PickMaterials(scene); } private void PickMaterials(Scene scene) { //IL_04ba: Unknown result type (might be due to invalid IL or missing references) //IL_04c4: Expected O, but got Unknown //IL_04df: Unknown result type (might be due to invalid IL or missing references) //IL_04e9: Expected O, but got Unknown //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03bd: Expected O, but got Unknown Material val = null; if ((Object)(object)_labTemplate == (Object)null) { foreach (Actor item in Object.FindObjectsOfType<Actor>()) { try { foreach (Renderer componentsInChild in ((Component)item).gameObject.GetComponentsInChildren<Renderer>(true)) { Material val2 = (((Object)(object)componentsInChild != (Object)null) ? componentsInChild.sharedMaterial : null); if ((Object)(object)val2 != (Object)null && (Object)(object)val2.shader != (Object)null && (((Object)val2.shader).name ?? "").Contains("VinylOrMetal")) { val = val2; break; } } } catch { } if ((Object)(object)val != (Object)null) { break; } } } if ((Object)(object)_labTemplate == (Object)null && (Object)(object)val == (Object)null) { foreach (GameObject item2 in (Il2CppArrayBase<GameObject>)(object)((Scene)(ref scene)).GetRootGameObjects()) { if ((Object)(object)item2 == (Object)null || (Object)(object)val != (Object)null) { continue; } foreach (MeshRenderer componentsInChild2 in item2.GetComponentsInChildren<MeshRenderer>(true)) { try { Material val3 = (((Object)(object)componentsInChild2 != (Object)null) ? ((Renderer)componentsInChild2).sharedMaterial : null); if ((Object)(object)val3 == (Object)null || (Object)(object)val3.shader == (Object)null || (!val3.HasProperty("_Color") && !val3.HasProperty("_BaseColor")) || (!val3.HasProperty("_MainTex") && !val3.HasProperty("_BaseMap"))) { continue; } string text = ((Object)val3.shader).name ?? ""; if (!text.Contains("Transparent") && !text.Contains("Particle") && !text.Contains("UI") && !text.Contains("Sprite") && !text.Contains("Unlit")) { val = val3; if (text.Contains("GangBeasts")) { break; } } } catch { } } } } if ((Object)(object)_labMistTemplate == (Object)null) { Material val4 = null; Material val5 = null; foreach (GameObject item3 in (Il2CppArrayBase<GameObject>)(object)((Scene)(ref scene)).GetRootGameObjects()) { if ((Object)(object)item3 == (Object)null) { continue; } foreach (ParticleSystemRenderer componentsInChild3 in item3.GetComponentsInChildren<ParticleSystemRenderer>(true)) { try { Material val6 = (((Object)(object)componentsInChild3 != (Object)null) ? ((Renderer)componentsInChild3).sharedMaterial : null); if (!((Object)(object)val6 == (Object)null) && !((Object)(object)val6.shader == (Object)null)) { string text2 = (((Object)val6.shader).name ?? "").ToLowerInvariant(); if (text2.Contains("additive") && (Object)(object)val4 == (Object)null) { val4 = val6; } else if ((text2.Contains("particle") || text2.Contains("transparent") || text2.Contains("fade")) && (Object)(object)val5 == (Object)null) { val5 = val6; } } } catch { } } } Material val7 = val4 ?? val5; if ((Object)(object)val7 != (Object)null) { _labMistTemplate = new Material(val7); try { ((Object)_labMistTemplate).hideFlags = (HideFlags)32; } catch { } Log.Msg("Labyrinth: acid mist uses shader '" + ((Object)val7.shader).name + "'."); } else { Log.Msg("Labyrinth: no see-through effect material on this map; the acid gets bubbles but no mist."); } } if (!((Object)(object)_labTemplate == (Object)null)) { return; } if ((Object)(object)val == (Object)null) { foreach (Actor item4 in Object.FindObjectsOfType<Actor>()) { try { foreach (Renderer componentsInChild4 in ((Component)item4).gameObject.GetComponentsInChildren<Renderer>(true)) { if ((Object)(object)componentsInChild4 != (Object)null && (Object)(object)componentsInChild4.sharedMaterial != (Object)null) { val = componentsInChild4.sharedMaterial; break; } } } catch { } if ((Object)(object)val != (Object)null) { break; } } } if ((Object)(object)val != (Object)null) { _labTemplate = new Material(val); } else { Shader val8 = Shader.Find("Standard"); if ((Object)(object)val8 != (Object)null) { _labTemplate = new Material(val8); } } if (!((Object)(object)_labTemplate != (Object)null)) { return; } string[] array = new string[10] { "_BumpMap", "_NormalMap", "_MetallicGlossMap", "_OcclusionMap", "_DetailAlbedoMap", "_DetailNormalMap", "_EmissionMap", "_ParallaxMap", "_SpecGlossMap", "_MaskMap" }; foreach (string text3 in array) { try { if (_labTemplate.HasProperty(text3)) { _labTemplate.SetTexture(text3, (Texture)null); } } catch { } } array = new string[5] { "_NORMALMAP", "_METALLICGLOSSMAP", "_DETAIL_MULX2", "_PARALLAXMAP", "_SPECGLOSSMAP" }; foreach (string text4 in array) { try { _labTemplate.DisableKeyword(text4); } catch { } } try { ((Object)_labTemplate).hideFlags = (HideFlags)32; } catch { } } private void HideStandIn(Scene scene, bool football = false) { int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; foreach (GameObject item in (Il2CppArrayBase<GameObject>)(object)((Scene)(ref scene)).GetRootGameObjects()) { if ((Object)(object)item == (Object)null) { continue; } foreach (Renderer componentsInChild in item.GetComponentsInChildren<Renderer>(true)) { try { if (!((Object)(object)componentsInChild == (Object)null) && componentsInChild.enabled && !((Object)(object)((Component)componentsInChild).GetComponentInParent<Actor>() != (Object)null) && !((Object)(object)((Component)componentsInChild).GetComponentInParent<Canvas>() != (Object)null) && !((Object)(object)((Component)componentsInChild).GetComponent<TMP_Text>() != (Object)null) && (!football || !((Object)(object)((Component)componentsInChild).GetComponentInParent<Football>() != (Object)null))) { componentsInChild.enabled = false; num++; } } catch { } } foreach (Collider componentsInChild2 in item.GetComponentsInChildren<Collider>(true)) { try { if (!((Object)(object)componentsInChild2 == (Object)null) && componentsInChild2.enabled && !((Object)(object)((Component)componentsInChild2).GetComponentInParent<Actor>() != (Object)null) && (!football || (!((Object)(object)((Component)componentsInChild2).GetComponentInParent<FootballGoal>() != (Object)null) && !((Object)(object)((Component)componentsInChild2).GetComponentInParent<Football>() != (Object)null)))) { componentsInChild2.enabled = false; num2++; } } catch { } } foreach (Rigidbody componentsInChild3 in item.GetComponentsInChildren<Rigidbody>(true)) { try { if (!((Object)(object)componentsInChild3 == (Object)null) && !componentsInChild3.isKinematic && !((Object)(object)((Component)componentsInChild3).GetComponentInParent<Actor>() != (Object)null) && (!football || !((Object)(object)((Component)componentsInChild3).GetComponentInParent<Football>() != (Object)null))) { componentsInChild3.isKinematic = true; num4++; } } catch { } } if (football) { continue; } foreach (Light componentsInChild4 in item.GetComponentsInChildren<Light>(true)) { try { if ((Object)(object)componentsInChild4 != (Object)null && ((Behaviour)componentsInChild4).enabled && (Object)(object)((Component)componentsInChild4).GetComponentInParent<Actor>() == (Object)null) { ((Behaviour)componentsInChild4).enabled = false; num3++; } } catch { } } } string value = (football ? "Stadium" : "Labyrinth"); Log.Msg($"{value}: layers - beasts {_labBeastLayer}, room {_labStaticLayer}, props {_labDynLayer} (all collide with beasts)."); Log.Msg($"{value}: hid the base map ({num} renderers, {num2} colliders, {num3} lights, {num4} loose props frozen)."); } private void ApplyLabyrinthEnv(Camera cam) { //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_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) if (!_labEnvChanged) { _envAmbient = RenderSettings.ambientLight; _envAmbientMode = RenderSettings.ambientMode; _envFog = RenderSettings.fog; _envFogColor = RenderSettings.fogColor; _envFogDensity = RenderSettings.fogDensity; _envFogMode = RenderSettings.fogMode; _envPixelLights = QualitySettings.pixelLightCount; _envSkybox = RenderSettings.skybox; _envCam = cam; if ((Object)(object)cam != (Object)null) { _envCamFlags = cam.clearFlags; _envCamBg = cam.backgroundColor; } } _labEnvChanged = true; try { RenderSettings.ambientMode = (AmbientMode)3; RenderSettings.ambientLight = new Color(0.36f, 0.37f, 0.38f, 1f); float num = Mathf.Clamp(_labFog.Value, 0f, 0.1f); RenderSettings.fog = num > 0f; RenderSettings.fogMode = (FogMode)2; RenderSettings.fogDensity = num; RenderSettings.fogColor = new Color(0.05f, 0.08f, 0.05f, 1f); QualitySettings.pixelLightCount = Mathf.Max(_envPixelLights, 8); RenderSettings.skybox = null; if ((Object)(object)cam != (Object)null) { cam.clearFlags = (CameraClearFlags)2; cam.backgroundColor = Color.black; } } catch (Exception ex) { Log.Warning("Labyrinth: lighting setup: " + ex.Message); } } private void RestoreLabyrinthEnv() { //IL_0008: 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_0029: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) _labEnvChanged = false; try { RenderSettings.ambientMode = _envAmbientMode; RenderSettings.ambientLight = _envAmbient; RenderSettings.fog = _envFog; RenderSettings.fogColor = _envFogColor; RenderSettings.fogDensity = _envFogDensity; RenderSettings.fogMode = _envFogMode; QualitySettings.pixelLightCount = _envPixelLights; RenderSettings.skybox = _envSkybox; RestoreFog(); foreach (KeyValuePair<IntPtr, KeyValuePair<Camera, CameraClearFlags>> item in _envCamFlagsAll) { try { if ((Object)(object)item.Value.Key != (Object)null) { item.Value.Key.clearFlags = item.Value.Value; } } catch { } } _envCamFlagsAll.Clear(); if ((Object)(object)_envCam != (Object)null) { _envCam.clearFlags = _envCamFlags; _envCam.backgroundColor = _envCamBg; } } catch { } _envCam = null; } private Material LabMat(string name, Color col, float metal = 0.1f, float smooth = 0.3f, Color? emit = null, Texture2D tex = null, Vector2? tiling = null) { //IL_0059: 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_005f: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: Unknown result type (might be due to invalid IL or missing references) if (_labMats.TryGetValue(name, out var value)) { try { if ((Object)(object)value != (Object)null && (Object)(object)value.shader != (Object)null) { return value; } } catch { } } Material val = (((Object)(object)_labTemplate != (Object)null) ? new Material(_labTemplate) : new Material(Shader.Find("Standard"))); ((Object)val).name = "Labyrinth_" + name; if (val.HasProperty("_Color")) { val.SetColor("_Color", col); } if (val.HasProperty("_BaseColor")) { val.SetColor("_BaseColor", col); } Texture2D val2 = (((Object)(object)tex != (Object)null) ? tex : Texture2D.whiteTexture); Vector2 val3 = (Vector2)(((??)tiling) ?? Vector2.one); string[] array = new string[2] { "_MainTex", "_BaseMap" }; foreach (string text in array) { if (val.HasProperty(text)) { val.SetTexture(text, (Texture)(object)val2); val.SetTextureScale(text, val3); } } if (val.HasProperty("_Metallic")) { val.SetFloat("_Metallic", metal); } if (val.HasProperty("_Smoothness")) { val.SetFloat("_Smoothness", smooth); } if (val.HasProperty("_Glossiness")) { val.SetFloat("_Glossiness", smooth); } if (val.HasProperty("_EmissionColor")) { Color val4 = (Color)(((??)emit) ?? Color.black); if (((Color)(ref val4)).maxColorComponent > 0f) { val.EnableKeyword("_EMISSION"); val.globalIlluminationFlags = (MaterialGlobalIlluminationFlags)1; } else { val.DisableKeyword("_EMISSION"); } val.SetColor("_EmissionColor", val4); } try { ((Object)val).hideFlags = (HideFlags)32; } catch { } _labMats[name] = val; return val; } private Material MatWall(Vector2 size) { //IL_0018: 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_005c: 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_0094: 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) return LabMat($"wall{size.x:0.#}x{size.y:0.#}", new Color(0.3f, 0.31f, 0.32f), 0.45f, 0.35f, (Color?)null, LabTextures.Wall(), (Vector2?)new Vector2(Mathf.Max(1f, size.x / 4.5f), Mathf.Max(1f, size.y / 4.5f))); } private Material MatFloor(Vector2 size) { //IL_0018: 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_005c: 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_0094: 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) return LabMat($"floor{size.x:0.#}x{size.y:0.#}", new Color(0.42f, 0.42f, 0.43f), 0.2f, 0.45f, (Color?)null, LabTextures.Floor(), (Vector2?)new Vector2(Mathf.Max(1f, size.x / 3f), Mathf.Max(0.5f, size.y / 3f))); } private Material MatGrate() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) return LabMat("grate", new Color(0.55f, 0.55f, 0.55f), 0.6f, 0.4f, (Color?)null, LabTextures.Grate(), (Vector2?)new Vector2(1f, 1f)); } private Material MatDarkMetal() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) return LabMat("darkmetal", new Color(0.12f, 0.12f, 0.13f), 0.6f, 0.45f); } private Material MatYellow() { //IL_0015: 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) return LabMat("yellow", new Color(1f, 0.76f, 0.05f), 0.3f, 0.55f, (Color?)new Color(0.08f, 0.06f, 0f), (Texture2D)null, (Vector2?)null); } private Material MatRedDoor() { //IL_0015: 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) return LabMat("door", new Color(0.85f, 0.06f, 0.05f), 0.2f, 0.55f, (Color?)new Color(0.18f, 0.01f, 0.01f), (Texture2D)null, (Vector2?)null); } private Material MatRedLamp() { //IL_0015: 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) return LabMat("redlamp", new Color(1f, 0.1f, 0.1f), 0f, 0.6f, (Color?)new Color(4f, 0.3f, 0.25f), (Texture2D)null, (Vector2?)null); } private Material MatWhiteLamp() { //IL_0015: 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) return LabMat("whitelamp", new Color(1f, 1f, 1f), 0f, 0.6f, (Color?)new Color(3f, 3f, 2.8f), (Texture2D)null, (Vector2?)null); } private Material MatPipe() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) return LabMat("pipe", new Color(0.36f, 0.4f, 0.38f), 0.85f, 0.65f); } private Material MatFanGlow() { //IL_0015: 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) return LabMat("fanglow", new Color(0.3f, 1f, 0.15f), 0f, 0.3f, (Color?)new Color(0.9f, 2.6f, 0.35f), (Texture2D)null, (Vector2?)null); } private Material MatStripes() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) return LabMat("stripes", Color.white, 0.2f, 0.4f, (Color?)new Color(0.05f, 0.04f, 0f), LabTextures.Stripes(), (Vector2?)new Vector2(1f, 1f)); } private Material MatSignYellow() { //IL_0015: 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) return LabMat("signyellow", new Color(1f, 0.82f, 0.1f), 0.1f, 0.4f, (Color?)new Color(0.1f, 0.08f, 0f), LabTextures.SignBorder(), (Vector2?)null); } private Material MatTrefoil() { //IL_0006: 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) return LabMat("trefoil", Color.white, 0.1f, 0.4f, (Color?)new Color(0.08f, 0.06f, 0f), LabTextures.HazardTriangle(), (Vector2?)null); } private Material MatBarrel() { //IL_0006: 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) return LabMat("barrel", Color.white, 0.35f, 0.55f, (Color?)new Color(0.05f, 0.04f, 0f), LabTextures.Barrel(), (Vector2?)null); } private Material MatPool() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_0049: Unknown result type (might be due to invalid IL or missing references) _labPoolEmit = new Color(0.55f, 1.9f, 0.12f); Material val = LabMat("pool2", Color.white, 0.1f, 0.95f, (Color?)_labPoolEmit, LabTextures.Toxic(), (Vector2?)new Vector2(1.5f, 1.2f)); try { if (val.HasProperty("_EmissionMap")) { val.SetTexture("_EmissionMap", (Texture)(object)LabTextures.Toxic()); } } catch { } _labPoolMat = val; return val; } private GameObject Prim(PrimitiveType type, string name, Transform parent, Vector3 localPos, Vector3 scale, Material mat, bool collider, Quaternion? localRot = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) GameObject val = GameObject.CreatePrimitive(type); ((Object)val).name = name; val.transform.SetParent(parent, false); val.transform.localPosition = localPos; val.transform.localRotation = (Quaternion)(((??)localRot) ?? Quaternion.identity); val.transform.localScale = scale; val.layer = _labStaticLayer; Renderer component = val.GetComponent<Renderer>(); if ((Object)(object)component != (Object)null) { if ((Object)(object)mat != (Object)null) { component.sharedMaterial = mat; } component.shadowCastingMode = (ShadowCastingMode)0; } if (!collider) { Collider component2 = val.GetComponent<Collider>(); if ((Object)(object)component2 != (Object)null) { Object.DestroyImmediate((Object)(object)component2); } } return val; } private GameObject Box(string name, Vector3 min, Vector3 max, Material mat, bool collider = true, Transform parent = null) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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_