using System; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; using System.Text.RegularExpressions; using AIGraph; using AK; using AWO.CustomFields; using AWO.Jsons; using AWO.Modules.TSL; using AWO.Modules.WEE; using AWO.Modules.WEE.Detours; using AWO.Modules.WEE.Events; using AWO.Modules.WEE.JsonInjects; using AWO.Modules.WEE.Replicators; using AWO.Modules.WOE; using AWO.Sessions; using AWO.Utils; using Agents; using AmorLib.API; using AmorLib.Events; using AmorLib.Networking.StateReplicators; using AmorLib.Utils; using AmorLib.Utils.Extensions; using AmorLib.Utils.JsonElementConverters; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Hook; using BepInEx.Unity.IL2CPP.Utils; using BepInEx.Unity.IL2CPP.Utils.Collections; using CellMenu; using ChainedPuzzles; using Enemies; using Expedition; using FluffyUnderware.DevTools.Extensions; using GTFO.API; using GTFO.API.Extensions; using GTFO.API.Utilities; using GameData; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Attributes; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppInterop.Runtime.Runtime; using Il2CppJsonNet; using Il2CppJsonNet.Linq; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using InjectLib.FieldInjection; using InjectLib.JsonNETInjection; using InjectLib.JsonNETInjection.Converter; using InjectLib.JsonNETInjection.Handler; using InjectLib.JsonNETInjection.Supports; using LevelGeneration; using Localization; using Microsoft.CodeAnalysis; using Player; using PlayerCoverage; using SNetwork; using TMPro; using UnityEngine; using UnityEngine.UI; [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("AdvancedWardenObjective")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+9066883ef3e7b1d18e849a982da20a4fea95afc0")] [assembly: AssemblyProduct("AdvancedWardenObjective")] [assembly: AssemblyTitle("AdvancedWardenObjective")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] internal sealed class IsUnmanagedAttribute : Attribute { } [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 AWO { internal static class Configuration { private static readonly ConfigFile Config; private static readonly ConfigEntry Config_VerboseEnabled; public static bool VerboseEnabled => Config_VerboseEnabled.Value; static Configuration() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Config = new ConfigFile(Path.Combine(Paths.ConfigPath, "AWO.cfg"), true); string text = "General Settings"; string text2 = "Enable Verbose Debug Logging"; string text3 = "Prints some additional logs to the console, which may be useful for rundown devs"; Config_VerboseEnabled = Config.Bind(text, text2, false, text3); } public static void Init() { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown LiveEditListener val = LiveEdit.CreateListener(Paths.ConfigPath, "AWO.cfg", false); val.FileChanged += new LiveEditEventHandler(OnFileChanged); bool flag = default(bool); BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(28, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Verbose logging is enabled: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(VerboseEnabled); } Logger.Debug(val2); } private static void OnFileChanged(LiveEditEventArgs e) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(21, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Config file changed: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(e.FullPath); } Logger.Warn(val); Config.Reload(); } } [BepInPlugin("GTFO.AWO", "AWO", "2.5.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal sealed class EntryPoint : BasePlugin { internal static class Coroutines { public static float CountdownStarted { get; set; } } internal static class TimerMods { public static float TimeModifier { get; set; } public static Color TimerColor { get; set; } public static float SpeedModifier { get; set; } public static LocaleText TimerTitleText { get; set; } public static LocaleText TimerBodyText { get; set; } } public static BlackoutState BlackoutState { get; private set; } = new BlackoutState(); public static SessionRandReplicator SessionRand { get; private set; } = new SessionRandReplicator(); public override void Load() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) Configuration.Init(); WardenEventExt.Initialize(); new Harmony("AWO.Harmony").PatchAll(); AssetAPI.OnStartupAssetsLoaded += delegate { LevelFailUpdateState.AssetLoaded(); }; LevelAPI.OnBuildDone += OnBuildDone; LevelAPI.OnLevelCleanup += OnLevelCleanup; WOEventDataFields.Init(); SerialLookupManager.Init(); Logger.Info("AWO is done loading!"); } private void OnBuildDone() { BlackoutState.Setup(); SessionRand.Setup(1u, RundownManager.GetActiveExpeditionData().sessionSeed); } private void OnLevelCleanup() { WardenObjectiveManager.m_exitEventsTriggered = false; BlackoutState.Cleanup(); SessionRand.Cleanup(); } } internal static class Logger { private static readonly ManualLogSource MLS; private const string Dev = "Dev"; static Logger() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown MLS = new ManualLogSource("AWO"); Logger.Sources.Add((ILogSource)(object)MLS); } private static string Format(string module, object msg) { return $"[{module}] {msg}"; } public static void Info(BepInExInfoLogInterpolatedStringHandler handler) { MLS.LogInfo(handler); } public static void Info(string str) { MLS.LogMessage((object)str); } public static void Info(string module, object data) { MLS.LogMessage((object)Format(module, data)); } public static void Debug(BepInExDebugLogInterpolatedStringHandler handler) { MLS.LogDebug(handler); } public static void Debug(string str) { MLS.LogDebug((object)str); } public static void Debug(string module, object data) { MLS.LogDebug((object)Format(module, data)); } public static void Error(BepInExErrorLogInterpolatedStringHandler handler) { MLS.LogError(handler); } public static void Error(string str) { MLS.LogError((object)str); } public static void Error(string module, object data) { MLS.LogError((object)Format(module, data)); } public static void Warn(BepInExWarningLogInterpolatedStringHandler handler) { MLS.LogWarning(handler); } public static void Warn(string str) { MLS.LogWarning((object)str); } public static void Warn(string module, object data) { MLS.LogWarning((object)Format(module, data)); } public static void Verbose(LogLevel level, string data) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Invalid comparison between Unknown and I4 //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Invalid comparison between Unknown and I4 if (!Configuration.VerboseEnabled) { return; } if ((int)level <= 4) { if ((int)level != 2) { if ((int)level == 4) { Warn("Dev", data); } } else { Error("Dev", data); } } else if ((int)level != 16) { if ((int)level == 32) { Debug("Dev", data); } } else { Info("Dev", data); } } } } namespace AWO.Utils { public static class NumberExtension { public static bool IsPrime(this int num) { if (num < 2) { return false; } if (num % 2 == 0) { return num == 2; } int num2 = (int)Math.Sqrt(num); for (int i = 3; i <= num2; i += 2) { if (num % i == 0) { return false; } } return true; } } public static class RandomExtensions { public static bool MeetProbability(this Random rand, float prob) { if (prob >= 1f) { return true; } if (prob <= 0f) { return false; } return prob >= rand.NextFloat(); } public static float NextRange(this Random rand, float min, float max) { return rand.NextFloat() * (max - min) + min; } public static float NextFloat(this Random rand) { return rand.NextSingle(); } } } namespace AWO.Sessions { internal struct BlackoutStatus { public bool blackoutEnabled; } internal sealed class BlackoutState : IStateReplicatorHolder { public StateReplicator? Replicator { get; private set; } public bool BlackoutEnabled { get; private set; } public void Setup() { BlackoutEnabled = false; Replicator = StateReplicator.Create(1u, new BlackoutStatus { blackoutEnabled = false }, (LifeTimeType)1, (IStateReplicatorHolder)this); } public void Cleanup() { BlackoutEnabled = false; Replicator?.Unload(); } public void SetEnabled(bool enabled) { Replicator?.SetState(new BlackoutStatus { blackoutEnabled = enabled }); } public void OnStateChange(BlackoutStatus oldState, BlackoutStatus state, bool isRecall) { //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Invalid comparison between Unknown and I4 //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0308: Unknown result type (might be due to invalid IL or missing references) //IL_030e: Invalid comparison between Unknown and I4 if (oldState.blackoutEnabled == state.blackoutEnabled) { return; } bool flag = !state.blackoutEnabled; foreach (LG_LabDisplay item in LG_Objects.TrackedList()) { if ((Object)(object)((item != null) ? item.m_Text : null) != (Object)null) { ((Behaviour)item.m_Text).enabled = flag; } } GUIX_VirtualSceneLink val = default(GUIX_VirtualSceneLink); foreach (LG_ComputerTerminal item2 in LG_Objects.TrackedList()) { if ((Object)(object)item2 == (Object)null) { continue; } item2.OnProximityExit(); Interact_ComputerTerminal componentInChildren = ((Component)item2).GetComponentInChildren(true); if ((Object)(object)componentInChildren != (Object)null) { ((Behaviour)componentInChildren).enabled = flag; ((Interact_Base)componentInChildren).SetActive(flag); } if (GameObjectPlusExtensions.TryAndGetComponent(((Component)item2).gameObject, ref val) && (Object)(object)val.m_virtualScene != (Object)null) { ((Component)val.m_virtualScene).gameObject.SetActive(flag); } if ((Object)(object)item2.m_text != (Object)null) { ((Behaviour)item2.m_text).enabled = flag; } if (!flag) { PlayerAgent localInteractionSource = item2.m_localInteractionSource; if ((Object)(object)localInteractionSource != (Object)null && localInteractionSource.FPItemHolder.InTerminalTrigger) { item2.ExitFPSView(); } } } foreach (LG_DoorButton item3 in LG_Objects.TrackedList()) { if ((Object)(object)item3 == (Object)null) { continue; } ((Component)item3.m_anim).gameObject.SetActive(flag); item3.m_enabled = flag; if (flag) { LG_WeakLock componentInChildren2 = ((Component)item3).GetComponentInChildren(); if ((Object)(object)componentInChildren2 != (Object)null && (int)componentInChildren2.Status != 3) { item3.m_enabled = false; } } } foreach (LG_WeakLock item4 in LG_Objects.TrackedList()) { if (!((Object)(object)item4 == (Object)null)) { ((Interact_Base)item4.m_intHack).m_isActive = flag; Transform val2 = ((Component)item4).transform.FindChild("HackableLock/SecurityLock/g_WeakLock/Security_Display_Locked") ?? ((Component)item4).transform.FindChild("HackableLock/Security_Display_Locked"); if ((Object)(object)val2 != (Object)null) { ((Component)val2).gameObject.active = flag; } } } foreach (LG_HSUActivator_Core item5 in LG_Objects.TrackedList()) { if ((Object)(object)item5 == (Object)null || !item5.m_isWardenObjective || (int)item5.m_stateReplicator.State.status != 0) { continue; } item5.m_insertHSUInteraction.SetActive(flag); foreach (GameObject item6 in (Il2CppArrayBase)(object)item5.m_activateWhenActive) { item6.SetActive(flag); } } BlackoutEnabled = state.blackoutEnabled; } } internal enum LevelFailMode { Default, Never, AnyPlayerDown } internal struct LevelFailCheck { public LevelFailMode mode; } internal static class LevelFailUpdateState { public static StateReplicator? Replicator; public static bool LevelFailAllowed { get; private set; } = true; public static bool LevelFailWhenAnyPlayerDown { get; private set; } = false; internal static void AssetLoaded() { Replicator = StateReplicator.Create(1u, new LevelFailCheck { mode = LevelFailMode.Default }, (LifeTimeType)0, (IStateReplicatorHolder)null); Replicator.OnStateChanged += OnStateChanged; LevelAPI.OnLevelCleanup += LevelCleanup; LG_Factory.OnFactoryBuildStart += Action.op_Implicit((Action)delegate { Replicator?.ClearAllRecallSnapshot(); Replicator?.SetState(new LevelFailCheck { mode = LevelFailMode.Default }); }); } private static void LevelCleanup() { SetFailAllowed(allowed: true); } public static void SetFailAllowed(bool allowed) { Replicator?.SetState(new LevelFailCheck { mode = ((!allowed) ? LevelFailMode.Never : LevelFailMode.Default) }); } public static void SetFailWhenAnyPlayerDown(bool enabled) { Replicator?.SetState(new LevelFailCheck { mode = (enabled ? LevelFailMode.AnyPlayerDown : LevelFailMode.Default) }); } private static void OnStateChanged(LevelFailCheck _, LevelFailCheck state, bool __) { switch (state.mode) { case LevelFailMode.Default: LevelFailAllowed = true; LevelFailWhenAnyPlayerDown = false; break; case LevelFailMode.Never: LevelFailAllowed = false; LevelFailWhenAnyPlayerDown = false; break; case LevelFailMode.AnyPlayerDown: LevelFailAllowed = true; LevelFailWhenAnyPlayerDown = true; break; } } } public static class LG_Objects { public static ImmutableDictionary> TrackedTypes { get; private set; } static LG_Objects() { TrackedTypes = ImmutableDictionary.CreateRange(new KeyValuePair>[5] { new KeyValuePair>(typeof(LG_ComputerTerminal), new HashSet()), new KeyValuePair>(typeof(LG_DoorButton), new HashSet()), new KeyValuePair>(typeof(LG_HSUActivator_Core), new HashSet()), new KeyValuePair>(typeof(LG_LabDisplay), new HashSet()), new KeyValuePair>(typeof(LG_WeakLock), new HashSet()) }); LevelAPI.OnLevelCleanup += Clear; } private static void Clear() { CollectionExtensions.ForEachValue>((IDictionary>)TrackedTypes, (Action>)delegate(HashSet set) { set.Clear(); }); } public static IEnumerable TrackedList() where T : Component { if (TrackedTypes.TryGetValue(typeof(T), out HashSet value)) { return value.Cast(); } return Enumerable.Empty(); } public static void AddToTrackedList(Component itemToAdd) { if (TrackedTypes.TryGetValue(((object)itemToAdd).GetType(), out HashSet value)) { value.Add(itemToAdd); } } public static void RemoveFromTrackedList(Component itemToRemove) { if (TrackedTypes.TryGetValue(((object)itemToRemove).GetType(), out HashSet value)) { value.Remove(itemToRemove); } } } public struct SessionRandState { public uint currentStep; } public sealed class SessionRandReplicator : IStateReplicatorHolder { public StateReplicator? Replicator { get; private set; } public int Seed { get; private set; } public uint Step { get; private set; } public uint State { get; private set; } public void Setup(uint id, int seed) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown Seed = seed; Step = 0u; State = (uint)Seed; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(12, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("SessionSeed "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(Seed); } Logger.Info(val); Replicator = StateReplicator.Create(id, new SessionRandState { currentStep = Step }, (LifeTimeType)1, (IStateReplicatorHolder)this); } public void Cleanup() { Step = 0u; Replicator?.Unload(); } public void SyncStep() { Replicator?.SetState(new SessionRandState { currentStep = Step }); } public void OnStateChange(SessionRandState oldState, SessionRandState state, bool isRecall) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Expected O, but got Unknown if (state.currentStep == Step) { Logger.Verbose((LogLevel)32, $"No change in SessionRand step from received state, isRecall: {isRecall}"); return; } if (state.currentStep < Step) { Logger.Verbose((LogLevel)4, $"SessionRand step cannot be lowered by received state, isRecall: {isRecall}"); Replicator?.SetStateUnsynced(new SessionRandState { currentStep = Step }); return; } bool flag = default(bool); BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(59, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Jumping ahead from local step "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(Step); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" to session step "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(state.currentStep); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", isRecall: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(isRecall); } Logger.Debug(val); Step = state.currentStep; Jump(Step); } public uint Next() { Replicator?.SetStateUnsynced(new SessionRandState { currentStep = ++Step }); uint num = (State += 2654435769u); num ^= num >> 16; num *= 569420461; num ^= num >> 15; num *= 1935289751; return num ^ (num >> 15); } public void Jump(ulong steps) { if (steps != 0) { State += (uint)(int)(steps * 2654435769u); } } public int NextInt() { return (int)(Next() & 0x7FFFFFFF); } public int NextInt(int max) { if (max <= 0) { throw new ArgumentOutOfRangeException("max", "max must be positive."); } return (int)(NextFloat() * (float)max); } public int NextInt(int min, int max) { if (min > max) { throw new ArgumentOutOfRangeException("min", "min must be less than or equal to max."); } return min + NextInt(max - min); } public float NextFloat() { return (float)Next() * 2.3283064E-10f; } } } namespace AWO.Sessions.Patches { [HarmonyPatch] internal static class Patch_InteractionOnBlackout { [HarmonyPatch(typeof(LG_ComputerTerminal), "OnProximityEnter")] [HarmonyPatch(typeof(LG_ComputerTerminal), "OnProximityExit")] [HarmonyPatch(typeof(LG_DoorButton), "OnWeakLockUnlocked")] [HarmonyPrefix] private static bool Pre_ToggleInteraction() { return !EntryPoint.BlackoutState.BlackoutEnabled; } } [HarmonyPatch] internal static class Patch_LevelFailCheck { [HarmonyPatch(typeof(WardenObjectiveManager), "CheckExpeditionFailed")] [HarmonyPostfix] [HarmonyPriority(200)] [HarmonyWrapSafe] private static void Post_CheckLevelFail(ref bool __result) { if (!LevelFailUpdateState.LevelFailAllowed) { __result = false; } else if (LevelFailUpdateState.LevelFailWhenAnyPlayerDown && HasAnyDownedPlayer()) { __result = true; } } private static bool HasAnyDownedPlayer() { Enumerator enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (!((Agent)current).Alive) { return true; } } return false; } } [HarmonyPatch] internal static class Patch_LG_ObjectsTrack { [HarmonyTargetMethods] private static IEnumerable TargetMethods() { yield return AccessTools.Method(typeof(LG_ComputerTerminal), "Setup", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(LG_DoorButton), "Setup", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(LG_HSUActivator_Core), "Start", (Type[])null, (Type[])null); yield return AccessTools.Method(typeof(LG_LabDisplay), "GenerateText", new Type[2] { typeof(int), typeof(SubComplex) }, (Type[])null); yield return AccessTools.Method(typeof(LG_WeakLock), "Setup", (Type[])null, (Type[])null); } [HarmonyPostfix] private static void Post_TrackObject(Component __instance) { LG_Objects.AddToTrackedList(__instance); } } } namespace AWO.Modules.WOE { [Obsolete] public static class WardenObjectiveExt { private static readonly Dictionary _DTOTypes; private static readonly List _ActiveContexts; static WardenObjectiveExt() { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_018c: 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_0129: Expected O, but got Unknown _DTOTypes = new Dictionary(); _ActiveContexts = new List(); IEnumerable enumerable = from x in typeof(WOE_ContextBase).Assembly.GetTypes() where !x.IsAbstract where x.IsAssignableTo(typeof(WOE_ContextBase)) select x; bool flag = default(bool); foreach (Type item in enumerable) { WOE_ContextBase wOE_ContextBase = (WOE_ContextBase)Activator.CreateInstance(item); if (_DTOTypes.TryGetValue(wOE_ContextBase.TargetType, out Type _)) { Logger.Error("Duplicate TargetType Detected!"); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(14, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("With '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(item.Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' and '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(wOE_ContextBase.GetType().Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'"); } Logger.Error(val); } else if (!wOE_ContextBase.DataType.IsAssignableTo(typeof(WOE_DataBase))) { BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(41, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(item.Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" does not have valid "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("DataType"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (not derived from "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("WOE_DataBase"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")"); } Logger.Error(val); } else { _DTOTypes[wOE_ContextBase.TargetType] = item; } } WOEvents.OnSetup += ObjectiveSetup; LevelAPI.OnLevelCleanup += LevelCleanup; } internal static void Initialize() { } private static void ObjectiveSetup(LG_LayerType layer, int chainIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0083: 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) WardenObjectiveDataBlock val = default(WardenObjectiveDataBlock); Type value; if (!WardenObjectiveManager.TryGetWardenObjectiveDataForLayer(layer, chainIndex, ref val)) { bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(44, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(layer); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" Layer (CI: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(chainIndex); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") does not have ObjectiveData!!!"); } Logger.Error(val2); } else if (_DTOTypes.TryGetValue(val.Type, out value)) { WOE_ContextBase wOE_ContextBase = (WOE_ContextBase)Activator.CreateInstance(value); wOE_ContextBase.Setup(layer, chainIndex); _ActiveContexts.Add(wOE_ContextBase); } } private static void LevelCleanup() { foreach (WOE_ContextBase activeContext in _ActiveContexts) { activeContext.OnLevelCleanup(); } _ActiveContexts.Clear(); } } public delegate void SetupObjectiveDel(LG_LayerType layer, int chainIndex); [Obsolete] internal static class WOEvents { public static event SetupObjectiveDel? OnSetup; internal static void Invoke_OnSetup(LG_LayerType layer, int chainIndex) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) WOEvents.OnSetup?.Invoke(layer, chainIndex); } } [Obsolete] internal abstract class WOE_ContextBase { public abstract eWardenObjectiveType TargetType { get; } public abstract Type DataType { get; } protected WOE_DataBase? Data { get; private set; } protected LG_LayerType Layer { get; private set; } protected int ChainIndex { get; private set; } public void Setup(LG_LayerType layer, int chainIndex) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) Layer = layer; ChainIndex = chainIndex; } public virtual void OnSetup() { } public virtual void OnBuildDone() { } public virtual void OnBuildDoneLate() { } public virtual void OnLevelCleanup() { } } [Obsolete] internal abstract class WOE_DataBase { public uint ObjectiveID { get; set; } public WardenObjectiveDataBlock? GameData { get; set; } } } namespace AWO.Modules.WOE.Objectives.Uplinks { [Obsolete] internal sealed class WOE_UplinkContext : WOE_ContextBase { public override eWardenObjectiveType TargetType => (eWardenObjectiveType)8; public override Type DataType => typeof(WOE_UplinkData); } [Obsolete] internal sealed class WOE_UplinkData : WOE_DataBase { public UplinkCodeBehaviour[] CodeBehaviours { get; set; } = Array.Empty(); } internal sealed class UplinkCodeBehaviour { public bool ShowCodesOnTerminal { get; set; } = false; public bool ShowCodesOnHUD { get; set; } = true; public bool ShowCodeToOtherTerminal { get; set; } = true; public TerminalZoneSelectionData TerminalZone { get; set; } = new TerminalZoneSelectionData(); public TerminalOutput[] StartOutputs { get; set; } = Array.Empty(); public TerminalOutput[] EndOutputs { get; set; } = Array.Empty(); public WardenObjectiveEventData[] EventsOnStart { get; set; } = Array.Empty(); public WardenObjectiveEventData[] EventsOnEnd { get; set; } = Array.Empty(); } } namespace AWO.Modules.WOE.Objectives.ReactorStartups { [Obsolete] internal sealed class WOE_ReactorStartupContext : WOE_ContextBase { public override eWardenObjectiveType TargetType => (eWardenObjectiveType)1; public override Type DataType => typeof(WOE_ReactorStartupData); } internal enum ReactorWavePuzzleType { Default, CustomLock, UseCommand_OnMainTerminal, UseCommand_InZone, PowerGenerator_InZone } [Obsolete] internal sealed class WOE_ReactorStartupData : WOE_DataBase { public bool RemoveMainStartupCommand { get; set; } = false; public bool RemoveMainVerifyCommand { get; set; } = false; public ScriptedWaveData[] WaveDatas { get; set; } = Array.Empty(); public ReactorWavePuzzleData[] WavePuzzles { get; set; } = Array.Empty(); } internal enum SettingWarpMode { Clamped, Repeat, PingPong } internal sealed class ScriptedWaveData { public float[] IntroDuration { get; set; } = Array.Empty(); public SettingWarpMode IntroDurationWarpMode { get; set; } = SettingWarpMode.Clamped; public float[] WaveDuration { get; set; } = Array.Empty(); public SettingWarpMode WaveDurationWarpMode { get; set; } = SettingWarpMode.Clamped; public string[][] WaveInstructions { get; set; } = Array.Empty(); public SettingWarpMode WaveInstructionsWarpMode { get; set; } = SettingWarpMode.Clamped; } internal sealed class ReactorWavePuzzleData { public ReactorWavePuzzleType Type { get; set; } = ReactorWavePuzzleType.Default; public bool ShowBeacon { get; set; } = false; public string BeaconText { get; set; } = "Auxiliary Terminal"; public Color BeaconColor { get; set; } = Color.magenta; public string Command { get; set; } = "REACTOR_CONTINUE"; public string CommandDescription { get; set; } = "CONTINUE REACTOR STARTUP PROCESS"; public bool ForceJumpWaveWhenSolved { get; set; } = true; } } namespace AWO.Modules.WOE.Objectives.GenClusters { [Obsolete] internal sealed class WOE_GenClusterContext : WOE_ContextBase { public override eWardenObjectiveType TargetType => (eWardenObjectiveType)9; public override Type DataType => typeof(int); } } namespace AWO.Modules.WOE.JsonInjects { [Obsolete] internal class ObjectiveDataHandler : Il2CppJsonReferenceTypeHandler { public override void OnRead(in Object result, in JToken jToken) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Invalid comparison between Unknown and I4 if ((int)jToken.Type == 1) { JObject val = (JObject)jToken; JToken val2 = default(JToken); if (val.TryGetValue("woeEnabled", ref val2) && (int)val2.Type == 9 && (bool)val2) { WardenObjectiveDataBlock val3 = ((Il2CppObjectBase)result).Cast(); } } } } } namespace AWO.Modules.WEE { internal static class VanillaEventOvr { internal static bool HasOverride(eWardenObjectiveEventType type, WardenObjectiveEventData e) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Invalid comparison between Unknown and I4 bool flag = e.Position != Vector3.zero; if (type - 3 > 1) { if ((int)type != 5) { if ((int)type == 16) { return flag || e.Count > 0; } return false; } return flag; } return (int)e.DimensionIndex > 0; } internal static void HandleEvent(eWardenObjectiveEventType type, WardenObjectiveEventData e, float currentDuration) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(Handle(type, e, currentDuration)), (Action)null); } private static IEnumerator Handle(eWardenObjectiveEventType type, WardenObjectiveEventData e, float currentDuration) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) float delay = Mathf.Max(e.Delay - currentDuration, 0f); if (delay > 0f) { int reloadCount = CheckpointManager.CheckpointUsage; yield return (object)new WaitForSeconds(delay); if (reloadCount < CheckpointManager.CheckpointUsage) { bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(47, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Delayed event "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(type); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" aborted due to checkpoint reload"); } Logger.Warn(val); yield break; } } if (WorldEventManager.GetCondition(e.Condition.ConditionIndex) != e.Condition.IsTrue) { Logger.Verbose((LogLevel)32, $"Condition {e.Condition.ConditionIndex} is not met"); yield break; } WardenObjectiveManager.DisplayWardenIntel(e.Layer, e.WardenIntel); if (e.DialogueID != 0) { PlayerDialogManager.WantToStartDialog(e.DialogueID, -1, false, false); } if (e.SoundID != 0) { PlaySound(e); } if (!SNet.IsMaster) { yield break; } switch (type - 3) { case 1: ToggleDimensionLights(mode: true, e.DimensionIndex); yield break; case 0: ToggleDimensionLights(mode: false, e.DimensionIndex); yield break; case 2: yield break; } if ((int)type == 16) { CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(SpawnEnemyOnPoint(e)), (Action)null); } } private static void PlaySound(WardenObjectiveEventData e) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) if ((int)e.Type != 5) { WardenObjectiveManager.Current.m_sound.Post(e.SoundID, true); } else { CellSoundPlayer val = new CellSoundPlayer(); GameObjectPlusExtensions.PostWithCleanup(val, e.SoundID, e.Position, 1u); } string text = ((Object)e.SoundSubtitle).ToString(); if (!string.IsNullOrWhiteSpace(text)) { GuiManager.PlayerLayer.ShowMultiLineSubtitle(text); } } private static void ToggleDimensionLights(bool mode, eDimensionIndex dimension) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) pEnvironmentInteraction val = new pEnvironmentInteraction { EnvironmentStateChangeType = (EnvironmentStateChangeType)1, LightsEnabled = mode, DimensionIndex = dimension }; EnvironmentStateManager.LogEnvironmentState("VEO SetLightMode Attempt"); EnvironmentStateManager.Current.AttemptInteract(val); } private static IEnumerator SpawnEnemyOnPoint(WardenObjectiveEventData e) { int count = ((e.Count < 2) ? 1 : e.Count); LG_WorldEventObject weObject = default(LG_WorldEventObject); Vector3 pos = (WorldEventUtils.TryGetRandomWorldEventObjectFromFilter(e.WorldEventObjectFilter, (uint)Builder.SessionSeedRandom.Seed, ref weObject) ? ((Component)weObject).transform.position : e.Position); LG_WorldEventObject obj = weObject; object obj2; if (obj == null) { obj2 = null; } else { LG_Area parentArea = obj.ParentArea; obj2 = ((parentArea != null) ? parentArea.m_courseNode : null); } if (obj2 == null) { obj2 = CourseNodeUtil.GetCourseNode(pos); } AIG_CourseNode courseNode = (AIG_CourseNode)obj2; if (courseNode == null) { Logger.Error("SpawnEnemyOnPoint", "Failed to find valid CourseNode from Position!"); yield break; } AgentMode val = ((!e.Enabled) ? ((e.EnemyID != 20) ? ((AgentMode)4) : ((AgentMode)3)) : ((AgentMode)1)); AgentMode mode = val; float interval = Math.Min(0.25f, 2f / (float)count); WaitForSeconds spawnInterval = new WaitForSeconds(interval); for (int i = 0; i < count; i++) { EnemyAgent.SpawnEnemy(e.EnemyID, pos, courseNode, mode); yield return spawnInterval; } } } internal static class WardenEventExt { internal static readonly Dictionary _EventsToTrigger; static WardenEventExt() { //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Expected O, but got Unknown _EventsToTrigger = new Dictionary(); IEnumerable enumerable = from x in AccessTools.GetTypesFromAssembly(Assembly.GetExecutingAssembly()) where !x.IsAbstract where x.IsAssignableTo(typeof(BaseEvent)) select x; bool flag = default(bool); foreach (Type item in enumerable) { BaseEvent baseEvent = (BaseEvent)Activator.CreateInstance(item); if (_EventsToTrigger.TryGetValue(baseEvent.EventType, out BaseEvent value)) { Logger.Error("Duplicate EventType detected!"); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(14, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("With '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(value.Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' and '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(baseEvent.Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'"); } Logger.Error(val); } else { baseEvent.Setup(); _EventsToTrigger[baseEvent.EventType] = baseEvent; } } } internal static void Initialize() { ClassInjector.RegisterTypeInIl2Cpp(); ClassInjector.RegisterTypeInIl2Cpp(); ClassInjector.RegisterTypeInIl2Cpp(); JsonInjector.SetConverter((Il2CppJsonUnmanagedTypeConverter)new EventTypeConverter()); JsonInjector.SetConverter((Il2CppJsonReferenceTypeConverter)(object)new ArrayableFlatConditionConverter()); JsonInjector.SetConverter((Il2CppJsonUnmanagedTypeConverter)new ArrayableFlatEnumConverter()); JsonInjector.SetConverter((Il2CppJsonUnmanagedTypeConverter)new ArrayableFlatEnumConverter()); JsonInjector.SetConverter((Il2CppJsonUnmanagedTypeConverter)new ArrayableFlatEnumConverter()); JsonInjector.AddHandler((Il2CppJsonReferenceTypeHandler)(object)new EventDataHandler()); JsonInjector.AddHandler((Il2CppJsonReferenceTypeHandler)(object)new TriggerDataHandler()); WEE_EnumInjector.Inject(); Detour_ExecuteEvent.Patch(); } internal static void HandleEvent(WEE_Type type, WardenObjectiveEventData e, float currentDuration) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: 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_0122: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) WEE_EventData wEEData = e.GetWEEData(); bool flag = default(bool); if (wEEData == null) { BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(76, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("WardenEvent Type is Extension ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(type); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("), but it's not registered to any dataholder!"); } Logger.Error(val); return; } if (!_EventsToTrigger.TryGetValue(type, out BaseEvent value)) { BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(31, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(type); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Event does not exist in lookup!"); } Logger.Error(val); return; } List<(eDimensionIndex, LG_LayerType, eLocalZoneIndex)> list = Expand(wEEData).ToList(); foreach (var (val2, layer, val3) in list) { if (!value.AllowArrayableGlobalIndex || list.Count == 1) { wEEData.DimensionIndex = val2; wEEData.Layer = layer; wEEData.LocalIndex = val3; CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(Handle(value, wEEData, currentDuration)), (Action)null); break; } CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(Handle(value, wEEData.Clone(val2, layer, val3), currentDuration)), (Action)null); } } private static IEnumerable<(eDimensionIndex, LG_LayerType, eLocalZoneIndex)> Expand(WEE_EventData e) { foreach (eDimensionIndex d in e.ArrayableDimension.Values) { foreach (LG_LayerType l in e.ArrayableLayer.Values) { foreach (eLocalZoneIndex z in e.ArrayableZone.Values) { yield return (d, l, z); } } } } private static IEnumerator Handle(BaseEvent eventInstance, WEE_EventData e, float currentDuration) { float delay = Mathf.Max(e.Delay - currentDuration, 0f); if (delay > 0f) { int reloadCount = CheckpointManager.CheckpointUsage; yield return (object)new WaitForSeconds(delay); if (reloadCount < CheckpointManager.CheckpointUsage) { bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(47, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Delayed event "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(e.Type); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" aborted due to checkpoint reload"); } Logger.Warn(val); yield break; } } foreach (WorldEventConditionPair condition in e.Condition) { if (WorldEventManager.GetCondition(condition.ConditionIndex) != condition.IsTrue) { Logger.Verbose((LogLevel)32, $"Condition {condition.ConditionIndex} is not met"); yield break; } } if (ClearWardenIntelQueueEvent.AllowWardenIntel) { WardenObjectiveManager.DisplayWardenIntel(e.Layer, LocaleText.op_Implicit(e.WardenIntel)); } else if (e.Type != WEE_Type.ClearWardenIntelQueue && e.SpecialBool) { ClearWardenIntelQueueEvent.ShowSubObjectiveMessage(e.Layer, e.WardenIntel); } if (e.Type != WEE_Type.ForcePlayPlayerDialogue) { if (e.DialogueID != 0) { PlayerDialogManager.WantToStartDialog(e.DialogueID, -1, false, false); } if (e.SoundID != 0) { WardenObjectiveManager.Current.m_sound.Post(e.SoundID, true); string line = LocaleText.op_Implicit(e.SoundSubtitle); if (!string.IsNullOrWhiteSpace(line) && e.Type != WEE_Type.PlaySubtitles) { GuiManager.PlayerLayer.ShowMultiLineSubtitle(line); } } } if (e.SubObjective.DoUpdate && e.Type != WEE_Type.MultiProgression) { WardenObjectiveManager.UpdateSyncCustomSubObjective(LocaleText.op_Implicit(e.SubObjective.CustomSubObjectiveHeader), LocaleText.op_Implicit(e.SubObjective.CustomSubObjective)); } if (e.Fog.DoUpdate) { EnvironmentStateManager.AttemptStartFogTransition(e.Fog.FogSetting, e.Fog.FogTransitionDuration, e.DimensionIndex); } SafeInvoke.Invoke((Action)eventInstance.Trigger, e); } } internal static class WEE_EnumInjector { public const int ExtendedIndex = 10000; private static readonly Dictionary _EventTypes; private static int _CurrentIndex; static WEE_EnumInjector() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown _EventTypes = new Dictionary(); _CurrentIndex = 0; WEE_Type[] values = Enum.GetValues(); bool flag = default(bool); for (int i = 0; i < values.Length; i++) { WEE_Type wEE_Type = values[i]; string text = wEE_Type.ToString(); AddEvent(text); BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(22, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Injecting EWOEvent: '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'"); } Logger.Debug(val); } } private static void AddEvent(string name) { _EventTypes[name] = _CurrentIndex + 10000; _CurrentIndex++; } internal static void Inject() { EnumInjector.InjectEnumValues(_EventTypes); } } public sealed class WEE_EventData { public WEE_Type Type { get; set; } public Arrayable Condition { get; set; } = (Arrayable)new WorldEventConditionPair(); public eWardenObjectiveEventTrigger Trigger { get; set; } = (eWardenObjectiveEventTrigger)0; public uint ChainPuzzle { get; set; } = 0u; public bool UseStaticBioscanPoints { get; set; } = false; [JsonPropertyName("DimensionIndex")] public Arrayable ArrayableDimension { get; set; } = (eDimensionIndex)0; [JsonIgnore] public eDimensionIndex DimensionIndex { get; set; } [JsonPropertyName("Layer")] public Arrayable ArrayableLayer { get; set; } = (LG_LayerType)0; [JsonIgnore] public LG_LayerType Layer { get; set; } [JsonPropertyName("LocalIndex")] public Arrayable ArrayableZone { get; set; } = (eLocalZoneIndex)0; [JsonIgnore] public eLocalZoneIndex LocalIndex { get; set; } public Vector3 Position { get; set; } = Vector3.zero; public float Delay { get; set; } = 0f; public float Duration { get; set; } = 0f; public LocaleText WardenIntel { get; set; } = LocaleText.Empty; public uint SoundID { get; set; } = 0u; public LocaleText SoundSubtitle { get; set; } = LocaleText.Empty; public uint DialogueID { get; set; } = 0u; public int Count { get; set; } = 0; public bool Enabled { get; set; } = true; public bool SpecialBool { get; set; } = false; public int SpecialNumber { get; set; } = -1; public LocaleText SpecialText { get; set; } = LocaleText.Empty; public string WorldEventObjectFilter { private get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return LocaleText.op_Implicit(SpecialText); } set { //IL_0002: Unknown result type (might be due to invalid IL or missing references) SpecialText = new LocaleText(value); } } public WEE_SubObjectiveData SubObjective { get; set; } = new WEE_SubObjectiveData(); public WEE_UpdateFogData Fog { get; set; } = new WEE_UpdateFogData(); public bool CleanUpEnemiesBehind { get; set; } = true; public WEE_ReactorEventData? Reactor { get; set; } = null; public WEE_CountdownData? Countdown { get; set; } = null; public WEE_ZoneLightData? SetZoneLight { get; set; } = null; public Arrayable CleanupEnemies { get; set; } = new WEE_CleanupEnemiesData(); public Arrayable SpawnHibernates { get; set; } = new Arrayable(); public Arrayable SpawnScouts { get; set; } = new Arrayable(); public Arrayable AddTerminalCommand { get; set; } = new Arrayable(); public Arrayable AddCommand { private get { return AddTerminalCommand; } set { AddTerminalCommand = value; } } public Arrayable HideTerminalCommand { get; set; } = new Arrayable(); public Arrayable HideCommand { private get { return HideTerminalCommand; } set { HideTerminalCommand = value; } } public Arrayable UnhideTerminalCommand { get; set; } = new Arrayable(); public Arrayable UnhideCommand { private get { return UnhideTerminalCommand; } set { UnhideTerminalCommand = value; } } public WEE_GiveResource? GiveResource { get; set; } = null; public ActiveEnemyWaveData? ActiveEnemyWave { get; set; } = null; public WEE_NestedEvent? NestedEvent { get; set; } = null; public WEE_StartEventLoop? StartEventLoop { get; set; } = null; public WEE_StartEventLoop? EventLoop { private get { return StartEventLoop; } set { StartEventLoop = value; } } public WEE_TeleportPlayer? TeleportPlayer { get; set; } = null; public WEE_InfectPlayer? InfectPlayer { get; set; } = null; public WEE_DamagePlayer? DamagePlayer { get; set; } = null; public WEE_RevivePlayer? RevivePlayer { get; set; } = null; public WEE_AdjustTimer AdjustTimer { get; set; } = new WEE_AdjustTimer(); public WEE_CountupData? Countup { get; set; } = null; public Arrayable NavMarker { get; set; } = new WEE_NavMarkerData(); public WEE_ShakeScreen? CameraShake { get; set; } = null; public WEE_StartPortalMachine? Portal { get; set; } = null; public WEE_SetSuccessScreen? SuccessScreen { get; set; } = null; public List MultiProgression { get; set; } = new List(); public WEE_PlayWaveDistantRoar? WaveRoarSound { get; set; } = null; public WEE_CustomHudText? CustomHudText { get; set; } = null; public WEE_CustomHudText? CustomHud { private get { return CustomHudText; } set { CustomHudText = value; } } public WEE_SpecialHudTimer? SpecialHudTimer { get; set; } = new WEE_SpecialHudTimer(); public WEE_SpecialHudTimer? SpecialHud { private get { return SpecialHudTimer; } set { SpecialHudTimer = value; } } public WEE_ForcePlayerDialogue? PlayerDialogue { get; set; } = null; public Arrayable SetTerminalLog { get; set; } = new Arrayable(); public Arrayable TerminalLog { private get { return SetTerminalLog; } set { SetTerminalLog = value; } } public List ObjectiveItems { get; set; } = new List(); public WEE_SetOutsideDimensionData? DimensionData { get; set; } = null; public WEE_SetExpeditionEnvironment? EnvironmentData { get; set; } = null; public WEE_FadeScreenInOut? FadeScreen { get; set; } = null; public WEE_EventData Clone(eDimensionIndex dim, LG_LayerType layer, eLocalZoneIndex zone) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) WEE_EventData wEE_EventData = (WEE_EventData)MemberwiseClone(); wEE_EventData.DimensionIndex = dim; wEE_EventData.Layer = layer; wEE_EventData.LocalIndex = zone; return wEE_EventData; } } public sealed class WEE_SubObjectiveData { public bool DoUpdate { get; set; } = false; public LocaleText CustomSubObjectiveHeader { get; set; } = LocaleText.Empty; public LocaleText CustomSubObjective { get; set; } = LocaleText.Empty; public uint Index { get; set; } = 0u; public int Priority { get; set; } = 1; public LG_LayerType Layer { get; set; } = (LG_LayerType)0; public bool IsLayerIndependent { get; set; } = true; public LocaleText OverrideTag { get; set; } = LocaleText.Empty; } public sealed class WEE_UpdateFogData { public bool DoUpdate { get; set; } = false; public uint FogSetting { get; set; } = 0u; public float FogTransitionDuration { get; set; } = 0f; } public sealed class WEE_ReactorEventData { public enum WaveState { Intro, Wave, Verify, Idle } public WaveState State { get; set; } = WaveState.Intro; public int Wave { get; set; } = 1; public float Progress { get; set; } = 0f; } public sealed class WEE_CountdownData { public float Duration { get; set; } = 0f; public bool CanShowHours { get; set; } = true; public LocaleText TimerText { get; set; } = LocaleText.Empty; public LocaleText TitleText { get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return TimerText; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) TimerText = value; } } public Color TimerColor { get; set; } = Color.red; public List EventsOnProgress { get; set; } = new List(); public List EventsOnDone { get; set; } = new List(); } public sealed class WEE_CleanupEnemiesData { public enum CleanUpType { Kill, Despawn } public CleanUpType Type { get; set; } = CleanUpType.Despawn; public int AreaIndex { get; set; } = -1; public int[] AreaBlacklist { get; set; } = Array.Empty(); public bool IncludeHibernate { get; set; } = true; public bool IncludeAggressive { get; set; } = true; public bool IncludeScout { get; set; } = true; public uint[] ExcludeEnemyID { get; set; } = Array.Empty(); public uint[] IncludeOnlyID { get; set; } = Array.Empty(); public void DoClear(AIG_CourseNode node) { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected I4, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) if (!SNet.IsMaster || node == null || node.m_enemiesInNode == null) { return; } foreach (EnemyAgent item in node.m_enemiesInNode.ToArray()) { AgentMode mode = ((AgentAI)item.AI).Mode; if ((mode - 1) switch { 0 => IncludeAggressive, 2 => IncludeScout, 3 => IncludeHibernate, _ => true, } && !ExcludeEnemyID.Contains(item.EnemyDataID) && (IncludeOnlyID.Length == 0 || IncludeOnlyID.Contains(item.EnemyDataID))) { switch (Type) { case CleanUpType.Despawn: ((Agent)item).m_replicator.Despawn(); break; case CleanUpType.Kill: item.Damage.IsImortal = false; item.Damage.BulletDamage(((Dam_SyncedDamageBase)item.Damage).DamageMax, (Agent)null, default(Vector3), default(Vector3), default(Vector3), false, 0, 1f, 1f, 0u); break; } } } } } public sealed class WEE_ZoneLightData { public enum ModifierType : byte { RevertToOriginal, SetZoneLightData, TransitionToOriginal } public ModifierType Type { get; set; } = ModifierType.RevertToOriginal; public uint LightDataID { get; set; } = 0u; public float TransitionDuration { get; set; } = 0.5f; public int Seed { get; set; } = 0; public bool UseRandomSeed => Seed == 0; } public sealed class WEE_SpawnHibernateData { public int AreaIndex { get; set; } = -1; public int[] AreaBlacklist { get; set; } = Array.Empty(); public uint EnemyID { get; set; } = 0u; public int Count { get; set; } = 0; public Vector3 Position { get; set; } = Vector3.zero; public Vector3 Rotation { get; set; } = Vector3.zero; } public sealed class WEE_SpawnScoutData { public int AreaIndex { get; set; } = -1; public int[] AreaBlacklist { get; set; } = Array.Empty(); public eEnemyGroupType GroupType { get; set; } public eEnemyRoleDifficulty Difficulty { get; set; } public int Count { get; set; } = 0; } public sealed class WEE_AddTerminalCommand { public struct LocaleTerminalOutput { public TerminalLineType LineType { get; set; } public LocaleText Output { get; set; } public float Time { get; set; } public readonly TerminalOutput ToTerminalOutput() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected O, but got Unknown return new TerminalOutput { LineType = LineType, Output = LocaleText.op_Implicit(SerialLookupManager.ParseLocaleText(Output)), Time = Time }; } } public int TerminalIndex { get; set; } = 0; public int CommandNumber { get; set; } = 6; public string Command { get; set; } = string.Empty; public LocaleText CommandDesc { get; set; } = LocaleText.Empty; public bool AutoIndentCommandDesc { get; set; } = false; public List PostCommandOutputs { get; set; } = new List(); public List CommandEvents { get; set; } = new List(); public bool ProgressWaitBeforeEvents { get; set; } = false; public TERM_CommandRule SpecialCommandRule { get; set; } = (TERM_CommandRule)0; } public sealed class WEE_HideTerminalCommand { public int TerminalIndex { get; set; } = 0; public TERM_Command CommandEnum { get; set; } = (TERM_Command)0; public int CommandNumber { get; set; } = 0; public bool DeleteCommand { get; set; } = false; } public sealed class WEE_UnhideTerminalCommand { public int TerminalIndex { get; set; } = 0; public TERM_Command CommandEnum { get; set; } = (TERM_Command)0; public int CommandNumber { get; set; } = 0; } public sealed class WEE_GiveResource { public float Health { get; set; } = 0f; public float MainAmmo { get; set; } = 0f; public float SpecialAmmo { get; set; } = 0f; public float ToolAmmo { get; set; } = 0f; public HashSet PlayerFilter { get; set; } = new HashSet(Enum.GetValues()); public bool FullTeamOverflow { get; set; } = true; public bool UseLocation { get; set; } = false; public bool IncludeSupplyEfficiency { get; set; } = false; public bool HasAnyAmmoGain => MainAmmo != 0f || SpecialAmmo != 0f || ToolAmmo != 0f; public bool HasAnyGain => Health != 0f && HasAnyAmmoGain; } public sealed class WEE_NestedEvent { public enum NestedMode : byte { ActivateAll, RandomAny, RandomWeighted } public struct EventsOnRandomWeight { public string DebugName { get; set; } public float Weight { get; set; } public int RepeatCount { get; set; } public bool IsInfinite { get; set; } public List Events { get; set; } } public NestedMode Type { get; set; } = NestedMode.ActivateAll; public int MaxRandomEvents { get; set; } = -1; public bool AllowRepeatsInRandom { get; set; } = false; public List EventsToActivate { get; set; } = new List(); public List WheelOfEvents { get; set; } = new List(); } public sealed class WEE_StartEventLoop { public int LoopIndex { get; set; } = 0; public float LoopDelay { get; set; } = 1f; public int LoopCount { get; set; } = -1; public List EventsToActivate { get; set; } = new List(); } public enum PlayerIndex : byte { P0, P1, P2, P3 } public sealed class WEE_TeleportPlayer { public struct TeleportData { public PlayerIndex PlayerIndex { get; set; } [JsonPropertyName("DimensionIndex")] public eDimensionIndex Dimension { get; set; } public Vector3 Position { get; set; } public string WorldEventObjectFilter { get; set; } [JsonPropertyName("LookDirection")] public int LookDir { get; set; } [JsonPropertyName("LookDirectionV3")] public Vector3 LookDirV3 { get; set; } public bool PlayWarpAnimation { get; set; } [JsonPropertyName("FlashDuration")] public float Duration { get; set; } [JsonIgnore] public PlayerAgent Player { get; set; } [JsonIgnore] public eDimensionIndex LastDimension { get; set; } [JsonIgnore] public Vector3 LastPosition { get; set; } [JsonIgnore] public Vector3 LastLookDirV3 { get; set; } [JsonIgnore] public List ItemsToWarp { get; set; } } public HashSet PlayerFilter { get; set; } = new HashSet(); public bool PlayWarpAnimation { get; set; } = true; public bool SendBPUsToHost { get; set; } = false; public Vector3 Player0Position { get; set; } = Vector3.zero; public int P0LookDir { get; set; } = 0; public Vector3 Player1Position { get; set; } = Vector3.zero; public int P1LookDir { get; set; } = 0; public Vector3 Player2Position { get; set; } = Vector3.zero; public int P2LookDir { get; set; } = 0; public Vector3 Player3Position { get; set; } = Vector3.zero; public int P3LookDir { get; set; } = 0; public bool FlashTeleport { get; set; } = false; public bool WarpSentries { get; set; } = true; public bool WarpBigPickups { get; set; } = true; public bool SendBigPickupsToHost { private get { return SendBPUsToHost; } set { SendBPUsToHost = value; } } public bool FullTeamOverflow { get; set; } = false; public List TPData { get; set; } = new List(); } public sealed class WEE_InfectPlayer { public HashSet PlayerFilter { get; set; } = new HashSet { PlayerIndex.P0, PlayerIndex.P1, PlayerIndex.P2, PlayerIndex.P3 }; public bool FullTeamOverflow { get; set; } = true; public float InfectionAmount { get; set; } = 0f; public bool InfectOverTime { get; set; } = false; public float Interval { get; set; } = 1f; public bool UseZone { get; set; } = false; } public sealed class WEE_DamagePlayer { public HashSet PlayerFilter { get; set; } = new HashSet { PlayerIndex.P0, PlayerIndex.P1, PlayerIndex.P2, PlayerIndex.P3 }; public bool FullTeamOverflow { get; set; } = true; public float DamageAmount { get; set; } = 0f; public bool DealPercentageDamage { get; set; } = false; public bool DamageOverTime { get; set; } = false; public float Interval { get; set; } = 1f; public bool UseZone { get; set; } = false; } public sealed class WEE_RevivePlayer { public HashSet PlayerFilter { get; set; } = new HashSet { PlayerIndex.P0, PlayerIndex.P1, PlayerIndex.P2, PlayerIndex.P3 }; public bool FullTeamOverflow { get; set; } = true; } public sealed class WEE_AdjustTimer { public float Duration { get; set; } = 0f; public float Speed { get; set; } = 0f; public bool UpdateTitleText { get; set; } = false; public LocaleText TitleText { get; set; } = LocaleText.Empty; public bool UpdateText { get; set; } = false; public bool UpdateBodyText { private get { return UpdateText; } set { UpdateText = value; } } public LocaleText CustomText { get; set; } = LocaleText.Empty; public LocaleText BodyText { private get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return CustomText; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) CustomText = value; } } public bool UpdateColor { get; set; } = false; public Color TimerColor { get; set; } = Color.red; public bool UpdateSpecialHud { get; set; } = false; public int SpecialHudIndex { get; set; } = 0; public float SpecialHudTimeModifier { get; set; } = 0f; } public sealed class WEE_CountupData { public float Duration { get; set; } = 0f; public float StartValue { get; set; } = 0f; public float Speed { get; set; } = 1f; public LocaleText TimerText { get; set; } = LocaleText.Empty; public LocaleText TitleText { private get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return TimerText; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) TimerText = value; } } public LocaleText CustomText { get; set; } = LocaleText.Empty; public LocaleText BodyText { private get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return CustomText; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) CustomText = value; } } public Color TimerColor { get; set; } = Color.red; public int DecimalPoints { get; set; } = 0; public List EventsOnProgress { get; set; } = new List(); public List EventsOnDone { get; set; } = new List(); } public struct EventsOnTimerProgress { public float Progress { get; set; } public List Events { get; set; } } public sealed class WEE_NavMarkerData { public int Index { get; set; } = 0; public NavMarkerOption Style { get; set; } = (NavMarkerOption)10; public LocaleText Title { get; set; } = LocaleText.Empty; public Color Color { get; set; } = new Color(0.701f, 0.435f, 0.964f, 1f); public bool UsePin { get; set; } = true; } public sealed class WEE_ShakeScreen { public float Radius { get; set; } = 0f; public float Duration { get; set; } = 0f; public float Amplitude { get; set; } = 0f; public float Frequency { get; set; } = 0f; public bool Directional { get; set; } = true; } public sealed class WEE_StartPortalMachine { public eDimensionIndex TargetDimension { get; set; } = (eDimensionIndex)1; public float TeleportDelay { get; set; } = 5f; public bool PreventPortalWarpTeamEvent { get; set; } = false; } public sealed class WEE_SetSuccessScreen { public enum ScreenType : byte { SetSuccessScreen, FlashFakeScreen } public ScreenType Type { get; set; } = ScreenType.SetSuccessScreen; public WinScreen CustomSuccessScreen { get; set; } = WinScreen.Empty; public eCM_MenuPage FakeEndScreen { get; set; } = (eCM_MenuPage)17; public uint OverrideMusic { get; set; } = 0u; } public sealed class WEE_PlayWaveDistantRoar { public enum WaveRoarSound : byte { Striker, Shooter, Birther, Shadow, Tank, Flyer, Immortal, Bullrush, Pouncer, Striker_Berserk, Shooter_Spread } public enum WaveRoarSize : byte { Small, Medium, Big } public WaveRoarSound RoarSound { get; set; } = WaveRoarSound.Striker; public WaveRoarSize RoarSize { get; set; } = WaveRoarSize.Small; public bool IsOutside { get; set; } = false; } public sealed class WEE_CustomHudText { public LocaleText Title { get; set; } = LocaleText.Empty; public LocaleText TitleText { private get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Title; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Title = value; } } public LocaleText Body { get; set; } = LocaleText.Empty; public LocaleText BodyText { private get { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return Body; } set { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Body = value; } } } public sealed class WEE_SpecialHudTimer { public enum SpecialHudType : byte { StartTimer, StartIndexTimer, StartPersistent, StopIndex, StopAll } public float Duration { get; set; } = 0f; public SpecialHudType Type { get; set; } = SpecialHudType.StartTimer; public int Index { get; set; } = 0; public LocaleText Message { get; set; } = LocaleText.Empty; public ePUIMessageStyle Style { get; set; } = (ePUIMessageStyle)0; public int Priority { get; set; } = -2; public bool ShowTimeInProgressBar { get; set; } = true; public bool InvertProgress { get; set; } = false; public List EventsOnProgress { get; set; } = new List(); public List EventsOnDone { get; set; } = new List(); public bool HasIndex { get { SpecialHudType type = Type; if (type - 1 <= SpecialHudType.StartIndexTimer) { return true; } return false; } } } public sealed class WEE_ForcePlayerDialogue { public enum DialogueType : byte { Closest, Specific, Random } public enum PlayerIntensityState : byte { Exploration, Stealth, Encounter, Combat } public DialogueType Type { get; set; } = DialogueType.Closest; public PlayerIndex CharacterID { get; set; } = PlayerIndex.P0; public PlayerIntensityState IntensityState { get; set; } = PlayerIntensityState.Exploration; } public sealed class WEE_SetTerminalLog { public enum LogEventType : byte { Add, Remove, Move } public int TerminalIndex { get; set; } = 0; public LogEventType Type { get; set; } = LogEventType.Add; public eDimensionIndex TargetDimensionIndex { get; set; } = (eDimensionIndex)0; public LG_LayerType TargetLayer { get; set; } = (LG_LayerType)0; public eLocalZoneIndex TargetLocalIndex { get; set; } = (eLocalZoneIndex)0; public int TargetTerminalIndex { get; set; } = 0; public string FileName { get; set; } = string.Empty; public LocaleText FileContent { get; set; } = LocaleText.Empty; public Language FileContentOriginalLanguage { get; set; } = (Language)1; public uint AttachedAudioFile { get; set; } = 0u; public int AttachedAudioByteSize { get; set; } = 0; public uint PlayerDialogToTriggerAfterAudio { get; set; } = 0u; public List EventsOnFileRead { get; set; } = new List(); public bool TryGetTargetTerminal(out LG_ComputerTerminal targetTerm) { //IL_000a: 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_0016: Unknown result type (might be due to invalid IL or missing references) targetTerm = null; LG_Zone val = default(LG_Zone); if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(TargetDimensionIndex, TargetLayer, TargetLocalIndex, ref val)) { return false; } if (TargetTerminalIndex < 0 || TargetTerminalIndex >= val.TerminalsSpawnedInZone.Count) { return false; } targetTerm = val.TerminalsSpawnedInZone[TargetTerminalIndex]; return (Object)(object)targetTerm != (Object)null; } } public sealed class WEE_SetPocketItem { public enum PlayerTagType : byte { Custom, Specific, Random, Closest } public int Index { get; set; } = 0; public int Count { get; set; } = 0; public bool IsOnTop { get; set; } = false; public LocaleText ItemName { get; set; } = LocaleText.Empty; public PlayerTagType TagType { get; set; } = PlayerTagType.Custom; public PlayerIndex PlayerIndex { get; set; } = PlayerIndex.P0; public string CustomTag { get; set; } = string.Empty; [JsonIgnore] public string? Tag { get; set; } = string.Empty; public bool ShouldRemove => Count < 1; private string LiveCount => (Count > 1) ? $"{Count} " : string.Empty; public string FormatString() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) return $"{LiveCount}{ItemName} [{Tag}]"; } } public sealed class WEE_SetOutsideDimensionData { public bool IsOutside { get; set; } = true; public ValueBase LightAzimuth { get; set; } = ValueBase.Unchanged; public ValueBase LightElevation { get; set; } = ValueBase.Unchanged; public ValueBase LightIntensity { get; set; } = ValueBase.Unchanged; public ValueBase AmbientIntensity { get; set; } = ValueBase.Unchanged; public ValueBase ReflectionsIntensity { get; set; } = ValueBase.Unchanged; public ValueBase GodrayRange { get; set; } = ValueBase.Unchanged; public ValueBase GodrayExponent { get; set; } = ValueBase.Unchanged; public uint AtmosphereData { get; set; } = 0u; public ValueBase AtmosphereDensity { get; set; } = ValueBase.Unchanged; public ValueBase Exposure { get; set; } = ValueBase.Unchanged; public ValueBase AerialScale { get; set; } = ValueBase.Unchanged; public ValueBase MieScattering { get; set; } = ValueBase.Unchanged; public ValueBase MieG { get; set; } = ValueBase.Unchanged; public ValueBase MultipleScattering { get; set; } = ValueBase.Unchanged; public uint CloudsData { get; set; } = 0u; public ValueBase CloudsCoverage { get; set; } = ValueBase.Unchanged; public ValueBase CloudsDensity { get; set; } = ValueBase.Unchanged; public ValueBase CloudsSharpness { get; set; } = ValueBase.Unchanged; public ValueBase CloudsShadowOpacity { get; set; } = ValueBase.Unchanged; public ValueBase CloudsTimescale { get; set; } = ValueBase.Unchanged; public ValueBase CloudsCrawling { get; set; } = ValueBase.Unchanged; public ValueBase CloudsFade { get; set; } = ValueBase.Unchanged; public BoolBase Sandstorm { get; set; } = BoolBase.Unchanged; public ValueBase SandstormEdgeA { get; set; } = ValueBase.Unchanged; public ValueBase SandstormEdgeB { get; set; } = ValueBase.Unchanged; public ValueBase SandstormMinFog { get; set; } = ValueBase.Unchanged; } public sealed class WEE_SetExpeditionEnvironment { public ValueBase EnvironmentWetness { get; set; } = ValueBase.Unchanged; public bool UpdateColor { get; set; } = false; public Color DustColor { get; set; } = Color.white; public ValueBase DustAlphaBoost { get; set; } = ValueBase.Unchanged; public ValueBase DustTurbulence { get; set; } = ValueBase.Unchanged; } public sealed class WEE_FadeScreenInOut { public Color FadeColor { get; set; } = Color.black; public float CurveTimeStart { get; set; } = 0f; public float CurveValueStart { get; set; } = 0f; public float CurveTimeEnd { get; set; } = 1f; public float CurveValueEnd { get; set; } = 1f; public float FadeSpeed { get; set; } = 1f; } public enum WEE_Type { CloseSecurityDoor = 10000, LockSecurityDoor = 10001, SetDoorInteraction = 10002, TriggerSecurityDoorAlarm = 10003, SolveSecurityDoorAlarm = 10004, StartReactor = 10005, ModifyReactorWaveState = 10006, ForceCompleteReactor = 10007, ForceCompleteLevel = 10008, ForceFailLevel = 10009, Countdown = 10010, SetLevelFailCheckEnabled = 10011, SetLevelFailWhenAnyPlayerDowned = 10012, KillAllPlayers = 10013, KillPlayersInZone = 10014, SolveSingleObjectiveItem = 10015, SetLightDataInZone = 10016, AlertEnemiesInZone = 10017, CleanupEnemiesInZone = 10018, SpawnHibernateInZone = 10019, SpawnScoutInZone = 10020, SaveCheckpoint = 10021, MoveExtractionWorldPosition = 10022, SetBlackoutEnabled = 10023, AddTerminalCommand = 10024, HideTerminalCommand = 10025, UnhideTerminalCommand = 10026, AddChainPuzzleToSecurityDoor = 10027, SetActiveEnemyWave = 10028, GiveResource = 10029, NestedEvent = 20000, StartEventLoop = 20001, StopEventLoop = 20002, TeleportPlayer = 20003, InfectPlayer = 20004, DamagePlayer = 20005, RevivePlayer = 20006, AdjustAWOTimer = 20007, Countup = 20008, ForceCompleteChainPuzzle = 20009, SpawnNavMarker = 20010, ShakeScreen = 20011, StartPortalMachine = 20012, SetSuccessScreen = 20013, PlaySubtitles = 20014, MultiProgression = 20015, PlayWaveRoarSound = 20016, CustomHudText = 20017, SpecialHudTimer = 20018, ForcePlayPlayerDialogue = 20019, SetTerminalLog = 20020, SetPocketItem = 20021, DoInteractWeakDoorsInZone = 20022, ToggleInteractWeakDoorsInZone = 20023, PickupSentries = 20024, SetOutsideDimensionData = 20025, SetExpeditionEnvironment = 20026, ClearWardenIntelQueue = 20027, ResetOnApproachDoor = 20028, FadeScreenInOut = 20029 } } namespace AWO.Modules.WEE.Replicators { public struct OutsideDataState { public float duration; public bool revertToOriginal; public bool isOutside; public uint atmosphereData; public uint cloudsData; public bool sandstorm; public unsafe fixed float fieldData[23]; } public sealed class OutsideDataReplicator : MonoBehaviour, IStateReplicatorHolder { public LG_Dimension Dimension = null; public DimensionData OutsideData = null; private OutsideDataState _origData; private float[] _origFields = new float[FieldMap.Length]; private Coroutine? _transitionCoroutine; internal static readonly (Func Get, Action Set)[] FieldMap = new(Func, Action)[23] { ((DimensionData d) => d.LightAzimuth, delegate(DimensionData d, float v) { d.LightAzimuth = v; }), ((DimensionData d) => d.LightElevation, delegate(DimensionData d, float v) { d.LightElevation = v; }), ((DimensionData d) => d.LightIntensity, delegate(DimensionData d, float v) { d.LightIntensity = v; }), ((DimensionData d) => d.AmbientIntensity, delegate(DimensionData d, float v) { d.AmbientIntensity = v; }), ((DimensionData d) => d.ReflectionsIntensity, delegate(DimensionData d, float v) { d.ReflectionsIntensity = v; }), ((DimensionData d) => d.GodrayRange, delegate(DimensionData d, float v) { d.GodrayRange = v; }), ((DimensionData d) => d.GodrayExponent, delegate(DimensionData d, float v) { d.GodrayExponent = v; }), ((DimensionData d) => d.AtmosphereDensity, delegate(DimensionData d, float v) { d.AtmosphereDensity = v; }), ((DimensionData d) => d.Exposure, delegate(DimensionData d, float v) { d.Exposure = v; }), ((DimensionData d) => d.AerialScale, delegate(DimensionData d, float v) { d.AerialScale = v; }), ((DimensionData d) => d.MieScattering, delegate(DimensionData d, float v) { d.MieScattering = v; }), ((DimensionData d) => d.MieG, delegate(DimensionData d, float v) { d.MieG = v; }), ((DimensionData d) => d.MultipleScattering, delegate(DimensionData d, float v) { d.MultipleScattering = v; }), ((DimensionData d) => d.CloudsCoverage, delegate(DimensionData d, float v) { d.CloudsCoverage = v; }), ((DimensionData d) => d.CloudsDensity, delegate(DimensionData d, float v) { d.CloudsDensity = v; }), ((DimensionData d) => d.CloudsSharpness, delegate(DimensionData d, float v) { d.CloudsSharpness = v; }), ((DimensionData d) => d.CloudsShadowOpacity, delegate(DimensionData d, float v) { d.CloudsShadowOpacity = v; }), ((DimensionData d) => d.CloudsTimescale, delegate(DimensionData d, float v) { d.CloudsTimescale = v; }), ((DimensionData d) => d.CloudsCrawling, delegate(DimensionData d, float v) { d.CloudsCrawling = v; }), ((DimensionData d) => d.CloudsFade, delegate(DimensionData d, float v) { d.CloudsFade = v; }), ((DimensionData d) => d.SandstormEdgeA, delegate(DimensionData d, float v) { d.SandstormEdgeA = v; }), ((DimensionData d) => d.SandstormEdgeB, delegate(DimensionData d, float v) { d.SandstormEdgeB = v; }), ((DimensionData d) => d.SandstormMinFog, delegate(DimensionData d, float v) { d.SandstormMinFog = v; }) }; [HideFromIl2Cpp] public StateReplicator? Replicator { get; private set; } private static float[] GetFieldArray(DimensionData dimData) { float[] array = new float[FieldMap.Length]; int num = 0; (Func, Action)[] fieldMap = FieldMap; for (int i = 0; i < fieldMap.Length; i++) { Func item = fieldMap[i].Item1; array[num++] = item(dimData); } return array; } public void Setup(Dimension dim) { //IL_00a6: 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_00bd: Expected I4, but got Unknown Dimension = ((Component)this).GetComponent(); if (dim.DimensionData == null) { ((Behaviour)this).enabled = false; return; } OutsideData = dim.DimensionData; _origData = new OutsideDataState { revertToOriginal = true, isOutside = OutsideData.IsOutside, atmosphereData = OutsideData.AtmosphereData, cloudsData = OutsideData.CloudsData, sandstorm = OutsideData.Sandstorm }; _origFields = GetFieldArray(OutsideData); Replicator = StateReplicator.Create((uint)(dim.DimensionIndex + 1), default(OutsideDataState), (LifeTimeType)1, (IStateReplicatorHolder)this); } public void OnDestroy() { Replicator?.Unload(); } public void SetOutsideData(OutsideDataState data) { Replicator?.SetState(data); } public unsafe void OnStateChange(OutsideDataState oldState, OutsideDataState state, bool isRecall) { if (_transitionCoroutine != null) { ((MonoBehaviour)Dimension).StopCoroutine(_transitionCoroutine); } float duration = (isRecall ? 0f : state.duration); float[] array = new float[FieldMap.Length]; if (state.revertToOriginal) { state = _origData; array = _origFields; } else { float* ptr = state.fieldData; for (int i = 0; i < FieldMap.Length; i++) { array[i] = ptr[i]; } } if (!array.All((float f) => f == 0f)) { LG_Dimension dimension = Dimension; OutsideDataState data = state; data.duration = duration; _transitionCoroutine = MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)dimension, OutsideTransition(data, array)); } } [HideFromIl2Cpp] private IEnumerator OutsideTransition(OutsideDataState data, float[] fieldArr) { OutsideData.IsOutside = data.isOutside; OutsideData.AtmosphereData = ((data.atmosphereData != 0) ? data.atmosphereData : OutsideData.AtmosphereData); OutsideData.CloudsData = ((data.cloudsData != 0) ? data.cloudsData : OutsideData.CloudsData); OutsideData.Sandstorm = data.sandstorm; float[] startValues = GetFieldArray(OutsideData); float startAzimuth = startValues[0]; float startElevation = startValues[1]; float endAzimuth = fieldArr[0]; float endElevation = fieldArr[1]; bool azimuthOnly = !float.IsNaN(endAzimuth); bool elevationOnly = !float.IsNaN(endElevation); Vector3 startDir = Vector3.zero; Vector3 endDir = Vector3.zero; bool slerpFlag = azimuthOnly && elevationOnly; if (slerpFlag) { startDir = DirFromDeg(startAzimuth, startElevation); endDir = DirFromDeg(endAzimuth, endElevation); } float time = 0f; while (time <= data.duration) { time += Time.deltaTime; float progress = Mathf.Clamp01(time / data.duration); if (slerpFlag) { Vector3 val = Vector3.Slerp(startDir, endDir, progress); Vector3 dir = ((Vector3)(ref val)).normalized; float elDeg = Mathf.Asin(Mathf.Clamp(dir.y, -1f, 1f)) * 57.29578f; float azDeg = Mathf.Atan2(dir.x, dir.z) * 57.29578f; FieldMap[0].Set(OutsideData, azDeg); FieldMap[1].Set(OutsideData, elDeg); } else if (azimuthOnly) { float azimuth = Mathf.LerpAngle(startAzimuth, endAzimuth, progress); FieldMap[0].Set(OutsideData, azimuth); } else if (elevationOnly) { float elevation = Mathf.Lerp(startElevation, endElevation, progress); FieldMap[1].Set(OutsideData, elevation); } for (int i = 2; i < FieldMap.Length; i++) { float endValue = fieldArr[i]; if (!float.IsNaN(endValue)) { float value = Mathf.Lerp(startValues[i], endValue, progress); FieldMap[i].Set(OutsideData, value); } } yield return null; } static Vector3 DirFromDeg(float num2, float num4) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) float num = num2 * ((float)Math.PI / 180f); float num3 = num4 * ((float)Math.PI / 180f); float num5 = Mathf.Sin(num3); float num6 = Mathf.Cos(num3); float num7 = Mathf.Sin(num) * num6; float num8 = Mathf.Cos(num) * num6; Vector3 val2 = new Vector3(num7, num5, num8); return ((Vector3)(ref val2)).normalized; } } } public struct ScanPositionState { public Vector3 position; public int nodeID; } public sealed class ScanPositionReplicator : MonoBehaviour, IStateReplicatorHolder { public CP_Bioscan_Core TrackingScan = null; public NavMarker? Marker; public bool IsExitScan; [HideFromIl2Cpp] public StateReplicator? Replicator { get; private set; } public void Setup(uint id, CP_Bioscan_Core scan, NavMarker? marker, bool isExit) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) Replicator = StateReplicator.Create(id, new ScanPositionState { position = ((Component)scan).transform.position, nodeID = scan.CourseNode.NodeID }, (LifeTimeType)1, (IStateReplicatorHolder)this); TrackingScan = scan; Marker = marker; IsExitScan = isExit; } public void OnDestroy() { Replicator?.Unload(); } public void TryUpdatePosition(Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) AIG_CourseNode courseNode = CourseNodeUtil.GetCourseNode(position); if (courseNode != null) { Replicator?.SetState(new ScanPositionState { position = position, nodeID = courseNode.NodeID }); } } public void OnStateChange(ScanPositionState oldState, ScanPositionState state, bool isRecall) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Invalid comparison between Unknown and I4 //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011f: 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_0131: Unknown result type (might be due to invalid IL or missing references) if (oldState.position == state.position) { return; } ((Component)TrackingScan).transform.position = state.position; if ((int)TrackingScan.State.status > 0) { TrackingScan.PlayerScanner.StopScan(); TrackingScan.PlayerScanner.StartScan(); } NavMarker? marker = Marker; if (marker != null) { marker.SetTrackingObject(((Component)TrackingScan).gameObject); } AIG_CourseNode val = default(AIG_CourseNode); if (AIG_CourseNode.GetCourseNode(state.nodeID, ref val)) { TrackingScan.CourseNode.UnregisterBioscan(TrackingScan); TrackingScan.m_courseNode = val; val.RegisterBioscan(TrackingScan); } if (!IsExitScan) { return; } LG_Zone zone = TrackingScan.m_courseNode.m_zone; string formattedText = zone.NavInfo.GetFormattedText((LG_NavInfoFormat)6); LG_LayerType[] values = Enum.GetValues(); foreach (LG_LayerType val2 in values) { if (WardenObjectiveManager.HasWardenObjectiveDataForLayer(val2)) { WardenObjectiveManager.SetObjectiveTextFragment(val2, WardenObjectiveManager.GetCurrentChainIndex(val2), (eWardenTextFragment)6, formattedText); WardenObjectiveManager.UpdateObjectiveGUIWithCurrentState(val2, false, false, true); } } } } public struct ZoneLightState { public bool transitionToOriginal; public uint lightData; public int lightSeed; public float duration; } public struct LightTransitionData { public enum Mode { Enabled, Disabled, Flickering, Original } public ILightModifier lightMod; public float duration; public float origIntensity; public float startIntensity; public float endIntensity; public Color startColor; public Color endColor; public Mode endMode; public int endModeSeed; public bool origEnabled; } public sealed class ZoneLightReplicator : MonoBehaviour, IStateReplicatorHolder { public LG_Zone Zone = null; public LightWorker[] LightsInZone = Array.Empty(); private readonly Dictionary _lightMods = new Dictionary(); private readonly Dictionary _modMap = new Dictionary(); public Coroutine? ShareStatusCoroutine; [HideFromIl2Cpp] public StateReplicator? Replicator { get; private set; } [HideFromIl2Cpp] public event Action? OnLightsChanged; public void Setup() { Zone = ((Component)this).GetComponent(); Replicator = StateReplicator.Create((uint)(Zone.ID + 1), default(ZoneLightState), (LifeTimeType)1, (IStateReplicatorHolder)this); LightsInZone = LightAPI.GetLightWorkersInZone((LG_Zone[])(object)new LG_Zone[1] { Zone }).ToArray(); } public void OnDestroy() { Replicator?.Unload(); } public void SetLightSetting(ZoneLightState data) { Replicator?.SetState(data); } public void RevertLightData() { Replicator?.SetState(new ZoneLightState { lightData = 0u }); } public void OnStateChange(ZoneLightState oldState, ZoneLightState state, bool isRecall) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown if (state.lightData == 0) { ClearLightMods(); return; } LightSettingsDataBlock block = default(LightSettingsDataBlock); if (!DataBlockUtil.TryGetBlock(state.lightData, ref block)) { bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(47, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to find enabled LightSettingsDataBlock "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(state.lightData); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("!"); } Logger.Error(val); return; } LightSettingSelector[] selectors = Enum.GetValues().Select(delegate(LightCategory category) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0008: Unknown result type (might be due to invalid IL or missing references) LightSettingSelector val2 = new LightSettingSelector(); val2.Setup(category, block); return val2; }).ToArray(); for (int num = 0; num < LightsInZone.Length; num++) { ApplyLightMod(selectors, state.transitionToOriginal, isRecall ? 0f : state.duration, state.lightSeed, num); } StartShareStatus(state.duration); } private void ClearLightMods() { foreach (KeyValuePair lightMod in _lightMods) { if (lightMod.Value != null) { ((MonoBehaviour)Zone).StopCoroutine(lightMod.Value); } lightMod.Key.Remove(); } _lightMods.Clear(); _modMap.Clear(); LightAPI.ForEachWorker((IEnumerable)LightsInZone, (Action)delegate(LightWorker worker) { worker.ToggleLightFlicker(true); }); StopShareStatus(); ShareStatus(); } private void ApplyLightMod(LightSettingSelector[] selectors, bool transitionToOrignal, float duration, int seed, int subseed) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_028e: Unknown result type (might be due to invalid IL or missing references) //IL_0295: 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_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) Random random = new Random(seed); for (int i = 0; i < Mathf.Abs(subseed); i++) { random.Next(); } LightWorker val = LightsInZone[subseed]; ILightModifier val2 = val.AddModifier(val.CurrentColor, val.CurrentIntensity, val.CurrentEnabled, 1000); if (_modMap.TryGetValue(val.InstanceID, out ILightModifier value) && _lightMods.TryGetValue(value, out Coroutine value2) && value2 != null) { ((MonoBehaviour)Zone).StopCoroutine(value2); _lightMods.Remove(value); value.Remove(); } _lightMods[val2] = null; _modMap[val.InstanceID] = val2; val.ToggleLightFlicker(false); LightCategorySetting val3 = default(LightCategorySetting); if (transitionToOrignal) { _lightMods[val2] = MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)Zone, LightTransition(new LightTransitionData { lightMod = val2, duration = duration, startIntensity = val2.Intensity, endIntensity = val.OrigIntensity, startColor = val2.Color, endColor = val.OrigColor, endMode = LightTransitionData.Mode.Original, origEnabled = val.OrigEnabled })); } else if (selectors[val.Light.m_category].TryGetRandomSetting((uint)subseed, ref val3) && random.MeetProbability(val3.Chance)) { _lightMods[val2] = MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)Zone, LightTransition(new LightTransitionData { lightMod = val2, duration = duration, origIntensity = val.PrefabIntensity, startIntensity = val2.Intensity, endIntensity = val.PrefabIntensity * val3.IntensityMul, startColor = val2.Color, endColor = val3.Color, endMode = (random.MeetProbability(val3.ChanceBroken) ? LightTransitionData.Mode.Flickering : LightTransitionData.Mode.Enabled), endModeSeed = random.Next() })); } else { _lightMods[val2] = MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)Zone, LightTransition(new LightTransitionData { lightMod = val2, duration = duration, startIntensity = val2.Intensity, endIntensity = 0f, startColor = val2.Color, endColor = Color.black, endMode = LightTransitionData.Mode.Disabled })); } } [HideFromIl2Cpp] private IEnumerator LightTransition(LightTransitionData data) { float time = 0f; bool flag = false; ILightModifier mod = data.lightMod; if (!mod.Enabled) { if (data.endMode == LightTransitionData.Mode.Disabled || (data.endMode == LightTransitionData.Mode.Original && !data.origEnabled)) { yield break; } data.startColor = Color.black; data.startIntensity = 0f; } else if (data.endMode == LightTransitionData.Mode.Original && !data.origEnabled) { data.endColor = Color.black; data.endIntensity = 0f; } while (time <= data.duration) { time += Time.deltaTime; float progress = Mathf.Clamp01(time / data.duration); mod.Color = Color.Lerp(data.startColor, data.endColor, progress); mod.Intensity = Mathf.Lerp(data.startIntensity, data.endIntensity, progress); yield return null; if (!flag && data.endMode != LightTransitionData.Mode.Disabled) { flag = true; mod.Enabled = true; } } switch (data.endMode) { case LightTransitionData.Mode.Disabled: mod.Enabled = false; break; case LightTransitionData.Mode.Flickering: _lightMods[data.lightMod] = MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)Zone, LightAnimation(data)); break; case LightTransitionData.Mode.Original: ClearLightMods(); break; } } [HideFromIl2Cpp] private IEnumerator LightAnimation(LightTransitionData data) { Random rand = new Random(data.endModeSeed); ILightModifier mod = data.lightMod; while (true) { float time = 0f; float duration = rand.NextRange(0.1f, 2.5f); float delay = rand.NextRange(0.2f, 1f); while (time <= duration) { time += Time.deltaTime; float ramp = Mathf.Clamp01(time / duration); mod.Intensity = data.origIntensity * ramp * ramp; yield return null; } mod.Intensity = 0f; yield return (object)new WaitForSeconds(delay); } } public void ShareStatus() { this.OnLightsChanged?.Invoke(); } public void StartShareStatus(float duration) { if (this.OnLightsChanged != null) { StopShareStatus(); ShareStatusCoroutine = CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoShareStatus(duration)), (Action)null); } } public void StopShareStatus() { if (ShareStatusCoroutine != null) { CoroutineManager.StopCoroutine(ShareStatusCoroutine); ShareStatusCoroutine = null; } } [HideFromIl2Cpp] private IEnumerator DoShareStatus(float duration) { float time = 0f; float interval = GetInvocationInterval(duration); float nextInvoke = interval; bool shouldSync = !float.IsNaN(interval); while (time <= duration) { time += Time.fixedDeltaTime; if (shouldSync && nextInvoke <= time && nextInvoke < duration) { ShareStatus(); nextInvoke += interval; } yield return null; } ShareStatus(); } private static float GetInvocationInterval(float time) { if (time < 2f) { return float.NaN; } if (time < 10f) { return time / 2f; } int num = (int)Math.Floor(time); if (num.IsPrime()) { num--; } List list = new List(); int num2 = (int)Math.Sqrt(num); for (int i = 1; i <= num2; i++) { if (num % i == 0) { list.Add(i); int num3 = num / i; if (num3 != i) { list.Add(num3); } } } list.Sort(); List list2 = list.Skip(1).Take(list.Count - 2).ToList(); if (list2.Count == 0) { return float.NaN; } float mean = (float)list2.Sum() / (float)list2.Count; int num4 = ((list2.Count % 2 != 1) ? list2.Aggregate(delegate(int a, int b) { float num5 = Math.Abs((float)a - mean); float num6 = Math.Abs((float)b - mean); return (num5 == num6) ? Math.Max(a, b) : ((num5 < num6) ? a : b); }) : ((int)mean)); return Math.Min(num4, 30f); } } } namespace AWO.Modules.WEE.Patches { [HarmonyPatch(typeof(LG_DimensionPortal), "Setup")] internal static class Patch_LG_DimensionPortal { [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_Setup(LG_DimensionPortal __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) StartPortalEvent.Portals.Add(GlobalIndexUtil.ToStruct(__instance.SpawnNode.m_zone), __instance); } } [HarmonyPatch(typeof(LG_WeakDoor), "Setup")] internal static class Patch_LG_WeakDoorButton { [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_Setup(LG_WeakDoor __instance) { CollectionExtensions.GetOrAddNew>((IDictionary>)DoInteractWeakDoorsEvent.WeakDoors, ((LG_ZoneExpander)__instance.Gate).CoursePortal.m_nodeA.m_zone.ID).Add(__instance); } } [HarmonyPatch(typeof(PUI_GameObjectives), "SetItems")] internal static class Patch_PUI_SetPocketItems { [HarmonyPrefix] [HarmonyWrapSafe] private static void Pre_SetItems(ref string txt) { if (!SetPocketItemEvent.HasEmptyPockets) { txt = string.Join("\n", new string[3] { SetPocketItemEvent.TopItems, txt, SetPocketItemEvent.BottomItems }.Where((string section) => !string.IsNullOrWhiteSpace(section))); } } } [HarmonyPatch(typeof(PUI_WardenIntel), "ShowSubObjectiveMessage")] internal static class Patch_PUI_WardenIntel { [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_ShowSubObjectiveMessage() { return ClearWardenIntelQueueEvent.AllowWardenIntel; } } [HarmonyPatch] internal static class Patch_TermCmdInterpreter { [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "ReceiveCommand")] [HarmonyPrefix] [HarmonyWrapSafe] private static void Pre_ReceiveCommand(LG_ComputerTerminalCommandInterpreter __instance, TERM_Command cmd, string inputLine, string param1, string param2) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 if ((int)cmd == 29 && SetTerminalLog.LogEventQueue.TryGetValue((__instance.m_terminal.SyncID, param1.ToUpper()), out Queue value)) { MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)__instance.m_terminal, DoEvents(value)); } } private static IEnumerator DoEvents(Queue eData) { yield return (object)new WaitForSeconds(3f); while (eData.Count > 0) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(eData.Dequeue(), (eWardenObjectiveEventTrigger)0, true, 0f); } } } [HarmonyPatch(typeof(MainMenuGuiLayer), "AddPage")] internal static class Patch_AddPage { public static bool McBased; [HarmonyPrefix] [HarmonyWrapSafe] private static bool Pre_AddPage(MainMenuGuiLayer __instance, eCM_MenuPage pageEnum, string pageResourcePath, ref CM_PageBase __result) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Invalid comparison between Unknown and I4 //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected I4, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected I4, but got Unknown //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected I4, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if ((int)GameStateManager.Current.m_currentStateName == 1 || !pageResourcePath.Contains('/')) { return true; } if ((int)pageEnum == 17 && !McBased) { Logger.Info("Credits to McBreezy for CustomSuccessScreens"); McBased = true; } try { ((Il2CppArrayBase)(object)__instance.m_pages)[(int)pageEnum] = GOUtil.SpawnChildAndGetComp(AssetAPI.GetLoadedAsset(pageResourcePath), ((Component)((GuiLayer)__instance).GuiLayerBase).transform); ((Il2CppArrayBase)(object)__instance.m_pages)[(int)pageEnum].Setup(__instance); __result = ((Il2CppArrayBase)(object)__instance.m_pages)[(int)pageEnum]; __result.OnResolutionChange(__instance.m_currentScaledRes); } catch { bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(33, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("CustomSuccessScreen "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(pageResourcePath); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" not found!!!"); } Logger.Error(val); return true; } return false; } } [HarmonyPatch] internal static class Patch_OnExpeditionUpdated { [HarmonyPatch(typeof(MainMenuGuiLayer), "OnExpeditionUpdated")] [HarmonyPrefix] [HarmonyWrapSafe] private static void Pre_ExpeditionUpdated(ExpeditionInTierData expeditionInTierData, out string? __state) { if (WinScreen.VanillaPaths.Contains(expeditionInTierData.SpecialOverrideData.CustomSuccessScreen)) { __state = null; return; } __state = new string(expeditionInTierData.SpecialOverrideData.CustomSuccessScreen); expeditionInTierData.SpecialOverrideData.CustomSuccessScreen = null; } [HarmonyPatch(typeof(MainMenuGuiLayer), "OnExpeditionUpdated")] [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_ExpeditionUpdated(MainMenuGuiLayer __instance, string? __state) { if (!string.IsNullOrEmpty(__state) && __state.Contains('/')) { __instance.PageCustomExpeditionSuccess = __instance.AddPage((eCM_MenuPage)17, __state); Logger.Debug("Successfully loaded modded CustomSuccessScreen"); } } [HarmonyPatch(typeof(GameStateManager), "DoChangeState")] [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_DoChangeState(GameStateManager __instance, eGameStateName nextState) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 if ((int)nextState != 5) { return; } foreach (CM_PageExpeditionSuccess item in Object.FindObjectsOfType()) { ((CM_PageBase)item).SetPageActive(false); } } } [HarmonyPatch(typeof(CM_PageExpeditionSuccess), "Update")] internal static class Patch_SuccessPageExitButton { [HarmonyPrefix] private static void Pre_FixButtonText(CM_PageExpeditionSuccess __instance) { __instance.m_btnLeaveExpedition.SetText(SNet.IsMaster ? Text.Get(913u) : Text.Get(914u)); } } } namespace AWO.Modules.WEE.JsonInjects { internal class ArrayableFlatConditionConverter : Il2CppJsonReferenceTypeConverter { protected override WorldEventConditionPair Read(JToken jToken, WorldEventConditionPair existingValue, JsonSerializer serializer) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown JTokenType type = jToken.Type; JTokenType val = type; if ((int)val != 1) { if ((int)val == 2) { JArray val2 = ((Il2CppObjectBase)jToken).Cast(); if (((JContainer)val2).Count > 0) { return ReadToken(val2[0]); } return new WorldEventConditionPair(); } return new WorldEventConditionPair(); } return ReadToken(jToken); } private static WorldEventConditionPair ReadToken(JToken token) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown JObject val = ((Il2CppObjectBase)token).Cast(); WorldEventConditionPair val2 = new WorldEventConditionPair(); JToken val3 = default(JToken); if (val.TryGetValue("ConditionIndex", ref val3)) { val2.ConditionIndex = (int)val3; } JToken val4 = default(JToken); if (val.TryGetValue("IsTrue", ref val4)) { val2.IsTrue = (bool)val4; } return val2; } protected override void Write(JsonWriter writer, WorldEventConditionPair value, JsonSerializer serializer) { writer.WriteStartObject(); writer.WritePropertyName("ConditionIndex"); writer.WriteValue(value.ConditionIndex); writer.WritePropertyName("IsTrue"); writer.WriteValue(value.IsTrue); writer.WriteEndObject(); } } internal class ArrayableFlatEnumConverter : Il2CppJsonUnmanagedTypeConverter where T : unmanaged, Enum { private static readonly bool IsByte = Enum.GetUnderlyingType(typeof(T)) == typeof(byte); protected override T Read(JToken jToken, T existingValue, JsonSerializer serializer) { //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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 JTokenType type = jToken.Type; JTokenType val = type; if ((int)val != 2) { if ((int)val == 6 || (int)val == 8) { return ParseEnum(jToken); } return default(T); } JArray val2 = ((Il2CppObjectBase)jToken).Cast(); if (((JContainer)val2).Count > 0) { return ParseEnum(val2[0]); } return default(T); } protected override void Write(JsonWriter writer, T value, JsonSerializer serializer) { writer.WriteValue(Convert.ToInt32(value)); } protected override Object ToIl2CppObject(T value) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) if (IsByte) { Byte val = new Byte { m_value = Convert.ToByte(value) }; return ((Byte)(ref val)).BoxIl2CppObject(); } Int32 val2 = new Int32 { m_value = Convert.ToInt32(value) }; return ((Int32)(ref val2)).BoxIl2CppObject(); } private static T ParseEnum(JToken jToken) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 if ((int)jToken.Type == 6) { return (T)Enum.ToObject(typeof(T), IsByte ? ((byte)jToken) : ((int)jToken)); } if ((int)jToken.Type == 8 && Enum.TryParse((string)jToken, ignoreCase: true, out var result)) { return result; } return default(T); } } internal class EventDataHandler : Il2CppJsonReferenceTypeHandler { public override void OnRead(in Object result, in JToken jToken) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected I4, but got Unknown WardenObjectiveEventData val = ((Il2CppObjectBase)result).Cast(); if (Enum.IsDefined((WEE_Type)val.Type)) { WEE_EventData data = InjectLibJSON.Deserialize(((Object)jToken).ToString(), Array.Empty()); val.SetWEEData(data); } } } internal class TriggerDataHandler : Il2CppJsonReferenceTypeHandler { public override void OnRead(in Object result, in JToken jToken) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Expected I4, but got Unknown WardenObjectiveEventData val = ((Il2CppObjectBase)result).Cast(); if (Enum.IsDefined((WEE_Type)val.Type)) { WEE_EventData data = InjectLibJSON.Deserialize(((Object)jToken).ToString(), Array.Empty()); val.SetWEEData(data); } } } internal class EventTypeConverter : Il2CppJsonUnmanagedTypeConverter { protected override eWardenObjectiveEventType Read(JToken jToken, eWardenObjectiveEventType existingValue, JsonSerializer serializer) { //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_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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_004f: Expected I4, but got Unknown JTokenType type = jToken.Type; JTokenType val = type; int num; if ((int)val != 6) { if ((int)val != 8) { return (eWardenObjectiveEventType)0; } string value = (string)jToken; if (Enum.TryParse(value, ignoreCase: true, out var result)) { num = (int)result; } else { if (!Enum.TryParse(value, ignoreCase: true, out eWardenObjectiveEventType result2)) { return (eWardenObjectiveEventType)0; } num = (int)result2; } } else { num = (int)jToken; } return (eWardenObjectiveEventType)num; } protected override void Write(JsonWriter writer, eWardenObjectiveEventType value, JsonSerializer serializer) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected I4, but got Unknown writer.WriteValue((int)value); } protected override Object ToIl2CppObject(eWardenObjectiveEventType value) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected I4, but got Unknown Int32 val = new Int32 { m_value = (int)value }; return ((Int32)(ref val)).BoxIl2CppObject(); } } } namespace AWO.Modules.WEE.Events { internal abstract class BaseEvent { public string Name { get; private set; } = string.Empty; protected PlayerAgent LocalPlayer { get; private set; } = new PlayerAgent(); protected static bool IsMaster => SNet.IsMaster; protected static bool HasMaster => SNet.HasMaster; public static Random MasterRand { get; } = new Random(Guid.NewGuid().GetHashCode()); public abstract WEE_Type EventType { get; } public virtual bool AllowArrayableGlobalIndex => false; public void Setup() { Name = GetType().Name; OnSetup(); } public void Trigger(WEE_EventData e) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown if (!PlayerManager.HasLocalPlayerAgent()) { bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(48, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Doesn't have LocalPlayer while triggering "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", wtf?"); } Logger.Error(val); } else { LocalPlayer = PlayerManager.GetLocalPlayerAgent(); TriggerCommon(e); if (IsMaster) { TriggerMaster(e); } else { TriggerClient(e); } } } protected virtual void OnSetup() { } protected virtual void TriggerCommon(WEE_EventData e) { } protected virtual void TriggerClient(WEE_EventData e) { } protected virtual void TriggerMaster(WEE_EventData e) { } protected void LogInfo(string msg) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(3, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(msg); } Logger.Info(val); } protected void LogInfo(BepInExInfoLogInterpolatedStringHandler handler) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown if (((BepInExLogInterpolatedStringHandler)handler).Enabled) { bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(3, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(handler); } Logger.Info(val); } } protected void LogDebug(string msg) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown bool flag = default(bool); BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(3, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(msg); } Logger.Debug(val); } protected void LogDebug(BepInExDebugLogInterpolatedStringHandler handler) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown if (((BepInExLogInterpolatedStringHandler)handler).Enabled) { bool flag = default(bool); BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(3, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(handler); } Logger.Debug(val); } } protected void LogWarning(string msg) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(3, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(msg); } Logger.Warn(val); } protected void LogWarning(BepInExWarningLogInterpolatedStringHandler handler) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown if (((BepInExLogInterpolatedStringHandler)handler).Enabled) { bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(3, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(handler); } Logger.Warn(val); } } protected void LogError(string msg) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(3, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(msg); } Logger.Error(val); } protected void LogError(BepInExErrorLogInterpolatedStringHandler handler) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown if (((BepInExLogInterpolatedStringHandler)handler).Enabled) { bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(3, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("["); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(handler); } Logger.Error(val); } } public bool TryGetZone(WEE_EventData e, [NotNullWhen(true)] out LG_Zone? zone) { //IL_001d: 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_0053: 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_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) Logger.Verbose((LogLevel)32, $"Searching for ({e.DimensionIndex}, {e.Layer}, {e.LocalIndex}) in level..."); if (Builder.CurrentFloor.TryGetZoneByLocalIndex(e.DimensionIndex, e.Layer, e.LocalIndex, ref zone)) { return true; } LogError("Unable to find zone in level!"); return false; } public bool TryGetZoneEntranceSecDoor(WEE_EventData e, [NotNullWhen(true)] out LG_SecurityDoor? door) { if (TryGetZone(e, out LG_Zone zone)) { return TryGetZoneEntranceSecDoor(zone, out door); } door = null; return false; } public bool TryGetZoneEntranceSecDoor(LG_Zone zone, [NotNullWhen(true)] out LG_SecurityDoor? door) { LG_Gate sourceGate = zone.m_sourceGate; object obj; if (sourceGate == null) { obj = null; } else { iLG_Door_Core spawnedDoor = sourceGate.SpawnedDoor; obj = ((spawnedDoor != null) ? ((Il2CppObjectBase)spawnedDoor).TryCast() : null); } door = (LG_SecurityDoor?)obj; if ((Object)(object)door != (Object)null) { return true; } LogError("Unable to find entrance/source security door for zone!"); return false; } public bool TryGetTerminalFromZone(WEE_EventData e, int index, [NotNullWhen(true)] out LG_ComputerTerminal? terminal) { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) if (TryGetZone(e, out LG_Zone zone) && index >= 0 && index < zone.TerminalsSpawnedInZone.Count) { terminal = zone.TerminalsSpawnedInZone[index]; return (Object)(object)terminal != (Object)null; } bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(29, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unable to find terminal "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(index); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" in "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(e.LocalIndex); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("!"); } LogError(val); terminal = null; return false; } public bool IsValidAreaIndex(int areaIndex, LG_Zone zone) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown List areas = zone.m_areas; if (areaIndex < 0 || areaIndex >= areas.Count) { bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(30, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Invalid area index ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(areaIndex); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") for zone"); } LogError(val); return false; } return true; } public S ResolveFieldsFallback(S value, S nested, bool debug = true) where S : struct { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown if (!EqualityComparer.Default.Equals(nested, default(S))) { return nested; } if (!EqualityComparer.Default.Equals(value, default(S))) { return value; } if (debug) { bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(42, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Both legacy-nested and field "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted("value"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" are default "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(typeof(S)); } LogWarning(val); } return default(S); } public string ResolveFieldsFallback(string value, string nested, bool debug = true) { if (!string.IsNullOrEmpty(nested)) { return nested; } if (!string.IsNullOrEmpty(value)) { return value; } if (debug) { LogWarning("Both legacy-nested and field value are null or empty strings"); } return string.Empty; } public Vector3 GetPositionFallback(Vector3 position, string weObjectFilter, bool debug = true) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown if (position != Vector3.zero) { return position; } LG_WorldEventObject val = default(LG_WorldEventObject); if (WorldEventUtils.TryGetRandomWorldEventObjectFromFilter(weObjectFilter, (uint)Builder.SessionSeedRandom.Seed, ref val) && ((Behaviour)val).enabled) { return ((Component)val).transform.position; } if (debug) { bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(67, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Position is zero, or could not find enabled WorldEventObjectFilter "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(weObjectFilter); } LogWarning(val2); } return Vector3.zero; } public static void ExecuteWardenEvents(List events, eWardenObjectiveEventTrigger trigger = (eWardenObjectiveEventTrigger)0, bool ignoreTrigger = true) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(ListExtensions.ToIl2Cpp(events), trigger, ignoreTrigger, 0f, (Il2CppStructArray)null); } } internal sealed class AddChainPuzzleToSecurityDoor : BaseEvent { public override WEE_Type EventType => WEE_Type.AddChainPuzzleToSecurityDoor; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerCommon(WEE_EventData e) { //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected I4, but got Unknown //IL_01b5: 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_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Invalid comparison between Unknown and I4 //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Expected O, but got Unknown //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Invalid comparison between Unknown and I4 //IL_02d0: Unknown result type (might be due to invalid IL or missing references) //IL_02d7: Expected O, but got Unknown //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Expected I4, but got Unknown //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) if (!TryGetZoneEntranceSecDoor(e, out LG_SecurityDoor door)) { return; } uint num = ((e.SpecialNumber > 0) ? ((uint)e.SpecialNumber) : e.ChainPuzzle); ChainedPuzzleDataBlock val = default(ChainedPuzzleDataBlock); bool flag = default(bool); if (!DataBlockUtil.TryGetBlock(num, ref val)) { BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(47, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to find enabled ChainedPuzzleDataBlock "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("!"); } LogError(val2); return; } pDoorState currentSyncState = door.m_sync.GetCurrentSyncState(); Vector3 val3 = default(Vector3); if (!door.GetChainedPuzzleStartPosition(ref val3)) { return; } eDoorStatus status = currentSyncState.status; eDoorStatus val4 = status; switch (val4 - 1) { case 9: case 15: LogError("Door is already open!"); break; case 7: LogError("Door already has an active chained puzzle!"); break; case 0: case 2: case 3: case 4: case 5: case 6: case 8: case 14: { if ((Object)(object)door.m_locks.ChainedPuzzleToSolve != (Object)null && !door.m_locks.ChainedPuzzleToSolve.IsSolved) { BepInExWarningLogInterpolatedStringHandler val5 = new BepInExWarningLogInterpolatedStringHandler(51, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("Door has an unsolved chained puzzle "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted(((GameDataBlockBase)(object)door.m_locks.ChainedPuzzleToSolve.Data).persistentID); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(", overriding..."); } LogWarning(val5); } ChainedPuzzleInstance val6 = ChainedPuzzleManager.CreatePuzzleInstance(val, door.Gate.ProgressionSourceArea, ((LG_ZoneExpander)door.Gate).m_linksTo, val3, ((Component)door).transform, false); currentSyncState.status = door.m_locks.SetupForChainedPuzzle(val6); door.m_sync.SetStateUnsynced(currentSyncState); if ((int)currentSyncState.status == 1 || (int)currentSyncState.status == 9) { if (val.TriggerAlarmOnActivate) { door.m_graphics.OnDoorState(new pDoorState { status = (eDoorStatus)4 }, false); door.m_mapLookatRevealer.SetLocalGUIObjStatus((eCM_GuiObjectStatus)9); } else { door.m_graphics.OnDoorState(new pDoorState { status = (eDoorStatus)5 }, false); } } LG_SecurityDoor_Anim val7 = ((Il2CppObjectBase)door.m_anim).TryCast(); LG_SecurityDoor_Anim val8 = val7; if (val8 != null) { Animator animator = val8.m_animator; eSecurityDoorType securityDoorType = door.m_securityDoorType; animator.Play((int)securityDoorType switch { 0 => "ClosedIdle", 1 => "ApexDoorClosed_Idle", 2 => "ClosedIdle", _ => string.Empty, }); } BepInExDebugLogInterpolatedStringHandler val9 = new BepInExDebugLogInterpolatedStringHandler(37, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val9).AppendLiteral("Door has recieved new chained puzzle "); ((BepInExLogInterpolatedStringHandler)val9).AppendFormatted(num); } LogDebug(val9); break; } default: LogError("Door is in an unsupported state!"); break; } } } internal sealed class CloseSecurityDoorEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.CloseSecurityDoor; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerMaster(WEE_EventData e) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Invalid comparison between Unknown and I4 //IL_0083: 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) if (!TryGetZoneEntranceSecDoor(e, out LG_SecurityDoor door)) { return; } pDoorState currentSyncState = door.m_sync.GetCurrentSyncState(); if ((int)currentSyncState.status != 10 && (int)currentSyncState.status != 16) { LogError("Door is already closed!"); return; } LG_Door_Sync val = ((Il2CppObjectBase)door.m_sync).TryCast(); if (!((Object)(object)val == (Object)null)) { LogDebug("Door closing..."); currentSyncState.status = (eDoorStatus)1; currentSyncState.hasBeenOpenedDuringGame = false; val.m_stateReplicator.State = currentSyncState; LG_Gate gate = door.Gate; gate.HasBeenOpenedDuringPlay = false; gate.IsTraversable = false; if (e.CleanUpEnemiesBehind) { int nodeDistanceToPlayer = ((LG_ZoneExpander)gate).m_linksFrom.m_courseNode.m_playerCoverage.GetNodeDistanceToPlayer(); int nodeDistanceToPlayer2 = ((LG_ZoneExpander)gate).m_linksTo.m_courseNode.m_playerCoverage.GetNodeDistanceToPlayer(); AIG_CourseNode sourceNode = ((nodeDistanceToPlayer < nodeDistanceToPlayer2) ? ((LG_ZoneExpander)gate).m_linksTo.m_courseNode : ((LG_ZoneExpander)gate).m_linksFrom.m_courseNode); LogDebug("Despawning enemies behind security door..."); AIG_SearchID.IncrementSearchID(); DespawnEnemiesInNearNodes(AIG_SearchID.SearchID, sourceNode); } } } private static void DespawnEnemiesInNearNodes(ushort searchID, AIG_CourseNode sourceNode) { if (((sourceNode != null) ? sourceNode.m_portals : null) == null) { return; } foreach (EnemyAgent item in sourceNode.m_enemiesInNode.ToArray()) { ((Agent)item).m_replicator.Despawn(); } Enumerator enumerator2 = sourceNode.m_portals.GetEnumerator(); while (enumerator2.MoveNext()) { AIG_CoursePortal current2 = enumerator2.Current; if (current2 == null || ((AIG_CourseGraphMember)current2).m_searchID == searchID) { continue; } ((AIG_CourseGraphMember)current2).m_searchID = searchID; if (!current2.IsProgressionLocked) { AIG_CourseNode oppositeNode = current2.GetOppositeNode(sourceNode); if (oppositeNode != null) { DespawnEnemiesInNearNodes(searchID, oppositeNode); } } } } } internal sealed class DoInteractWeakDoorsEvent : BaseEvent { public static readonly Dictionary> WeakDoors = new Dictionary>(); public override WEE_Type EventType => WEE_Type.DoInteractWeakDoorsInZone; public override bool AllowArrayableGlobalIndex => true; protected override void OnSetup() { LevelAPI.OnLevelCleanup += OnLevelCleanup; } private void OnLevelCleanup() { WeakDoors.Clear(); } protected override void TriggerMaster(WEE_EventData e) { //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) if (TryGetZone(e, out LG_Zone zone) && WeakDoors.TryGetValue(zone.ID, out HashSet value)) { foreach (LG_WeakDoor item in value) { item.m_sync.AttemptDoorInteraction((eDoorInteractionType)((!e.Enabled) ? 6 : 0), 0f, 0f, default(Vector3), (Agent)null); } return; } LogError("Zone may have no WeakDoors?"); } } internal sealed class LockSecurityDoorEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.LockSecurityDoor; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerCommon(WEE_EventData e) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) if (TryGetZoneEntranceSecDoor(e, out LG_SecurityDoor door)) { pDoorState currentSyncState = door.m_sync.GetCurrentSyncState(); if (BaseEvent.IsMaster) { LockSecDoor(door, currentSyncState); } LG_SecurityDoor_Locks val = ((Il2CppObjectBase)door.m_locks).TryCast(); if (!((Object)(object)val == (Object)null)) { val.m_intCustomMessage.m_message = SerialLookupManager.ParseTextFragments(LocaleText.op_Implicit(e.SpecialText)); } } } private void LockSecDoor(LG_SecurityDoor door, pDoorState state) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Invalid comparison between Unknown and I4 //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) if ((int)state.status == 10 || (int)state.status == 16) { LogError("Door is open!"); return; } if ((int)state.status == 3) { bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(85, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Door is "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(state.status); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", so there won't be any way to use the keycard if this door is unlocked again"); } LogWarning(val); } LG_Door_Sync val2 = ((Il2CppObjectBase)door.m_sync).TryCast(); if (!((Object)(object)val2 == (Object)null)) { state.status = (eDoorStatus)7; val2.m_stateReplicator.State = state; } } } internal sealed class ResetOnApproachDoorEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.ResetOnApproachDoor; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerMaster(WEE_EventData e) { //IL_001b: 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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) if (TryGetZoneEntranceSecDoor(e, out LG_SecurityDoor door)) { pDoorState currentSyncState = door.m_sync.GetCurrentSyncState(); currentSyncState.hasBeenApproached = false; LG_Door_Sync val = ((Il2CppObjectBase)door.m_sync).TryCast(); if (!((Object)(object)val == (Object)null)) { val.m_stateReplicator.State = currentSyncState; pDoorState lastState = door.m_lastState; lastState.hasBeenApproached = false; door.m_lastState = lastState; } } } } internal sealed class SetActiveEnemyWaveEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.SetActiveEnemyWave; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerCommon(WEE_EventData e) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Invalid comparison between Unknown and I4 //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Invalid comparison between Unknown and I4 //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Expected O, but got Unknown if (!TryGetZoneEntranceSecDoor(e, out LG_SecurityDoor door)) { return; } ActiveEnemyWaveData val = (ActiveEnemyWaveData)(((object)e.ActiveEnemyWave) ?? ((object)new ActiveEnemyWaveData())); pDoorState currentSyncState = door.m_sync.GetCurrentSyncState(); eDoorStatus status = currentSyncState.status; eDoorStatus val2 = status; if ((int)val2 == 10 || (int)val2 == 16) { LogError("Door is already open!"); return; } ActiveEnemyWaveData activeEnemyWaveData = door.ActiveEnemyWaveData; if (activeEnemyWaveData != null && activeEnemyWaveData.HasActiveEnemyWave) { door.m_sound.Post(EVENTS.MONSTER_RUCKUS_FROM_BEHIND_SECURITY_DOOR_LOOP_STOP, true); } door.SetupActiveEnemyWaveData(val); if (!val.HasActiveEnemyWave) { door.m_graphics.SetActiveEnemyWaveEnabled(false); door.m_locks.SetActiveEnemyWaveEnabled(false); door.m_anim.SetActiveEnemyWaveEnabled(false); } bool flag = default(bool); BepInExDebugLogInterpolatedStringHandler val3 = new BepInExDebugLogInterpolatedStringHandler(56, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Set enemy wave - Active: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val.HasActiveEnemyWave); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", GroupInFront: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val.EnemyGroupInfrontOfDoor); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", GroupInArea: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(val.EnemyGroupInArea); } LogDebug(val3); } } internal sealed class SetDoorInteractionEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.SetDoorInteraction; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerCommon(WEE_EventData e) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0040: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected I4, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) if (!TryGetZoneEntranceSecDoor(e, out LG_SecurityDoor door)) { return; } LG_SecurityDoor_Locks val = ((Il2CppObjectBase)door.m_locks).TryCast(); if (!((Object)(object)val == (Object)null)) { pDoorState currentSyncState = door.m_sync.GetCurrentSyncState(); eDoorStatus status = currentSyncState.status; eDoorStatus val2 = status; switch (val2 - 1) { case 9: case 15: LogError("Door is already open!"); break; case 5: case 6: case 14: val.m_intCustomMessage.m_message = SerialLookupManager.ParseTextFragments(LocaleText.op_Implicit(e.SpecialText)); break; case 2: val.m_intUseKeyItem.m_msgNeedItemHeader = SerialLookupManager.ParseTextFragments(LocaleText.op_Implicit(e.SpecialText)); break; case 0: case 3: case 4: case 8: val.m_intOpenDoor.InteractionMessage = SerialLookupManager.ParseTextFragments(LocaleText.op_Implicit(e.SpecialText)); break; default: LogError("Door is in an unsupported state!"); break; } } } } internal class SolveSecurityDoorAlarmEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.SolveSecurityDoorAlarm; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerCommon(WEE_EventData e) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009d: 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) if (!TryGetZoneEntranceSecDoor(e, out LG_SecurityDoor door)) { return; } pDoorState currentSyncState = door.m_sync.GetCurrentSyncState(); if ((int)currentSyncState.status == 5 || (int)currentSyncState.status == 4) { pChainedPuzzleState state = door.m_locks.ChainedPuzzleToSolve.m_stateReplicator.State; state.status = (eChainedPuzzleStatus)2; state.isSolved = true; state.isActive = false; if (BaseEvent.IsMaster) { door.m_locks.ChainedPuzzleToSolve.m_stateReplicator.State = state; } currentSyncState.status = (eDoorStatus)9; door.m_sync.SetStateUnsynced(currentSyncState); } } } internal sealed class ToggleInteractWeakDoorsEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.ToggleInteractWeakDoorsInZone; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerCommon(WEE_EventData e) { //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Invalid comparison between Unknown and I4 if (TryGetZone(e, out LG_Zone zone) && DoInteractWeakDoorsEvent.WeakDoors.TryGetValue(zone.ID, out HashSet value)) { foreach (LG_WeakDoor item in value) { item.m_inButtonOperation = !e.Enabled; foreach (LG_DoorButton item2 in ((IEnumerable)item.m_buttons).Where((LG_DoorButton button) => (Object)(object)button != (Object)null)) { ((Component)item2.m_anim).gameObject.SetActive(e.Enabled); item2.m_enabled = e.Enabled; if (e.Enabled) { LG_WeakLock componentInChildren = ((Component)item2).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null && (int)componentInChildren.Status != 3) { item2.m_enabled = false; } } } } return; } LogError("Zone may have no WeakDoors?"); } } internal sealed class TriggerSecurityDoorAlarmEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.TriggerSecurityDoorAlarm; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerMaster(WEE_EventData e) { //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) if (TryGetZoneEntranceSecDoor(e, out LG_SecurityDoor door)) { ChainedPuzzleInstance chainedPuzzleToSolve = door.m_locks.ChainedPuzzleToSolve; if ((Object)(object)chainedPuzzleToSolve == (Object)null) { LogError("Door does not have any chained puzzles to activate!"); } else if (!chainedPuzzleToSolve.IsSolved) { door.m_sync.AttemptDoorInteraction((eDoorInteractionType)4, 0f, 0f, default(Vector3), (Agent)null); } else { LogWarning("Door's chained puzzles are already solved"); } } } } internal sealed class AlertEnemiesInZoneEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.AlertEnemiesInZone; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerMaster(WEE_EventData e) { if (!TryGetZone(e, out LG_Zone zone)) { return; } if (e.SpecialNumber == -1) { Enumerator enumerator = zone.m_courseNodes.GetEnumerator(); while (enumerator.MoveNext()) { AIG_CourseNode current = enumerator.Current; DoAlert(current); } } else if (IsValidAreaIndex(e.SpecialNumber, zone)) { DoAlert(zone.m_areas[e.SpecialNumber].m_courseNode); } } private static void DoAlert(AIG_CourseNode node) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_0075: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) if (node.m_enemiesInNode == null || node.listenersInNode == null) { Logger.Error("AlertEnemiesInZoneEvent", "Null enemies or listeners in node!"); return; } NoiseManager.MakeNoise(new NM_NoiseData { noiseMaker = null, node = node, position = node.GetRandomPositionInside(), radiusMin = 0f, radiusMax = 64f, yScale = 1f, type = (NM_NoiseType)0, includeToNeightbourAreas = false, raycastFirstNode = false }); if (TryGetClosestAlivePlayerByNodeDist(node, out PlayerAgent player)) { Enumerator enumerator = node.m_enemiesInNode.GetEnumerator(); while (enumerator.MoveNext()) { EnemyAgent current = enumerator.Current; AgentMode val = (AgentMode)1; current.AI.SetStartMode(val); ((AgentAI)current.AI).ModeChange(); ((AgentAI)current.AI).m_mode = val; ((AgentAI)current.AI).SetDetectedAgent((Agent)(object)player, (AgentTargetDetectionType)4); } } else { Logger.Warn("AlertEnemiesInZoneEvent", "Failed to find closest alive player target!"); } } public static bool TryGetClosestAlivePlayerByNodeDist(AIG_CourseNode node, [NotNullWhen(true)] out PlayerAgent? player) { PlayerAgent val = null; PlayerAgent val2 = null; int num = int.MaxValue; int num2 = int.MaxValue; Il2CppReferenceArray coverageDatas = node.m_playerCoverage.m_coverageDatas; int num3 = Math.Min(PlayerManager.PlayerAgentsInLevel.Count, ((Il2CppArrayBase)(object)coverageDatas).Length); for (int i = 0; i < num3; i++) { PlayerAgent val3 = PlayerManager.PlayerAgentsInLevel[i]; PlayerCoverageData val4 = ((Il2CppArrayBase)(object)coverageDatas)[i]; if ((Object)(object)val3 == (Object)null || !((Agent)val3).Alive || val4 == null || !val4.IsValidNodeDistance) { continue; } int nodeDistance = val4.m_nodeDistance; if (val3.Owner.IsBot) { if (nodeDistance < num2) { num2 = nodeDistance; val2 = val3; } } else if (nodeDistance < num) { num = nodeDistance; val = val3; } } player = ((num <= num2) ? val : val2); DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(45, 2); defaultInterpolatedStringHandler.AppendLiteral("Closest alive player to node "); defaultInterpolatedStringHandler.AppendFormatted(node.m_zone.m_courseNodes.IndexOf(node)); defaultInterpolatedStringHandler.AppendLiteral(" by node dist: "); PlayerAgent? obj = player; defaultInterpolatedStringHandler.AppendFormatted(((obj != null) ? obj.PlayerName : null) ?? "null"); defaultInterpolatedStringHandler.AppendLiteral(")"); Logger.Verbose((LogLevel)32, defaultInterpolatedStringHandler.ToStringAndClear()); return (Object)(object)player != (Object)null; } } internal class CleanupEnemiesInZoneEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.CleanupEnemiesInZone; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerMaster(WEE_EventData e) { if (!TryGetZone(e, out LG_Zone zone)) { return; } foreach (WEE_CleanupEnemiesData value in e.CleanupEnemies.Values) { if (value.AreaIndex == -1) { Enumerator enumerator2 = zone.m_courseNodes.GetEnumerator(); while (enumerator2.MoveNext()) { AIG_CourseNode current2 = enumerator2.Current; if (!value.AreaBlacklist.Contains(zone.m_courseNodes.IndexOf(current2))) { value.DoClear(current2); } } } else if (IsValidAreaIndex(value.AreaIndex, zone)) { value.DoClear(zone.m_areas[value.AreaIndex].m_courseNode); } } } } internal class SpawnHibernateInZoneEvent : BaseEvent { private const float TimeToCompleteSpawn = 2f; public override WEE_Type EventType => WEE_Type.SpawnHibernateInZone; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerMaster(WEE_EventData e) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00da: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) if (!TryGetZone(e, out LG_Zone zone)) { return; } foreach (WEE_SpawnHibernateData value in e.SpawnHibernates.Values) { if (value.AreaIndex == -1 || IsValidAreaIndex(value.AreaIndex, zone)) { Vector3 positionFallback = GetPositionFallback(base.ResolveFieldsFallback(e.Position, value.Position, debug: false), LocaleText.op_Implicit(e.SpecialText), debug: false); int num = ResolveFieldsFallback(e.Count, value.Count); if (num == 1 && positionFallback != Vector3.zero) { AIG_CourseNode val = ((value.AreaIndex == -1) ? CourseNodeUtil.GetCourseNode(positionFallback) : zone.m_areas[value.AreaIndex].m_courseNode); EnemyAllocator.Current.SpawnEnemy(value.EnemyID, val, (AgentMode)4, positionFallback, Quaternion.Euler(value.Rotation), (EnemyGroup)null, -1); } else { CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoSpawn(value, zone, num, e.Enabled)), (Action)null); } } } } private static IEnumerator DoSpawn(WEE_SpawnHibernateData sh, LG_Zone zone, int count, bool enabled) { float interval = Math.Min(0.25f, 2f / (float)count); WaitForSeconds spawnInterval = new WaitForSeconds(interval); List areas = zone.m_areas; List validAreas = Enumerable.Range(0, areas.Count).Except(sh.AreaBlacklist).ToList(); if (validAreas.Count == 0) { Logger.Error("SpawnHibernateInZoneEvent", $"No valid areas to spawn hibernate! Area count: {areas.Count}, Blacklist: [{string.Join(", ", sh.AreaBlacklist)}]"); yield break; } for (int spawnCount = 0; spawnCount < count; spawnCount++) { int attempts = 0; AIG_CourseNode spawnNode; if (sh.AreaIndex != -1) { spawnNode = areas[sh.AreaIndex].m_courseNode; } else { int randArea = validAreas[BaseEvent.MasterRand.Next(validAreas.Count)]; spawnNode = areas[randArea].m_courseNode; } bool isValidPos; Vector3 pos; int num2; do { isValidPos = true; pos = spawnNode.GetRandomPositionInside(); Enumerator enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent player = enumerator.Current; if (!player.Owner.IsBot && GameObjectPlusExtensions.IsWithinSqrDistance(((Agent)player).Position, pos, 12.25f)) { isValidPos = false; Logger.Verbose((LogLevel)32, "A spawn position rerolled due to nearby player"); break; } } if (isValidPos) { Enumerator enumerator2 = spawnNode.m_enemiesInNode.GetEnumerator(); while (enumerator2.MoveNext()) { EnemyAgent enemy = enumerator2.Current; if (GameObjectPlusExtensions.IsWithinSqrDistance(enemy.Position, pos, 5.29f)) { isValidPos = false; Logger.Verbose((LogLevel)32, "A spawn position rerolled due to nearby enemy"); break; } } } if (!isValidPos) { int num = attempts + 1; attempts = num; num2 = ((num < 5) ? 1 : 0); } else { num2 = 0; } } while (num2 != 0); if (!isValidPos && !enabled) { Logger.Verbose((LogLevel)4, "An enemy failed to spawn after maximum reroll attempts reached"); continue; } Quaternion rotation = Quaternion.Euler(0f, BaseEvent.MasterRand.NextRange(0f, 360f), 0f); EnemyAllocator.Current.SpawnEnemy(sh.EnemyID, spawnNode, (AgentMode)4, pos, rotation, (EnemyGroup)null, -1); yield return spawnInterval; } } } internal class SpawnScoutInZoneEvent : BaseEvent { private const float TimeToCompleteSpawn = 2f; public override WEE_Type EventType => WEE_Type.SpawnScoutInZone; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerMaster(WEE_EventData e) { //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) if (!TryGetZone(e, out LG_Zone zone)) { return; } foreach (WEE_SpawnScoutData value in e.SpawnScouts.Values) { if (value.AreaIndex == -1 || IsValidAreaIndex(value.AreaIndex, zone)) { Vector3 positionFallback = GetPositionFallback(e.Position, LocaleText.op_Implicit(e.SpecialText), debug: false); int count = ResolveFieldsFallback(e.Count, value.Count); CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoSpawn(value, zone, positionFallback, count)), (Action)null); } } } private static IEnumerator DoSpawn(WEE_SpawnScoutData ss, LG_Zone zone, Vector3 pos, int count) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) float interval = Math.Min(0.25f, 2f / (float)count); WaitForSeconds spawnInterval = new WaitForSeconds(interval); List areas = zone.m_areas; List validAreas = Enumerable.Range(0, areas.Count).Except(ss.AreaBlacklist).ToList(); if (validAreas.Count == 0) { Logger.Error("SpawnScoutInZoneEvent", $"No valid areas to spawn scout! Area count: {areas.Count}, Blacklist: [{string.Join(", ", ss.AreaBlacklist)}]"); yield break; } EnemyGroupRandomizer r = default(EnemyGroupRandomizer); for (int spawnCount = 0; spawnCount < count; spawnCount++) { if (!EnemySpawnManager.TryCreateEnemyGroupRandomizer(ss.GroupType, ss.Difficulty, ref r)) { Logger.Error("SpawnScoutInZoneEvent", $"Invalid EnemyGroup: (GroupType: {ss.GroupType}, Difficulty: {ss.Difficulty})"); break; } EnemyGroupDataBlock randomGroup = r.GetRandomGroup(BaseEvent.MasterRand.NextFloat()); float popPoints = randomGroup.MaxScore * BaseEvent.MasterRand.NextRange(1f, 1.2f); AIG_CourseNode spawnNode; if (ss.AreaIndex != -1) { spawnNode = areas[ss.AreaIndex].m_courseNode; } else { int randArea = validAreas[BaseEvent.MasterRand.Next(validAreas.Count)]; spawnNode = areas[randArea].m_courseNode; } pEnemyGroupSpawnData spawnData = EnemyGroup.GetSpawnData((pos == Vector3.zero) ? spawnNode.GetRandomPositionInside() : pos, spawnNode, (EnemyGroupType)0, (eEnemyGroupSpawnType)0, ((GameDataBlockBase)(object)randomGroup).persistentID, popPoints, (IReplicator)null, (SurvivalWave)null, 0u, (AgentMode)4); spawnData.respawn = false; pEnemyGroupSpawnData scoutSpawnData = spawnData; EnemyGroup.Spawn(scoutSpawnData); yield return spawnInterval; r = null; } } } internal sealed class AdjustAWOTimerEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.AdjustAWOTimer; protected override void TriggerCommon(WEE_EventData e) { //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) EntryPoint.TimerMods.TimeModifier = ResolveFieldsFallback(e.Duration, e.AdjustTimer.Duration, debug: false); if (e.AdjustTimer.Speed != 0f) { EntryPoint.TimerMods.SpeedModifier = e.AdjustTimer.Speed; } if (e.AdjustTimer.UpdateTitleText) { EntryPoint.TimerMods.TimerTitleText = SerialLookupManager.ParseLocaleText(e.AdjustTimer.TitleText); } if (e.AdjustTimer.UpdateText) { EntryPoint.TimerMods.TimerBodyText = SerialLookupManager.ParseLocaleText(e.AdjustTimer.CustomText); } if ((e.AdjustTimer.UpdateText && e.AdjustTimer.CustomText != LocaleText.Empty) || e.AdjustTimer.UpdateColor) { EntryPoint.TimerMods.TimerColor = e.AdjustTimer.TimerColor; } if (e.AdjustTimer.UpdateSpecialHud && SpecialHudTimerEvent.SpecialHuds.TryGetValue(e.AdjustTimer.SpecialHudIndex, out SpecialHudTimerEvent.SpecialHudItem value)) { value.TimeModifier = e.AdjustTimer.SpecialHudTimeModifier; } } } internal sealed class ClearWardenIntelQueueEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.ClearWardenIntelQueue; public static bool AllowWardenIntel { get; private set; } = true; protected override void OnSetup() { LevelAPI.OnLevelCleanup += delegate { AllowWardenIntel = true; }; } protected override void TriggerCommon(WEE_EventData e) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) GuiManager.PlayerLayer.m_wardenIntel.ResetSubObjectiveMesssagQueue(); AllowWardenIntel = e.Enabled; if (e.WardenIntel != LocaleText.Empty && e.SpecialBool) { ShowSubObjectiveMessage(e.Layer, e.WardenIntel); } } internal static void ShowSubObjectiveMessage(LG_LayerType layer, LocaleText newSubObj) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) string text = WardenObjectiveManager.ReplaceFragmentsInString(layer, WardenObjectiveManager.GetCurrentChainIndex(layer), LocaleText.op_Implicit(newSubObj), true); PUI_WardenIntel wardenIntel = GuiManager.PlayerLayer.m_wardenIntel; wardenIntel.m_subObjectiveMessageQueue.AddLast(wardenIntel.NewObjectiveSequence("", text, false, 200f, 8f, (Action)null)); } } internal sealed class CountdownEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.Countdown; private static PUI_ObjectiveTimer ObjHudTimer => GuiManager.PlayerLayer.m_objectiveTimer; protected override void TriggerCommon(WEE_EventData e) { float num = ResolveFieldsFallback(e.Duration, e.Countdown?.Duration ?? 0f); if (num <= 0f) { LogWarning("Duration should generally be more than 0 seconds"); } EntryPoint.Coroutines.CountdownStarted = Time.realtimeSinceStartup; CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoCountdown(e.Countdown ?? new WEE_CountdownData(), num)), (Action)null); } private static IEnumerator DoCountdown(WEE_CountdownData cd, float duration) { int reloadCount = CheckpointManager.CheckpointUsage; float startTime = EntryPoint.Coroutines.CountdownStarted; float time = 0f; LocaleText timerTitle = SerialLookupManager.ParseLocaleText(cd.TimerText); Color color = cd.TimerColor; EntryPoint.TimerMods.TimeModifier = 0f; EntryPoint.TimerMods.TimerTitleText = timerTitle; EntryPoint.TimerMods.TimerColor = color; Queue cachedProgressEvents = new Queue(cd.EventsOnProgress.OrderBy((EventsOnTimerProgress prEv) => prEv.Progress)); bool hasProgressEvents = cachedProgressEvents.Count > 0; float nextProgress = (hasProgressEvents ? cachedProgressEvents.Peek().Progress : float.NaN); ObjHudTimer.SetTimerActive(true, true); ObjHudTimer.UpdateTimerTitle(LocaleText.op_Implicit(timerTitle)); UpdateTimerText(time, duration, color, cd.CanShowHours); while (time <= duration) { if (startTime < EntryPoint.Coroutines.CountdownStarted) { yield break; } if ((int)GameStateManager.CurrentStateName != 10 || reloadCount < CheckpointManager.CheckpointUsage) { ObjHudTimer.SetTimerActive(false, false); yield break; } if (hasProgressEvents && nextProgress <= NormalizedPercent(time, 0f, duration)) { BaseEvent.ExecuteWardenEvents(cachedProgressEvents.Dequeue().Events, (eWardenObjectiveEventTrigger)0); bool flag; hasProgressEvents = (flag = cachedProgressEvents.Count > 0); if (flag) { nextProgress = cachedProgressEvents.Peek().Progress; } } UpdateTimerText(time, duration, color, cd.CanShowHours); time += Time.deltaTime; if (EntryPoint.TimerMods.TimeModifier != 0f) { time -= EntryPoint.TimerMods.TimeModifier; EntryPoint.TimerMods.TimeModifier = 0f; } if (EntryPoint.TimerMods.TimerTitleText != timerTitle) { timerTitle = EntryPoint.TimerMods.TimerTitleText; ((TMP_Text)GuiManager.PlayerLayer.m_objectiveTimer.m_timerText).text = LocaleText.op_Implicit(timerTitle); } if (EntryPoint.TimerMods.TimerColor != color) { color = EntryPoint.TimerMods.TimerColor; } yield return null; } while (cachedProgressEvents.Count > 0) { BaseEvent.ExecuteWardenEvents(cachedProgressEvents.Dequeue().Events, (eWardenObjectiveEventTrigger)0); } BaseEvent.ExecuteWardenEvents(cd.EventsOnDone, (eWardenObjectiveEventTrigger)0); if ((int)GameStateManager.CurrentStateName == 10 && !(startTime < EntryPoint.Coroutines.CountdownStarted)) { ObjHudTimer.SetTimerActive(false, true); } } public static void UpdateTimerText(float time, float duration, Color color, bool showHours) { //IL_002d: Unknown result type (might be due to invalid IL or missing references) ObjHudTimer.SetTimerTextEnabled(true); float num = Math.Max(duration - time, 0f); TimeSpan timeSpan = TimeSpan.FromSeconds(num); ((Graphic)ObjHudTimer.m_timerText).color = color; ((TMP_Text)ObjHudTimer.m_timerText).text = ((showHours && timeSpan.TotalSeconds >= 3600.0) ? $"{(int)timeSpan.TotalHours:D1}:{timeSpan.Minutes:D2}:{timeSpan.Seconds:D2}" : $"{(int)timeSpan.TotalMinutes:D2}:{timeSpan.Seconds:D2}"); } public static float NormalizedPercent(float current, float min, float max) { if (min == max) { return float.NaN; } float num = Math.Clamp(current, min, max); return (num - min) / (max - min); } } internal sealed class CountupEvent : BaseEvent { private const string Tag = "[COUNTUP]"; private const string Max = "[CMAX]"; public override WEE_Type EventType => WEE_Type.Countup; private static PUI_ObjectiveTimer ObjHudTimer => GuiManager.PlayerLayer.m_objectiveTimer; protected override void TriggerCommon(WEE_EventData e) { float num = ResolveFieldsFallback(e.Duration, e.Countup?.Duration ?? 0f); if (num <= 0f) { LogWarning("Duration should generally be more than 0 seconds"); } EntryPoint.Coroutines.CountdownStarted = Time.realtimeSinceStartup; CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoCountup(e.Countup ?? new WEE_CountupData(), num)), (Action)null); } private static IEnumerator DoCountup(WEE_CountupData cu, float duration) { int reloadCount = CheckpointManager.CheckpointUsage; float startTime = EntryPoint.Coroutines.CountdownStarted; float count = cu.StartValue; float speed = cu.Speed; LocaleText titleText = SerialLookupManager.ParseLocaleText(cu.TimerText); LocaleText customText = SerialLookupManager.ParseLocaleText(cu.CustomText); string[] body = ParseCustomText(LocaleText.op_Implicit(customText), duration); Color color = cu.TimerColor; string htmlColor = ColorUtility.ToHtmlStringRGB(color); EntryPoint.TimerMods.TimeModifier = 0f; EntryPoint.TimerMods.SpeedModifier = speed; EntryPoint.TimerMods.TimerTitleText = titleText; EntryPoint.TimerMods.TimerBodyText = customText; EntryPoint.TimerMods.TimerColor = color; Queue cachedProgressEvents = new Queue(cu.EventsOnProgress.OrderBy((EventsOnTimerProgress prEv) => prEv.Progress)); bool hasProgressEvents = cachedProgressEvents.Count > 0; float nextProgress = (hasProgressEvents ? cachedProgressEvents.Peek().Progress : float.NaN); ObjHudTimer.SetTimerActive(true, true); ObjHudTimer.UpdateTimerTitle(LocaleText.op_Implicit(titleText)); ((TMP_Text)ObjHudTimer.m_timerText).text = $"{body[0]}{count.ToString($"F{cu.DecimalPoints}")}{body[1]}"; yield return (object)new WaitForSeconds(0.25f); while (count <= duration) { if (startTime < EntryPoint.Coroutines.CountdownStarted) { yield break; } if ((int)GameStateManager.CurrentStateName != 10 || reloadCount < CheckpointManager.CheckpointUsage) { ObjHudTimer.SetTimerActive(false, false); yield break; } if (hasProgressEvents && nextProgress <= NormalizedPercent(count, cu.StartValue, duration)) { BaseEvent.ExecuteWardenEvents(cachedProgressEvents.Dequeue().Events, (eWardenObjectiveEventTrigger)0); bool flag; hasProgressEvents = (flag = cachedProgressEvents.Count > 0); if (flag) { nextProgress = cachedProgressEvents.Peek().Progress; } } ((TMP_Text)ObjHudTimer.m_timerText).text = $"{body[0]}{count.ToString($"F{cu.DecimalPoints}")}{body[1]}"; count += speed * Time.deltaTime; if (EntryPoint.TimerMods.TimeModifier != 0f) { count += EntryPoint.TimerMods.TimeModifier; EntryPoint.TimerMods.TimeModifier = 0f; } if (EntryPoint.TimerMods.SpeedModifier != speed) { speed = EntryPoint.TimerMods.SpeedModifier; } if (EntryPoint.TimerMods.TimerTitleText != titleText) { titleText = EntryPoint.TimerMods.TimerTitleText; ((TMP_Text)ObjHudTimer.m_titleText).text = LocaleText.op_Implicit(titleText); } if (EntryPoint.TimerMods.TimerBodyText != customText) { customText = EntryPoint.TimerMods.TimerBodyText; body = ParseCustomText(LocaleText.op_Implicit(customText), duration); } if (EntryPoint.TimerMods.TimerColor != color) { color = EntryPoint.TimerMods.TimerColor; htmlColor = ColorUtility.ToHtmlStringRGB(color); } yield return null; } while (cachedProgressEvents.Count > 0) { BaseEvent.ExecuteWardenEvents(cachedProgressEvents.Dequeue().Events, (eWardenObjectiveEventTrigger)0); } BaseEvent.ExecuteWardenEvents(cu.EventsOnDone, (eWardenObjectiveEventTrigger)0); if ((int)GameStateManager.CurrentStateName == 10 && !(startTime < EntryPoint.Coroutines.CountdownStarted)) { ObjHudTimer.SetTimerActive(false, true); } } private static string[] ParseCustomText(string custom, float duration) { if (!custom.Contains("[COUNTUP]")) { return new string[2] { string.Empty, string.Empty }; } if (custom.Contains("[CMAX]")) { custom = custom.Replace("[CMAX]", duration.ToString()); } return custom.Split("[COUNTUP]", 2); } private static float NormalizedPercent(float current, float min, float max) { if (min == max) { return float.NaN; } float num = Math.Clamp(current, min, max); return (num - min) / (max - min); } } internal sealed class CustomHudTextEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.CustomHudText; private static PUI_ObjectiveTimer ObjHudTimer => GuiManager.PlayerLayer.m_objectiveTimer; protected override void OnSetup() { SNetEvents.OnCheckpointReload += OnCheckpointReload; } private void OnCheckpointReload() { if ((Object)(object)ObjHudTimer != (Object)null && ((Behaviour)ObjHudTimer).enabled) { ((TMP_Text)ObjHudTimer.m_titleText).text = string.Empty; ((TMP_Text)ObjHudTimer.m_timerText).text = string.Empty; ObjHudTimer.SetTimerActive(false, false); ObjHudTimer.SetTimerTextEnabled(false); } } protected override void TriggerCommon(WEE_EventData e) { //IL_0064: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) EntryPoint.Coroutines.CountdownStarted = Time.realtimeSinceStartup; ObjHudTimer.m_timerSoundPlayer.Post(EVENTS.STINGER_SUBOBJECTIVE_COMPLETE, true); if (e.Enabled) { CoroutineManager.BlinkIn(((Component)ObjHudTimer).gameObject, 0f); TextMeshPro titleText = ObjHudTimer.m_titleText; LocaleText? val = e.CustomHudText?.Title; ((TMP_Text)titleText).text = SerialLookupManager.ParseTextFragments(val.HasValue ? LocaleText.op_Implicit(val.GetValueOrDefault()) : string.Empty); TextMeshPro timerText = ObjHudTimer.m_timerText; val = e.CustomHudText?.Body; ((TMP_Text)timerText).text = SerialLookupManager.ParseTextFragments(val.HasValue ? LocaleText.op_Implicit(val.GetValueOrDefault()) : string.Empty); } else { CoroutineManager.BlinkOut(((Component)ObjHudTimer).gameObject, 0f); } } } internal sealed class MultiProgressionEvent : BaseEvent { public class LocalMPData { public PUI_ProgressionObjective ProgObj { get; private set; } public int Index { get; private set; } public string Header => ((TMP_Text)ProgObj.m_header).text; public string Body => ((TMP_Text)ProgObj.m_text).text; public int Priority { get; private set; } public bool IsHidden { get; set; } public LocalMPData(PUI_ProgressionObjective progObj, int index, int priority) { ProgObj = progObj; Index = index; Priority = priority; } } public static ImmutableDictionary> TrackedMPs = ImmutableDictionary.CreateRange(new KeyValuePair>[3] { new KeyValuePair>((LG_LayerType)0, new List()), new KeyValuePair>((LG_LayerType)1, new List()), new KeyValuePair>((LG_LayerType)2, new List()) }); public override WEE_Type EventType => WEE_Type.MultiProgression; private static PUI_GameObjectives ObjHud => GuiManager.PlayerLayer.WardenObjectives; protected override void OnSetup() { LevelAPI.OnEnterLevel += delegate { WardenObjectiveManager.OnLocalPlayerEnterNewLayerCallback += Action.op_Implicit((Action)LocalToLayer); }; LevelAPI.OnLevelCleanup += OnLevelCleanup; } private void LocalToLayer(PlayerAgent player, LG_LayerType layer) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) foreach (LocalMPData item in TrackedMPs[layer]) { if (item.IsHidden) { SetMultiProgression(item.Index, item.Header, item.Body, item.Priority); item.IsHidden = false; } } foreach (LG_LayerType item2 in TrackedMPs.Keys.Where((LG_LayerType key) => key != layer)) { foreach (LocalMPData item3 in TrackedMPs[item2]) { if (!item3.IsHidden) { ObjHud.RemoveProgressionObjective(item3.Index, false); item3.IsHidden = true; } } } } private static void OnLevelCleanup() { CollectionExtensions.ForEachValue>((IDictionary>)TrackedMPs, (Action>)delegate(List list) { list.Clear(); }); } protected override void TriggerCommon(WEE_EventData e) { //IL_0033: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028d: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown //IL_0120: Unknown result type (might be due to invalid IL or missing references) bool flag3 = default(bool); foreach (WEE_SubObjectiveData item3 in e.MultiProgression) { int key = (int)(item3.Index + 100); LG_LayerType val = base.ResolveFieldsFallback(e.Layer, item3.Layer, debug: false); (string, string) tuple = SetAndStyleSubObjective(item3, val); string item = tuple.Item1; string item2 = tuple.Item2; bool flag = ObjHud.m_progressionObjectiveMap.ContainsKey(key); bool flag2 = TrackedMPs.Values.Any((List list) => list.Any((LocalMPData localMP) => localMP.Index == key)); BepInExDebugLogInterpolatedStringHandler val2; if (!flag && !flag2) { val2 = new BepInExDebugLogInterpolatedStringHandler(58, 2, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Adding new SubObjective with Index: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(item3.Index); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", IsLayerIndependent: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(item3.IsLayerIndependent); } LogDebug(val2); PUI_ProgressionObjective progObj = SetMultiProgression(key, item, item2, item3.Priority); if (!item3.IsLayerIndependent) { TrackedMPs[val].Add(new LocalMPData(progObj, key, item3.Priority)); } continue; } if (!Utility.IsNullOrWhiteSpace(item)) { val2 = new BepInExDebugLogInterpolatedStringHandler(43, 1, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Updating text for SubObjective with Index: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(item3.Index); } LogDebug(val2); if (flag) { PUI_ProgressionObjective val3 = ObjHud.m_progressionObjectiveMap[key]; ((TMP_Text)val3.m_header).text = item; ((TMP_Text)val3.m_text).text = item2; val3.ResizeAccordingToText(); CoroutineManager.BlinkIn(val3.Header, 0.1f); CoroutineManager.BlinkIn(val3.SubObjective, 0.3f); CoroutineManager.StartCoroutine(ObjHud.DoUpdateObjectiveLayoutAfterTime(CoroutineManager.BlinkDuration), (Action)null); } if (flag2) { PUI_ProgressionObjective progObj2 = TrackedMPs.Values.SelectMany((List list) => list).FirstOrDefault((LocalMPData localMP) => localMP.Index == key).ProgObj; ((TMP_Text)progObj2.m_header).text = item; ((TMP_Text)progObj2.m_text).text = item2; } continue; } val2 = new BepInExDebugLogInterpolatedStringHandler(34, 1, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Removing SubObjective with Index: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(item3.Index); } LogDebug(val2); ObjHud.RemoveProgressionObjective(key, false); CollectionExtensions.ForEachValue>((IDictionary>)TrackedMPs, (Action>)delegate(List list) { list.RemoveAll((LocalMPData localMPData) => localMPData.Index == key); }); } } public static PUI_ProgressionObjective SetMultiProgression(int key, string header, string body, int priority) { PUI_ProgressionObjective val = Object.Instantiate(ObjHud.m_progressionObjectivePrefab, ObjHud.m_progressionObjectivesParent); ObjHud.m_progressionObjectives.Add(val); ObjHud.m_progressionObjectiveMap[key] = val; ObjHud.m_progressionObjectivePriorityMap[val] = priority; ((TMP_Text)val.m_header).text = header; ((TMP_Text)val.m_text).text = body; val.ResizeAccordingToText(); CoroutineManager.BlinkIn(((Component)val).gameObject, 0f); CoroutineManager.BlinkIn(val.Header, 0.1f); CoroutineManager.BlinkIn(val.SubObjective, 0.5f); ObjHud.UpdateObjectivesLayout(true, false); CoroutineManager.StartCoroutine(ObjHud.DoUpdateObjectiveLayoutAfterTime(CoroutineManager.BlinkDuration), (Action)null); return val; } public static (string, string) SetAndStyleSubObjective(WEE_SubObjectiveData sub, LG_LayerType layer) { //IL_0002: 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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) string text = LocaleText.op_Implicit(string.IsNullOrEmpty(LocaleText.op_Implicit(sub.CustomSubObjectiveHeader)) ? sub.CustomSubObjective : sub.CustomSubObjectiveHeader); string text2 = (string.IsNullOrEmpty(LocaleText.op_Implicit(sub.CustomSubObjectiveHeader)) ? string.Empty : LocaleText.op_Implicit(sub.CustomSubObjective)); text = StyleText(text, layer, LocaleText.op_Implicit(sub.OverrideTag), isHeader: true); text2 = StyleText(text2, layer, string.Empty, isHeader: false); return (text, text2); } public static string StyleText(string text, LG_LayerType layer, string tag, bool isHeader) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) string text2 = WardenObjectiveManager.ReplaceFragmentsInString(layer, WardenObjectiveManager.GetCurrentChainIndex(layer), text, true); return isHeader ? ObjHud.StyleMainObjText(text2, false, tag) : ObjHud.StyleSubObjText(text2, (SubObjectiveStyleType)0, 5); } } internal sealed class PlaySubtitlesEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.PlaySubtitles; protected override void TriggerCommon(WEE_EventData e) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) GuiManager.PlayerLayer.m_subtitles.ShowMultiLineSubtitle(LocaleText.op_Implicit(e.SoundSubtitle), e.Duration); } } internal sealed class SetPocketItemEvent : BaseEvent { public static readonly Dictionary PocketItemsMap = new Dictionary(); public override WEE_Type EventType => WEE_Type.SetPocketItem; public static bool HasEmptyPockets => PocketItemsMap.Count == 0; public static string TopItems { get; private set; } = string.Empty; public static string BottomItems { get; private set; } = string.Empty; protected override void OnSetup() { LevelAPI.OnLevelCleanup += OnLevelCleanup; } private void OnLevelCleanup() { PocketItemsMap.Clear(); TopItems = string.Empty; BottomItems = string.Empty; } protected override void TriggerCommon(WEE_EventData e) { //IL_00d8: 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_00e9: Unknown result type (might be due to invalid IL or missing references) foreach (WEE_SetPocketItem objectiveItem in e.ObjectiveItems) { int count = ResolveFieldsFallback(e.Count, objectiveItem.Count, debug: false); int index = objectiveItem.Index; if (!PocketItemsMap.ContainsKey(index)) { List slottedPlayers = SNet.Slots.SlottedPlayers; objectiveItem.Count = count; WEE_SetPocketItem wEE_SetPocketItem = objectiveItem; string tag; switch (objectiveItem.TagType) { case WEE_SetPocketItem.PlayerTagType.Custom: tag = objectiveItem.CustomTag; break; case WEE_SetPocketItem.PlayerTagType.Specific: { SNet_Player obj2 = slottedPlayers[(int)objectiveItem.PlayerIndex]; tag = ((obj2 != null) ? obj2.GetName() : null); break; } case WEE_SetPocketItem.PlayerTagType.Random: { SNet_Player obj = slottedPlayers[EntryPoint.SessionRand.NextInt(slottedPlayers.Count)]; tag = ((obj != null) ? obj.GetName() : null); break; } case WEE_SetPocketItem.PlayerTagType.Closest: tag = GetClosestPlayerName(GetPositionFallback(e.Position, LocaleText.op_Implicit(e.SpecialText))); break; default: tag = null; break; } wEE_SetPocketItem.Tag = tag; if (!Utility.IsNullOrWhiteSpace(objectiveItem.Tag)) { PocketItemsMap[index] = objectiveItem; } } else if (!objectiveItem.ShouldRemove) { PocketItemsMap[index].Count = count; } else { PocketItemsMap.Remove(index); } } TopItems = string.Join("\n", from pItem in PocketItemsMap.Values where pItem.IsOnTop select pItem.FormatString()); BottomItems = string.Join("\n", from pItem in PocketItemsMap.Values where !pItem.IsOnTop select pItem.FormatString()); PlayerBackpackManager.UpdatePocketItemGUI(); } private static string? GetClosestPlayerName(Vector3 pos) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) float num = float.PositiveInfinity; PlayerAgent val = null; Enumerator enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); float num2 = default(float); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (GameObjectPlusExtensions.IsWithinSqrDistance(((Agent)current).Position, pos, num, ref num2)) { num = num2; val = current; } } return (val != null) ? val.PlayerName : null; } } internal sealed class ShakeScreenEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.ShakeScreen; protected override void TriggerCommon(WEE_EventData e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) Vector3 positionFallback = GetPositionFallback(e.Position, LocaleText.op_Implicit(e.SpecialText), debug: false); CameraShakeEffect val; if (positionFallback != Vector3.zero) { AIG_CourseNode courseNode = CourseNodeUtil.GetCourseNode(positionFallback); val = (CameraShakeEffect)(((object)((courseNode != null) ? ComponentExt.AddChildGameObject((Component)(object)courseNode.m_area, "AWO_ShakeScreenEvent") : null)) ?? ((object)new CameraShakeEffect())); ((Component)val).transform.position = positionFallback; } else { val = ComponentExt.AddChildGameObject((Component)(object)base.LocalPlayer, "AWO_ShakeScreenEvent"); } WEE_ShakeScreen wEE_ShakeScreen = e.CameraShake ?? (e.CameraShake = new WEE_ShakeScreen()); val.Radius = wEE_ShakeScreen.Radius; val.Duration = ResolveFieldsFallback(e.Duration, wEE_ShakeScreen.Duration); val.Amplitude = wEE_ShakeScreen.Amplitude; val.Frequency = wEE_ShakeScreen.Frequency; val.directional = wEE_ShakeScreen.Directional; val.PlayOnEnable = true; val.Play(); } } internal class SpawnNavMarkerEvent : BaseEvent { public static readonly Dictionary NavMarkers = new Dictionary(); public override WEE_Type EventType => WEE_Type.SpawnNavMarker; protected override void OnSetup() { LevelAPI.OnLevelCleanup += OnLevelCleanup; } private void OnLevelCleanup() { NavMarkers.Clear(); } protected override void TriggerCommon(WEE_EventData e) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_00a2: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) foreach (WEE_NavMarkerData value2 in e.NavMarker.Values) { int num = ResolveFieldsFallback(value2.Index, e.Count, debug: false); if (!NavMarkers.TryGetValue(num, out NavMarker value)) { GameObject val = new GameObject($"AMAWO_{num}"); val.transform.position = GetPositionFallback(e.Position, LocaleText.op_Implicit(e.SpecialText)); GameObject val2 = val; value = GuiManager.NavMarkerLayer.PlaceCustomMarker(value2.Style, val2, LocaleText.op_Implicit(value2.Title), e.Duration, false); value.SetColor(value2.Color); value.SetPinEnabled(value2.UsePin); AIG_CourseNode courseNode = CourseNodeUtil.GetCourseNode(e.Position); if (courseNode != null) { string signInfo = "Z" + courseNode.m_area.m_navInfo.GetFormattedText((LG_NavInfoFormat)0); value.SetSignInfo(signInfo); } NavMarkers.Add(num, value); if (e.Duration > 0f) { CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DestroyAfterDelay(num, e.Duration)), (Action)null); } } value.SetVisible(e.Enabled); } } private static IEnumerator DestroyAfterDelay(int index, float duration) { yield return (object)new WaitForSeconds(duration); NavMarkers[index].SetVisible(false); NavMarkers.Remove(index); } } internal sealed class SpecialHudTimerEvent : BaseEvent { public class SpecialHudItem { public Coroutine? Coroutine { get; set; } public float TimeModifier { get; set; } public void StartCoroutine(WEE_SpecialHudTimer hud, float duration) { IEnumerator enumerator = ((hud.Type == WEE_SpecialHudTimer.SpecialHudType.StartIndexTimer) ? DoSpecialHudTimed(hud, duration) : DoSpecialHudPersistent(hud)); Coroutine = CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(enumerator), (Action)null); } public void StopCoroutine() { if (Coroutine != null) { CoroutineManager.StopCoroutine(Coroutine); Coroutine = null; } } } public static readonly ConcurrentDictionary SpecialHuds = new ConcurrentDictionary(); private const string Timer = "[TIMER]"; private const string Percent = "[PERCENT]"; public override WEE_Type EventType => WEE_Type.SpecialHudTimer; protected override void OnSetup() { LevelAPI.OnLevelCleanup += OnLevelCleanup; } private void OnLevelCleanup() { CollectionExtensions.ForEachValue((IDictionary)SpecialHuds, (Action)delegate(SpecialHudItem pSpecialHud) { pSpecialHud.StopCoroutine(); }); SpecialHuds.Clear(); } protected override void TriggerCommon(WEE_EventData e) { //IL_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Expected O, but got Unknown //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Expected O, but got Unknown //IL_028c: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Expected O, but got Unknown //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024d: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Expected O, but got Unknown WEE_SpecialHudTimer wEE_SpecialHudTimer = e.SpecialHudTimer ?? new WEE_SpecialHudTimer(); float num = ResolveFieldsFallback(e.Duration, wEE_SpecialHudTimer.Duration); bool flag = default(bool); switch (wEE_SpecialHudTimer.Type) { case WEE_SpecialHudTimer.SpecialHudType.StartTimer: if (num <= 0f) { LogError("Duration must be greater than 0 seconds!"); break; } LogDebug("Starting new Timed SpecialHud (no index, cannot be stopped once started)"); CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoSpecialHudTimed(wEE_SpecialHudTimer, num)), (Action)null); break; case WEE_SpecialHudTimer.SpecialHudType.StartIndexTimer: if (num <= 0f) { LogError("Duration must be greater than 0 seconds!"); } else if (!SpecialHuds.TryAdd(wEE_SpecialHudTimer.Index, new SpecialHudItem())) { BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(32, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("SpecialHud "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(wEE_SpecialHudTimer.Index); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is already active..."); } LogError(val); } else { BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(38, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Starting Timed SpecialHud with index: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(wEE_SpecialHudTimer.Index); } LogDebug(val2); SpecialHuds[wEE_SpecialHudTimer.Index].StartCoroutine(wEE_SpecialHudTimer, num); } break; case WEE_SpecialHudTimer.SpecialHudType.StartPersistent: if (!SpecialHuds.TryAdd(wEE_SpecialHudTimer.Index, new SpecialHudItem())) { BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(32, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("SpecialHud "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(wEE_SpecialHudTimer.Index); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is already active..."); } LogError(val); } else { BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(43, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Starting Persistent SpecialHud with index: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(wEE_SpecialHudTimer.Index); } LogDebug(val2); SpecialHuds[wEE_SpecialHudTimer.Index].StartCoroutine(wEE_SpecialHudTimer, num); } break; case WEE_SpecialHudTimer.SpecialHudType.StopIndex: { if (!SpecialHuds.TryRemove(wEE_SpecialHudTimer.Index, out SpecialHudItem value)) { BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(43, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("No active SpecialHud with index "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(wEE_SpecialHudTimer.Index); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" was found!"); } LogError(val); break; } BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(32, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Stopping SpecialHud with index: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(wEE_SpecialHudTimer.Index); } LogDebug(val2); CoroutineManager.StopCoroutine(value.Coroutine); GuiManager.InteractionLayer.MessageVisible = false; GuiManager.InteractionLayer.MessageTimerVisible = false; break; } case WEE_SpecialHudTimer.SpecialHudType.StopAll: CollectionExtensions.ForEachValue((IDictionary)SpecialHuds, (Action)delegate(SpecialHudItem hud) { CoroutineManager.StopCoroutine(hud.Coroutine); }); SpecialHuds.Clear(); LogDebug("Stopping all indexed SpecialHuds"); GuiManager.InteractionLayer.MessageVisible = false; GuiManager.InteractionLayer.MessageTimerVisible = false; break; } } private static IEnumerator DoSpecialHudTimed(WEE_SpecialHudTimer hud, float duration) { int reloadCount = CheckpointManager.CheckpointUsage; float time = 0f; string msg = SerialLookupManager.ParseTextFragments(LocaleText.op_Implicit(hud.Message)); bool hasTags = msg.Contains("[TIMER]") || msg.Contains("[PERCENT]"); Queue cachedProgressEvents = new Queue(hud.EventsOnProgress.OrderBy((EventsOnTimerProgress prEv) => prEv.Progress)); bool hasProgressEvents = cachedProgressEvents.Count > 0; float nextProgress = (hasProgressEvents ? cachedProgressEvents.Peek().Progress : float.NaN); GuiManager.InteractionLayer.MessageVisible = true; GuiManager.InteractionLayer.MessageTimerVisible = hud.ShowTimeInProgressBar; while (time <= duration) { if ((int)GameStateManager.CurrentStateName != 10 || reloadCount < CheckpointManager.CheckpointUsage) { GuiManager.InteractionLayer.MessageVisible = false; GuiManager.InteractionLayer.MessageTimerVisible = false; yield break; } if (hasProgressEvents && nextProgress <= NormalizedPercent(time, 0f, duration)) { BaseEvent.ExecuteWardenEvents(cachedProgressEvents.Dequeue().Events, (eWardenObjectiveEventTrigger)0); bool flag; hasProgressEvents = (flag = cachedProgressEvents.Count > 0); if (flag) { nextProgress = cachedProgressEvents.Peek().Progress; } } float percentage = Mathf.Clamp01(time / duration); float invertPercent = 1f - percentage; if (hud.ShowTimeInProgressBar) { GuiManager.InteractionLayer.SetMessageTimer((!hud.InvertProgress) ? percentage : invertPercent); } if (!hasTags) { GuiManager.InteractionLayer.SetMessage(msg, hud.Style, hud.Priority); } else { TimeSpan timeSpan = TimeSpan.FromSeconds((!hud.InvertProgress) ? (duration - time) : time); string tagTime = $"{(int)timeSpan.TotalMinutes:D2}:{timeSpan.Seconds:D2}"; string tagPercent = $"{((!hud.InvertProgress) ? percentage : invertPercent) * 100f:F0}%"; string formattedMsg = msg.Replace("[TIMER]", tagTime, StringComparison.Ordinal).Replace("[PERCENT]", tagPercent, StringComparison.Ordinal); GuiManager.InteractionLayer.SetMessage(formattedMsg, hud.Style, hud.Priority); } time += Time.deltaTime; if (hud.HasIndex && SpecialHuds[hud.Index].TimeModifier != 0f) { time -= SpecialHuds[hud.Index].TimeModifier * ((!hud.InvertProgress) ? 1f : (-1f)); SpecialHuds[hud.Index].TimeModifier = 0f; } yield return null; GuiManager.InteractionLayer.MessageVisible = true; GuiManager.InteractionLayer.MessageTimerVisible = hud.ShowTimeInProgressBar; } GuiManager.InteractionLayer.MessageVisible = false; GuiManager.InteractionLayer.MessageTimerVisible = false; while (cachedProgressEvents.Count > 0) { BaseEvent.ExecuteWardenEvents(cachedProgressEvents.Dequeue().Events, (eWardenObjectiveEventTrigger)0); } BaseEvent.ExecuteWardenEvents(hud.EventsOnDone, (eWardenObjectiveEventTrigger)0); if (hud.HasIndex) { SpecialHuds.TryRemove(hud.Index, out SpecialHudItem _); } } public static float NormalizedPercent(float current, float min, float max) { if (min == max) { return float.NaN; } float num = Math.Clamp(current, min, max); return (num - min) / (max - min); } private static IEnumerator DoSpecialHudPersistent(WEE_SpecialHudTimer hud) { int reloadCount = CheckpointManager.CheckpointUsage; string msg = SerialLookupManager.ParseTextFragments(LocaleText.op_Implicit(hud.Message)); GuiManager.InteractionLayer.MessageVisible = true; GuiManager.InteractionLayer.MessageTimerVisible = false; while ((int)GameStateManager.CurrentStateName == 10 && reloadCount >= CheckpointManager.CheckpointUsage) { GuiManager.InteractionLayer.SetMessage(msg, hud.Style, hud.Priority); yield return null; GuiManager.InteractionLayer.MessageVisible = true; GuiManager.InteractionLayer.MessageTimerVisible = false; } GuiManager.InteractionLayer.MessageVisible = false; GuiManager.InteractionLayer.MessageTimerVisible = false; } } internal sealed class ForceCompleteLevelEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.ForceCompleteLevel; protected override void TriggerMaster(WEE_EventData e) { WardenObjectiveManager.ForceCompleteObjective((LG_LayerType)0); SNet.Sync.SessionCommand((eSessionCommandType)3, 2); } } internal sealed class ForceFailLevelEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.ForceFailLevel; protected override void TriggerMaster(WEE_EventData e) { SNet.Sync.SessionCommand((eSessionCommandType)3, 1); } } internal sealed class SaveCheckpointEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.SaveCheckpoint; protected override void TriggerMaster(WEE_EventData e) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) CheckpointManager.StoreCheckpoint(((Agent)base.LocalPlayer).EyePosition); SNet.Capture.CaptureGameState((eBufferType)3); } } internal sealed class SetLevelFailCheckEnabledEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.SetLevelFailCheckEnabled; protected override void TriggerMaster(WEE_EventData e) { LevelFailUpdateState.SetFailAllowed(e.Enabled); } } internal sealed class SetLevelFailWhenAnyPlayerDownEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.SetLevelFailWhenAnyPlayerDowned; protected override void TriggerMaster(WEE_EventData e) { LevelFailUpdateState.SetFailWhenAnyPlayerDown(e.Enabled); } } internal sealed class SetSuccessScreenEvent : BaseEvent { private static string s_storedSuccessText = string.Empty; private static bool s_shouldResetMusic = false; public override WEE_Type EventType => WEE_Type.SetSuccessScreen; protected override void TriggerCommon(WEE_EventData e) { if (e.SuccessScreen == null) { WEE_SetSuccessScreen wEE_SetSuccessScreen = (e.SuccessScreen = new WEE_SetSuccessScreen()); } switch (e.SuccessScreen.Type) { case WEE_SetSuccessScreen.ScreenType.SetSuccessScreen: SetScreen(e); break; case WEE_SetSuccessScreen.ScreenType.FlashFakeScreen: CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(FakeScreen(e)), (Action)null); break; } } private static void SetScreen(WEE_EventData e) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) string text = e.SuccessScreen.CustomSuccessScreen; if (text != string.Empty) { try { RestoreSuccessText(); MainMenuGuiLayer.Current.PageExpeditionSuccess = ((Il2CppObjectBase)MainMenuGuiLayer.Current.AddPage((eCM_MenuPage)17, text)).Cast(); Logger.Verbose((LogLevel)32, "CustomSuccessScreen should now be changed to " + text); } catch { Logger.Error("SetSuccessScreen", "CustomSuccessScreen asset " + text + " not found!"); } } SetSuccessText(LocaleText.op_Implicit(e.SpecialText)); SetSuccessMusic(e.SuccessScreen.OverrideMusic); } private static IEnumerator FakeScreen(WEE_EventData e) { Logger.Verbose((LogLevel)32, "Enabling fake end screen... Disabled map and menu toggle"); SetSuccessText(LocaleText.op_Implicit(e.SpecialText)); FocusStateManager.EnterMenu(e.SuccessScreen.FakeEndScreen, true); FocusStateManager.MapToggleAllowed = false; FocusStateManager.MenuToggleAllowed = false; yield return (object)new WaitForSeconds(e.Duration); Logger.Verbose((LogLevel)32, "Disabling fake end screen... Enabled map and menu toggle"); RestoreSuccessText(); FocusStateManager.ExitMenu(true); FocusStateManager.ChangeState((eFocusState)4, true); FocusStateManager.MapToggleAllowed = true; FocusStateManager.MenuToggleAllowed = true; } private static void SetSuccessText(string text) { if (!(text == string.Empty)) { if (s_storedSuccessText == string.Empty) { s_storedSuccessText = ((TMP_Text)MainMenuGuiLayer.Current.PageExpeditionSuccess.m_header).text; LevelAPI.OnBuildStart += RestoreSuccessText; } ((TMP_Text)MainMenuGuiLayer.Current.PageExpeditionSuccess.m_header).SetText(text, true); Logger.Verbose((LogLevel)32, "Set success screen text to " + text + "."); } } private static void SetSuccessMusic(uint music) { if (!s_shouldResetMusic) { s_shouldResetMusic = true; LevelAPI.OnBuildStart += RestoreSuccessMusic; } MainMenuGuiLayer.Current.PageExpeditionSuccess.m_overrideSuccessMusic = music; Logger.Verbose((LogLevel)32, $"Set success screen music to sound id {music}."); } private static void RestoreSuccessText() { if (s_storedSuccessText != string.Empty) { ((TMP_Text)MainMenuGuiLayer.Current.PageExpeditionSuccess.m_header).SetText(s_storedSuccessText, true); s_storedSuccessText = string.Empty; LevelAPI.OnBuildStart -= RestoreSuccessText; } } private static void RestoreSuccessMusic() { if (s_shouldResetMusic) { MainMenuGuiLayer.Current.PageExpeditionSuccess.m_overrideSuccessMusic = 0u; s_shouldResetMusic = false; LevelAPI.OnBuildStart -= RestoreSuccessMusic; } } } internal sealed class NestedEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.NestedEvent; protected override void TriggerCommon(WEE_EventData e) { WEE_NestedEvent wEE_NestedEvent = e.NestedEvent ?? new WEE_NestedEvent(); BaseEvent.ExecuteWardenEvents(wEE_NestedEvent.Type switch { WEE_NestedEvent.NestedMode.RandomAny => SelectRandomUniform(wEE_NestedEvent), WEE_NestedEvent.NestedMode.RandomWeighted => SelectRandomWeighted(wEE_NestedEvent), _ => wEE_NestedEvent.EventsToActivate, }, (eWardenObjectiveEventTrigger)0); } private static List SelectRandomUniform(WEE_NestedEvent nested) { List list = new List(); int num = Math.Min(nested.MaxRandomEvents, nested.EventsToActivate.Count); for (int i = 0; i < num; i++) { int index; do { index = EntryPoint.SessionRand.NextInt(nested.EventsToActivate.Count); } while (!nested.AllowRepeatsInRandom && list.Contains(nested.EventsToActivate[index])); list.Add(nested.EventsToActivate[index]); } return list; } private static List SelectRandomWeighted(WEE_NestedEvent nested) { int num = 0; int maxRandomEvents = nested.MaxRandomEvents; List list = nested.EventsToActivate.Where((WardenObjectiveEventData e) => (int)e.Trigger == 0 || (int)e.Trigger == 1).ToList(); List collection = nested.EventsToActivate.Where((WardenObjectiveEventData e) => (int)e.Trigger == 2).ToList(); List list2 = new List(nested.WheelOfEvents); if (list2.Count > 0) { do { Logger.Verbose((LogLevel)32, $"WheelofEvents spin #{num + 1}"); int index = PickWeightedIndex(list2); WEE_NestedEvent.EventsOnRandomWeight eventsOnRandomWeight = list2[index]; list.AddRange(eventsOnRandomWeight.Events); string text = $"{nested.WheelOfEvents.IndexOf(eventsOnRandomWeight)} {(Utility.IsNullOrWhiteSpace(eventsOnRandomWeight.DebugName) ? string.Empty : ("(" + eventsOnRandomWeight.DebugName + ")"))}"; Logger.Verbose((LogLevel)32, "Selected group index " + text); if (!nested.AllowRepeatsInRandom || (!eventsOnRandomWeight.IsInfinite && --eventsOnRandomWeight.RepeatCount <= 0)) { list2.RemoveAt(index); Logger.Verbose((LogLevel)32, $"Removed group index {text}. New wheel size is {list2.Count}"); } else { list2[index] = eventsOnRandomWeight; } list.AddRange(collection); } while (++num < maxRandomEvents && list2.Count > 0); Logger.Verbose((LogLevel)32, "WheelofEvents is now done"); } list.AddRange(nested.EventsToActivate.Where((WardenObjectiveEventData e) => (int)e.Trigger == 3)); return list; } private static int PickWeightedIndex(List wheel) { float num = wheel.Sum((WEE_NestedEvent.EventsOnRandomWeight part) => part.Weight); float num2 = EntryPoint.SessionRand.NextFloat() * num; float num3 = 0f; Logger.Verbose((LogLevel)32, $"Rolled {num2} / {num}"); for (int num4 = 0; num4 < wheel.Count; num4++) { num3 += wheel[num4].Weight; if (num2 < num3) { return num4; } } return wheel.Count - 1; } } internal sealed class ForceCompleteReactorEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.ForceCompleteReactor; protected override void TriggerMaster(WEE_EventData e) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Expected I4, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) Enumerator enumerator = WardenObjectiveManager.Current.m_wardenObjectiveItem.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair current = enumerator.Current; if (current.Key.Layer != e.Layer) { continue; } LG_WardenObjective_Reactor val = ((Il2CppObjectBase)current.Value).TryCast(); if (!((Object)(object)val == (Object)null)) { pReactorState currentState = val.m_currentState; eReactorStatus status = currentState.status; eReactorStatus val2 = status; switch ((int)val2) { case 0: case 2: case 3: case 4: currentState.status = (eReactorStatus)5; val.m_stateReplicator.State = currentState; break; case 1: case 6: case 7: case 8: currentState.status = (eReactorStatus)9; val.m_stateReplicator.State = currentState; break; case 5: case 9: LogWarning("Reactor is already completed"); break; } } } } } internal sealed class ModifyReactorWaveStateEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.ModifyReactorWaveState; protected override void TriggerMaster(WEE_EventData e) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_009c: Invalid comparison between Unknown and I4 //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Invalid comparison between Unknown and I4 //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) if (e.Reactor == null) { WEE_ReactorEventData wEE_ReactorEventData = (e.Reactor = new WEE_ReactorEventData()); } Enumerator enumerator = WardenObjectiveManager.Current.m_wardenObjectiveItem.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair current = enumerator.Current; if (current.Key.Layer != e.Layer) { continue; } LG_WardenObjective_Reactor val = ((Il2CppObjectBase)current.Value).TryCast(); if ((Object)(object)val == (Object)null) { continue; } pReactorState state = val.m_stateReplicator.State; if (e.Reactor.State == WEE_ReactorEventData.WaveState.Idle && (int)state.status > 0) { state.stateCount = 0; state.verifyFailed = false; val.AttemptInteract((eReactorInteraction)13, 0f); val.SetGUIMessage(true, string.Empty, (ePUIMessageStyle)4, true, "", ""); GuiManager.InteractionLayer.MessageVisible = false; GuiManager.InteractionLayer.MessageTimerVisible = false; continue; } eReactorStatus status = state.status; if (status - 2 <= 3) { state.stateCount = e.Reactor.Wave; state.stateProgress = e.Reactor.Progress; state.verifyFailed = false; state.status = (eReactorStatus)(e.Reactor.State switch { WEE_ReactorEventData.WaveState.Intro => 2, WEE_ReactorEventData.WaveState.Wave => 3, WEE_ReactorEventData.WaveState.Verify => 4, _ => 2, }); val.m_stateReplicator.State = state; } else { LogError("Reactor in invalid state, or already Inactive_Idle"); } } } } [Obsolete] internal sealed class SolveSingleObjectiveItemEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.SolveSingleObjectiveItem; protected override void TriggerMaster(WEE_EventData e) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_0025: 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_00c4: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); if (!WardenObjectiveManager.HasWardenObjectiveDataForLayer(e.Layer)) { BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(21, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(e.Layer); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Objective is Missing"); } LogError(val); return; } int currentChainIndex = WardenObjectiveManager.GetCurrentChainIndex(e.Layer); List objectiveItemCollection = WardenObjectiveManager.GetObjectiveItemCollection(e.Layer, currentChainIndex); if (objectiveItemCollection == null) { BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(49, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(e.Layer); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Objective Doesn't have ObjectiveItem Collection!"); } LogError(val); return; } Enumerator enumerator = objectiveItemCollection.GetEnumerator(); while (enumerator.MoveNext()) { iWardenObjectiveItem current = enumerator.Current; if (current.ObjectiveItemSolved) { continue; } WardenObjectiveManager.OnLocalPlayerSolvedObjectiveItem(e.Layer, current, false); break; } } } internal sealed class StartPortalEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.StartPortalMachine; public static Dictionary Portals { get; set; } = new Dictionary(); protected override void OnSetup() { LevelAPI.OnLevelCleanup += OnLevelCleanup; } private void OnLevelCleanup() { Portals.Clear(); } protected override void TriggerCommon(WEE_EventData e) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_009f: 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_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Expected O, but got Unknown //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) if (!TryGetZone(e, out LG_Zone zone)) { return; } if (!Portals.TryGetValue(GlobalIndexUtil.ToStruct(zone), out LG_DimensionPortal value)) { LogError("Cannot find Portal!"); return; } if (e.Portal == null) { WEE_StartPortalMachine wEE_StartPortalMachine = (e.Portal = new WEE_StartPortalMachine()); } value.m_targetDimension = e.Portal.TargetDimension; value.m_teleportDelay = e.Portal.TeleportDelay; value.m_portalEventData = new WardenObjectiveEventData { Type = (eWardenObjectiveEventType)((!e.Portal.PreventPortalWarpTeamEvent) ? 8 : 0), DimensionIndex = value.m_targetDimension, Delay = value.m_teleportDelay }; if (BaseEvent.IsMaster && e.Enabled) { LogDebug("Activating portal..."); pDimensionPortalState state = value.m_stateReplicator.State; state.isSequenceIncomplete = false; state.status = (eDimensionPortalStatus)1; value.m_stateReplicator.State = state; pItemData_Custom val = default(pItemData_Custom); value.SetPortalKeyInserted(ref val); } } } internal sealed class StartReactorEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.StartReactor; protected override void TriggerMaster(WEE_EventData e) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Invalid comparison between Unknown and I4 //IL_008d: 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_0094: Invalid comparison between Unknown and I4 //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown Enumerator enumerator = WardenObjectiveManager.Current.m_wardenObjectiveItem.GetEnumerator(); bool flag = default(bool); while (enumerator.MoveNext()) { KeyValuePair current = enumerator.Current; if (current.Key.Layer != e.Layer) { continue; } LG_WardenObjective_Reactor val = ((Il2CppObjectBase)current.Value).TryCast(); if ((Object)(object)val == (Object)null) { continue; } pReactorState currentState = val.m_currentState; if ((int)currentState.status == 0) { val.OnInitialPuzzleSolved(); val.m_terminal.TrySyncSetCommandIsUsed((TERM_Command)21); continue; } if ((int)currentState.status == 1) { val.OnInitialPuzzleSolved(); val.m_terminal.TrySyncSetCommandIsUsed((TERM_Command)23); continue; } BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(32, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(base.Name); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" only works while in idle state!"); } LogError(val2); } } } internal sealed class DamagePlayerEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.DamagePlayer; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerMaster(WEE_EventData e) { if (e.DamagePlayer == null) { WEE_DamagePlayer wEE_DamagePlayer = (e.DamagePlayer = new WEE_DamagePlayer()); } HashSet hashSet = new HashSet(e.DamagePlayer.PlayerFilter.Select((PlayerIndex filter) => (int)filter)); if (!TryGetZone(e, out LG_Zone zone)) { return; } for (int num = 0; num < PlayerManager.PlayerAgentsInLevel.Count; num++) { bool flag = num >= 4 && e.DamagePlayer.FullTeamOverflow && hashSet.Count == 4 && hashSet.Max() < 4; PlayerAgent val = PlayerManager.PlayerAgentsInLevel[num]; if (!flag && !hashSet.Contains(num)) { continue; } AIG_CourseNode courseNode = ((Agent)val).CourseNode; if (!((Object)(object)((courseNode != null) ? courseNode.m_zone : null) == (Object)null)) { if (e.DamagePlayer.DamageOverTime && e.Duration > 0f) { CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DamageOverTime(e, val, zone.ID)), (Action)null); } else { ApplyDamage(val, e.DamagePlayer.DamageAmount, e.DamagePlayer.DealPercentageDamage, e.DamagePlayer.UseZone, zone.ID); } } } } private static IEnumerator DamageOverTime(WEE_EventData e, PlayerAgent player, int id) { int reloadCount = CheckpointManager.CheckpointUsage; float damagePerSecond = e.DamagePlayer.DamageAmount / e.Duration; float elapsed = 0f; WaitForSeconds delay = new WaitForSeconds(e.DamagePlayer.Interval); while (elapsed < e.Duration && (int)GameStateManager.CurrentStateName == 10 && reloadCount >= CheckpointManager.CheckpointUsage) { ApplyDamage(player, damagePerSecond, e.DamagePlayer.DealPercentageDamage, e.DamagePlayer.UseZone, id); elapsed += Time.deltaTime; yield return delay; } } private static void ApplyDamage(PlayerAgent player, float damage, bool dealPercentDmg, bool useZone, int id) { if (!useZone || ((Agent)player).CourseNode.m_zone.ID == id) { float num = damage / 100f * (dealPercentDmg ? ((Dam_SyncedDamageBase)player.Damage).HealthMax : player.PlayerData.health); player.Damage.OnIncomingDamage(num, 0f, (Agent)null); } } } internal sealed class ForcePlayerDialogueEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.ForcePlayPlayerDialogue; protected override void TriggerCommon(WEE_EventData e) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_0071: 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_0082: 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_00b2: Expected O, but got Unknown //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_02ae: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01fb: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Invalid comparison between Unknown and I4 //IL_0285: Unknown result type (might be due to invalid IL or missing references) //IL_0297: 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_026f: Unknown result type (might be due to invalid IL or missing references) //IL_02f1: Unknown result type (might be due to invalid IL or missing references) //IL_02cd: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0312: Expected O, but got Unknown PlayerDialogDataBlock val = default(PlayerDialogDataBlock); bool flag = default(bool); if (!DataBlockUtil.TryGetBlock(e.DialogueID, ref val)) { BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(46, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Failed to find enabled PlayerDialogDataBlock "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(e.DialogueID); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("!"); } LogError(val2); return; } WEE_ForcePlayerDialogue wEE_ForcePlayerDialogue = e.PlayerDialogue ?? new WEE_ForcePlayerDialogue(); if (!TryGetPlayerCharacter(wEE_ForcePlayerDialogue, GetPositionFallback(e.Position, LocaleText.op_Implicit(e.SpecialText), debug: false), out PlayerAgent player, out List charFilterList)) { LogError("Failed to find character!"); return; } CellSoundPlayer val3 = new CellSoundPlayer(); CellSoundPlayer val4 = val3; uint gROUP = CHARACTER.GROUP; val4.SetSwitch(gROUP, player.CharacterID switch { 0 => SWITCH.CH_01, 1 => SWITCH.CH_02, 2 => SWITCH.CH_03, 3 => SWITCH.CH_04, _ => throw new NotImplementedException($"[{base.Name}] only supports default lobby size. Unknown CharacterID {player.CharacterID}"), }); CellSoundPlayer val5 = val3; uint gROUP2 = INTENSITY_STATE.GROUP; val5.SetSwitch(gROUP2, wEE_ForcePlayerDialogue.IntensityState switch { WEE_ForcePlayerDialogue.PlayerIntensityState.Exploration => SWITCH.INTENSITY_1_EXPLORATION, WEE_ForcePlayerDialogue.PlayerIntensityState.Stealth => SWITCH.INTENSITY_2_STEALTH, WEE_ForcePlayerDialogue.PlayerIntensityState.Encounter => SWITCH.INTENSITY_3_ENCOUNTER, WEE_ForcePlayerDialogue.PlayerIntensityState.Combat => SWITCH.INTENSITY_4_COMBAT, _ => SWITCH.INTENSITY_1_EXPLORATION, }); if (!((Agent)player).IsLocallyOwned) { val3.SetRTPCValue(GAME_PARAMETERS.FIRST_PERSON_MIX, 0f); Vector3 val6 = ((Agent)base.LocalPlayer).Position - ((Agent)player).Position; float magnitude = ((Vector3)(ref val6)).magnitude; if (magnitude > player.PlayerData.radioEnabledDefaultDistance) { float num = 1f - (magnitude - player.PlayerData.radioEnabledDefaultDistance) / (player.PlayerData.radioQualityLowestAtDistance - player.PlayerData.radioEnabledDefaultDistance); num *= 100f; val3.SetRTPCValue(GAME_PARAMETERS.RADIO_QUALITY_DISTANCE, num); val3.SetRTPCValue(GAME_PARAMETERS.RADIO_DISTORTION_ON_OFF, 1f); } else { val3.SetRTPCValue(GAME_PARAMETERS.RADIO_QUALITY_DISTANCE, 100f); val3.SetRTPCValue(GAME_PARAMETERS.RADIO_DISTORTION_ON_OFF, 0f); } } else { val3.SetRTPCValue(GAME_PARAMETERS.FIRST_PERSON_MIX, 1f); } DialogCharFilter playerCharacterFilter = player.PlayerCharacterFilter; if ((int)playerCharacterFilter != 1) { charFilterList.Remove(playerCharacterFilter); } DialogAlternativeWithCast dialogAlternativeWithCast = PlayerDialogManager.Current.m_dialogCastingDirector.GetDialogAlternativeWithCast(e.DialogueID, Il2CppStructArray.op_Implicit(charFilterList.ToArray()), playerCharacterFilter); if (dialogAlternativeWithCast == null) { BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(49, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("PlayerDialogDataBlock "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(((GameDataBlockBase)(object)val).persistentID); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" has no dialogAlternatives?"); } LogError(val2); return; } int num2 = EntryPoint.SessionRand.NextInt(((Il2CppArrayBase)(object)dialogAlternativeWithCast.m_data.lineEventIDs).Count); uint num3 = ((Il2CppArrayBase)(object)dialogAlternativeWithCast.m_data.lineEventIDs)[num2]; uint num4 = ((Il2CppArrayBase)(object)dialogAlternativeWithCast.m_data.SubtitleIDs)[num2]; AkSoundEngine.SetRandomSeed(EntryPoint.SessionRand.Next()); GameObjectPlusExtensions.PostWithCleanup(val3, num3, ((Agent)player).Position, 1u); WardenObjectiveManager.Current.m_sound.Post(e.SoundID, true); if (e.SoundSubtitle != LocaleText.Empty) { LogWarning("Skipping this event's SoundSubtitle since player dialogue is active"); } GuiManager.PlayerLayer.m_subtitles.ShowMultiLineSubtitle(Text.Get(num4), ResolveFieldsFallback(4f, e.Duration)); } private static bool TryGetPlayerCharacter(WEE_ForcePlayerDialogue dialog, Vector3 pos, [NotNullWhen(true)] out PlayerAgent? player, out List charFilterList) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) player = null; charFilterList = new List(); Il2CppStructArray allRegistredPlayerCharacterFilters = PlayerDialogManager.GetAllRegistredPlayerCharacterFilters(); bool flag = false; float num = float.PositiveInfinity; float num2 = default(float); foreach (DialogCharFilter item in (Il2CppArrayBase)(object)allRegistredPlayerCharacterFilters) { charFilterList.Add(item); if (flag) { continue; } PlayerAgent playerAgentForCharacter = PlayerDialogManager.GetPlayerAgentForCharacter(item); if (!((Object)(object)playerAgentForCharacter == (Object)null)) { if (dialog.Type == WEE_ForcePlayerDialogue.DialogueType.Random) { player = PlayerManager.PlayerAgentsInLevel[EntryPoint.SessionRand.NextInt(((Il2CppArrayBase)(object)allRegistredPlayerCharacterFilters).Count)]; flag = true; } else if (dialog.Type == WEE_ForcePlayerDialogue.DialogueType.Specific && playerAgentForCharacter.CharacterID == (int)dialog.CharacterID) { player = playerAgentForCharacter; flag = true; } else if (dialog.Type == WEE_ForcePlayerDialogue.DialogueType.Closest && GameObjectPlusExtensions.IsWithinSqrDistance(((Agent)playerAgentForCharacter).Position, pos, num, ref num2)) { num = num2; player = playerAgentForCharacter; } } } return (Object)(object)player != (Object)null; } } internal sealed class GiveResourceEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.GiveResource; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerMaster(WEE_EventData e) { WEE_GiveResource wEE_GiveResource = e.GiveResource ?? new WEE_GiveResource(); HashSet hashSet = new HashSet(wEE_GiveResource.PlayerFilter.Select((PlayerIndex filter) => (int)filter)); LG_Zone zone = null; if (wEE_GiveResource.UseLocation && !TryGetZone(e, out zone)) { return; } bool flag = wEE_GiveResource.FullTeamOverflow && hashSet.Count == 4 && hashSet.Max() < 4; for (int num = 0; num < PlayerManager.PlayerAgentsInLevel.Count; num++) { PlayerAgent val = PlayerManager.PlayerAgentsInLevel[num]; if (!flag && !hashSet.Contains(num)) { continue; } if (wEE_GiveResource.UseLocation) { AIG_CourseNode courseNode = ((Agent)val).CourseNode; if (((courseNode != null) ? new int?(courseNode.m_zone.ID) : ((int?)null)) != zone.ID) { continue; } } GiveResource(val, wEE_GiveResource); } } private static void GiveResource(PlayerAgent player, WEE_GiveResource data) { if (data.HasAnyAmmoGain) { float num = (data.IncludeSupplyEfficiency ? AgentModifierManager.ApplyModifier((Agent)(object)player, (AgentModifier)108, 1f) : 1f); PlayerBackpackManager.GiveAmmoToPlayer(player.Owner, data.MainAmmo * num, data.SpecialAmmo * num, data.ToolAmmo * num); } if (data.Health != 0f) { float num2 = (data.IncludeSupplyEfficiency ? AgentModifierManager.ApplyModifier((Agent)(object)player, (AgentModifier)3, 1f) : 1f); player.GiveHealth(player, data.Health * num2); } } } internal sealed class InfectPlayerEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.InfectPlayer; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerMaster(WEE_EventData e) { if (e.InfectPlayer == null) { WEE_InfectPlayer wEE_InfectPlayer = (e.InfectPlayer = new WEE_InfectPlayer()); } HashSet hashSet = new HashSet(e.InfectPlayer.PlayerFilter.Select((PlayerIndex filter) => (int)filter)); if (!TryGetZone(e, out LG_Zone zone)) { return; } for (int num = 0; num < PlayerManager.PlayerAgentsInLevel.Count; num++) { bool flag = num >= 4 && e.InfectPlayer.FullTeamOverflow && hashSet.Count == 4 && hashSet.Max() < 4; PlayerAgent val = PlayerManager.PlayerAgentsInLevel[num]; if ((!flag && !hashSet.Contains(num)) || val.Owner.IsBot) { continue; } AIG_CourseNode courseNode = ((Agent)val).CourseNode; if (!((Object)(object)((courseNode != null) ? courseNode.m_zone : null) == (Object)null)) { if (e.InfectPlayer.InfectOverTime && e.Duration > 0f) { CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(InfectOverTime(e, val, zone.ID)), (Action)null); } else { ApplyInfection(val, e.InfectPlayer.InfectionAmount, e.InfectPlayer.UseZone, zone.ID); } } } } private static IEnumerator InfectOverTime(WEE_EventData e, PlayerAgent player, int id) { int reloadCount = CheckpointManager.CheckpointUsage; float infectionPerSecond = e.InfectPlayer.InfectionAmount / e.Duration; float elapsed = 0f; WaitForSeconds delay = new WaitForSeconds(e.InfectPlayer.Interval); while (elapsed < e.Duration && (int)GameStateManager.CurrentStateName == 10 && reloadCount >= CheckpointManager.CheckpointUsage) { ApplyInfection(player, infectionPerSecond, e.InfectPlayer.UseZone, id); elapsed += Time.deltaTime; yield return delay; } } private static void ApplyInfection(PlayerAgent player, float infection, bool useZone, int id) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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) pInfection val = new pInfection { amount = infection / 100f, mode = (pInfectionMode)1, effect = (pInfectionEffect)0 }; if (!useZone || ((Agent)player).CourseNode.m_zone.ID == id) { player.Damage.ModifyInfection(val, true, true); } } } internal sealed class KillAllPlayersEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.KillAllPlayers; protected override void TriggerMaster(WEE_EventData e) { Enumerator enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; current.Damage.OnIncomingDamage(((Dam_SyncedDamageBase)current.Damage).DamageMax, 0f, (Agent)null); } } } internal sealed class KillPlayersInZoneEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.KillPlayersInZone; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerMaster(WEE_EventData e) { if (!TryGetZone(e, out LG_Zone zone)) { return; } int iD = zone.ID; Enumerator enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (((Agent)current).CourseNode.m_zone.ID == iD) { current.Damage.OnIncomingDamage(((Dam_SyncedDamageBase)current.Damage).DamageMax, 0f, (Agent)null); } } } } internal sealed class PickupSentries : BaseEvent { public override WEE_Type EventType => WEE_Type.PickupSentries; protected override void TriggerMaster(WEE_EventData e) { Enumerator enumerator = Dimension.WarpableObjects.GetEnumerator(); while (enumerator.MoveNext()) { IWarpableObject current = enumerator.Current; SentryGunInstance val = ((Il2CppObjectBase)current).TryCast(); if ((Object)(object)val != (Object)null && ((ItemEquippable)val).LocallyPlaced) { val.m_sync.WantItemAction(((Item)val).Owner, (SyncedItemAction_New)0); } } } } internal sealed class RevivePlayerEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.RevivePlayer; protected override void TriggerMaster(WEE_EventData e) { //IL_00af: Unknown result type (might be due to invalid IL or missing references) if (e.RevivePlayer == null) { WEE_RevivePlayer wEE_RevivePlayer = (e.RevivePlayer = new WEE_RevivePlayer()); } HashSet hashSet = new HashSet(e.RevivePlayer.PlayerFilter.Select((PlayerIndex filter) => (int)filter)); for (int num = 0; num < PlayerManager.PlayerAgentsInLevel.Count; num++) { bool flag = num >= 4 && e.RevivePlayer.FullTeamOverflow && hashSet.Count == 4 && hashSet.Max() < 4; PlayerAgent val = PlayerManager.PlayerAgentsInLevel[num]; if ((flag || hashSet.Contains(num)) && !((Agent)val).Alive) { AgentReplicatedActions.PlayerReviveAction(val, val, ((Agent)val).Position); } } } } internal sealed class TeleportPlayerEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.TeleportPlayer; protected override void TriggerMaster(WEE_EventData e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Expected O, but got Unknown //IL_00fd: 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_0127: 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_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Unknown result type (might be due to invalid IL or missing references) //IL_02df: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_031b: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_0372: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Unknown result type (might be due to invalid IL or missing references) if ((int)GameStateManager.CurrentStateName != 10) { LogError("Not in level!!!"); return; } WEE_TeleportPlayer wEE_TeleportPlayer = e.TeleportPlayer ?? new WEE_TeleportPlayer(); List playerAgentsInLevel = PlayerManager.PlayerAgentsInLevel; if (wEE_TeleportPlayer.TPData.Count == 0) { bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(69, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("No TPData provided, we will convert! "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(base.Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has been changed (see AWO wiki)"); } LogWarning(val); HashSet hashSet = new HashSet(wEE_TeleportPlayer.PlayerFilter.Select((PlayerIndex filter) => (int)filter)); for (int num = 0; num < playerAgentsInLevel.Count; num++) { if (hashSet.Contains(num)) { var (position, lookDir) = num switch { 0 => (wEE_TeleportPlayer.Player0Position, wEE_TeleportPlayer.P0LookDir), 1 => (wEE_TeleportPlayer.Player1Position, wEE_TeleportPlayer.P1LookDir), 2 => (wEE_TeleportPlayer.Player2Position, wEE_TeleportPlayer.P2LookDir), 3 => (wEE_TeleportPlayer.Player3Position, wEE_TeleportPlayer.P3LookDir), _ => (((Agent)playerAgentsInLevel[num]).Position, 4), }; wEE_TeleportPlayer.TPData.Add(new WEE_TeleportPlayer.TeleportData { PlayerIndex = (PlayerIndex)num, Position = position, LookDir = lookDir, PlayWarpAnimation = wEE_TeleportPlayer.PlayWarpAnimation }); } } } Dictionary> dictionary = AssignWarpables(wEE_TeleportPlayer, playerAgentsInLevel); for (int num2 = 0; num2 < playerAgentsInLevel.Count; num2++) { bool flag2 = num2 >= 4 && wEE_TeleportPlayer.FullTeamOverflow && wEE_TeleportPlayer.TPData.Count == 4 && wEE_TeleportPlayer.TPData.Max((WEE_TeleportPlayer.TeleportData tpd) => (int)tpd.PlayerIndex) < 4; int p = (flag2 ? (num2 % 4) : num2); int num3 = wEE_TeleportPlayer.TPData.FindIndex((WEE_TeleportPlayer.TeleportData tpd) => (int)tpd.PlayerIndex == p); if (num3 != -1) { WEE_TeleportPlayer.TeleportData teleportData = wEE_TeleportPlayer.TPData[num3]; PlayerAgent val2 = playerAgentsInLevel[num2]; WEE_TeleportPlayer.TeleportData tpData = new WEE_TeleportPlayer.TeleportData { Player = val2, PlayerIndex = teleportData.PlayerIndex, Dimension = base.ResolveFieldsFallback(e.DimensionIndex, teleportData.Dimension, debug: false), Position = GetPositionFallback(base.ResolveFieldsFallback(e.Position, teleportData.Position, debug: false), ResolveFieldsFallback(LocaleText.op_Implicit(e.SpecialText), teleportData.WorldEventObjectFilter, debug: false)), LookDirV3 = base.ResolveFieldsFallback(GetLookDirV3(val2, teleportData.LookDir), teleportData.LookDirV3, debug: false), PlayWarpAnimation = (wEE_TeleportPlayer.PlayWarpAnimation || teleportData.PlayWarpAnimation), Duration = ResolveFieldsFallback(e.Duration, teleportData.Duration, wEE_TeleportPlayer.FlashTeleport), LastDimension = ((Agent)val2).DimensionIndex, LastPosition = ((Agent)val2).Position, LastLookDirV3 = CamDirIfNotBot(val2), ItemsToWarp = CollectionExtensions.GetOrAddNew>((IDictionary>)dictionary, num2) }; if (wEE_TeleportPlayer.FlashTeleport) { CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(FlashBack(tpData)), (Action)null); } DoTeleport(tpData); } } } private static Dictionary> AssignWarpables(WEE_TeleportPlayer tp, List lobby) { //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) Dictionary> dictionary = new Dictionary>(); Enumerator enumerator = Dimension.WarpableObjects.GetEnumerator(); while (enumerator.MoveNext()) { IWarpableObject current = enumerator.Current; SentryGunInstance val = ((Il2CppObjectBase)current).TryCast(); if ((Object)(object)val != (Object)null && tp.WarpSentries) { CollectionExtensions.GetOrAddNew>((IDictionary>)dictionary, lobby.IndexOf(((Item)val).Owner)).Add(current); continue; } ItemInLevel val2 = ((Il2CppObjectBase)current).TryCast(); if (!tp.FlashTeleport && tp.WarpBigPickups && lobby.Count == tp.TPData.Count && (Object)(object)val2 != (Object)null && val2.CanWarp && val2.internalSync.GetCurrentState().placement.droppedOnFloor) { CollectionExtensions.GetOrAddNew>((IDictionary>)dictionary, tp.SendBPUsToHost ? PlayerManager.GetLocalPlayerAgent().PlayerSlotIndex : BaseEvent.MasterRand.Next(lobby.Count)).Add(current); } } return dictionary; } private static IEnumerator FlashBack(WEE_TeleportPlayer.TeleportData tpData) { int reloadCount = CheckpointManager.CheckpointUsage; Logger.Verbose((LogLevel)32, $"{tpData.PlayerIndex} flash warp to {tpData.LastDimension} is queued..."); yield return (object)new WaitForSeconds(tpData.Duration); if ((int)GameStateManager.CurrentStateName == 10 && reloadCount >= CheckpointManager.CheckpointUsage) { Logger.Verbose((LogLevel)32, $"Warping {tpData.PlayerIndex} back to {tpData.LastDimension}"); tpData.Dimension = tpData.LastDimension; tpData.Position = tpData.LastPosition; tpData.LookDirV3 = ((tpData.LookDir != 4) ? tpData.LastLookDirV3 : CamDirIfNotBot(tpData.Player)); DoTeleport(tpData); } } private static void DoTeleport(WEE_TeleportPlayer.TeleportData tpData) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ea: Invalid comparison between Unknown and I4 //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_0115: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) if (tpData.Player.Owner.IsBot) { tpData.Player.TryWarpTo(tpData.Dimension, tpData.Position, Vector3.forward, false); } else { tpData.Player.Sync.SendSyncWarp(tpData.Dimension, tpData.Position, tpData.LookDirV3, (WarpOptions)(tpData.PlayWarpAnimation ? 7 : 4)); } foreach (IWarpableObject item in tpData.ItemsToWarp) { SentryGunInstance val = ((Il2CppObjectBase)item).TryCast(); if ((Object)(object)val != (Object)null && ((ItemEquippable)val).LocallyPlaced) { val.m_sync.WantItemAction(tpData.Player, (SyncedItemAction_New)0); continue; } ItemInLevel val2 = ((Il2CppObjectBase)item).TryCast(); if ((Object)(object)val2 != (Object)null && (int)val2.GetSyncComponent().GetCurrentState().status != 1) { val2.GetSyncComponent().AttemptPickupInteraction((ePickupItemInteractionType)1, (SNet_Player)null, ((Item)val2).pItemData.custom, tpData.Position, Quaternion.identity, CourseNodeUtil.GetCourseNode(tpData.Position, tpData.Dimension), true, true); } } } private static Vector3 GetLookDirV3(PlayerAgent player, int lookDir) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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_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_0035: 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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) return (Vector3)(lookDir switch { 0 => Vector3.forward, 1 => Vector3.left, 2 => Vector3.right, 3 => Vector3.back, 4 => CamDirIfNotBot(player), _ => Vector3.forward, }); } private static Vector3 CamDirIfNotBot(PlayerAgent player) { //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_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (player.Owner.IsBot) { return Vector3.forward; } if (((Agent)player).IsLocallyOwned) { Vector3 cameraRayDir = player.FPSCamera.CameraRayDir; return ((Vector3)(ref cameraRayDir)).normalized; } pPlayerLocomotion locomotionData = player.Sync.m_locomotionData; return ((MidResVector3_Normalized)(ref locomotionData.LookDir)).Value; } } internal sealed class StartEventLoop : BaseEvent { public static readonly ConcurrentDictionary ActiveEventLoops = new ConcurrentDictionary(); public override WEE_Type EventType => WEE_Type.StartEventLoop; protected override void OnSetup() { LevelAPI.OnLevelCleanup += OnLevelCleanup; } private void OnLevelCleanup() { CollectionExtensions.ForEachValue((IDictionary)ActiveEventLoops, (Action)delegate(Coroutine loop) { CoroutineManager.StopCoroutine(loop); }); ActiveEventLoops.Clear(); } protected override void TriggerCommon(WEE_EventData e) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Expected O, but got Unknown //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown WEE_StartEventLoop wEE_StartEventLoop = e.StartEventLoop ?? new WEE_StartEventLoop(); bool flag = default(bool); if (wEE_StartEventLoop.LoopDelay < 1f) { LogError("LoopDelay must be greater than or equal to 1.0 seconds"); } else if (!ActiveEventLoops.TryAdd(wEE_StartEventLoop.LoopIndex, null)) { BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(31, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("EventLoop "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(wEE_StartEventLoop.LoopIndex); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is already active..."); } LogError(val); } else { BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(26, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Starting EventLoop Index: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(wEE_StartEventLoop.LoopIndex); } LogDebug(val2); ActiveEventLoops[wEE_StartEventLoop.LoopIndex] = CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoLoop(wEE_StartEventLoop)), (Action)null); } } private static IEnumerator DoLoop(WEE_StartEventLoop sel) { int index = sel.LoopIndex; int repeatNum = 0; int repeatMax = sel.LoopCount; bool repeatInf = repeatMax == -1; List eData = ListExtensions.ToIl2Cpp(sel.EventsToActivate); int myReloadCount = CheckpointManager.CheckpointUsage; WaitForSeconds delay = new WaitForSeconds(sel.LoopDelay); Coroutine value; for (; repeatNum < repeatMax || repeatInf; repeatNum++) { if ((int)GameStateManager.CurrentStateName != 10 || myReloadCount < CheckpointManager.CheckpointUsage) { ActiveEventLoops.TryRemove(index, out value); yield break; } Logger.Debug("StartEventLoop", $"EventLoop {index} repeating #{repeatNum + 1}"); WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(eData, (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray)null); yield return delay; } Logger.Debug("StartEventLoop", $"EventLoop {index} is now done"); ActiveEventLoops.TryRemove(index, out value); } } internal sealed class StopEventLoop : BaseEvent { public override WEE_Type EventType => WEE_Type.StopEventLoop; protected override void TriggerCommon(WEE_EventData e) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected O, but got Unknown Coroutine value; if (e.Count == -1) { CollectionExtensions.ForEachValue((IDictionary)StartEventLoop.ActiveEventLoops, (Action)delegate(Coroutine loop) { CoroutineManager.StopCoroutine(loop); }); StartEventLoop.ActiveEventLoops.Clear(); LogDebug("Stopped all EventLoops"); } else if (StartEventLoop.ActiveEventLoops.TryRemove(e.Count, out value)) { CoroutineManager.StopCoroutine(value); bool flag = default(bool); BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(18, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Stopped EventLoop "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(e.Count); } LogDebug(val); } else { LogError("No active EventLoop found!"); } } } internal sealed class AddTerminalCommand : BaseEvent { public override WEE_Type EventType => WEE_Type.AddTerminalCommand; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerCommon(WEE_EventData e) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Expected O, but got Unknown //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Expected O, but got Unknown //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f4: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0318: Expected O, but got Unknown //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0327: Expected O, but got Unknown //IL_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0211: Unknown result type (might be due to invalid IL or missing references) //IL_0217: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); ChainedPuzzleDataBlock val5 = default(ChainedPuzzleDataBlock); foreach (WEE_AddTerminalCommand value in e.AddTerminalCommand.Values) { if (!TryGetTerminalFromZone(e, value.TerminalIndex, out LG_ComputerTerminal terminal)) { continue; } TERM_Command val = (TERM_Command)(byte)(50 + value.CommandNumber); if (terminal.m_command.m_commandsPerEnum.ContainsKey(val)) { BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(53, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("A command with index "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(val); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" is already present on terminal!"); } LogError(val2); break; } string text = SerialLookupManager.ParseTextFragments(LocaleText.op_Implicit(value.CommandDesc)); if (value.AutoIndentCommandDesc) { text = "" + text + ""; } List val3 = ListExtensions.ToIl2Cpp(value.CommandEvents); terminal.m_command.m_commandsPerEnum.Add(val, value.Command.ToLower()); terminal.m_command.m_commandsPerString.Add(value.Command.ToLower(), val); terminal.m_command.m_commandHelpStrings.Add(val, new LocalizedText { UntranslatedText = text, Id = 0u }); terminal.m_command.m_commandEventMap.Add(val, val3); ChainedPuzzleInstance val4 = null; for (int i = 0; i < val3.Count; i++) { WardenObjectiveEventData eventData = val3[i]; if (eventData.ChainPuzzle != 0) { if (!DataBlockUtil.TryGetBlock(eventData.ChainPuzzle, ref val5)) { BepInExWarningLogInterpolatedStringHandler val6 = new BepInExWarningLogInterpolatedStringHandler(47, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("Failed to find enabled ChainedPuzzleDataBlock "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted(eventData.ChainPuzzle); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("!"); } LogWarning(val6); continue; } AIG_CourseNode val7 = terminal.SpawnNode ?? CourseNodeUtil.GetCourseNode(terminal.m_position, e.DimensionIndex); val4 = ChainedPuzzleManager.CreatePuzzleInstance(val5, val7.m_area, terminal.m_wardenObjectiveSecurityScanAlign.position, terminal.m_wardenObjectiveSecurityScanAlign, eventData.UseStaticBioscanPoints); terminal.SetChainPuzzleForCommand(val, i, val4); } if ((Object)(object)val4 != (Object)null) { ChainedPuzzleInstance obj = val4; obj.OnPuzzleSolved += Action.op_Implicit((Action)delegate { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(eventData, (eWardenObjectiveEventTrigger)0, true, 0f); }); } } List list = value.PostCommandOutputs.ConvertAll((WEE_AddTerminalCommand.LocaleTerminalOutput locale) => locale.ToTerminalOutput()); if (value.ProgressWaitBeforeEvents) { TerminalOutput item = new TerminalOutput { LineType = (TerminalLineType)4, Output = new LocalizedText { UntranslatedText = Text.Get(401434557u), Id = 0u }, Time = 3f }; list.Insert(0, item); } terminal.m_command.m_commandPostOutputMap.Add(val, ListExtensions.ToIl2Cpp(list)); terminal.TrySyncSetCommandRule(val, value.SpecialCommandRule); } } } internal sealed class HideTerminalCommand : BaseEvent { public override WEE_Type EventType => WEE_Type.HideTerminalCommand; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerCommon(WEE_EventData e) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Expected I4, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0149: 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_016f: 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) bool flag = default(bool); foreach (WEE_HideTerminalCommand value in e.HideTerminalCommand.Values) { if (!TryGetTerminalFromZone(e, value.TerminalIndex, out LG_ComputerTerminal terminal)) { continue; } TERM_Command val = (TERM_Command)(byte)(50 + value.CommandNumber); TERM_Command val2; if (value.CommandNumber == 0 && (int)value.CommandEnum > 0) { val2 = value.CommandEnum; } else { if (!terminal.m_command.m_commandsPerEnum.ContainsKey(val)) { BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(69, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("No TERM_Command given, or (num "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(value.CommandNumber); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" -- enum "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted((int)value.CommandEnum); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(") does not exist on terminal!"); } LogError(val3); continue; } val2 = val; } if (value.DeleteCommand) { string text = terminal.m_command.m_commandsPerEnum[val2]; terminal.m_command.m_commandsPerEnum.Remove(val2); terminal.m_command.m_commandsPerString.Remove(text); terminal.m_command.m_commandHelpStrings.Remove(val2); terminal.m_command.m_commandEventMap.Remove(val2); terminal.m_command.m_commandPostOutputMap.Remove(val2); } else if (BaseEvent.IsMaster) { pComputerTerminalState state = terminal.m_stateReplicator.State; state.TryHideCommand(val2); terminal.m_stateReplicator.State = state; } } } } internal sealed class SetTerminalLog : BaseEvent { public static readonly Dictionary<(uint, string), Queue> LogEventQueue = new Dictionary<(uint, string), Queue>(); public override WEE_Type EventType => WEE_Type.SetTerminalLog; public override bool AllowArrayableGlobalIndex => true; protected override void OnSetup() { LevelAPI.OnLevelCleanup += OnLevelCleanup; } private void OnLevelCleanup() { LogEventQueue.Clear(); } protected override void TriggerCommon(WEE_EventData e) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: 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_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Expected O, but got Unknown foreach (WEE_SetTerminalLog value2 in e.SetTerminalLog.Values) { if (!TryGetTerminalFromZone(e, value2.TerminalIndex, out LG_ComputerTerminal term)) { continue; } string filename = value2.FileName.ToUpper(); switch (value2.Type) { case WEE_SetTerminalLog.LogEventType.Add: if (!LogAbsentOn(term)) { break; } if (value2.FileContent == LocaleText.Empty) { LogError("Terminal log's FileContent cannot be empty."); break; } term.AddLocalLog(new TerminalLogFileData { FileName = filename, FileContent = LocaleText.op_Implicit(value2.FileContent), FileContentOriginalLanguage = value2.FileContentOriginalLanguage, AttachedAudioFile = value2.AttachedAudioFile, AttachedAudioByteSize = value2.AttachedAudioByteSize, PlayerDialogToTriggerAfterAudio = value2.PlayerDialogToTriggerAfterAudio }, true); if (value2.EventsOnFileRead.Any()) { LogEventQueue[(term.SyncID, filename)] = new Queue(value2.EventsOnFileRead); } break; case WEE_SetTerminalLog.LogEventType.Remove: if (LogPresentOnSrc()) { term.RemoveLocalLog(filename); } break; case WEE_SetTerminalLog.LogEventType.Move: { if (!LogPresentOnSrc()) { break; } if (!value2.TryGetTargetTerminal(out LG_ComputerTerminal targetTerm)) { LogError("Failed to find target terminal"); } else if (LogAbsentOn(targetTerm)) { TerminalLogFileData val = term.GetLocalLogs()[filename]; targetTerm.AddLocalLog(val, true); term.RemoveLocalLog(filename); if (LogEventQueue.TryGetValue((term.SyncID, filename), out Queue value)) { LogEventQueue.Remove((term.SyncID, filename)); LogEventQueue[(targetTerm.SyncID, filename)] = value; } } break; } } bool LogAbsentOn(LG_ComputerTerminal t) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown if (!t.GetLocalLogs().ContainsKey(filename)) { return true; } bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(57, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("A log file with filename "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(filename); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" is already present on terminal!"); } LogError(val2); return false; } bool LogPresentOnSrc() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown if (term.GetLocalLogs().ContainsKey(filename)) { return true; } bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(57, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Source terminal does not contain log file with filename "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted(filename); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("!"); } LogError(val2); return false; } } } } internal sealed class UnhideTerminalCommand : BaseEvent { public override WEE_Type EventType => WEE_Type.UnhideTerminalCommand; public override bool AllowArrayableGlobalIndex => true; protected override void TriggerMaster(WEE_EventData e) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Invalid comparison between Unknown and I4 //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_00d8: Expected I4, but got Unknown bool flag = default(bool); foreach (WEE_UnhideTerminalCommand value in e.UnhideTerminalCommand.Values) { if (!TryGetTerminalFromZone(e, value.TerminalIndex, out LG_ComputerTerminal terminal)) { continue; } TERM_Command val = (TERM_Command)(byte)(50 + value.CommandNumber); TERM_Command val2; if (value.CommandNumber == 0 && (int)value.CommandEnum > 0) { val2 = value.CommandEnum; } else { if (!terminal.m_command.m_commandsPerEnum.ContainsKey(val)) { BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(69, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("No TERM_Command given, or (num "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted(value.CommandNumber); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" -- enum "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted((int)value.CommandEnum); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(") does not exist on terminal!"); } LogError(val3); continue; } val2 = val; } terminal.TrySyncSetCommandShow(val2); } } } internal class CompleteChainPuzzleEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.ForceCompleteChainPuzzle; protected override void TriggerMaster(WEE_EventData e) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown uint num = ((e.SpecialNumber > 0) ? ((uint)e.SpecialNumber) : e.ChainPuzzle); if (!TryGetCPInstance(num, out ChainedPuzzleInstance puzzleInstance) || !puzzleInstance.IsActive || puzzleInstance.IsSolved) { bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(51, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("An active chained puzzle with index "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" was not found!"); } LogError(val); } else { SolvePuzzleCores(puzzleInstance, e.Count); } } private static bool TryGetCPInstance(uint ID, [NotNullWhen(true)] out ChainedPuzzleInstance? puzzleInstance) { Enumerator enumerator = ChainedPuzzleManager.Current.m_instances.GetEnumerator(); while (enumerator.MoveNext()) { ChainedPuzzleInstance current = enumerator.Current; if (((GameDataBlockBase)(object)current.Data).persistentID == ID) { puzzleInstance = current; return true; } } puzzleInstance = null; return false; } private static void SolvePuzzleCores(ChainedPuzzleInstance puzzleInstance, int count) { Il2CppReferenceArray chainedPuzzleCores = puzzleInstance.m_chainedPuzzleCores; for (int i = 0; i < ((Il2CppArrayBase)(object)chainedPuzzleCores).Length && (i != count || count <= 0); i++) { SolveCore(((Il2CppArrayBase)(object)chainedPuzzleCores)[i]); } } private static void SolveCore(iChainedPuzzleCore core) { //IL_0136: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Invalid comparison between Unknown and I4 //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_0032: 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_0037: Invalid comparison between Unknown and I4 //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Invalid comparison between Unknown and I4 //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Invalid comparison between Unknown and I4 //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Invalid comparison between Unknown and I4 //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) CP_Cluster_Core val = ((Il2CppObjectBase)core).TryCast(); if ((Object)(object)val != (Object)null) { CP_Cluster_Sync val2 = ((Il2CppObjectBase)val.m_sync).Cast(); eClusterStatus status = val2.GetCurrentState().status; eClusterStatus val3 = status; if ((int)val3 != 1) { if ((int)val3 == 3) { return; } } else { iChainedPuzzleHolopathSpline spline = val.m_spline; if (spline != null) { ((Il2CppObjectBase)spline).Cast().m_sound.Post(EVENTS.BIOSCAN_TUBE_EMITTER_STOP, true); } } foreach (iChainedPuzzleCore item in (Il2CppArrayBase)(object)val.m_childCores) { SolveCore(item); } if (val2.m_syncRoutine != null) { ((MonoBehaviour)val2).StopCoroutine(val2.m_syncRoutine); val2.m_syncRoutine = null; } else if ((int)val2.GetCurrentState().status == 3) { return; } pClusterState latestState = val2.m_latestState; latestState.status = (eClusterStatus)3; latestState.progress = 1f; val2.m_latestState = latestState; val2.m_stateReplicator.State = latestState; return; } CP_Bioscan_Core val4 = ((Il2CppObjectBase)core).Cast(); CP_Bioscan_Sync val5 = ((Il2CppObjectBase)val4.m_sync).Cast(); eBioscanStatus status2 = val5.GetCurrentState().status; eBioscanStatus val6 = status2; if ((int)val6 != 1) { if ((int)val6 == 4) { return; } } else { iChainedPuzzleHolopathSpline spline2 = val4.m_spline; if (spline2 != null) { ((Il2CppObjectBase)spline2).Cast().m_sound.Post(EVENTS.BIOSCAN_TUBE_EMITTER_STOP, true); } } if (val4.IsMovable && !val4.m_movingComp.OnlyMoveWhenScannig) { val4.m_movingComp.StopMoving(); } if (val5.m_syncRoutine != null) { ((MonoBehaviour)val5).StopCoroutine(val5.m_syncRoutine); val5.m_syncRoutine = null; } pBioscanState latestState2 = val5.m_latestState; latestState2.status = (eBioscanStatus)4; latestState2.progress = 1f; val5.m_latestState = latestState2; val5.m_stateReplicator.State = latestState2; } } internal sealed class MoveExtractionWorldPositionEvent : BaseEvent { private static ScanPositionReplicator? EntranceScanReplicator; private static ScanPositionReplicator? ExitScanReplicator; public override WEE_Type EventType => WEE_Type.MoveExtractionWorldPosition; public static bool HasFailed { get; private set; } private string FailWarning(string scan, string tile) { return $"[{base.Name}] An issue occured setting up the {scan} scan replicator. There might be an issue with the {tile} tile? This event will not work in this level!"; } protected override void OnSetup() { LevelAPI.OnFactoryDone += PostFactoryDone; LevelAPI.OnLevelCleanup += delegate { HasFailed = false; }; } private void PostFactoryDone() { iWardenObjectiveWinConditionItem elevatorExitWinConditionItem = WardenObjectiveManager.m_elevatorExitWinConditionItem; ElevatorShaftLanding val = ((elevatorExitWinConditionItem != null) ? ((Il2CppObjectBase)elevatorExitWinConditionItem).TryCast() : null); iWardenObjectiveWinConditionItem customGeoExitWinConditionItem = WardenObjectiveManager.m_customGeoExitWinConditionItem; LG_LevelExitGeo val2 = ((customGeoExitWinConditionItem != null) ? ((Il2CppObjectBase)customGeoExitWinConditionItem).TryCast() : null); if ((Object)(object)val != (Object)null) { TrackWinConditionScan(val); } if ((Object)(object)val2 != (Object)null) { TrackWinConditionScan(val2); } } private void TrackWinConditionScan(ElevatorShaftLanding landing) { try { if (landing.m_puzzle.NRofPuzzles() == 1) { iChainedPuzzleCore puzzle = landing.m_puzzle.GetPuzzle(0); CP_Bioscan_Core val = ((Il2CppObjectBase)puzzle).TryCast(); if (!((Object)(object)val == (Object)null)) { ScanPositionReplicator scanPositionReplicator = ((Component)landing).gameObject.AddComponent(); scanPositionReplicator.Setup(10u, val, landing.m_marker, isExit: true); EntranceScanReplicator = scanPositionReplicator; } } } catch { Logger.Warn(FailWarning("entrance", "elevator")); EntranceScanReplicator = null; HasFailed = true; } } private void TrackWinConditionScan(LG_LevelExitGeo exitGeo) { try { if (exitGeo.m_puzzle.NRofPuzzles() == 1) { iChainedPuzzleCore puzzle = exitGeo.m_puzzle.GetPuzzle(0); CP_Bioscan_Core val = ((Il2CppObjectBase)puzzle).TryCast(); if (!((Object)(object)val == (Object)null)) { ScanPositionReplicator scanPositionReplicator = ((Component)exitGeo).gameObject.AddComponent(); scanPositionReplicator.Setup(20u, val, exitGeo.m_marker, isExit: true); EntranceScanReplicator = scanPositionReplicator; } } } catch { Logger.Warn(FailWarning("extraction", "exit")); ExitScanReplicator = null; HasFailed = true; } } protected override void TriggerMaster(WEE_EventData e) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0025: 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) Vector3 positionFallback = GetPositionFallback(e.Position, LocaleText.op_Implicit(e.SpecialText)); EntranceScanReplicator?.TryUpdatePosition(positionFallback); ExitScanReplicator?.TryUpdatePosition(positionFallback); if (HasFailed) { LogError("Failed replicator setup during LG_Factory build"); } } } internal sealed class PlayWaveDistantRoarEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.PlayWaveRoarSound; protected override void TriggerCommon(WEE_EventData e) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_00c1: 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_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0136: 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_0147: Unknown result type (might be due to invalid IL or missing references) CellSoundPlayer val = new CellSoundPlayer(); WEE_PlayWaveDistantRoar wEE_PlayWaveDistantRoar = e.WaveRoarSound ?? new WEE_PlayWaveDistantRoar(); CellSoundPlayer val2 = val; uint gROUP = ENEMY_TYPE.GROUP; val2.SetSwitch(gROUP, wEE_PlayWaveDistantRoar.RoarSound switch { WEE_PlayWaveDistantRoar.WaveRoarSound.Shooter => SWITCH.SHOOTER, WEE_PlayWaveDistantRoar.WaveRoarSound.Birther => SWITCH.BIRTHER, WEE_PlayWaveDistantRoar.WaveRoarSound.Shadow => SWITCH.SHADOW, WEE_PlayWaveDistantRoar.WaveRoarSound.Tank => SWITCH.TANK, WEE_PlayWaveDistantRoar.WaveRoarSound.Flyer => SWITCH.FLYER, WEE_PlayWaveDistantRoar.WaveRoarSound.Immortal => SWITCH.IMMORTAL, WEE_PlayWaveDistantRoar.WaveRoarSound.Bullrush => SWITCH.BULLRUSHER, WEE_PlayWaveDistantRoar.WaveRoarSound.Pouncer => SWITCH.POUNCER, WEE_PlayWaveDistantRoar.WaveRoarSound.Striker_Berserk => SWITCH.STRIKER_BERSERK, WEE_PlayWaveDistantRoar.WaveRoarSound.Shooter_Spread => SWITCH.SHOOTER_SPREAD, _ => SWITCH.STRIKER, }); CellSoundPlayer val3 = val; uint gROUP2 = ROAR_SIZE.GROUP; val3.SetSwitch(gROUP2, wEE_PlayWaveDistantRoar.RoarSize switch { WEE_PlayWaveDistantRoar.WaveRoarSize.Medium => SWITCH.MEDIUM, WEE_PlayWaveDistantRoar.WaveRoarSize.Big => SWITCH.BIG, _ => SWITCH.SMALL, }); val.SetSwitch(ENVIROMENT.GROUP, wEE_PlayWaveDistantRoar.IsOutside ? SWITCH.DESERT : SWITCH.COMPLEX); GameObjectPlusExtensions.PostWithCleanup(val, EVENTS.PLAY_WAVE_DISTANT_ROAR, GetPositionFallback(e.Position, LocaleText.op_Implicit(e.SpecialText)), 1u); } } internal sealed class SetBlackoutEnabledEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.SetBlackoutEnabled; protected override void TriggerMaster(WEE_EventData e) { EntryPoint.BlackoutState.SetEnabled(e.Enabled); } } internal sealed class SetExpeditionEnvironmentEvent : BaseEvent { private static ExpeditionData? _activeExpedition; private static float _cachedRealityWetness; private static Color _cachedRealityDustColor; private static float _cachedRealityDustTurbulence; public override WEE_Type EventType => WEE_Type.SetExpeditionEnvironment; protected override void OnSetup() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown LevelAPI.OnLevelDataUpdated += new LevelDataUpdateEvent(OnLevelDataUpdated); LevelAPI.OnBuildStart += OnBuildStart; LevelAPI.OnLevelCleanup += OnLevelCleanup; } private void OnLevelDataUpdated(ActiveExpedition activeExp, ExpeditionInTierData expData) { _activeExpedition = expData.Expedition; } private void OnBuildStart() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) if (_activeExpedition != null) { _cachedRealityWetness = _activeExpedition.EnvironmentWetness; _cachedRealityDustColor = _activeExpedition.DustColor; _cachedRealityDustTurbulence = _activeExpedition.DustTurbulence; } } private void OnLevelCleanup() { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (_activeExpedition != null) { _activeExpedition.EnvironmentWetness = _cachedRealityWetness; _activeExpedition.DustColor = _cachedRealityDustColor; _activeExpedition.DustTurbulence = _cachedRealityDustTurbulence; } } protected override void TriggerCommon(WEE_EventData e) { //IL_0002: 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_0049: Invalid comparison between Unknown and I4 //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_0114: 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_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_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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) Dimension val = default(Dimension); if (!Dimension.GetDimension(e.DimensionIndex, ref val) || val.DimensionData == null) { LogError("Dimension does not exist, or unable to find DimensionData?"); return; } WEE_SetExpeditionEnvironment wEE_SetExpeditionEnvironment = e.EnvironmentData ?? new WEE_SetExpeditionEnvironment(); ValueBase val2; if ((int)e.DimensionIndex == 0) { if (_activeExpedition != null) { ExpeditionData? activeExpedition = _activeExpedition; val2 = wEE_SetExpeditionEnvironment.EnvironmentWetness; activeExpedition.EnvironmentWetness = ((ValueBase)(ref val2)).GetAbsValue(_activeExpedition.EnvironmentWetness); _activeExpedition.DustColor = (wEE_SetExpeditionEnvironment.UpdateColor ? wEE_SetExpeditionEnvironment.DustColor : _activeExpedition.DustColor); ExpeditionData? activeExpedition2 = _activeExpedition; val2 = wEE_SetExpeditionEnvironment.DustTurbulence; activeExpedition2.DustTurbulence = ((ValueBase)(ref val2)).GetAbsValue(_activeExpedition.DustTurbulence); } } else { DimensionData dimensionData = val.DimensionData; val2 = wEE_SetExpeditionEnvironment.EnvironmentWetness; dimensionData.EnvironmentWetness = ((ValueBase)(ref val2)).GetAbsValue(dimensionData.EnvironmentWetness); dimensionData.DustColor = (wEE_SetExpeditionEnvironment.UpdateColor ? wEE_SetExpeditionEnvironment.DustColor : dimensionData.DustColor); val2 = wEE_SetExpeditionEnvironment.DustAlphaBoost; dimensionData.DustAlphaBoost = ((ValueBase)(ref val2)).GetAbsValue(dimensionData.DustAlphaBoost); val2 = wEE_SetExpeditionEnvironment.DustTurbulence; dimensionData.DustTurbulence = ((ValueBase)(ref val2)).GetAbsValue(dimensionData.DustTurbulence); } } } internal sealed class SetLightDataInZoneEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.SetLightDataInZone; public override bool AllowArrayableGlobalIndex => true; protected override void OnSetup() { LevelAPI.OnAfterBuildBatch += OnAfterBuildBatch; } private void OnAfterBuildBatch(BatchName batch) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Invalid comparison between Unknown and I4 if ((int)batch == 61) { Enumerator enumerator = Builder.CurrentFloor.allZones.GetEnumerator(); while (enumerator.MoveNext()) { LG_Zone current = enumerator.Current; ((Component)current).gameObject.AddComponent().Setup(); } } } protected override void TriggerMaster(WEE_EventData e) { if (!TryGetZone(e, out LG_Zone zone)) { return; } WEE_ZoneLightData wEE_ZoneLightData = e.SetZoneLight ?? new WEE_ZoneLightData(); ZoneLightReplicator zoneLightReplicator = default(ZoneLightReplicator); if (!GameObjectPlusExtensions.TryAndGetComponent(((Component)zone).gameObject, ref zoneLightReplicator)) { LogError("Unable to find ZoneLightReplicator component in zone?"); return; } switch (wEE_ZoneLightData.Type) { case WEE_ZoneLightData.ModifierType.RevertToOriginal: zoneLightReplicator.RevertLightData(); break; case WEE_ZoneLightData.ModifierType.SetZoneLightData: zoneLightReplicator.SetLightSetting(new ZoneLightState { transitionToOriginal = false, lightData = wEE_ZoneLightData.LightDataID, lightSeed = (wEE_ZoneLightData.UseRandomSeed ? BaseEvent.MasterRand.Next(int.MinValue, int.MaxValue) : wEE_ZoneLightData.Seed), duration = wEE_ZoneLightData.TransitionDuration }); break; case WEE_ZoneLightData.ModifierType.TransitionToOriginal: zoneLightReplicator.SetLightSetting(new ZoneLightState { transitionToOriginal = true, lightData = (((GameDataBlockBase)(object)zone.m_lightSettings)?.persistentID ?? 0), lightSeed = zone.ID + 1, duration = wEE_ZoneLightData.TransitionDuration }); break; } } } internal sealed class SetOutsideDimensionDataEvent : BaseEvent { private static readonly Func[] _baseFields = new Func[23] { (WEE_SetOutsideDimensionData d) => d.LightAzimuth, (WEE_SetOutsideDimensionData d) => d.LightElevation, (WEE_SetOutsideDimensionData d) => d.LightIntensity, (WEE_SetOutsideDimensionData d) => d.AmbientIntensity, (WEE_SetOutsideDimensionData d) => d.ReflectionsIntensity, (WEE_SetOutsideDimensionData d) => d.GodrayRange, (WEE_SetOutsideDimensionData d) => d.GodrayExponent, (WEE_SetOutsideDimensionData d) => d.AtmosphereDensity, (WEE_SetOutsideDimensionData d) => d.Exposure, (WEE_SetOutsideDimensionData d) => d.AerialScale, (WEE_SetOutsideDimensionData d) => d.MieScattering, (WEE_SetOutsideDimensionData d) => d.MieG, (WEE_SetOutsideDimensionData d) => d.MultipleScattering, (WEE_SetOutsideDimensionData d) => d.CloudsCoverage, (WEE_SetOutsideDimensionData d) => d.CloudsDensity, (WEE_SetOutsideDimensionData d) => d.CloudsSharpness, (WEE_SetOutsideDimensionData d) => d.CloudsShadowOpacity, (WEE_SetOutsideDimensionData d) => d.CloudsTimescale, (WEE_SetOutsideDimensionData d) => d.CloudsCrawling, (WEE_SetOutsideDimensionData d) => d.CloudsFade, (WEE_SetOutsideDimensionData d) => d.SandstormEdgeA, (WEE_SetOutsideDimensionData d) => d.SandstormEdgeB, (WEE_SetOutsideDimensionData d) => d.SandstormMinFog }; public override WEE_Type EventType => WEE_Type.SetOutsideDimensionData; protected override void OnSetup() { LevelEvents.OnBuildDoneLate += OnBuildDoneLate; } private void OnBuildDoneLate() { Enumerator enumerator = Builder.CurrentFloor.m_dimensions.GetEnumerator(); while (enumerator.MoveNext()) { Dimension current = enumerator.Current; ((Component)current.DimensionLevel).gameObject.AddComponent().Setup(current); } } protected unsafe override void TriggerMaster(WEE_EventData e) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) Dimension val = default(Dimension); OutsideDataReplicator outsideDataReplicator = default(OutsideDataReplicator); if (!Dimension.GetDimension(e.DimensionIndex, ref val) || !GameObjectPlusExtensions.TryAndGetComponent(((Component)val.DimensionLevel).gameObject, ref outsideDataReplicator) || !((Behaviour)outsideDataReplicator).enabled) { LogError("Dimension does not exist, or unable to find enabled OutsideDataReplicator in dimension?"); return; } WEE_SetOutsideDimensionData wEE_SetOutsideDimensionData = e.DimensionData ?? new WEE_SetOutsideDimensionData(); OutsideDataState outsideDataState = new OutsideDataState { duration = e.Duration, revertToOriginal = !e.Enabled, isOutside = wEE_SetOutsideDimensionData.IsOutside, atmosphereData = wEE_SetOutsideDimensionData.AtmosphereData, cloudsData = wEE_SetOutsideDimensionData.CloudsData }; BoolBase sandstorm = wEE_SetOutsideDimensionData.Sandstorm; outsideDataState.sandstorm = ((BoolBase)(ref sandstorm)).GetValue(outsideDataReplicator.OutsideData.Sandstorm); OutsideDataState outsideData = outsideDataState; PackFields(wEE_SetOutsideDimensionData, outsideDataReplicator.OutsideData, outsideData.fieldData); outsideDataReplicator.SetOutsideData(outsideData); } private unsafe static void PackFields(WEE_SetOutsideDimensionData d, DimensionData r, float* dest) { //IL_000e: 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_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < _baseFields.Length; i++) { ValueBase val = _baseFields[i](d); float num = OutsideDataReplicator.FieldMap[i].Get(r); dest[i] = (((int)val.Mode == 0 && val.Value == 1f) ? float.NaN : ((ValueBase)(ref val)).GetAbsValue(num)); } } } } namespace AWO.Modules.WEE.Events.HUD { internal sealed class FadeScreenEvent : BaseEvent { public override WEE_Type EventType => WEE_Type.FadeScreenInOut; protected override void TriggerCommon(WEE_EventData e) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) CM_PreSuccessScreen_FadeOut val = ComponentExt.AddChildGameObject((Component)(object)Builder.GetElevatorArea(), "AWO_FadeScreenEvent"); WEE_FadeScreenInOut wEE_FadeScreenInOut = e.FadeScreen ?? new WEE_FadeScreenInOut(); val.m_fadeColor = wEE_FadeScreenInOut.FadeColor; val.m_curve = AnimationCurve.EaseInOut(wEE_FadeScreenInOut.CurveTimeStart, wEE_FadeScreenInOut.CurveValueStart, wEE_FadeScreenInOut.CurveTimeEnd, wEE_FadeScreenInOut.CurveValueEnd); val.m_fadeSpeed = wEE_FadeScreenInOut.FadeSpeed; } } } namespace AWO.Modules.WEE.Detours { internal static class Detour_ExecuteEvent { public unsafe delegate byte MoveNextDel(IntPtr _this, Il2CppMethodInfo* methodInfo); public const byte IL2CPP_TRUE = 1; public const byte IL2CPP_FALSE = 0; private static INativeDetour _Detour; private static MoveNextDel _Original; public unsafe static void Patch() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown Type[] nestedTypes = typeof(WorldEventManager).GetNestedTypes(); Type type = null; Type[] array = nestedTypes; bool flag = default(bool); foreach (Type type2 in array) { if (type2?.Name?.Contains("DoExcecuteEvent", StringComparison.InvariantCulture) == true) { type = type2; BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(18, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Found Patch Type: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(type2?.Name); } Logger.Debug(val); break; } } if (type == null) { Logger.Error("Unable to find generated IEnumerator!"); return; } IntPtr nativeClassPointer = Il2CppClassPointerStore.GetNativeClassPointer(type); if (nativeClassPointer == IntPtr.Zero) { Logger.Error("Unable to get Il2Cpp Clazz Ptr!"); return; } void* il2CppMethod = GetIl2CppMethod(nativeClassPointer, "MoveNext", typeof(bool).FullName); if (il2CppMethod == null) { Logger.Error("Unable to find method: MoveNext!"); } else if (ExecuteEventContext.TrySetup(nativeClassPointer)) { _Detour = INativeDetour.CreateAndApply((IntPtr)(nint)il2CppMethod, (MoveNextDel)Detour, ref _Original); Logger.Debug("Detour has finished setup!"); } else { Logger.Error("Unable to setup ExecuteEventContext!"); } } private unsafe static byte Detour(IntPtr _this, Il2CppMethodInfo* methodInfo) { //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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected I4, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Expected I4, but got Unknown //IL_00b9: 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: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Expected O, but got Unknown //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected I4, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected I4, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) ExecuteEventContext executeEventContext = new ExecuteEventContext(_this); WardenObjectiveEventData data = executeEventContext.Data; eWardenObjectiveEventType type = data.Type; bool flag = default(bool); BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(30, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("We got Type "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted((int)type); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" on a Warden Event"); } Logger.Debug(val); if (Enum.IsDefined(typeof(WEE_Type), (int)type)) { val = new BepInExDebugLogInterpolatedStringHandler(52, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Found WardenEventExt for '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted((WEE_Type)type); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("', aborting original call!"); } Logger.Debug(val); WardenEventExt.HandleEvent((WEE_Type)type, data, executeEventContext.CurrentDuration); executeEventContext.State = -1; return 0; } if (VanillaEventOvr.HasOverride(type, data)) { val = new BepInExDebugLogInterpolatedStringHandler(64, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Found valid VanillaEventOverride for '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(type); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("', aborting original call!"); } Logger.Debug(val); VanillaEventOvr.HandleEvent(type, data, executeEventContext.CurrentDuration); executeEventContext.State = -1; return 0; } return _Original(_this, methodInfo); } private unsafe static void* GetIl2CppMethod(IntPtr clazz, string methodName, string returnTypeName) { void** ptr = (void**)IL2CPP.GetIl2CppMethod(clazz, false, methodName, returnTypeName, Array.Empty()).ToPointer(); return (ptr == null) ? ptr : (*ptr); } } internal sealed class ExecuteEventContext { private readonly IntPtr _BasePtr; public static IntPtr ClazzPtr { get; private set; } public static IntPtr Field_eData_Ptr { get; private set; } = IntPtr.Zero; public static IntPtr Field_currentDuration_Ptr { get; private set; } = IntPtr.Zero; public static IntPtr Field_state_Ptr { get; private set; } = IntPtr.Zero; public static int StateFieldOffset => (int)IL2CPP.il2cpp_field_get_offset(Field_state_Ptr); public static int CurrentDurationFieldOffset => (int)IL2CPP.il2cpp_field_get_offset(Field_currentDuration_Ptr); public static int DataFieldOffset => (int)IL2CPP.il2cpp_field_get_offset(Field_eData_Ptr); public unsafe WardenObjectiveEventData Data { get { //IL_0022: Unknown result type (might be due to invalid IL or missing references) IntPtr intPtr = *(IntPtr*)(_BasePtr + DataFieldOffset).ToPointer(); return (intPtr == (IntPtr)0) ? ((WardenObjectiveEventData)null) : new WardenObjectiveEventData(intPtr); } set { IntPtr intPtr = _BasePtr + DataFieldOffset; IL2CPP.il2cpp_gc_wbarrier_set_field(_BasePtr, intPtr, IL2CPP.Il2CppObjectBaseToPtr((Il2CppObjectBase)(object)value)); } } public unsafe float CurrentDuration { get { IntPtr intPtr = _BasePtr + CurrentDurationFieldOffset; return *(float*)(void*)intPtr; } set { *(float*)((nint)_BasePtr + CurrentDurationFieldOffset) = value; } } public unsafe int State { get { IntPtr intPtr = _BasePtr + StateFieldOffset; return *(int*)(void*)intPtr; } set { *(int*)((nint)_BasePtr + StateFieldOffset) = value; } } public static bool TrySetup(IntPtr clazz) { ClazzPtr = clazz; Field_eData_Ptr = IL2CPP.GetIl2CppField(ClazzPtr, "eData"); if (Field_eData_Ptr == IntPtr.Zero) { Logger.Error("Unable to find 'eData' Field!"); return false; } Field_currentDuration_Ptr = IL2CPP.GetIl2CppField(ClazzPtr, "currentDuration"); if (Field_currentDuration_Ptr == IntPtr.Zero) { Logger.Error("Unable to find 'currentDuration' Field!"); return false; } FindStateField(); return true; } private static void FindStateField() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown IntPtr zero = IntPtr.Zero; IntPtr intPtr; bool flag = default(bool); while ((intPtr = IL2CPP.il2cpp_class_get_fields(ClazzPtr, ref zero)) != IntPtr.Zero) { string text = Marshal.PtrToStringAnsi(IL2CPP.il2cpp_field_get_name(intPtr)); if (text != null && text.Contains("_state", StringComparison.InvariantCultureIgnoreCase)) { BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(21, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Found State Field: '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'"); } Logger.Debug(val); Field_state_Ptr = intPtr; break; } } } public ExecuteEventContext(IntPtr ptr) { _BasePtr = ptr; } } } namespace AWO.Modules.TSL { [HarmonyPatch] internal static class Patch_IncomingFragments { [HarmonyPatch(typeof(WardenObjectiveManager), "ReplaceFragmentsInString")] [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_ReplaceFragments(ref string __result) { __result = SerialLookupManager.ParseTextFragments(__result); } [HarmonyPatch(typeof(LG_SecurityDoor_Locks), "OnDoorState")] [HarmonyPostfix] [HarmonyPriority(200)] [HarmonyWrapSafe] private static void InteractText_OnDoorState(LG_SecurityDoor_Locks __instance, pDoorState state) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Invalid comparison between Unknown and I4 if ((int)state.status == 5 || (int)state.status == 4) { __instance.m_intOpenDoor.InteractionMessage = SerialLookupManager.ParseTextFragments(__instance.m_intOpenDoor.InteractionMessage); __instance.m_intCustomMessage.m_message = SerialLookupManager.ParseTextFragments(__instance.m_intCustomMessage.m_message); } } } public static class SerialLookupManager { public static readonly Dictionary>> SerialMap = new Dictionary>>(); private const string Pattern = "\\[(?.+?)_(?:(?:[^\\d_]*)(?\\d+))_(?:(?:[^\\d_]*)(?\\d+))_(?:(?:[^\\d_]*)(?\\d+))(?:_(?\\d+))?\\]"; private const string Terminal = "TERMINAL"; private const string Zone = "ZONE"; private static readonly string Module = "SerialLookupManager"; public static event Action? OnEnterParseText; internal static void Init() { LevelAPI.OnBuildDone += BuildSerialMap; LevelAPI.OnEnterLevel += OnEnterLevel; LevelAPI.OnLevelCleanup += Cleanup; InteropAPI.RegisterCall("TSL.ParseTextFragments", (Func)((object[] args) => (args != null && args.Length != 0 && args[0] is string input) ? ParseTextFragments(input) : null)); } private static void BuildSerialMap() { //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_045f: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Invalid comparison between Unknown and I4 //IL_02c4: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d1: Unknown result type (might be due to invalid IL or missing references) //IL_02d8: Invalid comparison between Unknown and I4 //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02e3: Invalid comparison between Unknown and I4 //IL_032d: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Unknown result type (might be due to invalid IL or missing references) //IL_0339: Invalid comparison between Unknown and I4 //IL_033b: Unknown result type (might be due to invalid IL or missing references) //IL_033f: Invalid comparison between Unknown and I4 //IL_0359: Unknown result type (might be due to invalid IL or missing references) Logger.Verbose((LogLevel)32, "Building serial map..."); int num = 0; Enumerator enumerator = LG_LevelInteractionManager.GetAllTerminalInterfaces().GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair current = enumerator.Current; try { if (current.Key == null) { continue; } iTerminalItem value = current.Value; if (((value != null) ? value.SpawnNode : null) == null) { continue; } int num2 = current.Key.LastIndexOf('_'); if (num2 == -1) { continue; } string text = current.Key.Substring(0, num2); string text2 = current.Key.Substring(num2 + 1); if ((int)current.Value.FloorItemType != 4) { if (!int.TryParse(text2, out var _)) { Logger.Warn(Module, current.Key + " does not have a serial number"); continue; } (int, int, int) tuple = GlobalIndexUtil.ToIntTuple(current.Value.SpawnNode.m_zone); CollectionExtensions.GetOrAddNew<(int, int, int), List>((IDictionary<(int, int, int), List>)CollectionExtensions.GetOrAddNew>>((IDictionary>>)SerialMap, text), tuple).Add(text2); num++; } } catch (Exception value2) { Logger.Verbose((LogLevel)2, $"We encountered an exception iterating through LG_LevelInteractionManager.GetAllTerminalInterfaces [{num + 1}]:\n{value2}"); } } Enumerator enumerator2 = Builder.CurrentFloor.allZones.GetEnumerator(); while (enumerator2.MoveNext()) { LG_Zone current2 = enumerator2.Current; try { if ((Object)(object)current2 == (Object)null) { continue; } (int, int, int) tuple2 = GlobalIndexUtil.ToIntTuple(current2); CollectionExtensions.GetOrAddNew<(int, int, int), List>((IDictionary<(int, int, int), List>)CollectionExtensions.GetOrAddNew>>((IDictionary>>)SerialMap, "ZONE"), tuple2).Add(current2.Alias.ToString()); num++; if (current2.TerminalsSpawnedInZone == null) { continue; } Enumerator enumerator3 = current2.TerminalsSpawnedInZone.GetEnumerator(); while (enumerator3.MoveNext()) { LG_ComputerTerminal current3 = enumerator3.Current; if ((Object)(object)current3 == (Object)null) { continue; } int num3 = current3.m_terminalItem.TerminalItemKey.LastIndexOf('_'); if (num3 == -1) { continue; } string item = current3.m_terminalItem.TerminalItemKey.Substring(num3 + 1); CollectionExtensions.GetOrAddNew<(int, int, int), List>((IDictionary<(int, int, int), List>)CollectionExtensions.GetOrAddNew>>((IDictionary>>)SerialMap, "TERMINAL"), tuple2).Add(item); num++; LG_ComputerTerminalCommandInterpreter cmdInterpreter = current3.m_command; Enumerator enumerator4 = cmdInterpreter.m_commandHelpStrings.Keys.GetEnumerator(); while (enumerator4.MoveNext()) { TERM_Command key = enumerator4.Current; if ((int)key >= 38 && (int)key <= 42) { OnEnterParseText += delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) cmdInterpreter.m_commandHelpStrings[key] = LocaleText.op_Implicit(ParseLocaleText(new LocaleText(cmdInterpreter.m_commandHelpStrings[key]))); }; } } Enumerator> enumerator5 = cmdInterpreter.m_commandPostOutputMap.Keys.GetEnumerator(); while (enumerator5.MoveNext()) { TERM_Command current4 = enumerator5.Current; if ((int)current4 < 38 || (int)current4 > 42) { continue; } Enumerator enumerator6 = cmdInterpreter.m_commandPostOutputMap[current4].GetEnumerator(); while (enumerator6.MoveNext()) { TerminalOutput postCmd = enumerator6.Current; OnEnterParseText += delegate { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) postCmd.Output = LocaleText.op_Implicit(ParseLocaleText(new LocaleText(postCmd.Output))); }; } } LG_Gate sourceGate = current2.m_sourceGate; object obj; if (sourceGate == null) { obj = null; } else { iLG_Door_Core spawnedDoor = sourceGate.SpawnedDoor; if (spawnedDoor == null) { obj = null; } else { LG_SecurityDoor obj2 = ((Il2CppObjectBase)spawnedDoor).TryCast(); if (obj2 == null) { obj = null; } else { iLG_Door_Locks locks = obj2.m_locks; obj = ((locks != null) ? ((Il2CppObjectBase)locks).TryCast() : null); } } } LG_SecurityDoor_Locks locks2 = (LG_SecurityDoor_Locks)obj; if (!((Object)(object)locks2 == (Object)null)) { OnEnterParseText += delegate { locks2.m_intCustomMessage.m_message = ParseTextFragments(locks2.m_intCustomMessage.m_message); locks2.m_intOpenDoor.InteractionMessage = ParseTextFragments(locks2.m_intOpenDoor.InteractionMessage); locks2.m_intUseKeyItem.m_msgNeedItemHeader = ParseTextFragments(locks2.m_intUseKeyItem.m_msgNeedItemHeader); }; } } } catch (Exception value3) { Logger.Verbose((LogLevel)2, $"We encountered an exception iterating through ({current2.DimensionIndex}, {current2.Layer.m_type}, {current2.LocalIndex})'s TerminalsSpawnedInZone:\n{value3}"); } } Logger.Verbose((LogLevel)32, PrintSerialMap()); Logger.Info(Module, $"On build done, collected {num} serial numbers"); } private static void OnEnterLevel() { SafeInvoke.Invoke(SerialLookupManager.OnEnterParseText); } private static void Cleanup() { SerialMap.Clear(); SerialLookupManager.OnEnterParseText = null; } public static LocaleText ParseLocaleText(LocaleText input) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) if (input == LocaleText.Empty) { return input; } string text = ParseTextFragments(LocaleText.op_Implicit(input)); if (text == LocaleText.op_Implicit(input)) { return input; } input.ID = 0u; input.RawText = text; return input; } public static string ParseTextFragments(string input) { if (Utility.IsNullOrWhiteSpace(input)) { return input; } List<(int start, int end)> spans = new List<(int, int)>(); Stack stack = new Stack(); for (int i = 0; i < input.Length; i++) { if (input[i] == '[') { stack.Push(i); } else if (input[i] == ']' && stack.Count > 0) { int item = stack.Pop(); spans.Add((item, i)); } } StringBuilder stringBuilder = new StringBuilder(input); List<(int, int)> list = spans.Where(((int start, int end) s) => !spans.Any(((int start, int end) t) => t.start > s.start && t.end < s.end)).ToList(); foreach (var item4 in list) { int item2 = item4.Item1; int item3 = item4.Item2; string text = input.Substring(item2, item3 - item2 + 1); Match match = Regex.Match(text, "\\[(?.+?)_(?:(?:[^\\d_]*)(?\\d+))_(?:(?:[^\\d_]*)(?\\d+))_(?:(?:[^\\d_]*)(?\\d+))(?:_(?\\d+))?\\]"); if (match.Success && TryFindSerialNumber(match, out string serialStr)) { stringBuilder.Replace(text, serialStr); } } return stringBuilder.ToString(); } public static bool TryFindSerialNumber(Match match, out string serialStr) { string value = match.Groups["ItemName"].Value; int num = int.Parse(match.Groups["Dimension"].Value); int num2 = int.Parse(match.Groups["Layer"].Value); int num3 = int.Parse(match.Groups["Zone"].Value); int num4 = (match.Groups["InstanceIndex"].Success ? int.Parse(match.Groups["InstanceIndex"].Value) : 0); (int, int, int) key = (num, num2, num3); if (SerialMap.TryGetValue(value, out Dictionary<(int, int, int), List> value2) && value2.TryGetValue(key, out var value3) && num4 < value3.Count) { string value4 = value3[num4]; serialStr = $"{value}{((value != "ZONE") ? "_" : " ")}{value4}"; return true; } serialStr = match.Value; Logger.Error(Module, $"No match found for TerminalItem: '{value}' in (D{num}, L{num2}, Z{num3}) at instance #{num4}"); return false; } public static string PrintSerialMap() { StringBuilder stringBuilder = new StringBuilder(); foreach (KeyValuePair>> item in SerialMap) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(6, 1, stringBuilder2); handler.AppendLiteral("Item: "); handler.AppendFormatted(item.Key); stringBuilder3.AppendLine(ref handler); foreach (KeyValuePair<(int, int, int), List> item2 in item.Value) { stringBuilder2 = stringBuilder; StringBuilder stringBuilder4 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(12, 3, stringBuilder2); handler.AppendLiteral("\t(D"); handler.AppendFormatted(item2.Key.Item1); handler.AppendLiteral(", L"); handler.AppendFormatted(item2.Key.Item2); handler.AppendLiteral(", Z"); handler.AppendFormatted(item2.Key.Item3); handler.AppendLiteral("): "); stringBuilder4.Append(ref handler); if (item2.Value.Count > 0) { stringBuilder.AppendLine(string.Join(", ", item2.Value)); } } } return $"TERMINAL SERIAL MAP\n{stringBuilder}"; } } } namespace AWO.Jsons { [JsonConverter(typeof(ArrayableConverterFactory))] public struct Arrayable { public IReadOnlyList Values { get; } public readonly bool IsEmpty => Values.Count == 0; public readonly bool IsSingle => Values.Count == 1; public readonly T First => IsEmpty ? default(T) : Values[0]; public readonly T this[int index] => Values[index]; public Arrayable() { Values = Array.Empty(); } public Arrayable(T value) { Values = new T[1] { value }; } public Arrayable(IEnumerable values) { Values = new List(values); } public readonly IEnumerator GetEnumerator() { return Values.GetEnumerator(); } public static implicit operator Arrayable(T value) { return new Arrayable(value); } public static implicit operator Arrayable(T[] values) { return new Arrayable(values); } public static implicit operator Arrayable(List values) { return new Arrayable(values); } public static implicit operator T(Arrayable arrayable) { return arrayable.First; } public override readonly string ToString() { object result; if (!IsSingle) { result = "[" + string.Join(", ", Values) + "]"; } else { T val = Values[0]; result = ((val != null) ? val.ToString() : null) ?? "null"; } return (string)result; } } public class ArrayableConverter : JsonConverter> { public override Arrayable Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType == JsonTokenType.StartArray) { List values = JsonSerializer.Deserialize>(ref reader, options); return new Arrayable(values); } T value = JsonSerializer.Deserialize(ref reader, options); return new Arrayable(value); } public override void Write(Utf8JsonWriter writer, Arrayable value, JsonSerializerOptions options) { if (value.Values == null) { writer.WriteNullValue(); return; } writer.WriteStartArray(); foreach (T value2 in value.Values) { JsonSerializer.Serialize(writer, value2, options); } writer.WriteEndArray(); } } public class ArrayableConverterFactory : JsonConverterFactory { public override bool CanConvert(Type typeToConvert) { return typeToConvert.IsGenericType && typeToConvert.GetGenericTypeDefinition() == typeof(Arrayable<>); } public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options) { Type type = typeToConvert.GetGenericArguments()[0]; Type type2 = typeof(ArrayableConverter<>).MakeGenericType(type); return (JsonConverter)Activator.CreateInstance(type2); } } [JsonConverter(typeof(WinScreenConverter))] public struct WinScreen { public static readonly string[] VanillaPaths = new string[4] { "CM_PageExpeditionSuccess_Completed", "CM_PageExpeditionSuccess_Resources expended_CellUI 2", "CM_PageExpeditionSuccess_SignalLost_CellUI", "CM_PageExpeditionSuccess_Stack Empty_CellUI 1" }; public string PagePath; public static readonly WinScreen Empty = new WinScreen(string.Empty); public WinScreen(int index) { if (index >= 0 && index < VanillaPaths.Length) { PagePath = VanillaPaths[index]; } else { PagePath = string.Empty; } } public WinScreen(string filepath) { PagePath = filepath; } public override readonly string ToString() { return PagePath; } public static explicit operator WinScreen(string filepath) { return new WinScreen(filepath); } public static explicit operator WinScreen(int index) { return new WinScreen(index); } public static implicit operator string(WinScreen winScreen) { return winScreen.ToString(); } public static implicit operator int(WinScreen winScreen) { int num = Array.IndexOf(VanillaPaths, winScreen.PagePath); return (num >= 0) ? num : (-1); } } public class WinScreenConverter : JsonConverter { public override bool HandleNull => true; public override WinScreen Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { return reader.TokenType switch { JsonTokenType.String => new WinScreen(reader.GetString()), JsonTokenType.Number => new WinScreen(reader.GetInt32()), JsonTokenType.Null => WinScreen.Empty, _ => throw new JsonException($"WinScreenJson type: {reader.TokenType} is not implemented!"), }; } public override void Write(Utf8JsonWriter writer, WinScreen value, JsonSerializerOptions options) { if (value.PagePath != string.Empty) { writer.WriteStringValue(value.PagePath); } } } } namespace AWO.CustomFields { [Obsolete] internal static class WODataBlockFields { internal static void Init() { FieldInjector.DefineManagedField("m_WOEDataRef"); } public static void SetWEEData(this WardenObjectiveDataBlock target, WOE_DataBase data) { FieldInjector.TrySetManagedField(target, "m_WOEDataRef", data); } public static WOE_DataBase GetWEEData(this WardenObjectiveDataBlock target) { WOE_DataBase result = default(WOE_DataBase); FieldInjector.TryGetManagedField(target, "m_WOEDataRef", ref result); return result; } } internal static class WOEventDataFields { internal static void Init() { FieldInjector.DefineManagedField("m_WEEDataRef"); } public static void SetWEEData(this WardenObjectiveEventData target, WEE_EventData data) { FieldInjector.TrySetManagedField(target, "m_WEEDataRef", data); } public static WEE_EventData GetWEEData(this WardenObjectiveEventData target) { WEE_EventData result = default(WEE_EventData); FieldInjector.TryGetManagedField(target, "m_WEEDataRef", ref result); return result; } } } namespace AWO.API { [Obsolete] public static class JsonAPI { } }