using System; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using AK; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Unity.IL2CPP; using CellMenu; using ChainedPuzzles; using GTFO.API; using GameData; using Gear; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using LevelGeneration; using Localization; using Microsoft.CodeAnalysis; using Player; using QuixoticPlugin.Modules.LevelBehavior; using TMPro; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("QuixoticPlugin")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("QuixoticPlugin")] [assembly: AssemblyTitle("QuixoticPlugin")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace QuixoticPlugin { [BepInPlugin("Amor.QTP", "QuixoticPlugin", "1.0.5")] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class EntryPoint : BasePlugin { public override void Load() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) new Harmony("Amor.QTP").PatchAll(); LevelAPI.OnEnterLevel += C3_SelectHSUActivatorCore.OnEnterLevel; ((BasePlugin)this).Log.LogMessage((object)"QuixoticPlugin is now loaded!"); } } } namespace QuixoticPlugin.Modules.Patches { [HarmonyPatch] internal static class BorkenCellGeoFixRelatedPatches { [HarmonyPrepare] private static bool Prepare() { return !((BaseChainloader)(object)IL2CPPChainloader.Instance).Plugins.ContainsKey("com.hirnukuono.BorkenCellGeoFix"); } [HarmonyPatch(typeof(LG_SetupFloor), "Build")] [HarmonyPrefix] [HarmonyWrapSafe] private static void FixCheeseSpot() { GameObject loadedAsset = AssetAPI.GetLoadedAsset("Assets/AssetPrefabs/Complex/Dimensions/Desert/Dimension_Desert_R7B3.prefab"); if (!((Object)(object)loadedAsset != (Object)null)) { return; } foreach (LG_PrefabSpawner componentsInChild in loadedAsset.GetComponentsInChildren()) { if (((Object)((Component)componentsInChild).transform.parent.parent).name == "Area_A" && (((Object)((Component)componentsInChild).transform).name == "LG_PrefabSpawner_prop_generic_beam_c_column_4m_tile_001 (35)" || ((Object)((Component)componentsInChild).transform).name == "LG_PrefabSpawner_prop_generic_beam_c_column_4m_tile_001 (36)")) { componentsInChild.m_disableCollision = true; } } } [HarmonyPatch(typeof(CP_Bioscan_Graphics), "Setup")] [HarmonyPostfix] [HarmonyWrapSafe] private static void FixSustainScanGraphic(CP_Bioscan_Graphics __instance) { foreach (Transform componentsInChild in ((Component)__instance).GetComponentsInChildren(true)) { if (((Object)componentsInChild).name.Contains("zone", StringComparison.OrdinalIgnoreCase)) { MeshRenderer component = ((Component)componentsInChild).GetComponent(); Material val = ((component != null) ? ((Renderer)component).material : null); if ((Object)(object)val != (Object)null && ((Object)val).name.Contains("pentagon", StringComparison.OrdinalIgnoreCase)) { val.SetTexture("_Mask", (Texture)(object)Texture2D.whiteTexture); } } } } } [HarmonyPatch] internal static class FixChainedObjectiveAlarmOnLand { [HarmonyPatch(typeof(ElevatorShaftLanding), "OnBuildDone")] [HarmonyPostfix] [HarmonyWrapSafe] private static void PostBuildDone(ElevatorShaftLanding __instance) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (MainLayerHasChainedObjectiveWithAlarm(out WardenObjectiveDataBlock mainObjDB)) { __instance.m_sound.Post(EVENTS.ALARM_AMBIENT_LOOP, true); __instance.m_sound.SetRTPCValue(GAME_PARAMETERS.ALARM_AMBIENT_MIX, 100f); if (!string.IsNullOrEmpty(LocalizedText.op_Implicit(mainObjDB.WaveOnElevatorWardenIntel))) { GuiManager.PlayerLayer.m_wardenIntel.ShowSubObjectiveMessage(string.Empty, LocalizedText.op_Implicit(mainObjDB.WaveOnElevatorWardenIntel), false, 200f, 8f, (Action)null); } } } private static bool MainLayerHasChainedObjectiveWithAlarm([NotNullWhen(true)] out WardenObjectiveDataBlock? mainObjDB) { if (RundownManager.Current.m_activeExpedition.MainLayerData.ChainedObjectiveData.Count == 0) { mainObjDB = null; return false; } mainObjDB = WardenObjectiveManager.Current.m_activeWardenObjectives[(LG_LayerType)0]; return WardenObjectiveManager.HasValidWaveSettings(mainObjDB.WavesOnElevatorLand) && WardenObjectiveManager.WaveSettingsHasAlarm(mainObjDB.WavesOnElevatorLand); } } [HarmonyPatch] internal static class FixLevelButtonCollider { [HarmonyPatch(typeof(CM_PageRundown_New), "Update")] [HarmonyPostfix] private static void FixThroughClicks(CM_PageRundown_New __instance) { Transform child = ((Component)__instance.m_popupMovement).transform.GetChild(0); bool flag = child != null && ((Component)child).gameObject.active; Enumerator enumerator = __instance.m_expIconsAll.GetEnumerator(); while (enumerator.MoveNext()) { CM_ExpeditionIcon_New current = enumerator.Current; ((Behaviour)((CM_Item)current).m_collider).enabled = !flag; } } } [HarmonyPatch] internal static class FixMultipleBPUDistribution { private static int _seed; [HarmonyPatch(typeof(RundownManager), "SetActiveExpedition")] [HarmonyPostfix] private static void SetActiveExp() { _seed = RundownManager.GetActiveExpeditionData().sessionSeed; } [HarmonyPatch(typeof(LG_PickupItem), "SetupAsBigPickupItem", new Type[] { typeof(int), typeof(BigPickupDistributionDataBlock), typeof(bool), typeof(int) })] [HarmonyPrefix] private static bool SpawnPatch(LG_PickupItem __instance, ref BigPickupDistributionDataBlock data, ref bool isWardenObjectiveItem, ref int objectiveChainIndex) { __instance.SetupCommon(); uint itemID = data.SpawnData[_seed % data.SpawnsPerZone].ItemID; __instance.SetupBigPickupItemWithItemId(itemID, isWardenObjectiveItem, objectiveChainIndex); Debug.Log(Object.op_Implicit(Deb.Purple($"SetupAsBigPickupItem, spawning item with id: {itemID}, isWardenObjectiveItem: {isWardenObjectiveItem}", 0f))); _seed++; return false; } } [HarmonyPatch] internal static class RemoveArtifactHeat { private static readonly Vector3 _space = new Vector3(99999f, 99999f, 99999f); [HarmonyPatch(typeof(CM_ExpeditionIcon_New), "SetArtifactHeat")] [HarmonyPostfix] private static void HideRundownHeat(CM_ExpeditionIcon_New __instance) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) __instance.HideArtifactHeat(); __instance.m_statusText.transform.SetPositionAndRotation(__instance.m_artifactHeatText.transform.position, __instance.m_artifactHeatText.transform.rotation); } [HarmonyPatch(typeof(CM_MenuBar), "SetExpIconArtifactHeat")] [HarmonyPrefix] private static bool ReplaceMenuBarHeat(CM_MenuBar __instance) { TextMeshPro publicName = __instance.m_expIcon.m_publicName; ((Component)publicName).gameObject.SetActive(true); ((TMP_Text)publicName).autoSizeTextContainer = true; ((TMP_Text)publicName).fontSizeMax = 60f; ((TMP_Text)publicName).fontSize = 60f; return false; } [HarmonyPatch(typeof(CM_PageExpeditionSuccess), "OnEnable")] [HarmonyPostfix] private static void YeetSuccessScreenHeat(CM_PageExpeditionSuccess __instance) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) ((Component)__instance.m_ArtifactInventoryDisplay).transform.localPosition = _space; __instance.m_artifactInfo_text.transform.localPosition = _space; } [HarmonyPatch(typeof(CM_PageExpeditionFail), "OnEnable")] [HarmonyPostfix] private static void YeetDefeatScreenHeat(CM_PageExpeditionFail __instance) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) ((Component)__instance.m_ArtifactInventoryDisplay).transform.localPosition = _space; __instance.m_artifactInfo_text.transform.localPosition = _space; } [HarmonyPatch(typeof(CM_ExpeditionWindow), "SetExpeditionInfo")] [HarmonyPostfix] private static void RundownLevelIntelPopupHeat(CM_ExpeditionWindow __instance) { ((TMP_Text)__instance.m_artifactHeatTitle).text = Text.Get(42u); } } } namespace QuixoticPlugin.Modules.LevelBehavior { internal static class C3_SelectHSUActivatorCore { internal static void OnEnterLevel() { //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Invalid comparison between Unknown and I4 //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Invalid comparison between Unknown and I4 //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_013b: 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_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_0161: Expected O, but got Unknown if (RundownManager.Current.m_activeExpedition.LevelLayoutData != 100301) { return; } int num = -1; foreach (LG_WardenObjective_HSUActivator_Room room in Object.FindObjectsOfType()) { if ((Object)(object)room == (Object)null || (int)room.m_roomArea.m_zone.DimensionIndex != 3 || (int)room.m_roomArea.m_zone.LocalIndex != 2) { continue; } List list = ((IEnumerable)((Component)room).GetComponentsInChildren()).OrderByDescending((LG_HSUActivator_Core go) => ((Component)go).transform.position.y).ToList(); if (list.Any()) { num = 10 + list.FindIndex((LG_HSUActivator_Core core) => ((Component)core).transform.position.y == ((Component)room.m_core).transform.position.y); } } if (num > 9 && num < 13) { WorldEventManager.ExecuteEvent(new WardenObjectiveEventData { Type = (eWardenObjectiveEventType)19, Delay = 1f, Condition = new WorldEventConditionPair { ConditionIndex = num, IsTrue = true } }, 0f); } } } [HarmonyPatch] internal static class DX_DeactivateAlarms { [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "DisableAlarmsCommand")] [HarmonyPrefix] private static bool PersistentTankErrorAlarm(LG_ComputerTerminalCommandInterpreter __instance) { if (RundownManager.Current.m_activeExpedition.LevelLayoutData != 7810) { return true; } __instance.AddOutput((TerminalLineType)3, "Executing alarm-shutdown protocol......don't leave terminal!", 3f, (TerminalSoundType)0, (TerminalSoundType)0); __instance.AddOutput((TerminalLineType)0, "Connecting to active alarm systems", 1f, (TerminalSoundType)0, (TerminalSoundType)0); __instance.AddOutput((TerminalLineType)0, "Confirming valid terminal ID", 2.4f, (TerminalSoundType)0, (TerminalSoundType)0); __instance.AddOutput((TerminalLineType)2, "Shutting down alarms...", 3f, (TerminalSoundType)0, (TerminalSoundType)0); ElevatorShaftLanding.StopAmbientAlarm(); __instance.AddOutput((TerminalLineType)0, "Alarm(s) linked to this terminal successfully shut down.", 0.7f, (TerminalSoundType)0, (TerminalSoundType)0); __instance.AddOutput((TerminalLineType)0, "://ERROR! High tiered alarm CmDx1e4rL1 failed to deactivate.", 1.4f, (TerminalSoundType)0, (TerminalSoundType)0); __instance.OnEndOfQueue += Action.op_Implicit((Action)delegate { GuiManager.PlayerLayer.m_objectiveTimer.SetTimerActive(false, true); }); return false; } } [HarmonyPatch] internal static class FogBeacon { [HarmonyPatch(typeof(ItemSpawnManager), "SetupItemPrefabs")] [HarmonyPostfix] private static void ChangeBeaconMaterial() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) Material loadedAsset = AssetAPI.GetLoadedAsset("Assets/AmAssets/Ancillary/Items/DefoggerBig_red.mat"); for (int i = 0; i < 3; i++) { Dictionary> val = ((Il2CppArrayBase>>)(object)ItemSpawnManager.m_loadedPrefabsPerItemMode)[i]; GameObject val2 = Object.Instantiate(val[203u][1]); ((Renderer)val2.GetComponentInChildren()).sharedMaterial = loadedAsset; val2.transform.position = new Vector3(10000f, 10000f, 10000f); val[203u][1] = val2; } } [HarmonyPatch(typeof(LG_PickupItem), "SetupBigPickupItemWithItemId")] [HarmonyPostfix] private static void PickupItemSetup(LG_PickupItem __instance, uint itemId) { if (itemId == 203) { SetupAsFogBeacon(__instance); } } private static void SetupAsFogBeacon(LG_PickupItem pickupItem) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_020a: Expected O, but got Unknown //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_0195: 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_019b: Unknown result type (might be due to invalid IL or missing references) float pickupTime = 1.9f; float placeTime = 1.5f; FogRepeller_Sphere val = new GameObject("FogInstance_Beacon_Fake").AddComponent(); val.InfiniteDuration = false; val.LifeDuration = float.MaxValue; val.GrowDuration = float.MaxValue; val.ShrinkDuration = float.MaxValue; val.Range = 1f; FogRepeller_Sphere beaconHeld = new GameObject("FogInstance_Beacon_SmallLayer").AddComponent(); beaconHeld.InfiniteDuration = true; beaconHeld.GrowDuration = 5f; beaconHeld.ShrinkDuration = 16f; beaconHeld.Range = 5f; beaconHeld.Offset = Vector3.zero; FogRepeller_Sphere beaconPlaced = new GameObject("FogInstance_Beacon_BigLayer").AddComponent(); beaconPlaced.InfiniteDuration = true; beaconPlaced.GrowDuration = 4f; beaconPlaced.ShrinkDuration = 12f; beaconPlaced.Range = 12f; beaconPlaced.Offset = Vector3.zero; PlaceNavMarkerOnGO componentInChildren = ((Component)pickupItem.m_root).GetComponentInChildren(); componentInChildren.UpdatePlayerColor(new Color(1f, 0.5f, 0f)); CarryItemPickup_Core componentInChildren2 = ((Component)pickupItem.m_root).GetComponentInChildren(); HeavyFogRepellerPickup val2 = ((Il2CppObjectBase)componentInChildren2).Cast(); iCarryItemWithGlobalState val3 = default(iCarryItemWithGlobalState); byte byteId = default(byte); if (CarryItemWithGlobalStateManager.TryCreateItemInstance((eCarryItemWithGlobalStateType)0, pickupItem.m_root, ref val3, ref byteId)) { pItemData_Custom customData = ((Item)val2).GetCustomData(); customData.byteId = byteId; pItemData_Custom val4 = customData; ((Item)val2).SetCustomData(val4, true); } HeavyFogRepellerGlobalState val5 = ((Il2CppObjectBase)val3).Cast(); ((Component)beaconHeld).transform.SetParent(((Component)val5).transform, false); ((Component)beaconPlaced).transform.SetParent(((Component)val5).transform, false); val5.m_repellerSphere = val; beaconHeld.m_sphereAllocator = new FogSphereAllocator(); beaconPlaced.m_sphereAllocator = new FogSphereAllocator(); Interact_Pickup_PickupItem interact = ((Il2CppObjectBase)componentInChildren2.m_interact).Cast(); ((Interact_Timed)interact).InteractDuration = pickupTime; val5.CallbackOnStateChange += Action.op_Implicit((Action)delegate(pCarryItemWithGlobalState_State oldState, pCarryItemWithGlobalState_State newState, bool isRecall) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 //IL_0057: Unknown result type (might be due to invalid IL or missing references) if (isRecall) { FogRepeller_Sphere obj = beaconHeld; if (obj != null) { obj.KillRepellerInstantly(); } FogRepeller_Sphere obj2 = beaconPlaced; if (obj2 != null) { obj2.KillRepellerInstantly(); } } else { eHeavyFogRepellerStatus val6 = (eHeavyFogRepellerStatus)newState.status; eHeavyFogRepellerStatus val7 = val6; if ((int)val7 != 1) { if ((int)val7 == 2) { FogRepeller_Sphere obj3 = beaconHeld; if (obj3 != null) { obj3.StopRepelling(); } FogRepeller_Sphere obj4 = beaconPlaced; if (obj4 != null) { obj4.StartRepelling(); } ((Interact_Timed)interact).InteractDuration = pickupTime; } } else { FogRepeller_Sphere obj5 = beaconHeld; if (obj5 != null) { obj5.StartRepelling(); } if (oldState.status != 0) { FogRepeller_Sphere obj6 = beaconPlaced; if (obj6 != null) { obj6.StopRepelling(); } } ((Interact_Timed)interact).InteractDuration = placeTime; } } }); } } }