Decompiled source of Nadir v1.0.6
BepInEx/plugins/Nadir/Custom/AggroFix_Revised.dll
Decompiled a day agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.Json; using System.Text.Json.Serialization; using AIGraph; using API; using Agents; using AggroFix.BepInEx; using AggroFix.CustomSettings; using AggroFix.Dependencies; using AggroFix.JSON; using AggroFix.JSON.Converters; using AggroFix.Utils; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using Enemies; using GTFO.API; using GTFO.API.Utilities; using GameData; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes; using Il2CppSystem.Collections.Generic; using LevelGeneration; using MTFO.API; using Microsoft.CodeAnalysis; using Player; using SNetwork; using StateMachines; using UnityEngine; using UnityEngine.Analytics; [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("AggroFix_Revised")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("AggroFix_Revised")] [assembly: AssemblyTitle("AggroFix_Revised")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace API { [HarmonyPatch(typeof(GameDataInit))] internal class GameDataInit_Patches { [HarmonyPatch("Initialize")] [HarmonyWrapSafe] [HarmonyPostfix] public static void Initialize_Postfix() { Analytics.enabled = false; } } internal static class APILogger { private static readonly ManualLogSource logger; static APILogger() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown logger = new ManualLogSource("Rand-API"); Logger.Sources.Add((ILogSource)(object)logger); } private static string Format(string module, object msg) { return $"[{module}]: {msg}"; } public static void Info(string module, object data) { logger.LogMessage((object)Format(module, data)); } public static void Verbose(string module, object data) { logger.LogDebug((object)Format(module, data)); } public static void Log(object data) { logger.LogDebug((object)Format("AggroFix_Revised", data)); } public static void Debug(object data) { if (ConfigManager.Debug) { Log(data); } } public static void Warn(object data) { logger.LogWarning((object)Format("AggroFix_Revised", data)); } public static void Error(object data) { logger.LogError((object)Format("AggroFix_Revised", data)); } } } namespace AggroFix { internal static class DinoLogger { private static ManualLogSource logger = Logger.CreateLogSource("AggroFix"); public static void Log(string format, params object[] args) { Log(string.Format(format, args)); } public static void Log(string str) { if (logger != null) { logger.Log((LogLevel)8, (object)str); } } public static void Warning(string format, params object[] args) { Warning(string.Format(format, args)); } public static void Warning(string str) { if (logger != null) { logger.Log((LogLevel)4, (object)str); } } public static void Error(string format, params object[] args) { Error(string.Format(format, args)); } public static void Error(string str) { if (logger != null) { logger.Log((LogLevel)2, (object)str); } } public static void Debug(string format, params object[] args) { Debug(string.Format(format, args)); } public static void Debug(string str) { if (logger != null) { logger.Log((LogLevel)32, (object)str); } } } [HarmonyPatch] internal static class Fix { private static bool patch = true; private static bool IsTargetReachable(AIG_CourseNode source, AIG_CourseNode target) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Invalid comparison between Unknown and I4 //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Invalid comparison between Unknown and I4 if (source == null || target == null) { return false; } if (source.NodeID == target.NodeID) { return true; } AIG_SearchID.IncrementSearchID(); ushort searchID = AIG_SearchID.SearchID; Queue<AIG_CourseNode> queue = new Queue<AIG_CourseNode>(); queue.Enqueue(source); while (queue.Count > 0) { AIG_CourseNode val = queue.Dequeue(); ((AIG_CourseGraphMember)val).m_searchID = searchID; Enumerator<AIG_CoursePortal> enumerator = val.m_portals.GetEnumerator(); while (enumerator.MoveNext()) { AIG_CoursePortal current = enumerator.Current; LG_Gate gate = current.Gate; object obj; if (gate == null) { obj = null; } else { iLG_Door_Core spawnedDoor = gate.SpawnedDoor; obj = ((spawnedDoor != null) ? ((Il2CppObjectBase)spawnedDoor).TryCast<LG_SecurityDoor>() : null); } LG_SecurityDoor val2 = (LG_SecurityDoor)obj; if ((Object)(object)val2 != (Object)null && (int)val2.LastStatus != 10 && (int)val2.LastStatus != 16) { continue; } AIG_CourseNode oppositeNode = current.GetOppositeNode(val); if (((AIG_CourseGraphMember)oppositeNode).m_searchID != searchID) { if (oppositeNode.NodeID == target.NodeID) { return true; } queue.Enqueue(oppositeNode); } } } return false; } [HarmonyPatch(typeof(EnemyCourseNavigation), "UpdateTracking")] [HarmonyPostfix] private static void UpdateTracking(EnemyCourseNavigation __instance) { //IL_007a: 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_0081: 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_0085: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Invalid comparison between Unknown and I4 if (!SettingsManager.ActiveSettings.EnableAggroFix || !patch || !SNet.IsMaster) { return; } EnemyAgent owner = __instance.m_owner; if (((Agent)owner).CourseNode == null || __instance.m_targetRef == null || (Object)(object)__instance.m_targetRef.m_agent == (Object)null) { return; } ES_StateEnum stateEnum = ((StateMachine<ES_Base>)(object)owner.Locomotion).m_currentState.m_stateEnum; ES_StateEnum val = stateEnum; if ((int)val == 14) { return; } if (!IsTargetReachable(((Agent)owner).CourseNode, __instance.m_targetRef.m_agent.CourseNode)) { if (ConfigManager.Debug) { APILogger.Debug("Invalid current " + ((Il2CppObjectBase)__instance.m_targetRef.m_agent).Cast<PlayerAgent>().Owner.NickName); } bool flag = false; int num = Random.RandomRangeInt(0, PlayerManager.PlayerAgentsInLevel.Count); PlayerAgent val2 = PlayerManager.PlayerAgentsInLevel[num]; for (int i = 0; i < PlayerManager.PlayerAgentsInLevel.Count; i++) { APILogger.Debug("Checking " + val2.Owner.NickName); if (((Agent)val2).Alive && ((Object)val2).GetInstanceID() != ((Object)__instance.m_targetRef.m_agent).GetInstanceID() && IsTargetReachable(((Agent)owner).CourseNode, ((Agent)val2).CourseNode)) { flag = true; break; } num = (num + 1) % PlayerManager.PlayerAgentsInLevel.Count; val2 = PlayerManager.PlayerAgentsInLevel[num]; } if (flag) { APILogger.Debug("Rerouted to " + val2.Owner.NickName); patch = false; ((AgentAI)owner.AI).SetTarget((Agent)(object)val2); patch = true; } else if (ConfigManager.Debug) { APILogger.Debug("No valid target found " + ((Il2CppObjectBase)__instance.m_targetRef.m_agent).Cast<PlayerAgent>().Owner.NickName); } } else if (ConfigManager.Debug) { APILogger.Debug("Current " + ((Il2CppObjectBase)__instance.m_targetRef.m_agent).Cast<PlayerAgent>().Owner.NickName); } } } } namespace AggroFix.Utils { internal static class DictExtensions { public static TValue GetOrAdd<TKey, TValue>(this IDictionary<TKey, TValue> dict, TKey key) where TValue : new() { if (!dict.TryGetValue(key, out TValue value)) { dict.Add(key, value = new TValue()); } return value; } } internal class DictListEnumerator<T> : IEnumerator<T>, IEnumerator, IDisposable { private readonly IEnumerator<List<T>> _valueEnumerator; private List<T>? _curList; private int _index; private T? _current; public T Current => _current; object IEnumerator.Current => Current; internal DictListEnumerator(Dictionary<string, List<T>> data) { _valueEnumerator = data.Values.GetEnumerator(); if (_valueEnumerator.MoveNext()) { _curList = _valueEnumerator.Current; } _index = -1; } public void Dispose() { } public bool MoveNext() { if (_curList == null || ++_index >= _curList.Count) { if (!_valueEnumerator.MoveNext()) { return false; } _curList = _valueEnumerator.Current; _index = 0; } _current = _curList[_index]; return true; } public void Reset() { _valueEnumerator.Reset(); if (_valueEnumerator.MoveNext()) { _curList = _valueEnumerator.Current; } _index = -1; } } internal static class StringExtensions { public static T ToEnum<T>(this string? value, T defaultValue) where T : struct { if (string.IsNullOrEmpty(value)) { return defaultValue; } T result; return Enum.TryParse<T>(value.Replace(" ", null), ignoreCase: true, out result) ? result : defaultValue; } } } namespace AggroFix.Dependencies { internal static class MTFOWrapper { public const string PLUGIN_GUID = "com.dak.MTFO"; public static readonly bool HasMTFO; public static string GameDataPath => HasMTFO ? GameDataPath_Unsafe() : ""; public static string CustomPath => HasMTFO ? CustomPath_Unsafe() : ""; public static bool HasCustomContent => HasMTFO && HasCustomContent_Unsafe(); static MTFOWrapper() { HasMTFO = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.ContainsKey("com.dak.MTFO"); } [MethodImpl(MethodImplOptions.NoInlining)] private static string GameDataPath_Unsafe() { return MTFOPathAPI.RundownPath; } [MethodImpl(MethodImplOptions.NoInlining)] private static string CustomPath_Unsafe() { return MTFOPathAPI.CustomPath; } [MethodImpl(MethodImplOptions.NoInlining)] private static bool HasCustomContent_Unsafe() { return MTFOPathAPI.HasRundownPath; } } } namespace AggroFix.BepInEx { public static class Module { public const string GUID = "randomuserhi.AggroFix_Revised"; public const string Name = "AggroFix_Revised"; public const string Version = "0.0.1"; } public static class ConfigManager { public static ConfigFile configFile; private static ConfigEntry<bool> debug; public static bool Debug { get { return debug.Value; } set { debug.Value = value; } } static ConfigManager() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown string text = Path.Combine(Paths.ConfigPath, "AggroFix_Revised.cfg"); configFile = new ConfigFile(text, true); debug = configFile.Bind<bool>("Debug", "enable", false, "Enables debug messages when true."); } } [BepInPlugin("randomuserhi.AggroFix_Revised", "AggroFix_Revised", "0.0.1")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInIncompatibility("randomuserhi.AggroFix")] public class Plugin : BasePlugin { private static Harmony? harmony; public override void Load() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown SettingsManager.Init(); APILogger.Log("Plugin is loaded!"); harmony = new Harmony("randomuserhi.AggroFix_Revised"); harmony.PatchAll(); APILogger.Log("Debug is " + (ConfigManager.Debug ? "Enabled" : "Disabled")); } } } namespace AggroFix.JSON { public static class ISFJson { private static readonly JsonSerializerOptions _setting = new JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip, IncludeFields = true, PropertyNameCaseInsensitive = true, WriteIndented = true, IgnoreReadOnlyProperties = true }; public static T? Deserialize<T>(string json) { return JsonSerializer.Deserialize<T>(json, _setting); } public static T? Deserialize<T>(ref Utf8JsonReader reader) { return JsonSerializer.Deserialize<T>(ref reader, _setting); } public static object? Deserialize(Type type, string json) { return JsonSerializer.Deserialize(json, type, _setting); } public static string Serialize<T>(T value) { return JsonSerializer.Serialize(value, _setting); } public static void Serialize<T>(Utf8JsonWriter writer, T value) { JsonSerializer.Serialize(writer, value, _setting); } public static void Serialize<T>(Utf8JsonWriter writer, string name, T value) { writer.WritePropertyName(name); JsonSerializer.Serialize(writer, value, _setting); } } } namespace AggroFix.JSON.Converters { public sealed class LevelTargetConverter : JsonConverter<LevelTarget> { public override LevelTarget? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { LevelTarget levelTarget = new LevelTarget(); if (ParseTarget(ref reader, levelTarget, options)) { return levelTarget; } throw new JsonException("Expected level target to be a tier, tierindex, or level layout ID"); } private static bool ParseTarget(ref Utf8JsonReader reader, LevelTarget target, JsonSerializerOptions options) { //IL_0075: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Invalid comparison between Unknown and I4 //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Invalid comparison between Unknown and I4 if (reader.TokenType == JsonTokenType.Null) { return true; } if (reader.TokenType == JsonTokenType.String) { string @string = reader.GetString(); if (@string.Length >= 5) { target.Tier = @string.Substring(0, 5).ToEnum<eRundownTier>((eRundownTier)99); } else { target.Tier = ("Tier" + @string[0]).ToEnum<eRundownTier>((eRundownTier)99); } int num = ((@string.Length < 5) ? 1 : 5); if ((int)target.Tier != 99 && @string.Length > num) { string text = @string; int num2 = num; if (int.TryParse(text.Substring(num2, text.Length - num2), out var result)) { target.TierIndex = result - 1; } else { target.Tier = (eRundownTier)99; } } if ((int)target.Tier == 99) { target.LevelLayoutID = JsonSerializer.Deserialize<uint>(ref reader, options); } return true; } if (reader.TokenType == JsonTokenType.Number) { target.LevelLayoutID = reader.GetUInt32(); return true; } return false; } public override void Write(Utf8JsonWriter writer, LevelTarget? value, JsonSerializerOptions options) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (value != null) { if (value.LevelLayoutID == 0 && (int)value.Tier == 99) { writer.WriteNullValue(); return; } if (value.LevelLayoutID != 0) { writer.WriteNumberValue(value.LevelLayoutID); return; } eRundownTier tier = value.Tier; string? text = ((object)(eRundownTier)(ref tier)).ToString(); writer.WriteStringValue(text[text.Length - 1] + ((value.TierIndex >= 0) ? (value.TierIndex + 1).ToString() : "")); } } } public sealed class SettingsDataConverter : JsonConverter<SettingsData> { public override SettingsData? Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) { if (reader.TokenType == JsonTokenType.Null) { return null; } SettingsData settingsData = new SettingsData(); if (reader.TokenType != JsonTokenType.StartObject) { throw new JsonException("Expected Trigger Coordinator to be either a string or object"); } while (reader.Read()) { if (reader.TokenType == JsonTokenType.EndObject) { return settingsData; } if (reader.TokenType != JsonTokenType.PropertyName) { throw new JsonException("Expected PropertyName token"); } string @string = reader.GetString(); reader.Read(); switch (@string.ToLowerInvariant()) { case "levels": case "level": if (reader.TokenType == JsonTokenType.StartArray) { settingsData.Levels = JsonSerializer.Deserialize<LevelTarget[]>(ref reader, options); } else if (reader.TokenType != JsonTokenType.Null) { settingsData.Levels = new LevelTarget[1] { JsonSerializer.Deserialize<LevelTarget>(ref reader, options) }; } break; case "enableaggrofix": settingsData.EnableAggroFix = reader.GetBoolean(); break; } } throw new JsonException("Expected EndObject token"); } public override void Write(Utf8JsonWriter writer, SettingsData? value, JsonSerializerOptions options) { if (value == null) { writer.WriteNullValue(); return; } writer.WriteStartObject(); writer.WritePropertyName("Levels"); if (value.Levels.Length == 0) { writer.WriteNullValue(); } else if (value.Levels.Length == 1) { JsonSerializer.Serialize(writer, value.Levels[0], options); } else { JsonSerializer.Serialize(writer, value.Levels, options); } writer.WriteNumber("RundownID", value.RundownID); writer.WriteBoolean("EnableAggroFix", value.EnableAggroFix); writer.WriteEndObject(); } } } namespace AggroFix.CustomSettings { [JsonConverter(typeof(LevelTargetConverter))] public sealed class LevelTarget { public uint LevelLayoutID { get; set; } = 0u; public eRundownTier Tier { get; set; } = (eRundownTier)99; public int TierIndex { get; set; } = -1; public bool IsMatch(uint layoutID, eRundownTier tier, int tierIndex) { //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) if (layoutID == LevelLayoutID) { return true; } if (Tier == tier && (TierIndex == -1 || TierIndex == tierIndex)) { return true; } return false; } } [JsonConverter(typeof(SettingsDataConverter))] public sealed class SettingsData { public static readonly SettingsData Default = new SettingsData(); public static readonly SettingsData[] Template = new SettingsData[3] { new SettingsData { Levels = new LevelTarget[1] { new LevelTarget { LevelLayoutID = 420u } }, EnableAggroFix = true }, new SettingsData { Levels = new LevelTarget[1] { new LevelTarget { Tier = (eRundownTier)1 } }, EnableAggroFix = true }, new SettingsData { Levels = new LevelTarget[2] { new LevelTarget { LevelLayoutID = 4115u }, new LevelTarget { Tier = (eRundownTier)2, TierIndex = 0 } }, EnableAggroFix = true } }; public uint RundownID = 0u; public LevelTarget[] Levels { get; set; } = Array.Empty<LevelTarget>(); public bool EnableAggroFix { get; set; } = false; } public sealed class SettingsManager { public static readonly SettingsManager Current; private static (eRundownTier tier, int tierIndex) _currentLevel; private readonly Dictionary<string, List<SettingsData>> _fileToData = new Dictionary<string, List<SettingsData>>(); private readonly LiveEditListener _liveEditListener; public static SettingsData ActiveSettings { get; set; } private void FileChanged(LiveEditEventArgs e) { LiveEditEventArgs e2 = e; DinoLogger.Warning("LiveEdit File Changed: " + e2.FileName); LiveEdit.TryReadFileContent(e2.FullPath, (Action<string>)delegate(string content) { ReadFileContent(e2.FullPath, content); }); } private void FileDeleted(LiveEditEventArgs e) { DinoLogger.Warning("LiveEdit File Removed: " + e.FileName); _fileToData.Remove(e.FullPath); RefreshSettings(); } private void FileCreated(LiveEditEventArgs e) { LiveEditEventArgs e2 = e; DinoLogger.Warning("LiveEdit File Created: " + e2.FileName); LiveEdit.TryReadFileContent(e2.FullPath, (Action<string>)delegate(string content) { ReadFileContent(e2.FullPath, content); }); } private void ReadFileContent(string file, string content) { _fileToData.Remove(file); List<SettingsData> list = null; try { list = ISFJson.Deserialize<List<SettingsData>>(content); } catch (JsonException ex) { DinoLogger.Error("Error parsing settings json " + file); DinoLogger.Error(ex.Message); } if (list != null) { _fileToData[file] = list; RefreshSettings(); } } private static uint ActiveRundownID() { string activeRundownKey = RundownManager.ActiveRundownKey; uint result = default(uint); if (!RundownManager.RundownProgressionReady || !RundownManager.TryGetIdFromLocalRundownKey(activeRundownKey, ref result)) { return 0u; } return result; } private static void RefreshSettings() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Invalid comparison between Unknown and I4 //IL_0047: 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_00de: Unknown result type (might be due to invalid IL or missing references) SettingsData activeSettings = ActiveSettings; ActiveSettings = SettingsData.Default; uint num = ActiveRundownID(); if (num == 0) { return; } pActiveExpedition activeExpeditionData = RundownManager.GetActiveExpeditionData(); if ((int)activeExpeditionData.tier == 99) { return; } if (_currentLevel.tier == activeExpeditionData.tier && _currentLevel.tierIndex == activeExpeditionData.expeditionIndex) { ActiveSettings = activeSettings; return; } uint levelLayoutData = RundownManager.ActiveExpedition.LevelLayoutData; IEnumerator<SettingsData> enumerator = Current.GetEnumerator(); while (enumerator.MoveNext()) { SettingsData current = enumerator.Current; if (current.RundownID != 0 && current.RundownID != num) { continue; } LevelTarget[] levels = current.Levels; foreach (LevelTarget levelTarget in levels) { if (levelTarget.IsMatch(levelLayoutData, activeExpeditionData.tier, activeExpeditionData.expeditionIndex)) { ActiveSettings = current; if (ActiveSettings.EnableAggroFix) { APILogger.Warn("Enabled=true, AggroFix Working."); } else { APILogger.Warn("Enabled=false, AggroFix Non-Working."); } return; } } } APILogger.Warn("Level Non-Detected in JSON. AggroFix doesn't load."); } private SettingsManager() { //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Expected O, but got Unknown //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Expected O, but got Unknown //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016e: Expected O, but got Unknown if (!MTFOWrapper.HasCustomContent) { DinoLogger.Log($"No custom path detected! Has MTFO? {MTFOWrapper.HasMTFO}"); return; } string text = Path.Combine(MTFOWrapper.CustomPath, "AggroFix_Revised"); if (!Directory.Exists(text)) { DinoLogger.Log("No settings directory detected. Creating template."); Directory.CreateDirectory(text); StreamWriter streamWriter = File.CreateText(Path.Combine(text, "Template.json")); streamWriter.WriteLine(ISFJson.Serialize(SettingsData.Template)); streamWriter.Flush(); streamWriter.Close(); } else { DinoLogger.Log("SettingsData directory detected."); } foreach (string item in Directory.EnumerateFiles(text, "*.json", SearchOption.AllDirectories)) { string content = File.ReadAllText(item); ReadFileContent(item, content); } _liveEditListener = LiveEdit.CreateListener(text, "*.json", true); _liveEditListener.FileCreated += new LiveEditEventHandler(FileCreated); _liveEditListener.FileChanged += new LiveEditEventHandler(FileChanged); _liveEditListener.FileDeleted += new LiveEditEventHandler(FileDeleted); } static SettingsManager() { ActiveSettings = SettingsData.Default; _currentLevel = ((eRundownTier)99, 0); Current = new SettingsManager(); } internal static void Init() { LevelAPI.OnBuildStart += RefreshSettings; } public List<SettingsData> GetSettingsData() { List<SettingsData> list2 = new List<SettingsData>(_fileToData.Values.Sum((List<SettingsData> list) => list.Count)); IEnumerator<SettingsData> enumerator = GetEnumerator(); while (enumerator.MoveNext()) { list2.Add(enumerator.Current); } return list2; } public IEnumerator<SettingsData> GetEnumerator() { return new DictListEnumerator<SettingsData>(_fileToData); } } }
BepInEx/plugins/Nadir/Custom/BigPickupCarryOnBack.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes; using LevelGeneration; using Microsoft.CodeAnalysis; using Player; using SNetwork; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("BigPickupCarryOnBack")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("BigPickupCarryOnBack")] [assembly: AssemblyTitle("BigPickupCarryOnBack")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace BigPickupCarryOnBack_Patches { internal static class BigPickupUtil { internal static readonly HashSet<uint> TargetIds = new HashSet<uint> { 1001u, 1002u, 1003u, 1004u }; internal static bool IsTargetCarried(out BackpackItem carryItem) { carryItem = null; return PlayerBackpackManager.TryGetItem(SNet.LocalPlayer, (InventorySlot)8, ref carryItem) && carryItem != null && TargetIds.Contains(carryItem.ItemID); } internal static bool IsTargetCarried() { BackpackItem carryItem; return IsTargetCarried(out carryItem); } } [HarmonyPatch(typeof(LG_PickupItem))] internal class SetupBigPickupItemWithItemId { [HarmonyPatch("SetupBigPickupItemWithItemId")] [HarmonyPostfix] private static void LG_PickupItem__SetupBigPickupItemWithItemId__Postfix(LG_PickupItem __instance, uint itemId) { if (itemId == 1002) { CarryItemPickup_Core componentInChildren = ((Component)__instance.m_root).GetComponentInChildren<CarryItemPickup_Core>(); Interact_Pickup_PickupItem val = ((Il2CppObjectBase)componentInChildren.m_interact).Cast<Interact_Pickup_PickupItem>(); ((Interact_Timed)val).InteractDuration = 1.5f; } } } [HarmonyPatch(typeof(FirstPersonItemHolder))] internal class Patch_FirstPersonItemHolder { [HarmonyPatch("ItemCanMoveQuick")] [HarmonyPrefix] private static bool FirstPersonItemHolder__ItemCanMoveQuick__Prefix(ref bool __result) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 if (PlayerBackpackManager.LocalBackpack.HasBackpackItem((InventorySlot)8) && (int)PlayerManager.GetLocalPlayerAgent().Inventory.WieldedSlot != 8) { __result = false; return false; } return true; } } [HarmonyPatch(typeof(PlayerBackpackManager))] internal class Patch_PlayerBackpackManager { [HarmonyPatch("HasItem_Local")] [HarmonyPrefix] private static bool PlayerBackpackManager__HasItem_Local__Prefix(InventorySlot slot, ref bool __result) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 if ((int)slot != 8) { return true; } __result = false; return false; } } [HarmonyPatch(typeof(PlayerInventoryLocal))] internal class Patch_PlayerInventoryLocal { private static void ForceWieldSlot(PlayerInventoryLocal inv, InventorySlot slot) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) ((PlayerInventoryBase)inv).Owner.Sync.WantsToWieldSlot(slot, false); pInventoryStatus syncedInventoryStatus = ((PlayerInventoryBase)inv).Owner.Sync.m_syncedInventoryStatus; syncedInventoryStatus.wieldedSlot = slot; ((PlayerInventoryBase)inv).Owner.Sync.m_syncedInventoryStatus = syncedInventoryStatus; ((PlayerInventoryBase)inv).Owner.Sync.LastWantedSlot = syncedInventoryStatus.wieldedSlot; ((PlayerInventoryBase)inv).Owner.Sync.m_inventoryStatusPacket.Send(syncedInventoryStatus, (SNet_ChannelType)4); ((PlayerInventoryBase)inv).Owner.Sync.DoInventoryWield(syncedInventoryStatus); } [HarmonyPatch("Awake")] [HarmonyPostfix] private static void PlayerInventoryLocal__Awake__Postfix(PlayerInventoryLocal __instance) { if (!__instance.m_allowedScrollSlots.Contains((InventorySlot)8)) { __instance.m_allowedScrollSlots.Add((InventorySlot)8); } } [HarmonyPatch("CheckInput")] [HarmonyPrefix] private static bool PlayerInventoryLocal__CheckInput__Prefix(PlayerInventoryLocal __instance) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Invalid comparison between Unknown and I4 //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Invalid comparison between Unknown and I4 //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) if ((int)((PlayerInventoryBase)__instance).WieldedSlot != 8) { return true; } if (!BigPickupUtil.IsTargetCarried()) { return true; } if (InputMapper.GetButtonDownKeyMouseGamepad((InputAction)32, (eFocusState)0)) { ((PlayerInventoryBase)__instance).Owner.Sync.WantsToSetFlashlightEnabled(!((PlayerInventoryBase)__instance).WantsFlashlightEnabled, false); } if (((PlayerInventoryBase)__instance).Owner.FPItemHolder.ItemHiddenTrigger) { return false; } InventorySlot? val = null; if (InputMapper.GetButtonDownKeyMouseGamepad((InputAction)23, (eFocusState)0)) { val = (InventorySlot)1; } else if (InputMapper.GetButtonDownKeyMouseGamepad((InputAction)24, (eFocusState)0)) { val = (InventorySlot)2; } else if (InputMapper.GetButtonDownKeyMouseGamepad((InputAction)25, (eFocusState)0)) { val = (InventorySlot)3; } else if (InputMapper.GetButtonDownKeyMouseGamepad((InputAction)27, (eFocusState)0)) { val = (InventorySlot)4; } else if (InputMapper.GetButtonDownKeyMouseGamepad((InputAction)28, (eFocusState)0)) { val = (InventorySlot)5; } else if (InputMapper.GetButtonDownKeyMouseGamepad((InputAction)26, (eFocusState)0)) { val = (InventorySlot)10; } else if (InputMapper.GetButtonDownKeyMouseGamepad((InputAction)29, (eFocusState)0)) { val = (InventorySlot)11; } if (val.HasValue && val.Value != ((PlayerInventoryBase)__instance).WieldedSlot) { BackpackItem val2 = default(BackpackItem); if (!PlayerBackpackManager.TryGetItem(SNet.LocalPlayer, val.Value, ref val2) || val2 == null) { return false; } bool flag = (int)((PlayerInventoryBase)__instance).WieldedSlot == 8 && BigPickupUtil.IsTargetCarried(); _ = val2.Status; if (!flag) { return false; } ItemEquippable val3 = ((Il2CppObjectBase)val2.Instance).TryCast<ItemEquippable>(); if ((Object)(object)val3 != (Object)null && val3.CanWield) { ForceWieldSlot(__instance, val.Value); __instance.m_itemScrollTimer = Clock.Time + 0.1f; } } if ((int)FocusStateManager.CurrentState != 6 && !__instance.CheckWieldingKeys() && (Object)(object)((PlayerInventoryBase)__instance).m_wieldedItem != (Object)null) { float axisKeyMouse = InputMapper.GetAxisKeyMouse((InputAction)30, (eFocusState)0); bool buttonDownKeyMouseGamepad = InputMapper.GetButtonDownKeyMouseGamepad((InputAction)31, (eFocusState)0); if ((((PlayerInventoryBase)__instance).AllowScrollInput && ((PlayerInventoryBase)__instance).m_wieldedItem.WeaponSwitchAllowed && Mathf.Abs(axisKeyMouse) > 0f && Clock.Time > __instance.m_itemScrollTimer) || buttonDownKeyMouseGamepad) { int num = ((axisKeyMouse > 0f) ? __instance.GetNextSlot(((PlayerInventoryBase)__instance).WieldedSlot, -1) : __instance.GetNextSlot(((PlayerInventoryBase)__instance).WieldedSlot, 1)); if (num > -1) { ForceWieldSlot(__instance, (InventorySlot)(byte)num); __instance.m_itemScrollTimer = Clock.Time + 0.1f; } } } if (__instance.m_FPItemHolder.ItemIsBusy) { return false; } if (InputMapper.GetButtonDownKeyMouseGamepad((InputAction)11, (eFocusState)0) && ((PlayerInventoryBase)__instance).CanReloadCurrent()) { ((PlayerInventoryBase)__instance).TriggerReload(); } return false; } [HarmonyPatch("CheckInput")] [HarmonyPostfix] private static void CheckInput_Postfix(PlayerInventoryLocal __instance) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 if (!((PlayerInventoryBase)__instance).Owner.FPItemHolder.ItemHiddenTrigger && (int)FocusStateManager.CurrentState != 6 && (int)((PlayerInventoryBase)__instance).WieldedSlot != 8 && BigPickupUtil.IsTargetCarried() && (Input.GetKeyDown((KeyCode)56) || Input.GetKeyDown((KeyCode)264)) && Clock.Time > __instance.m_itemScrollTimer) { ForceWieldSlot(__instance, (InventorySlot)8); __instance.m_itemScrollTimer = Clock.Time + 0.1f; } } } [HarmonyPatch(typeof(PLOC_Base))] internal class Patch_PLOC_State { [HarmonyPatch("GetHorizontalVelocityFromInput")] [HarmonyPostfix] [HarmonyPriority(0)] private static void PLOC_Base__GetHorizontalVelocityFromInput__Postfix(PLOC_Base __instance, ref Vector3 __result) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) if (__instance.m_owner.Owner.IsLocal && BigPickupUtil.IsTargetCarried() && (int)__instance.m_owner.Inventory.WieldedSlot != 8) { __result *= 0.7f; } } } } namespace BigPickupCarryOnBack { [BepInPlugin("BigPickupCarryOnBack", "BigPickupCarryOnBack", "1.0.0")] internal class EntryPoint : BasePlugin { public static EntryPoint Instance; private Harmony m_Harmony; public override void Load() { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown Instance = this; m_Harmony = new Harmony("BigPickupCarryOnBack"); m_Harmony.PatchAll(); } } }
BepInEx/plugins/Nadir/Custom/Inas07.ThermalSights.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text.Json.Serialization; using AssetShards; using BepInEx; using BepInEx.Unity.IL2CPP; using ChainedPuzzles; using ExtraObjectiveSetup.BaseClasses; using ExtraObjectiveSetup.Expedition.Gears; using ExtraObjectiveSetup.Utils; using FirstPersonItem; using GTFO.API; using GTFO.API.Utilities; using GameData; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Microsoft.CodeAnalysis; using ThermalSights.Definition; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Inas07.ThermalSights")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Inas07.ThermalSights")] [assembly: AssemblyTitle("Inas07.ThermalSights")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ThermalSights { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Inas.ThermalSights", "ThermalSights", "1.0.0")] public class EntryPoint : BasePlugin { public const string AUTHOR = "Inas"; public const string PLUGIN_NAME = "ThermalSights"; public const string VERSION = "1.0.0"; private Harmony m_Harmony; public override void Load() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown SetupManagers(); m_Harmony = new Harmony("ThermalSights"); m_Harmony.PatchAll(); EOSLogger.Log("ThermalSights loaded."); } private void SetupManagers() { AssetShardManager.OnStartupAssetsLoaded += Action.op_Implicit((Action)delegate { ((GenericDefinitionManager<TSADefinition>)TSAManager.Current).Init(); }); } } public class TSAManager : GenericDefinitionManager<TSADefinition> { public class PuzzleVisualWrapper { public GameObject GO { get; set; } public Renderer Renderer { get; set; } public float Intensity { get; set; } public float BehindWallIntensity { get; set; } public void SetIntensity(float t) { if (GO.active) { if (Intensity > 0f) { Renderer.material.SetFloat("_Intensity", Intensity * t); } if (BehindWallIntensity > 0f) { Renderer.material.SetFloat("_BehindWallIntensity", BehindWallIntensity * t); } } } } private const bool OUTPUT_THERMAL_SHADER_SETTINGS_ON_WIELD = false; public static TSAManager Current { get; } protected override string DEFINITION_NAME => "ThermalSight"; private Dictionary<uint, Renderer[]> InLevelGearThermals { get; } = new Dictionary<uint, Renderer[]>(); private HashSet<uint> ModifiedInLevelGearThermals { get; } = new HashSet<uint>(); private HashSet<uint> ThermalOfflineGears { get; } = new HashSet<uint>(); public uint CurrentGearPID { get; private set; } private List<PuzzleVisualWrapper> PuzzleVisuals { get; } = new List<PuzzleVisualWrapper>(); protected override void FileChanged(LiveEditEventArgs e) { base.FileChanged(e); InitThermalOfflineGears(); CleanupInLevelGearThermals(keepCurrentGear: true); TrySetThermalSightRenderer(CurrentGearPID); } public override void Init() { InitThermalOfflineGears(); } private void InitThermalOfflineGears() { ThermalOfflineGears.Clear(); foreach (PlayerOfflineGearDataBlock allBlock in GameDataBlockBase<PlayerOfflineGearDataBlock>.GetAllBlocks()) { if (((GameDataBlockBase<PlayerOfflineGearDataBlock>)(object)allBlock).name.ToLowerInvariant().EndsWith("_t")) { ThermalOfflineGears.Add(((GameDataBlockBase<PlayerOfflineGearDataBlock>)(object)allBlock).persistentID); } } EOSLogger.Debug($"Found OfflineGear with thermal sight, count: {ThermalOfflineGears.Count}"); } private bool TryGetInLevelGearThermalRenderersFromItem(ItemEquippable item, uint gearPID, out Renderer[] renderers) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) renderers = null; if (item.GearIDRange == null) { return false; } if (gearPID == 0) { gearPID = ExpeditionGearManager.GetOfflineGearPID(item.GearIDRange); } if (gearPID == 0 || !IsGearWithThermal(gearPID)) { return false; } bool flag = false; if (!InLevelGearThermals.ContainsKey(gearPID)) { flag = true; } else { try { _ = ((Component)InLevelGearThermals[gearPID][0]).gameObject.transform.position; flag = false; } catch { ModifiedInLevelGearThermals.Remove(gearPID); flag = true; } } if (flag) { renderers = (from x in ((IEnumerable<Renderer>)((Component)item).GetComponentsInChildren<Renderer>(true))?.Where((Renderer x) => (Object)(object)x.sharedMaterial != (Object)null && (Object)(object)x.sharedMaterial.shader != (Object)null) where ((Object)x.sharedMaterial.shader).name.ToLower().Contains("Thermal".ToLower()) select x).ToArray() ?? null; if (renderers != null) { if (renderers.Length != 1) { EOSLogger.Warning(((Item)item).PublicName + " contains more than 1 thermal renderers!"); } InLevelGearThermals[gearPID] = renderers; return true; } EOSLogger.Debug(((Item)item).PublicName + ": thermal renderer not found"); return false; } renderers = InLevelGearThermals[gearPID]; return true; } internal bool TrySetThermalSightRenderer(uint gearPID = 0u) { //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0105: Expected O, but got Unknown //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_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Expected O, but got Unknown //IL_0190: Unknown result type (might be due to invalid IL or missing references) if (gearPID == 0) { gearPID = CurrentGearPID; } if (!IsGearWithThermal(gearPID)) { return false; } if (ModifiedInLevelGearThermals.Contains(gearPID)) { return true; } if (base.definitions.TryGetValue(gearPID, out var value) && InLevelGearThermals.TryGetValue(gearPID, out var value2)) { TSShader shader = value.Definition.Shader; Renderer[] array = value2; foreach (Renderer val in array) { PropertyInfo[] properties = shader.GetType().GetProperties(); foreach (PropertyInfo propertyInfo in properties) { Type type = Nullable.GetUnderlyingType(propertyInfo.PropertyType) ?? propertyInfo.PropertyType; string text = "_" + propertyInfo.Name; if (type == typeof(float)) { val.material.SetFloat(text, (float)propertyInfo.GetValue(shader)); } else if (type == typeof(EOSColor)) { EOSColor val2 = (EOSColor)propertyInfo.GetValue(shader); val.material.SetVector(text, Color.op_Implicit(val2.ToUnityColor())); } else if (type == typeof(bool)) { bool flag = (bool)propertyInfo.GetValue(shader); val.material.SetFloat(text, flag ? 1f : 0f); } else if (type == typeof(Vec4)) { Vec4 val3 = (Vec4)propertyInfo.GetValue(shader); val.material.SetVector(text, val3.ToVector4()); } } } ModifiedInLevelGearThermals.Add(gearPID); return true; } return false; } internal void OnPlayerItemWielded(FirstPersonItemHolder fpsItemHolder, ItemEquippable item) { if (item.GearIDRange == null) { CurrentGearPID = 0u; return; } CurrentGearPID = ExpeditionGearManager.GetOfflineGearPID(item.GearIDRange); TryGetInLevelGearThermalRenderersFromItem(item, CurrentGearPID, out var _); TrySetThermalSightRenderer(CurrentGearPID); } public bool IsGearWithThermal(uint gearPID) { return ThermalOfflineGears.Contains(gearPID); } private void CleanupInLevelGearThermals(bool keepCurrentGear = false) { if (!keepCurrentGear || !InLevelGearThermals.ContainsKey(CurrentGearPID)) { InLevelGearThermals.Clear(); } else { Renderer[] value = InLevelGearThermals[CurrentGearPID]; InLevelGearThermals.Clear(); InLevelGearThermals[CurrentGearPID] = value; } ModifiedInLevelGearThermals.Clear(); } internal void SetCurrentThermalSightSettings(float t) { if (InLevelGearThermals.TryGetValue(CurrentGearPID, out var value) && base.definitions.TryGetValue(CurrentGearPID, out var value2)) { Renderer[] array = value; foreach (Renderer obj in array) { float zoom = value2.Definition.Shader.Zoom; float offAimPixelZoom = value2.Definition.OffAimPixelZoom; float num = Mathf.Lerp(zoom, offAimPixelZoom, t); obj.material.SetFloat("_Zoom", num); } } } private void Clear() { CurrentGearPID = 0u; CleanupInLevelGearThermals(); CleanupPuzzleVisuals(); } private TSAManager() { LevelAPI.OnBuildStart += Clear; LevelAPI.OnLevelCleanup += Clear; } static TSAManager() { Current = new TSAManager(); } public void RegisterPuzzleVisual(CP_Bioscan_Core core) { Il2CppArrayBase<Renderer> componentsInChildren = ((Component)core).gameObject.GetComponentsInChildren<Renderer>(true); if (componentsInChildren == null) { return; } foreach (Renderer item2 in ((IEnumerable<Renderer>)componentsInChildren).Where((Renderer comp) => ((Object)((Component)comp).gameObject).name.Equals("Zone")).ToList()) { GameObject gameObject = ((Component)item2).gameObject; float @float = item2.material.GetFloat("_Intensity"); float float2 = item2.material.GetFloat("_BehindWallIntensity"); PuzzleVisualWrapper item = new PuzzleVisualWrapper { GO = gameObject, Renderer = item2, Intensity = @float, BehindWallIntensity = float2 }; PuzzleVisuals.Add(item); } } public void RegisterPuzzleVisual(PuzzleVisualWrapper wrapper) { PuzzleVisuals.Add(wrapper); } internal void SetPuzzleVisualsIntensity(float t) { PuzzleVisuals.ForEach(delegate(PuzzleVisualWrapper v) { v.SetIntensity(t); }); } private void CleanupPuzzleVisuals() { PuzzleVisuals.Clear(); } } } namespace ThermalSights.Patches { internal static class CP_Bioscan_Core_Setup { [HarmonyPostfix] [HarmonyPatch(typeof(CP_Bioscan_Core), "Setup")] private static void Post_CaptureBioscanVisual(CP_Bioscan_Core __instance) { TSAManager.Current.RegisterPuzzleVisual(__instance); } } [HarmonyPatch] internal static class FirstPersonItemHolder_SetWieldedItem { public static event Action<FirstPersonItemHolder, ItemEquippable> OnItemWielded; [HarmonyPostfix] [HarmonyPatch(typeof(FirstPersonItemHolder), "SetWieldedItem")] private static void Post_SetWieldedItem(FirstPersonItemHolder __instance, ItemEquippable item) { TSAManager.Current.OnPlayerItemWielded(__instance, item); TSAManager.Current.SetPuzzleVisualsIntensity(1f); TSAManager.Current.SetCurrentThermalSightSettings(1f); FirstPersonItemHolder_SetWieldedItem.OnItemWielded?.Invoke(__instance, item); } } [HarmonyPatch] internal static class FPIS_Aim_Update { public static event Action<FPIS_Aim, float> OnAimUpdate; [HarmonyPostfix] [HarmonyPatch(typeof(FPIS_Aim), "Update")] private static void Post_Aim_Update(FPIS_Aim __instance) { if (!((Object)(object)((FPItemState)__instance).Holder.WieldedItem == (Object)null)) { float num = 1f - FirstPersonItemHolder.m_transitionDelta; if (!TSAManager.Current.IsGearWithThermal(TSAManager.Current.CurrentGearPID)) { num = Math.Max(0.05f, num); } else { TSAManager.Current.SetCurrentThermalSightSettings(num); } TSAManager.Current.SetPuzzleVisualsIntensity(num); FPIS_Aim_Update.OnAimUpdate?.Invoke(__instance, num); } } } } namespace ThermalSights.Definition { public class TSADefinition { public float OffAimPixelZoom { get; set; } = 1f; public TSShader Shader { get; set; } = new TSShader(); } public class TSShader { [JsonPropertyName("DistanceFalloff")] [Range(0.0, 1.0)] public float HeatFalloff { get; set; } = 0.01f; [Range(0.0, 1.0)] public float FogFalloff { get; set; } = 0.1f; [JsonPropertyName("PixelZoom")] [Range(0.0, 1.0)] public float Zoom { get; set; } = 0.8f; [JsonPropertyName("AspectRatioAdjust")] [Range(0.0, 2.0)] public float RatioAdjust { get; set; } = 1f; [Range(0.0, 1.0)] public float DistortionCenter { get; set; } = 0.5f; public float DistortionScale { get; set; } = 1f; public float DistortionSpeed { get; set; } = 1f; public float DistortionSignalSpeed { get; set; } = 0.025f; [Range(0.0, 1.0)] public float DistortionMin { get; set; } = 0.01f; [Range(0.0, 1.0)] public float DistortionMax { get; set; } = 0.4f; [JsonPropertyName("AmbientTemperature")] [Range(0.0, 1.0)] public float AmbientTemp { get; set; } = 0.15f; [JsonPropertyName("BackgroundTemperature")] [Range(0.0, 1.0)] public float BackgroundTemp { get; set; } = 0.05f; [Range(0.0, 10.0)] public float AlbedoColorFactor { get; set; } = 0.5f; [Range(0.0, 10.0)] public float AmbientColorFactor { get; set; } = 5f; public float OcclusionHeat { get; set; } = 0.5f; public float BodyOcclusionHeat { get; set; } = 2.5f; [Range(0.0, 1.0)] public float ScreenIntensity { get; set; } = 0.2f; [Range(0.0, 1.0)] public float OffAngleFade { get; set; } = 0.95f; [Range(0.0, 1.0)] public float Noise { get; set; } = 0.1f; [JsonPropertyName("MinShadowEnemyDistortion")] [Range(0.0, 1.0)] public float DistortionMinShadowEnemies { get; set; } = 0.2f; [JsonPropertyName("MaxShadowEnemyDistortion")] [Range(0.0, 1.0)] public float DistortionMaxShadowEnemies { get; set; } = 1f; [Range(0.0, 1.0)] public float DistortionSignalSpeedShadowEnemies { get; set; } = 1f; public float ShadowEnemyFresnel { get; set; } = 10f; [Range(0.0, 1.0)] public float ShadowEnemyHeat { get; set; } = 0.1f; public EOSColor ReticuleColorA { get; set; } = new EOSColor { r = 1f, g = 1f, b = 1f, a = 1f }; public EOSColor ReticuleColorB { get; set; } = new EOSColor { r = 1f, g = 1f, b = 1f, a = 1f }; public EOSColor ReticuleColorC { get; set; } = new EOSColor { r = 1f, g = 1f, b = 1f, a = 1f }; [Range(0.0, 20.0)] public float SightDirt { get; set; } public bool LitGlass { get; set; } public bool ClipBorders { get; set; } = true; public Vec4 AxisX { get; set; } = new Vec4(); public Vec4 AxisY { get; set; } = new Vec4(); public Vec4 AxisZ { get; set; } = new Vec4(); public bool Flip { get; set; } = true; [JsonPropertyName("Distance1")] [Range(0.0, 100.0)] public float ProjDist1 { get; set; } = 100f; [JsonPropertyName("Distance2")] [Range(0.0, 100.0)] public float ProjDist2 { get; set; } = 66f; [JsonPropertyName("Distance3")] [Range(0.0, 100.0)] public float ProjDist3 { get; set; } = 33f; [JsonPropertyName("Size1")] [Range(0.0, 3.0)] public float ProjSize1 { get; set; } = 1f; [JsonPropertyName("Size2")] [Range(0.0, 3.0)] public float ProjSize2 { get; set; } = 1f; [JsonPropertyName("Size3")] [Range(0.0, 3.0)] public float ProjSize3 { get; set; } = 1f; [JsonPropertyName("Zeroing")] [Range(-1.0, 1.0)] public float ZeroOffset { get; set; } } }
BepInEx/plugins/Nadir/Custom/LEGACY.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; 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 AIGraph; using AK; using Agents; using AssetShards; using BepInEx; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Utils.Collections; using BoosterImplants; using CellMenu; using ChainedPuzzles; using EOSExt.Reactor.Managers; using Enemies; using ExtraObjectiveSetup; using ExtraObjectiveSetup.BaseClasses; using ExtraObjectiveSetup.ExtendedWardenEvents; using ExtraObjectiveSetup.Instances; using ExtraObjectiveSetup.Utils; using FloLib.Infos; using FloLib.Networks.Replications; using GTFO.API; using GTFO.API.JSON.Converters; using GTFO.API.Utilities; using GameData; using Gear; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using LEGACY.ExtraEvents; using LEGACY.LegacyOverride; using LEGACY.LegacyOverride.DummyVisual; using LEGACY.LegacyOverride.DummyVisual.VisualGOAnimation; using LEGACY.LegacyOverride.DummyVisual.VisualGOAnimation.AnimationConfig; using LEGACY.LegacyOverride.DummyVisual.VisualSequenceType; using LEGACY.LegacyOverride.ElevatorCargo; using LEGACY.LegacyOverride.EnemyTagger; using LEGACY.LegacyOverride.EventScan; using LEGACY.LegacyOverride.ExpeditionIntelNotification; using LEGACY.LegacyOverride.ExpeditionSuccessPage; using LEGACY.LegacyOverride.FogBeacon; using LEGACY.LegacyOverride.ForceFail; using LEGACY.LegacyOverride.Music; using LEGACY.LegacyOverride.ResourceStations; using LEGACY.Utils; using LEGACY.VanillaFix; using LevelGeneration; using Localization; using MTFO.API; using Microsoft.CodeAnalysis; using Player; using SNetwork; using ScanPosOverride.Managers; using StateMachines; using TMPro; using ThermalSights; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("LEGACY")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LEGACY")] [assembly: AssemblyTitle("LEGACY")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [HarmonyPatch(typeof(PUI_Watermark), "UpdateWatermark")] internal static class Patch_WatermarkUpdateWatermark { private static void Postfix(PUI_Watermark __instance) { string text = "4.6.2+git44e73d7-dirty-main".Remove("x.x.x".Length); ((TMP_Text)__instance.m_watermarkText).SetText("<color=red>MODDED</color> <color=orange>" + text + "</color>\n<color=red>Warren</color>", true); } } namespace LEGACY { internal static class Assets { public static GameObject CircleSensor { get; private set; } public static GameObject MovableSensor { get; private set; } public static GameObject OBSVisual { get; private set; } public static GameObject ObjectiveMarker { get; private set; } public static GameObject EventScan { get; private set; } internal static GameObject DummyScan { get; private set; } internal static GameObject DummySensor { get; private set; } internal static GameObject AmmoStation { get; private set; } internal static GameObject MediStation { get; private set; } internal static GameObject ToolStation { get; private set; } public static void Init() { CircleSensor = AssetAPI.GetLoadedAsset<GameObject>("Assets/SecuritySensor/CircleSensor.prefab"); MovableSensor = AssetAPI.GetLoadedAsset<GameObject>("Assets/SecuritySensor/MovableSensor.prefab"); OBSVisual = AssetAPI.GetLoadedAsset<GameObject>("Assets/SecuritySensor/OBSVisual.prefab"); ObjectiveMarker = AssetAPI.GetLoadedAsset<GameObject>("Assets/SecuritySensor/ObjectiveMarker.prefab"); EventScan = AssetAPI.GetLoadedAsset<GameObject>("Assets/EventObjects/EventScan.prefab"); DummyScan = AssetAPI.GetLoadedAsset<GameObject>("Assets/DummyVisual/DummyScan.prefab"); DummySensor = AssetAPI.GetLoadedAsset<GameObject>("Assets/DummyVisual/DummySensor.prefab"); AmmoStation = AssetAPI.GetLoadedAsset<GameObject>("Assets/Misc/AmmoStation.prefab"); MediStation = AssetAPI.GetLoadedAsset<GameObject>("Assets/Misc/MediStation.prefab"); ToolStation = AssetAPI.GetLoadedAsset<GameObject>("Assets/Misc/ToolStation.prefab"); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Inas.LEGACY", "LEGACY", "4.3.3")] public class EntryPoint : BasePlugin { public const string AUTHOR = "Inas"; public const string RUNDOWN_NAME = "LEGACY"; public const string VERSION = "4.3.3"; public const bool TESTING = false; public const string TEST_STRING = "TESTING"; private Harmony m_Harmony; public override void Load() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown m_Harmony = new Harmony("LEGACY"); m_Harmony.PatchAll(); LegacyOverrideManagers.Init(); LegacyExtraEvents.Init(); LEGACY.VanillaFix.Debugger.Current.Init(); AssetAPI.OnAssetBundlesLoaded += Assets.Init; EventAPI.OnManagersSetup += delegate { AssetShardManager.OnStartupAssetsLoaded += Action.op_Implicit((Action)MainMenuGuiLayer.Current.PageRundownNew.SetupCustomTutorialButton); }; } } } namespace LEGACY.Reactor { [HarmonyPatch] internal class Patch_ReactorShutdown { [HarmonyPostfix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")] private static void Post_OnStateChange(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState) { //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_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_0026: 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_0053: Invalid comparison between Unknown and I4 //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected I4, but got Unknown //IL_007e: 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_0086: 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_0099: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || oldState.status == newState.status) { return; } WardenObjectiveDataBlock val = null; if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref val) || val == null) { LegacyLogger.Error("Patch_ReactorShutdown: "); LegacyLogger.Error("Failed to get warden objective"); } else if ((int)val.Type == 2 && !val.OnActivateOnSolveItem) { eWardenObjectiveEventTrigger val2 = (eWardenObjectiveEventTrigger)0; eReactorStatus status = newState.status; switch (status - 7) { default: return; case 0: val2 = (eWardenObjectiveEventTrigger)1; break; case 1: val2 = (eWardenObjectiveEventTrigger)2; break; case 2: val2 = (eWardenObjectiveEventTrigger)3; break; } _ = __instance.SpawnNode.LayerType; WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(val.EventsOnActivate, val2, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); } } [HarmonyPrefix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnBuildDone")] private static void Pre_OnBuildDone_ChainedPuzzleMidObjectiveFix(LG_WardenObjective_Reactor __instance) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) WardenObjectiveDataBlock val = null; if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref val) || val == null) { LegacyLogger.Error("Patch_ReactorShutdown: Failed to get warden objective"); } else if (val.ChainedPuzzleMidObjective != 0) { __instance.m_chainedPuzzleAlignMidObjective = __instance.m_chainedPuzzleAlign; } } [HarmonyPrefix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "Update")] private static bool Pre_Update(LG_WardenObjective_Reactor __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 if ((int)__instance.m_currentState.status != 7) { return true; } if (!__instance.m_currentWaveData.HasVerificationTerminal) { return true; } __instance.SetGUIMessage(true, Text.Format(3000u, (Object[])(object)new Object[1] { Object.op_Implicit("<color=orange>" + __instance.m_currentWaveData.VerificationTerminalSerial + "</color>") }), (ePUIMessageStyle)3, false, "", ""); return false; } } [HarmonyPatch] internal class Patch_ReactorStartup_ExtraEventsExecution { [HarmonyPostfix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")] private static void Post_ExecuteOnNoneEventsOnDefenseStart(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 if (oldState.status != newState.status && (int)newState.status == 3) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)0, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); } } [HarmonyPostfix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnBuildDone")] private static void Post_OnBuildDone(LG_WardenObjective_Reactor __instance) { //IL_0011: 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_004c: Invalid comparison between Unknown and I4 WardenObjectiveDataBlock db = default(WardenObjectiveDataBlock); if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref db) || db == null) { LegacyLogger.Error("Patch_ReactorStartup_ExtraEventsExecution: "); LegacyLogger.Error("Failed to get warden objective"); } else if ((int)db.Type == 1 && !db.OnActivateOnSolveItem) { ChainedPuzzleInstance chainedPuzzleToStartSequence = __instance.m_chainedPuzzleToStartSequence; chainedPuzzleToStartSequence.OnPuzzleSolved += Action.op_Implicit((Action)delegate { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(db.EventsOnActivate, (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); }); } } } [HarmonyPatch] internal class Patch_ReactorStartup_OverwriteGUIBehaviour { private static HashSet<uint> ForceDisableLevels; [HarmonyPrefix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")] private static bool Pre_HideReactorMessageForInfiniteWave(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_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_0017: Invalid comparison between Unknown and I4 //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_0020: Invalid comparison between Unknown and I4 //IL_0037: 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_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_0051: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected I4, but got Unknown //IL_0060: 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_0268: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) if (oldState.status == newState.status) { return true; } if ((int)newState.status != 2 && (int)newState.status != 3 && (int)newState.status != 4) { return true; } if (ForceDisable()) { if (oldState.stateCount != newState.stateCount) { __instance.OnStateCountUpdate(newState.stateCount); } if (oldState.stateProgress != newState.stateProgress) { __instance.OnStateProgressUpdate(newState.stateProgress); } __instance.ReadyForVerification = false; eReactorStatus status = newState.status; switch (status - 2) { case 0: { WardenObjectiveDataBlock val = null; if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref val) || val == null) { LegacyLogger.Error("Patch_ReactorStartup_OverwriteGUIBehaviour: "); LegacyLogger.Error("Failed to get warden objective datablock"); break; } __instance.m_lightCollection.SetMode(val.LightsOnDuringIntro); __instance.m_lightCollection.ResetUpdateValues(true); __instance.lcReset = true; __instance.m_lightsBlinking = false; __instance.m_spawnEnemies = false; __instance.m_progressUpdateEnabled = true; __instance.m_alarmCountdownPlayed = false; __instance.m_currentDuration = ((!newState.verifyFailed) ? __instance.m_currentWaveData.Warmup : __instance.m_currentWaveData.WarmupFail); WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)1, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); if (__instance.m_currentWaveCount == 1) { Debug.LogError(Object.op_Implicit("Reactor IDLE START")); __instance.m_sound.Post(EVENTS.REACTOR_POWER_LEVEL_1_LOOP, true); __instance.m_sound.SetRTPCValue(GAME_PARAMETERS.REACTOR_POWER, 0f); } else { Debug.LogError(Object.op_Implicit("Reactor REACTOR_POWER_DOWN")); __instance.m_sound.Post(EVENTS.REACTOR_POWER_LEVEL_2_TO_1_TRANSITION, true); __instance.m_sound.SetRTPCValue(GAME_PARAMETERS.REACTOR_POWER, 0f); } break; } case 1: __instance.m_lightCollection.ResetUpdateValues(true); __instance.lcReset = true; __instance.m_spawnEnemies = true; __instance.m_currentEnemyWaveIndex = 0; __instance.m_alarmCountdownPlayed = false; __instance.m_progressUpdateEnabled = true; __instance.m_currentDuration = __instance.m_currentWaveData.Wave; __instance.m_sound.Post(EVENTS.REACTOR_POWER_LEVEL_1_TO_3_TRANSITION, true); break; case 2: __instance.m_lightCollection.ResetUpdateValues(false); __instance.lcReset = true; __instance.m_spawnEnemies = false; __instance.m_progressUpdateEnabled = true; __instance.ReadyForVerification = true; Debug.Log(Object.op_Implicit("Wait for verify! newState.verifyFailed? " + newState.verifyFailed)); __instance.m_currentDuration = ((!newState.verifyFailed) ? __instance.m_currentWaveData.Verify : __instance.m_currentWaveData.VerifyFail); WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)2, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); break; } __instance.m_currentState = newState; return false; } return true; } private static bool ForceDisable() { return ForceDisableLevels.Contains(RundownManager.ActiveExpedition.LevelLayoutData); } static Patch_ReactorStartup_OverwriteGUIBehaviour() { ForceDisableLevels = new HashSet<uint>(); LevelLayoutDataBlock block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock("Legacy_L3E2_L1"); if (block != null) { ForceDisableLevels.Add(((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).persistentID); } block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock("Legacy_L1E1_L1"); if (block != null) { ForceDisableLevels.Add(((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).persistentID); } } } } namespace LEGACY.HardcodedBehaviours { [HarmonyPatch] internal class Patch_PickupItem_Hardcoded { [HarmonyPrefix] [HarmonyPatch(typeof(LG_Distribute_PickupItemsPerZone), "Build")] private static void Pre_LG_Distribute_PickupItemsPerZone(LG_Distribute_PickupItemsPerZone __instance) { //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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 LevelLayoutDataBlock block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock("LAYOUT_O4_1_L1"); if (block == null || RundownManager.ActiveExpedition.LevelLayoutData != ((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).persistentID) { return; } eLocalZoneIndex localIndex = __instance.m_zone.LocalIndex; if ((int)localIndex != 1) { if ((int)localIndex == 5) { __instance.m_zonePlacementWeights.Start = 0f; __instance.m_zonePlacementWeights.Middle = 0f; __instance.m_zonePlacementWeights.End = 100000f; } } else if ((int)__instance.m_pickupType == 1) { __instance.m_zonePlacementWeights.Start = 100000f; __instance.m_zonePlacementWeights.Middle = 0f; __instance.m_zonePlacementWeights.End = 0f; } } } } namespace LEGACY.VanillaFix { [HarmonyPatch] internal class Patch_FixScoutFreeze { [HarmonyPrefix] [HarmonyPatch(typeof(ES_ScoutScream), "CommonUpdate")] private static bool Prefix_Debug(ES_ScoutScream __instance) { if (((AgentAI)((ES_Base)__instance).m_ai).Target == null) { return false; } return true; } } [HarmonyPatch] internal class Patch_LG_SecurityDoor_Fix_EventsOnUnlockDoor_Powergenerator { [HarmonyPrefix] [HarmonyPatch(typeof(LG_SecurityDoor), "OnSyncDoorStatusChange")] private static void Pre_OnSyncDoorStatusChange(LG_SecurityDoor __instance, pDoorState state, bool isRecall) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 eDoorStatus status = state.status; if ((status - 4 <= 1 || (int)status == 9) && (int)__instance.m_lastState.status == 6 && !isRecall) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.LinkedToZoneData.EventsOnUnlockDoor, (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); } } } [HarmonyPatch] internal class Patch_LockSecurityDoor_FixCustomText { [HarmonyPostfix] [HarmonyPatch(typeof(LG_SecurityDoor_Locks), "Setup", new Type[] { typeof(LG_SecurityDoor) })] private static void Post_LG_SecurityDoor_Locks_Setup(LG_SecurityDoor door, LG_SecurityDoor_Locks __instance) { LocalizedText customText = door.LinkedToZoneData.ProgressionPuzzleToEnter.CustomText; __instance.m_lockedWithNoKeyInteractionText = customText; } } [HarmonyPatch] internal class Debugger { public static Debugger Current { get; private set; } = new Debugger(); public bool DEBUGGING { get; private set; } private Debugger() { } internal void Init() { _ = DEBUGGING; } private void f1(int k, out string v) { if (k < 2) { v = "2"; } v = null; } private void f2(int k, ref string v) { if (k < 2) { v = "2"; } } } } namespace LEGACY.Utils { public delegate float EasingFunction(float t, float b, float c, float d); public delegate bool BoolCheck(); internal static class CoroutineEase { [CompilerGenerated] private sealed class <DoEaseLocalPos>d__1 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BoolCheck checkAbort; public EasingFunction ease; public float startTime; public float duration; public Transform trans; public Vector3 sourcePos; public Vector3 targetPos; public Action onDone; private bool <doAbort>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DoEaseLocalPos>d__1(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00c1: 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_007a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <doAbort>5__2 = false; break; case 1: <>1__state = -1; break; } if (Clock.Time < startTime + duration && !<doAbort>5__2) { <doAbort>5__2 = checkAbort != null && checkAbort(); float num = ease(Clock.Time - startTime, 0f, 1f, duration); trans.localPosition = Vector3.Lerp(sourcePos, targetPos, num); <>2__current = null; <>1__state = 1; return true; } trans.localPosition = targetPos; if (!<doAbort>5__2 && onDone != null) { onDone(); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DoEaseLocalRot>d__2 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BoolCheck checkAbort; public EasingFunction ease; public float startTime; public float duration; public Transform trans; public Vector3 sourceEuler; public Vector3 targetEuler; public Action onDone; private bool <doAbort>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DoEaseLocalRot>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00c1: 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_007a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <doAbort>5__2 = false; break; case 1: <>1__state = -1; break; } if (Clock.Time < startTime + duration && !<doAbort>5__2) { <doAbort>5__2 = checkAbort != null && checkAbort(); float num = ease(Clock.Time - startTime, 0f, 1f, duration); trans.localEulerAngles = Vector3.Lerp(sourceEuler, targetEuler, num); <>2__current = null; <>1__state = 1; return true; } trans.localEulerAngles = targetEuler; if (!<doAbort>5__2 && onDone != null) { onDone(); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DoEaseLocalScale>d__0 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public BoolCheck checkAbort; public EasingFunction ease; public float startTime; public float duration; public Transform trans; public Vector3 startScale; public Vector3 targetScale; public Action onDone; private bool <doAbort>5__2; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DoEaseLocalScale>d__0(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00c1: 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_007a: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <doAbort>5__2 = false; break; case 1: <>1__state = -1; break; } if (Clock.Time < startTime + duration && !<doAbort>5__2) { <doAbort>5__2 = checkAbort != null && checkAbort(); float num = ease(Clock.Time - startTime, 0f, 1f, duration); trans.localScale = Vector3.Lerp(startScale, targetScale, num); <>2__current = null; <>1__state = 1; return true; } trans.localScale = targetScale; if (!<doAbort>5__2 && onDone != null) { onDone(); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [IteratorStateMachine(typeof(<DoEaseLocalScale>d__0))] private static IEnumerator DoEaseLocalScale(Transform trans, Vector3 startScale, Vector3 targetScale, float startTime, float duration, EasingFunction ease, Action onDone, BoolCheck checkAbort) { //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_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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DoEaseLocalScale>d__0(0) { trans = trans, startScale = startScale, targetScale = targetScale, startTime = startTime, duration = duration, ease = ease, onDone = onDone, checkAbort = checkAbort }; } [IteratorStateMachine(typeof(<DoEaseLocalPos>d__1))] private static IEnumerator DoEaseLocalPos(Transform trans, Vector3 sourcePos, Vector3 targetPos, float startTime, float duration, EasingFunction ease, Action onDone, BoolCheck checkAbort) { //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_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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DoEaseLocalPos>d__1(0) { trans = trans, sourcePos = sourcePos, targetPos = targetPos, startTime = startTime, duration = duration, ease = ease, onDone = onDone, checkAbort = checkAbort }; } [IteratorStateMachine(typeof(<DoEaseLocalRot>d__2))] private static IEnumerator DoEaseLocalRot(Transform trans, Vector3 sourceEuler, Vector3 targetEuler, float startTime, float duration, EasingFunction ease, Action onDone, BoolCheck checkAbort) { //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_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) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DoEaseLocalRot>d__2(0) { trans = trans, sourceEuler = sourceEuler, targetEuler = targetEuler, startTime = startTime, duration = duration, ease = ease, onDone = onDone, checkAbort = checkAbort }; } internal static Coroutine EaseLocalScale(Transform trans, Vector3 startScale, Vector3 targetScale, float duration, EasingFunction ease = null, Action onDone = null, BoolCheck checkAbort = null) { //IL_0014: 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) EasingFunction ease2 = ease ?? new EasingFunction(Easing.EaseOutExpo); return CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoEaseLocalScale(trans, startScale, targetScale, Clock.Time, duration, ease2, onDone, checkAbort)), (Action)null); } internal static Coroutine EaseLocalPos(Transform trans, Vector3 sourcePos, Vector3 targetPos, float duration, EasingFunction ease = null, Action onDone = null, BoolCheck checkAbort = null) { //IL_0014: 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) EasingFunction ease2 = ease ?? new EasingFunction(Easing.EaseOutExpo); return CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoEaseLocalPos(trans, sourcePos, targetPos, Clock.Time, duration, ease2, onDone, checkAbort)), (Action)null); } internal static Coroutine EaseLocalRot(Transform trans, Vector3 sourceEuler, Vector3 targetEuler, float duration, EasingFunction ease = null, Action onDone = null, BoolCheck checkAbort = null) { //IL_0014: 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) EasingFunction ease2 = ease ?? new EasingFunction(Easing.EaseOutExpo); return CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoEaseLocalRot(trans, sourceEuler, targetEuler, Clock.Time, duration, ease2, onDone, checkAbort)), (Action)null); } } public static class Helper { private static void ResetChild(iChainedPuzzleCore ICore) { CP_Bioscan_Core val = ((Il2CppObjectBase)ICore).TryCast<CP_Bioscan_Core>(); if ((Object)(object)val != (Object)null) { ((Il2CppObjectBase)val.m_spline).Cast<CP_Holopath_Spline>(); ((Il2CppObjectBase)val.PlayerScanner).Cast<CP_PlayerScanner>().ResetScanProgression(0f); val.Deactivate(); return; } CP_Cluster_Core val2 = ((Il2CppObjectBase)ICore).TryCast<CP_Cluster_Core>(); if ((Object)(object)val2 == (Object)null) { LegacyLogger.Error("ResetChild: found iChainedPuzzleCore that is neither CP_Bioscan_Core nor CP_Cluster_Core..."); return; } ((Il2CppObjectBase)val2.m_spline).Cast<CP_Holopath_Spline>(); foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)val2.m_childCores) { ResetChild(item); } val2.Deactivate(); } public static void ResetChainedPuzzle(ChainedPuzzleInstance chainedPuzzleInstance) { //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_0023: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0065: 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_0075: 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_0091: 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_009b: 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_00a9: Unknown result type (might be due to invalid IL or missing references) if (chainedPuzzleInstance.Data.DisableSurvivalWaveOnComplete) { chainedPuzzleInstance.m_sound = new CellSoundPlayer(chainedPuzzleInstance.m_parent.position); } foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)chainedPuzzleInstance.m_chainedPuzzleCores) { ResetChild(item); } if (SNet.IsMaster) { pChainedPuzzleState state = chainedPuzzleInstance.m_stateReplicator.State; pChainedPuzzleState val = default(pChainedPuzzleState); val.status = (eChainedPuzzleStatus)0; val.currentSurvivalWave_EventID = state.currentSurvivalWave_EventID; val.isSolved = false; val.isActive = false; pChainedPuzzleState val2 = val; chainedPuzzleInstance.m_stateReplicator.InteractWithState(val2, new pChainedPuzzleInteraction { type = (eChainedPuzzleInteraction)2 }); } } public static List<T> ToManagedList<T>(this List<T> il2cppList) { List<T> list = new List<T>(); Enumerator<T> enumerator = il2cppList.GetEnumerator(); while (enumerator.MoveNext()) { T current = enumerator.Current; list.Add(current); } return list; } public static bool TryGetComponent<T>(this GameObject obj, out T comp) { comp = obj.GetComponent<T>(); return comp != null; } public static bool IsPlayerInLevel(PlayerAgent player) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 return (int)player.Owner.Load<pGameState>().gameState == 10; } public static ChainedPuzzleInstance GetChainedPuzzleForCommandOnTerminal(LG_ComputerTerminal terminal, string command) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected I4, but got Unknown //IL_00bc: 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_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Invalid comparison between Unknown and I4 //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Invalid comparison between Unknown and I4 //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Invalid comparison between Unknown and I4 //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Invalid comparison between Unknown and I4 //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Invalid comparison between Unknown and I4 uint num = 0u; if (terminal.SpawnNode.m_dimension.IsMainDimension) { LG_LayerType layerType = terminal.SpawnNode.LayerType; switch ((int)layerType) { case 0: num = RundownManager.ActiveExpedition.LevelLayoutData; break; case 1: num = RundownManager.ActiveExpedition.SecondaryLayout; break; case 2: num = RundownManager.ActiveExpedition.ThirdLayout; break; default: LegacyLogger.Error("Unimplemented layer type."); return null; } } else { num = terminal.SpawnNode.m_dimension.DimensionData.LevelLayoutData; } LevelLayoutDataBlock block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock(num); List<CustomTerminalCommand> val = null; List<LG_ComputerTerminal> terminalsSpawnedInZone = terminal.SpawnNode.m_zone.TerminalsSpawnedInZone; int num2 = terminalsSpawnedInZone.IndexOf(terminal); ExpeditionZoneData val2 = null; Enumerator<ExpeditionZoneData> enumerator = block.Zones.GetEnumerator(); while (enumerator.MoveNext()) { ExpeditionZoneData current = enumerator.Current; if (current.LocalIndex == terminal.SpawnNode.m_zone.LocalIndex) { val2 = current; break; } } if (val2 == null) { LegacyLogger.Error("Cannot find target zone data."); return null; } if (val2.TerminalPlacements.Count != terminalsSpawnedInZone.Count) { LegacyLogger.Error("The numbers of terminal placement and spawn, skipped for the zone terminal."); return null; } val = val2.TerminalPlacements[num2].UniqueCommands; if (val.Count == 0) { return null; } List<WardenObjectiveEventData> val3 = null; TERM_Command val4 = (TERM_Command)0; Enumerator<CustomTerminalCommand> enumerator2 = val.GetEnumerator(); string text = default(string); string text2 = default(string); while (enumerator2.MoveNext()) { CustomTerminalCommand current2 = enumerator2.Current; if (current2.Command == command) { val3 = current2.CommandEvents; if (!terminal.m_command.TryGetCommand(current2.Command, ref val4, ref text, ref text2)) { LegacyLogger.Error("Cannot get TERM_COMMAND for command {0} on the specified terminal."); } break; } } if (val3 == null || (int)val4 == 0) { return null; } if ((int)val4 != 38 && (int)val4 != 39 && (int)val4 != 40 && (int)val4 != 41 && (int)val4 != 42) { return null; } ChainedPuzzleInstance val5 = null; for (int i = 0; i < val3.Count && (val3[i].ChainPuzzle == 0 || !terminal.TryGetChainPuzzleForCommand(val4, i, ref val5) || !((Object)(object)val5 != (Object)null)); i++) { } return val5; } public static bool TryGetZoneEntranceSecDoor(LG_Zone zone, out LG_SecurityDoor door) { if ((Object)(object)zone == (Object)null) { door = null; return false; } if ((Object)(object)zone.m_sourceGate == (Object)null) { door = null; return false; } if (zone.m_sourceGate.SpawnedDoor == null) { door = null; return false; } door = ((Il2CppObjectBase)zone.m_sourceGate.SpawnedDoor).TryCast<LG_SecurityDoor>(); return (Object)(object)door != (Object)null; } internal static bool isSecDoorToZoneOpened(LG_Zone zone14) { //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_0029: Invalid comparison between Unknown and I4 LG_SecurityDoor door = null; if (!TryGetZoneEntranceSecDoor(zone14, out door) || (Object)(object)door == (Object)null) { return false; } return (int)door.m_sync.GetCurrentSyncState().status == 10; } public static List<T> cast<T>(List<T> list) { List<T> list2 = new List<T>(); Enumerator<T> enumerator = list.GetEnumerator(); while (enumerator.MoveNext()) { T current = enumerator.Current; list2.Add(current); } return list2; } private static eDimensionIndex GetCurrentDimensionIndex() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (PlayerManager.PlayerAgentsInLevel.Count <= 0) { throw new Exception("? You don't have any player agent in level? How could that happen?"); } return ((Agent)PlayerManager.PlayerAgentsInLevel[0]).DimensionIndex; } public static void GetMinLayerAndLocalIndex(out LG_LayerType MinLayer, out eLocalZoneIndex MinLocalIndex) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between I4 and Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between I4 and Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected I4, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected I4, but got Unknown MinLayer = (LG_LayerType)2; MinLocalIndex = (eLocalZoneIndex)20; Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (IsPlayerInLevel(current)) { if ((int)MinLayer > (int)current.m_courseNode.LayerType) { MinLayer = (LG_LayerType)(int)current.m_courseNode.LayerType; MinLocalIndex = (eLocalZoneIndex)20; } if ((int)MinLocalIndex >= (int)current.m_courseNode.m_zone.LocalIndex) { MinLocalIndex = (eLocalZoneIndex)(int)current.m_courseNode.m_zone.LocalIndex; } } } } public static void GetMaxLayerAndLocalIndex(out LG_LayerType MaxLayer, out eLocalZoneIndex MaxLocalIndex) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between I4 and Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between I4 and Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected I4, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected I4, but got Unknown MaxLayer = (LG_LayerType)0; MaxLocalIndex = (eLocalZoneIndex)0; Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (IsPlayerInLevel(current)) { if ((int)MaxLayer < (int)current.m_courseNode.LayerType) { MaxLayer = (LG_LayerType)(int)current.m_courseNode.LayerType; MaxLocalIndex = (eLocalZoneIndex)0; } if ((int)MaxLocalIndex < (int)current.m_courseNode.m_zone.LocalIndex) { MaxLocalIndex = (eLocalZoneIndex)(int)current.m_courseNode.m_zone.LocalIndex; } } } } public static int GetMinAreaIndex(LG_Zone zone) { //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) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)zone == (Object)null) { return -1; } LG_LayerType type = zone.m_layer.m_type; eLocalZoneIndex localIndex = zone.LocalIndex; GetCurrentDimensionIndex(); int num = zone.m_areas.Count; Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (current.m_courseNode.LayerType != type || current.m_courseNode.m_zone.LocalIndex != localIndex) { continue; } int i = 0; for (List<LG_Area> areas = zone.m_areas; i < areas.Count; i++) { if (((Object)((Component)areas[i]).gameObject).GetInstanceID() == ((Object)((Component)current.m_courseNode.m_area).gameObject).GetInstanceID()) { if (num > i) { num = i; } break; } } } return num; } public static LG_ComputerTerminal FindTerminal(eDimensionIndex dimensionIndex, LG_LayerType layerType, eLocalZoneIndex localIndex, int terminalIndex) { //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_0034: 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_005c: 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_00f2: 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) LG_Zone val = null; if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(dimensionIndex, layerType, localIndex, ref val) || (Object)(object)val == (Object)null) { LegacyLogger.Error($"FindTerminal: Didn't find LG_Zone {dimensionIndex}, {layerType}, {localIndex}"); return null; } if (val.TerminalsSpawnedInZone == null || terminalIndex >= val.TerminalsSpawnedInZone.Count) { LegacyLogger.Error($"FindTerminal: Invalid terminal index {terminalIndex} - {((val.TerminalsSpawnedInZone != null) ? val.TerminalsSpawnedInZone.Count : 0)} terminals are spawned in {dimensionIndex}, {layerType}, {localIndex}"); return null; } if (terminalIndex >= 0) { return val.TerminalsSpawnedInZone[terminalIndex]; } return null; } public static AIG_NodeCluster GetNodeFromDimensionPosition(eDimensionIndex dimensionIndex, Vector3 position) { //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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) AIG_GeomorphNodeVolume val = default(AIG_GeomorphNodeVolume); AIG_VoxelNodePillar val2 = default(AIG_VoxelNodePillar); AIG_INode val3 = default(AIG_INode); AIG_NodeCluster result = default(AIG_NodeCluster); if (!AIG_GeomorphNodeVolume.TryGetGeomorphVolume(0, dimensionIndex, position, ref val) || !((AIG_NodeVolume)val).m_voxelNodeVolume.TryGetPillar(position, ref val2) || !val2.TryGetVoxelNode(position.y, ref val3) || !AIG_NodeCluster.TryGetNodeCluster(val3.ClusterID, ref result)) { LegacyLogger.Error("TryWarpTo : Position is not valid, try again inside an area."); return null; } return result; } } internal static class Json { private static readonly JsonSerializerOptions _setting; static Json() { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Expected O, but got Unknown _setting = new JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip, IncludeFields = false, PropertyNameCaseInsensitive = true, WriteIndented = true, IgnoreReadOnlyProperties = true }; _setting.Converters.Add(new JsonStringEnumConverter()); _setting.Converters.Add((JsonConverter)new LocalizedTextConverter()); } public static T Deserialize<T>(string json) { return JsonSerializer.Deserialize<T>(json, _setting); } public static object Deserialize(Type type, string json) { return JsonSerializer.Deserialize(json, type, _setting); } public static string Serialize<T>(T value) { return JsonSerializer.Serialize(value, _setting); } public static void Load<T>(string filePath, out T config) where T : new() { config = Deserialize<T>(File.ReadAllText(filePath)); } } internal static class LegacyLogger { private static ManualLogSource logger = Logger.CreateLogSource("LEGACYCore"); public static void Log(string format, params object[] args) { Log(string.Format(format, args)); } public static void Log(string str) { if (logger != null) { logger.Log((LogLevel)8, (object)str); } } public static void Warning(string format, params object[] args) { Warning(string.Format(format, args)); } public static void Warning(string str) { if (logger != null) { logger.Log((LogLevel)4, (object)str); } } public static void Error(string format, params object[] args) { Error(string.Format(format, args)); } public static void Error(string str) { if (logger != null) { logger.Log((LogLevel)2, (object)str); } } public static void Debug(string format, params object[] args) { Debug(string.Format(format, args)); } public static void Debug(string str) { if (logger != null) { logger.Log((LogLevel)32, (object)str); } } } public class SpawnHibernateEnemiesEvent { public eWardenObjectiveEventTrigger Trigger { get; set; } public int Type { get; set; } = 170; public eDimensionIndex DimensionIndex { get; set; } public LG_LayerType Layer { get; set; } public eLocalZoneIndex LocalIndex { get; set; } public string WorldEventObjectFilter { get; set; } = "RANDOM"; public uint EnemyID { get; set; } public int Count { get; set; } = 1; public float Delay { get; set; } public float Duration { get; set; } = 2f; } public class WeightedAreaSelector { private static readonly Dictionary<LG_Zone, WeightedAreaSelector> dict; private WeightedRandomBag<LG_Area> weightedRandomBag; public static WeightedAreaSelector Get(LG_Zone zone) { //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_003c: 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_0059: Expected I4, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (!dict.ContainsKey(zone)) { WeightedAreaSelector weightedAreaSelector = new WeightedAreaSelector(); Enumerator<LG_Area> enumerator = zone.m_areas.GetEnumerator(); while (enumerator.MoveNext()) { LG_Area current = enumerator.Current; float num = 0f; LG_AreaSize size = current.m_size; switch (size - 1) { case 4: num = 7f; break; case 0: num = 20f; break; case 1: num = 30f; break; case 2: num = 35f; break; case 3: num = 45f; break; default: LegacyLogger.Error($"Unhandled LG_AreaSize: {current.m_size}. Won't build."); return null; } weightedAreaSelector.AddEntry(current, num); } dict.Add(zone, weightedAreaSelector); } return dict[zone]; } public static WeightedAreaSelector Get(eDimensionIndex eDimensionIndex, LG_LayerType layerType, eLocalZoneIndex localIndex) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) LG_Zone val = default(LG_Zone); if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(eDimensionIndex, layerType, localIndex, ref val) || !Object.op_Implicit((Object)(object)val)) { return null; } return Get(val); } private WeightedAreaSelector() { weightedRandomBag = new WeightedRandomBag<LG_Area>(); } private void AddEntry(LG_Area area, float weight) { weightedRandomBag.AddEntry(area, weight); } public LG_Area GetRandom() { return weightedRandomBag.GetRandom(); } private static void OnBuildDone() { } private static void Clear() { dict.Clear(); } static WeightedAreaSelector() { dict = new Dictionary<LG_Zone, WeightedAreaSelector>(); LevelAPI.OnLevelCleanup += dict.Clear; } } public class WeightedRandomBag<T> { private struct Entry { public double accumulatedWeight; public T item; } private List<Entry> entries = new List<Entry>(); private double accumulatedWeight; private Random rand = new Random(); public void AddEntry(T item, double weight) { if (weight <= 0.0) { LegacyLogger.Error("AddEntry: no non-positive weight pls."); return; } accumulatedWeight += weight; entries.Add(new Entry { item = item, accumulatedWeight = accumulatedWeight }); } public T GetRandom() { double num = rand.NextDouble() * accumulatedWeight; foreach (Entry entry in entries) { if (entry.accumulatedWeight >= num) { return entry.item; } } return default(T); } } } namespace LEGACY.LegacyOverride { internal class NavMarkerManager { private Dictionary<string, GameObject> markerVisuals = new Dictionary<string, GameObject>(); private Dictionary<string, NavMarker> navMarkers = new Dictionary<string, NavMarker>(); private List<GameObject> arbitraryNavMarkers = new List<GameObject>(); public static NavMarkerManager Current { get; private set; } = new NavMarkerManager(); private GameObject InstantiateMarkerVisual() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_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) GameObject obj = Object.Instantiate<GameObject>(Assets.ObjectiveMarker); float num = 0.16216217f; Transform transform = obj.transform; transform.localPosition += Vector3.up * num; return obj; } public void EnableMarkerAt(string markerName, GameObject target, float scale) { //IL_0047: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) if (navMarkers.ContainsKey(markerName)) { navMarkers[markerName].SetVisible(true); } else { NavMarker val = GuiManager.NavMarkerLayer.PrepareGenericMarker(target); if ((Object)(object)val != (Object)null) { val.SetColor(new Color(0.855f, 0.482f, 0.976f)); val.SetStyle((eNavMarkerStyle)14); val.SetVisible(true); navMarkers[markerName] = val; } else { LegacyLogger.Error("EnableMarkerAt: got null nav marker"); } } GameObject val2 = null; if (markerVisuals.ContainsKey(markerName)) { val2 = markerVisuals[markerName]; } else { val2 = InstantiateMarkerVisual(); val2.transform.localScale = new Vector3(scale, scale, scale); val2.transform.SetPositionAndRotation(target.transform.position, Quaternion.identity); markerVisuals[markerName] = val2; } CoroutineManager.BlinkIn(val2, 0f); LegacyLogger.Debug("EnableMarker: marker " + markerName + " enabled"); } public void EnableArbitraryMarkerAt(string markerName, Vector3 Position) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_002f: 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_006b: Unknown result type (might be due to invalid IL or missing references) if (navMarkers.ContainsKey(markerName)) { navMarkers[markerName].SetVisible(true); } else { GameObject val = new GameObject(markerName); val.transform.SetPositionAndRotation(Position, Quaternion.identity); arbitraryNavMarkers.Add(val); NavMarker val2 = GuiManager.NavMarkerLayer.PrepareGenericMarker(val); if ((Object)(object)val2 != (Object)null) { val2.SetColor(new Color(0.855f, 0.482f, 0.976f)); val2.SetStyle((eNavMarkerStyle)14); val2.SetVisible(true); navMarkers[markerName] = val2; } else { LegacyLogger.Error("EnableMarkerAt: got null nav marker"); } } LegacyLogger.Debug("EnableMarker: marker " + markerName + " enabled"); } internal (GameObject markerVisual, NavMarker navMakrer) GetMarkerVisuals(string markerName) { if (!markerVisuals.TryGetValue(markerName, out var value) || !navMarkers.TryGetValue(markerName, out var value2)) { return (null, null); } return (value, value2); } public void DisableMakrer(string markerName) { if (navMarkers.ContainsKey(markerName)) { navMarkers[markerName].SetVisible(false); } if (markerVisuals.ContainsKey(markerName)) { GameObject val = markerVisuals[markerName]; if (val.active) { CoroutineManager.BlinkOut(val, 0f); } LegacyLogger.Debug("DisableMakrer: marker " + markerName + " disabled"); } } public void Clear() { foreach (GameObject value in markerVisuals.Values) { Object.Destroy((Object)(object)value); } arbitraryNavMarkers.ForEach((Action<GameObject>)Object.Destroy); markerVisuals.Clear(); navMarkers.Clear(); arbitraryNavMarkers.Clear(); } private NavMarkerManager() { LevelAPI.OnBuildStart += Clear; LevelAPI.OnLevelCleanup += Clear; } } internal static class LegacyOverrideManagers { internal static readonly string LEGACY_CONFIG_PATH = Path.Combine(MTFOPathAPI.CustomPath, "LegacyOverride"); internal static void Init() { ElevatorCargoOverrideManager.Current.Init(); BigPickupFogBeaconSettingManager.Current.Init(); EnemyTaggerSettingManager.Current.Init(); ForceFailManager.Current.Init(); ((GenericExpeditionDefinitionManager<ExpeditionIntel>)ExpeditionIntelNotifier.Current).Init(); ((GenericExpeditionDefinitionManager<EventScanDefinition>)EventScanManager.Current).Init(); ((GenericExpeditionDefinitionManager<VisualGroupDefinition>)VisualManager.Current).Init(); ((GenericExpeditionDefinitionManager<MusicOverride>)MusicStateOverrider.Current).Init(); ((ZoneDefinitionManager<LevelSpawnedFogBeaconDefinition>)LevelSpawnedFogBeaconManager.Current).Init(); ((GenericExpeditionDefinitionManager<SuccessPageCustomization>)SuccessPageCustomizationManager.Current).Init(); ((GenericExpeditionDefinitionManager<ResourceStationDefinition>)ResourceStationManager.Current).Init(); } } } namespace LEGACY.LegacyOverride.ResourceStations { public sealed class ToolStation : ResourceStation { public override string ItemKey => $"Tool_Station_{base.SerialNumber}"; protected override void SetupInteraction() { base.SetupInteraction(); TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.InteractionPrompt.ToolStation"); Interact.InteractionMessage = ((block == null) ? "TOOL STATION" : Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID)); } protected override void Replenish(PlayerAgent player) { PlayerAmmoStorage ammoStorage = PlayerBackpackManager.GetBackpack(player.Owner).AmmoStorage; float num = Math.Max(0f, Math.Min(def.SupplyUplimit.Tool - ammoStorage.ClassAmmo.RelInPack, def.SupplyEfficiency.Tool)); player.GiveAmmoRel((PlayerAgent)null, 0f, 0f, num); player.Sound.Post(EVENTS.AMMOPACK_APPLY, true); } public static ToolStation Instantiate(ResourceStationDefinition def) { if (def.StationType != StationType.TOOL) { LegacyLogger.Error($"Trying to instantiate MediStation with def with 'StationType': {def.StationType}!"); return null; } GameObject gO = Object.Instantiate<GameObject>(Assets.ToolStation); return new ToolStation(def, gO); } private ToolStation(ResourceStationDefinition def, GameObject GO) : base(def, GO) { } static ToolStation() { } } public sealed class MediStation : ResourceStation { public const float VANILLA_MAX_HEALTH = 25f; public override string ItemKey => $"Health_Station_{base.SerialNumber}"; protected override void SetupInteraction() { base.SetupInteraction(); TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.InteractionPrompt.MediStation"); Interact.InteractionMessage = ((block == null) ? "HEALTH STATION" : Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID)); } protected override void Replenish(PlayerAgent player) { float health = ((Dam_SyncedDamageBase)player.Damage).Health; float num = def.SupplyUplimit.Medi * 25f; if (!(health >= num)) { player.GiveHealth((PlayerAgent)null, Math.Min(def.SupplyEfficiency.Medi, (num - health) / 25f)); player.Sound.Post(EVENTS.MEDPACK_APPLY, true); } } public static MediStation Instantiate(ResourceStationDefinition def) { if (def.StationType != 0) { LegacyLogger.Error($"Trying to instantiate MediStation with def with 'StationType': {def.StationType}!"); return null; } GameObject gO = Object.Instantiate<GameObject>(Assets.MediStation); return new MediStation(def, gO); } private MediStation(ResourceStationDefinition def, GameObject GO) : base(def, GO) { } static MediStation() { } } public abstract class ResourceStation { [CompilerGenerated] private sealed class <BlinkMarker>d__61 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ResourceStation <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <BlinkMarker>d__61(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Expected O, but got Unknown int num = <>1__state; ResourceStation resourceStation = <>4__this; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; } else { <>1__state = -1; } resourceStation.StationMarkerGO.SetActive(!resourceStation.StationMarkerGO.active); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 1; return true; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public const int UNLIMITED_USE_TIME = int.MaxValue; private Coroutine m_blinkMarkerCoroutine; public virtual GameObject GameObject { get; protected set; } public GameObject InteractGO { get { GameObject gameObject = GameObject; return ((gameObject != null) ? ((Component)gameObject.transform.GetChild(3)).gameObject : null) ?? null; } } public GameObject StationMarkerGO { get { GameObject gameObject = GameObject; return ((gameObject != null) ? ((Component)gameObject.transform.GetChild(2)).gameObject : null) ?? null; } } public virtual Interact_Timed Interact { get; protected set; } public virtual ResourceStationDefinition def { get; protected set; } public RSTimer Timer { get; protected set; } public StateReplicator<RSStateStruct> StateReplicator { get; protected set; } public RSStateStruct State => StateReplicator?.State ?? new RSStateStruct(); public LG_GenericTerminalItem TerminalItem { get; protected set; } public AIG_CourseNode SpawnNode { get { return TerminalItem.SpawnNode; } set { TerminalItem.SpawnNode = value; } } protected int SerialNumber { get; private set; } public virtual string ItemKey => $"Resource_Station_{SerialNumber}"; public bool Enabled => State.Enabled; protected virtual bool InCooldown { get { if (State.RemainingUseTime <= 0) { return State.CurrentCooldownTime > 0f; } return false; } } public virtual bool HasUnlimitedUseTime => def.AllowedUseTimePerCooldown == int.MaxValue; public virtual void Destroy() { if (m_blinkMarkerCoroutine != null) { CoroutineManager.StopCoroutine(m_blinkMarkerCoroutine); m_blinkMarkerCoroutine = null; } Object.Destroy((Object)(object)GameObject); StateReplicator?.Unload(); Interact = null; def = null; StateReplicator = null; } protected virtual bool CanInteract() { if (Enabled) { return !InCooldown; } return false; } protected abstract void Replenish(PlayerAgent player); protected virtual void SetInteractionText() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) string text = Text.Format(827u, (Object[])(object)new Object[1] { Object.op_Implicit(InputMapper.GetBindingName(((Interact_Base)Interact).InputAction)) }); TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.OnAdditionalInteractionText.ResourceStation"); string text2 = ((block == null) ? "TO REPLENISH" : Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID)); string text3 = (HasUnlimitedUseTime ? string.Empty : $"({State.RemainingUseTime}/{def.AllowedUseTimePerCooldown})"); GuiManager.InteractionLayer.SetInteractPrompt(Interact.InteractionMessage, text + text2 + text3, (ePUIMessageStyle)0); } protected virtual void OnTriggerInteraction(PlayerAgent player) { RSStateStruct state = State; int num = (HasUnlimitedUseTime ? int.MaxValue : Math.Max(state.RemainingUseTime - 1, 0)); int num2 = player.Owner.PlayerSlotIndex(); if (num2 < 0 || num2 >= ((Il2CppArrayBase<SNet_Slot>)(object)SNet.Slots.PlayerSlots).Count) { LegacyLogger.Error($"ResourceStation_OnTriggerInteraction: player {player.PlayerName} has invalid slot index: {num2}"); } else { StateReplicator?.SetState(new RSStateStruct { LastInteractedPlayer = num2, RemainingUseTime = num, CurrentCooldownTime = ((num == 0) ? def.CooldownTime : 0f), Enabled = true }); } } protected virtual void OnInteractionSelected(PlayerAgent agent, bool selected) { if (selected) { SetInteractionText(); } } protected virtual void SetupInteraction() { Interact.InteractDuration = def.InteractDuration; Interact_Timed interact = Interact; interact.ExternalPlayerCanInteract += Func<PlayerAgent, bool>.op_Implicit((Func<PlayerAgent, bool>)((PlayerAgent _) => CanInteract())); Interact_Timed interact2 = Interact; interact2.OnInteractionSelected += Action<PlayerAgent, bool>.op_Implicit((Action<PlayerAgent, bool>)OnInteractionSelected); Interact_Timed interact3 = Interact; interact3.OnInteractionTriggered += Action<PlayerAgent>.op_Implicit((Action<PlayerAgent>)OnTriggerInteraction); } protected virtual void SetupTerminalItem() { //IL_000b: 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_0021: Unknown result type (might be due to invalid IL or missing references) LG_Zone val = default(LG_Zone); if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(((GlobalZoneIndex)def).DimensionIndex, ((GlobalZoneIndex)def).LayerType, ((GlobalZoneIndex)def).LocalIndex, ref val) || (Object)(object)val == (Object)null) { LegacyLogger.Error("ResourceStation: Cannot find spawn node!"); return; } if (def.AreaIndex < 0 || def.AreaIndex >= val.m_areas.Count) { LegacyLogger.Error("ResourceStation: Cannot find spawn node - Area index is invalid!"); return; } TerminalItem.Setup(ItemKey, val.m_areas[def.AreaIndex].m_courseNode); if (SpawnNode != null) { TerminalItem.FloorItemLocation = SpawnNode.m_zone.NavInfo.GetFormattedText((LG_NavInfoFormat)7); } TerminalItem.FloorItemStatus = (eFloorInventoryObjectStatus)0; } protected virtual void OnStateChanged(RSStateStruct oldState, RSStateStruct newState, bool isRecall) { if (isRecall) { return; } int lastInteractedPlayer = newState.LastInteractedPlayer; if (lastInteractedPlayer < 0 || lastInteractedPlayer >= ((Il2CppArrayBase<SNet_Slot>)(object)SNet.Slots.PlayerSlots).Count) { return; } if (((Interact_Base)Interact).IsSelected) { SetInteractionText(); } if (!SNet.IsMaster) { return; } LegacyLogger.Warning($"ResourceStation OnStateChanged: replenish for player {lastInteractedPlayer}, remaining use time: {newState.RemainingUseTime}"); if (oldState.RemainingUseTime > 0) { SNet_Player playerInSlot = SNet.Slots.GetPlayerInSlot(lastInteractedPlayer); if ((Object)(object)playerInSlot != (Object)null) { Replenish(((Il2CppObjectBase)playerInSlot.m_playerAgent).Cast<PlayerAgent>()); } else { LegacyLogger.Error($"playerSlot_{lastInteractedPlayer} has no player agent!"); } } if (newState.RemainingUseTime == 0) { LegacyLogger.Warning("ResourceStation OnStateChanged: cooldown timer starts!"); OnCoolDownStart(); } } protected virtual void OnCoolDownStart() { Timer.StartTimer(def.CooldownTime); if (m_blinkMarkerCoroutine == null) { m_blinkMarkerCoroutine = CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(BlinkMarker()), (Action)null); } } protected virtual void OnCoolDownTimerProgress(float progress) { } protected virtual void OnCoolDownEnd() { LegacyLogger.Warning("ResourceStation OnCoolDownEnd"); if (m_blinkMarkerCoroutine != null) { CoroutineManager.StopCoroutine(m_blinkMarkerCoroutine); m_blinkMarkerCoroutine = null; StationMarkerGO.SetActive(true); } if (SNet.IsMaster) { LegacyLogger.Warning("ResourceStation OnCoolDownEnd: master reset state!"); StateReplicator.SetState(new RSStateStruct { LastInteractedPlayer = -1, RemainingUseTime = def.AllowedUseTimePerCooldown, CurrentCooldownTime = 0f, Enabled = true }); } } protected virtual void SetupReplicator() { if (StateReplicator == null) { uint num = EOSNetworking.AllotReplicatorID(); if (num == 0) { LegacyLogger.Error("ResourceStation: replicatorID depleted, cannot setup replicator!"); return; } StateReplicator = StateReplicator<RSStateStruct>.Create(num, new RSStateStruct { RemainingUseTime = def.AllowedUseTimePerCooldown, CurrentCooldownTime = -1f, Enabled = true }, (LifeTimeType)1, (IStateReplicatorHolder<RSStateStruct>)null); StateReplicator.OnStateChanged += OnStateChanged; } } protected virtual void SetupRSTimer() { if ((Object)(object)Timer == (Object)null) { Timer = RSTimer.Instantiate(OnCoolDownTimerProgress, OnCoolDownEnd); } } [IteratorStateMachine(typeof(<BlinkMarker>d__61))] private IEnumerator BlinkMarker() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <BlinkMarker>d__61(0) { <>4__this = this }; } protected ResourceStation(ResourceStationDefinition def, GameObject GO) { //IL_0025: 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) this.def = def; GameObject = GO; GameObject.transform.SetPositionAndRotation(def.Position.ToVector3(), def.Rotation.ToQuaternion()); Interact = InteractGO.GetComponent<Interact_Timed>(); SerialNumber = SerialGenerator.GetUniqueSerialNo(); if ((Object)(object)Interact == (Object)null) { LegacyLogger.Error("ResourceStation: Interact Comp not found!"); } else { SetupInteraction(); } TerminalItem = GO.GetComponent<LG_GenericTerminalItem>(); if ((Object)(object)TerminalItem == (Object)null) { LegacyLogger.Error("ResourceStation: TerminalItem not found!"); } else { SetupTerminalItem(); } SetupReplicator(); SetupRSTimer(); } static ResourceStation() { } } public sealed class AmmoStation : ResourceStation { public override string ItemKey => $"Ammunition_Station_{base.SerialNumber}"; protected override void SetupInteraction() { base.SetupInteraction(); TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.InteractionPrompt.AmmoStation"); Interact.InteractionMessage = ((block == null) ? "AMMUNITION STATION" : Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID)); } public static AmmoStation Instantiate(ResourceStationDefinition def) { if (def.StationType != StationType.AMMO) { LegacyLogger.Error($"Trying to instantiate AmmoStation with def with 'StationType': {def.StationType}!"); return null; } GameObject gO = Object.Instantiate<GameObject>(Assets.AmmoStation); return new AmmoStation(def, gO); } protected override void Replenish(PlayerAgent player) { PlayerAmmoStorage ammoStorage = PlayerBackpackManager.GetBackpack(player.Owner).AmmoStorage; float num = Math.Max(0f, Math.Min(def.SupplyUplimit.AmmoStandard - ammoStorage.StandardAmmo.RelInPack, def.SupplyEfficiency.AmmoStandard)); float num2 = Math.Max(0f, Math.Min(def.SupplyUplimit.AmmoSpecial - ammoStorage.SpecialAmmo.RelInPack, def.SupplyEfficiency.AmmoSpecial)); player.GiveAmmoRel((PlayerAgent)null, num, num2, 0f); player.Sound.Post(EVENTS.AMMOPACK_APPLY, true); } private AmmoStation(ResourceStationDefinition def, GameObject GO) : base(def, GO) { } static AmmoStation() { } } public enum StationType { MEDI, AMMO, TOOL } public class SupplyUplimit { public float Medi { get; set; } = 0.6f; public float AmmoStandard { get; set; } = 1f; public float AmmoSpecial { get; set; } = 1f; public float Tool { get; set; } } public class SupplyEfficiency { public float Medi { get; set; } = 0.2f; public float AmmoStandard { get; set; } = 0.15f; public float AmmoSpecial { get; set; } = 0.15f; public float Tool { get; set; } } public class ResourceStationDefinition : GlobalZoneIndex { public int AreaIndex { get; set; } public string WorldEventObjectFilter { get; set; } = string.Empty; public StationType StationType { get; set; } = StationType.AMMO; public Vec3 Position { get; set; } = new Vec3(); public Vec3 Rotation { get; set; } = new Vec3(); public float InteractDuration { get; set; } = 2.5f; public SupplyEfficiency SupplyEfficiency { get; set; } = new SupplyEfficiency(); public SupplyUplimit SupplyUplimit { get; set; } = new SupplyUplimit(); public int AllowedUseTimePerCooldown { get; set; } = int.MaxValue; public float CooldownTime { get; set; } = 3f; } public class ResourceStationManager : GenericExpeditionDefinitionManager<ResourceStationDefinition> { public static ResourceStationManager Current { get; private set; } protected override string DEFINITION_NAME => "ResourceStation"; private Dictionary<string, ResourceStation> Stations { get; } = new Dictionary<string, ResourceStation>(); private void Build(ResourceStationDefinition def) { if (Stations.ContainsKey(def.WorldEventObjectFilter)) { LegacyLogger.Error("ResourceStationManager: WorldEventObjectFilter '" + def.WorldEventObjectFilter + "' is already used"); return; } ResourceStation resourceStation = null; switch (def.StationType) { case StationType.MEDI: resourceStation = MediStation.Instantiate(def); break; case StationType.AMMO: resourceStation = AmmoStation.Instantiate(def); break; case StationType.TOOL: resourceStation = ToolStation.Instantiate(def); break; default: LegacyLogger.Error($"ResourceStation {def.StationType} is unimplemented"); return; } if (resourceStation != null) { Stations[def.WorldEventObjectFilter] = resourceStation; LegacyLogger.Debug("ResourceStation '" + def.WorldEventObjectFilter + "' instantiated"); } } private void BuildStations() { if (base.definitions.TryGetValue(base.CurrentMainLevelLayout, out var value)) { value.Definitions.ForEach(Build); } } private void Clear() { foreach (ResourceStation value in Stations.Values) { value.Destroy(); } Stations.Clear(); } private ResourceStationManager() { LevelAPI.OnBuildStart += delegate { Clear(); }; LevelAPI.OnLevelCleanup += Clear; LevelAPI.OnBuildDone += BuildStations; } static ResourceStationManager() { Current = new ResourceStationManager(); } } public struct RSStateStruct { public int LastInteractedPlayer; public int RemainingUseTime; public float CurrentCooldownTime; public bool Enabled; public RSStateStruct() { LastInteractedPlayer = 0; RemainingUseTime = 0; CurrentCooldownTime = 0f; Enabled = false; } } public class RSTimer : MonoBehaviour { private float startTime; private float endTime; private bool hasOnGoingTimer; private Action<float> OnProgress; private Action OnTimerEnd; public float RemainingTime { get { if (!hasOnGoingTimer) { return 0f; } return Math.Max(endTime - Clock.Time, 0f); } } private static List<GameObject> TimerGOs { get; } private void Update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)GameStateManager.CurrentStateName == 10 && hasOnGoingTimer) { float time = Clock.Time; if (OnProgress != null) { OnProgress((time - startTime) / (endTime - startTime)); } if (!(time < endTime)) { endTime = 0f; hasOnGoingTimer = false; OnTimerEnd?.Invoke(); } } } public void StartTimer(float time) { if (time <= 0f) { LegacyLogger.Error("StartTimer: time is not positive!"); return; } if (hasOnGoingTimer) { LegacyLogger.Error("StartTimer: this timer is yet ended!"); return; } startTime = Clock.Time; endTime = startTime + time; hasOnGoingTimer = true; } private void OnDestroy() { endTime = 0f; hasOnGoingTimer = false; OnTimerEnd = null; } public static RSTimer Instantiate(Action<float> onProgress, Action actionOnEnd) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown GameObject val = new GameObject(); RSTimer rSTimer = val.AddComponent<RSTimer>(); rSTimer.OnProgress = onProgress; rSTimer.OnTimerEnd = actionOnEnd; TimerGOs.Add(val); return rSTimer; } public static void DestroyAll() { TimerGOs.ForEach((Action<GameObject>)Object.Destroy); TimerGOs.Clear(); } private RSTimer() { } static RSTimer() { TimerGOs = new List<GameObject>(); ClassInjector.RegisterTypeInIl2Cpp<RSTimer>(); LevelAPI.OnBuildStart += DestroyAll; LevelAPI.OnLevelCleanup += DestroyAll; } } } namespace LEGACY.LegacyOverride.EnemyTargeting { internal class EnemyTargetingPrioritizer : MonoBehaviour { public const float UPDATE_INTERVAL = 3f; private float nextUpdateTime = float.NaN; internal EnemyAgent enemy; private Dam_EnemyDamageBase damage { get { EnemyAgent obj = enemy; if (obj == null) { return null; } return obj.Damage; } } private AgentTarget target { get { EnemyAgent obj = enemy; if (obj == null) { return null; } return ((AgentAI)obj.AI).Target; } } private void Update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if ((int)GameStateManager.CurrentStateName != 10 || !SNet.IsMaster) { return; } if (float.IsNaN(nextUpdateTime)) { nextUpdateTime = Clock.Time + 3f; } else if (!(Clock.Time < nextUpdateTime) && !((Object)(object)enemy == (Object)null)) { nextUpdateTime = Clock.Time + 3f; if ((int)((AgentAI)enemy.AI).Mode == 1 && target != null && !(((Il2CppObjectBase)target.m_agent.CourseNode).Pointer == ((Il2CppObjectBase)((Agent)enemy).CourseNode).Pointer) && PlayerManager.PlayerAgentsInLevel.Count > 1 && ((Agent)PlayerManager.PlayerAgentsInLevel[0]).CourseNode.m_dimension.DimensionIndex == ((Agent)enemy).CourseNode.m_dimension.DimensionIndex) { TryPrioritizeCloserTarget(); } } } internal void TryPrioritizeCloserTarget() { _ = target; Agent val = null; Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (((Agent)current).Alive && ((Il2CppObjectBase)((Agent)current).CourseNode).Pointer == ((Il2CppObjectBase)((Agent)enemy).CourseNode).Pointer) { val = (Agent)(object)current; break; } } if ((Object)(object)val == (Object)null) { enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current2 = enumerator.Current; if (((Agent)current2).Alive && ((Il2CppObjectBase)((Agent)current2).CourseNode.m_zone).Pointer == ((Il2CppObjectBase)((Agent)enemy).CourseNode.m_zone).Pointer) { val = (Agent)(object)current2; break; } } } if ((Object)(object)val != (Object)null) { ((AgentAI)enemy.AI).SetTarget(val); } } private void OnDestroy() { enemy = null; } static EnemyTargetingPrioritizer() { ClassInjector.RegisterTypeInIl2Cpp<EnemyTargetingPrioritizer>(); } } } namespace LEGACY.LegacyOverride.Patches { [HarmonyPatch] internal static class ExpeditionSuccessPage { [HarmonyPostfix] [HarmonyPatch(typeof(CM_PageExpeditionSuccess), "OnEnable")] private static void Post_CM_PageExpeditionSuccess_OnEnable(CM_PageExpeditionSuccess __instance) { if (!((Object)(object)__instance == (Object)null)) { SuccessPageCustomization currentCustomization = SuccessPageCustomizationManager.Current.CurrentCustomization; if (currentCustomization != null) { ((TMP_Text)__instance.m_header).SetText(LocalizedText.op_Implicit(currentCustomization.PageHeader), true); __instance.m_overrideSuccessMusic = currentCustomization.OverrideSuccessMusic; LegacyLogger.Warning("Post_CM_PageExpeditionSuccess_OnEnable: " + ((Object)currentCustomization.PageHeader).ToString()); } } } } [HarmonyPatch] internal static class LevelSpawnFogBeacon_BugFix { [HarmonyPostfix] [HarmonyPatch(typeof(HeavyFogRepellerGlobalState), "AttemptInteract")] private static void Post_HeavyFogRepellerGlobalState_AttemptInteract(HeavyFogRepellerGlobalState __instance) { LevelSpawnedFogBeaconSettings lSFBDef = LevelSpawnedFogBeaconManager.Current.GetLSFBDef(__instance); if (lSFBDef != null) { __instance.m_repellerSphere.Range = lSFBDef.Range; } } } [HarmonyPatch] internal class PrioritizeEnemyTargeting { private static bool s_patch = true; [HarmonyPostfix] [HarmonyPatch(typeof(EnemyCourseNavigation), "UpdateTracking")] private static void UpdateTracking(EnemyCourseNavigation __instance) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 if (!s_patch) { return; } int count = PlayerManager.PlayerAgentsInLevel.Count; if (!SNet.IsMaster || count <= 1) { return; } EnemyAgent owner = __instance.m_owner; if ((int)((StateMachine<ES_Base>)(object)owner.Locomotion).m_currentState.m_stateEnum == 14 || ((Il2CppObjectBase)__instance.m_targetRef.m_agent.CourseNode).Pointer == ((Il2CppObjectBase)((Agent)owner).CourseNode).Pointer) { return; } PlayerAgent val = null; int num = Random.RandomRangeInt(0, count); for (int i = 0; i < count; i++) { PlayerAgent val2 = PlayerManager.PlayerAgentsInLevel[num]; if (((Agent)val2).Alive && ((Il2CppObjectBase)((Agent)val2).CourseNode).Pointer == ((Il2CppObjectBase)((Agent)owner).CourseNode).Pointer) { val = val2; break; } num = (num + 1) % count; } if ((Object)(object)val != (Object)null) { s_patch = false; ((AgentAI)owner.AI).SetTarget((Agent)(object)val); s_patch = true; } } } [HarmonyPatch] internal class RundownSelectionCustomization { [CompilerGenerated] private sealed class <reverseReveal>d__6 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public CM_PageRundown_New p; public bool hosting; public Transform guixSurfaceTransform; private float <arrowScale>5__2; private float <tierMarkerDelay>5__3; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <reverseReveal>d__6(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Expected O, but got Unknown //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036f: Expected O, but got Unknown //IL_03b0: Unknown result type (might be due to invalid IL or missing references) //IL_03ba: Expected O, but got Unknown //IL_03f9: Unknown result type (might be due to invalid IL or missing references) //IL_040e: 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_0117: 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_00ac: Expected O, but got Unknown //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Expected O, but got Unknown //IL_046a: Unknown result type (might be due to invalid IL or missing references) //IL_0474: Expected O, but got Unknown //IL_0519: Unknown result type (might be due to invalid IL or missing references) //IL_0523: Expected O, but got Unknown //IL_05c8: Unknown result type (might be due to invalid IL or missing references) //IL_05d2: Expected O, but got Unknown //IL_0677: Unknown result type (might be due to invalid IL or missing references) //IL_0681: Expected O, but got Unknown //IL_072c: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Expected O, but got Unknown //IL_07e1: Unknown result type (might be due to invalid IL or missing references) //IL_07eb: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <arrowScale>5__2 = p.m_tierSpacing * 5f * p.m_tierSpaceToArrowScale; if (hosting) { CoroutineManager.BlinkIn(p.m_buttonConnect, 0f, (Transform)null); <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 1; return true; } goto IL_00ed; case 1: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.24f); <>1__state = 2; return true; case 2: <>1__state = -1; ((RectTransformComp)p.m_buttonConnect).SetVisible(false); goto IL_00ed; case 3: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 4; return true; case 4: <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_SURFACE_LEVEL_SHRINK, ""); CoroutineEase.EaseLocalScale(p.m_textRundownHeader.transform, Vector3.one, new Vector3(0.6f, 0.6f, 0.6f), 0.2f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); <>2__current = CoroutineEase.EaseLocalScale(guixSurfaceTransform, Vector3.one, new Vector3(0.2f, 0.2f, 0.2f), 0.2f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); <>1__state = 5; return true; case 5: <>1__state = -1; <>2__current = (object)new WaitForSeconds(0.1f); <>1__state = 6; return true; case 6: <>1__state = -1; CoroutineEase.EaseLocalPos(p.m_textRundownHeader.transform, p.m_textRundownHeader.transform.localPosition, p.m_rundownHeaderPos, 0.2f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); CoroutineManager.BlinkIn(p.m_rundownIntelButton, 0f, (Transform)null); <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 7; return true; case 7: <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_SURFACE_LEVEL_TURN, ""); <>2__current = CoroutineEase.EaseLocalRot(guixSurfaceTransform, Vector3.zero, new Vector3(70f, 0f, 0f), 0.3f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); <>1__state = 8; return true; case 8: <>1__state = -1; p.m_verticalArrow.SetActive(true); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 9; return true; case 9: <>1__state = -1; CoroutineManager.BlinkIn(((Component)p.m_tierMarkerSectorSummary).gameObject, 0f); CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_5, ""); <>2__current = (object)new WaitForSeconds(0.5f); <>1__state = 10; return true; case 10: <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_SPINE_START, ""); CoroutineEase.EaseLocalScale(p.m_verticalArrow.transform, new Vector3(1f, 0f, 1f), new Vector3(1f, <arrowScale>5__2, 1f), 4.3f, (EasingFunction)Easing.LinearTween, (Action)delegate { CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_SPINE_STOP, ""); }, (BoolCheck)null); <tierMarkerDelay>5__3 = 0.6f; <>2__current = (object)new WaitForSeconds(0.2f); <>1__state = 11; return true; case 11: { <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_3, ""); ((Component)p.m_guix_Tier3).gameObject.SetActive(true); for (int k = 0; k < p.m_expIconsTier3.Count; k++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier3[k]).gameObject, (float)k * 0.1f); } if (p.m_expIconsTier3.Count > 0) { p.m_tierMarker3.SetVisible(true, <tierMarkerDelay>5__3); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 12; return true; } case 12: { <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_5, ""); ((Component)p.m_guix_Tier5).gameObject.SetActive(true); for (int i = 0; i < p.m_expIconsTier5.Count; i++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier5[i]).gameObject, (float)i * 0.1f); } if (p.m_expIconsTier5.Count > 0) { p.m_tierMarker5.SetVisible(true, <tierMarkerDelay>5__3); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 13; return true; } case 13: { <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_4, ""); ((Component)p.m_guix_Tier4).gameObject.SetActive(true); for (int m = 0; m < p.m_expIconsTier4.Count; m++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier4[m]).gameObject, (float)m * 0.1f); } if (p.m_expIconsTier4.Count > 0) { p.m_tierMarker4.SetVisible(true, <tierMarkerDelay>5__3); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 14; return true; } case 14: { <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_2, ""); ((Component)p.m_guix_Tier2).gameObject.SetActive(true); for (int l = 0; l < p.m_expIconsTier2.Count; l++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier2[l]).gameObject, (float)l * 0.1f); } if (p.m_expIconsTier2.Count > 0) { p.m_tierMarker2.SetVisible(true, <tierMarkerDelay>5__3); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 15; return true; } case 15: { <>1__state = -1; CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_1, ""); ((Component)p.m_guix_Tier1).gameObject.SetActive(true); for (int j = 0; j < p.m_expIconsTier1.Count; j++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier1[j]).gameObject, (float)j * 0.1f); } if (p.m_expIconsTier1.Count > 0) { p.m_tierMarker1.SetVisible(true, <tierMarkerDelay>5__3); } <>2__current = (object)new WaitForSeconds(1f); <>1__state = 16; return true; } case 16: { <>1__state = -1; ((Component)p.m_joinOnServerIdText).gameObject.SetActive(true); CoroutineManager.BlinkIn(p.m_aboutTheRundownButton, 0f, (Transform)null); CoroutineManager.BlinkIn(p.m_discordButton, 0.1f, (Transform)null); if (SNet.IsMaster || !SNet.IsInLobby) { CoroutineManager.BlinkIn(p.m_matchmakeAllButton, 0.2f, (Transform)null); } p.m_selectionIsRevealed = true; p.CheckClipboard(); return false; } IL_00ed: CM_PageBase.PostSound(EVENTS.MENU_SURFACE_LEVEL_MOVE_UP, ""); <>2__current = CoroutineEase.EaseLocalPos(guixSurfaceTransform, Vector3.zero, new Vector3(0f, 650f, 0f), 0.5f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); <>1__state = 3; return true; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static uint r1TitleID; private static uint r2TitleID; [HarmonyPostfix]
BepInEx/plugins/Nadir/Custom/LG.EXT.dll
Decompiled a day agousing System; using System.CodeDom.Compiler; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using CullingSystem; using GTFO.API; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using LG.EXT.Comps; using Microsoft.CodeAnalysis; using SNetwork; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("LG.EXT")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("LG.EXT")] [assembly: AssemblyTitle("LG.EXT")] [assembly: TargetPlatform("Windows7.0")] [assembly: SupportedOSPlatform("Windows7.0")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class IsUnmanagedAttribute : Attribute { } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LG.EXT { [BepInPlugin("LG.EXT.GUID", "LG.EXT", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class EntryPoint : BasePlugin { private Harmony _Harmony; public override void Load() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Expected O, but got Unknown ClassInjector.RegisterTypeInIl2Cpp<LG_DynamicLight>(); _Harmony = new Harmony("LG.EXT.Harmony"); _Harmony.PatchAll(); } public override bool Unload() { _Harmony.UnpatchSelf(); return ((BasePlugin)this).Unload(); } } internal static class Logger { private static readonly ManualLogSource _Logger; static Logger() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown _Logger = new ManualLogSource("LG.EXT"); Logger.Sources.Add((ILogSource)(object)_Logger); } private static string Format(object msg) { return msg.ToString(); } public static void Info(BepInExInfoLogInterpolatedStringHandler handler) { _Logger.LogInfo(handler); } public static void Info(string str) { _Logger.LogMessage((object)str); } public static void Info(object data) { _Logger.LogMessage((object)Format(data)); } public static void Debug(BepInExDebugLogInterpolatedStringHandler handler) { _Logger.LogDebug(handler); } public static void Debug(string str) { _Logger.LogDebug((object)str); } public static void Debug(object data) { _Logger.LogDebug((object)Format(data)); } public static void Error(BepInExErrorLogInterpolatedStringHandler handler) { _Logger.LogError(handler); } public static void Error(string str) { _Logger.LogError((object)str); } public static void Error(object data) { _Logger.LogError((object)Format(data)); } public static void Fatal(BepInExFatalLogInterpolatedStringHandler handler) { _Logger.LogFatal(handler); } public static void Fatal(string str) { _Logger.LogFatal((object)str); } public static void Fatal(object data) { _Logger.LogFatal((object)Format(data)); } public static void Warn(BepInExWarningLogInterpolatedStringHandler handler) { _Logger.LogWarning(handler); } public static void Warn(string str) { _Logger.LogWarning((object)str); } public static void Warn(object data) { _Logger.LogWarning((object)Format(data)); } [Conditional("DEBUG")] public static void DebugOnly(object data) { } } [GeneratedCode("VersionInfoGenerator", "2.1.3+git35c0c2a-master")] [CompilerGenerated] internal static class VersionInfo { public const string RootNamespace = "LG.EXT"; public const string Version = "1.0.0"; public const string VersionPrerelease = null; public const string VersionMetadata = null; public const string SemVer = "1.0.0"; public const string GitRevShort = null; public const string GitRevLong = null; public const string GitBranch = null; public const string GitTag = null; public const int GitCommitsSinceTag = 0; public const bool GitIsDirty = false; } } namespace LG.EXT.Patches { [HarmonyPatch(typeof(C_Light), "Setup")] internal static class Patch_C_Light { private static void Prefix(Light light, C_Light __instance, ref bool isStatic) { if (isStatic) { LG_DynamicLight component = ((Component)light).GetComponent<LG_DynamicLight>(); if ((Object)(object)component != (Object)null) { component.CullLight = __instance; isStatic = false; } } } } } namespace LG.EXT.Net { public abstract class NetVar { } public abstract class NetVar<T> : NetVar where T : unmanaged { public static readonly int PayloadCapacity = Marshal.SizeOf<T>(); internal T _Value; public abstract NetVarLifeTime LifeTime { get; } public abstract bool CanClientRequestChange { get; } public T Value { get { return _Value; } set { if (!SNet.IsMaster && CanClientRequestChange) { _Value = value; NetworkAPI.InvokeFreeSizedEvent("NLiNV", Array.Empty<byte>(), (SNet_ChannelType)2); } else { if (!SNet.IsMaster) { return; } _Value = value; using MemoryStream memoryStream = new MemoryStream(PayloadCapacity + 1); using BinaryWriter binaryWriter = new BinaryWriter(memoryStream); binaryWriter.Write((byte)2); WriteValue(binaryWriter, _Value); NetworkAPI.InvokeFreeSizedEvent("NLiNV", memoryStream.GetBuffer(), (SNet_ChannelType)2); } } } public NetVar(T initialValue) { _Value = initialValue; } protected virtual void OnChanged(T oldState, T newState, bool isRecall) { } private unsafe T ReadValue(BinaryReader reader) { Span<byte> buffer = stackalloc byte[PayloadCapacity]; reader.Read(buffer); fixed (byte* ptr = buffer) { return Marshal.PtrToStructure<T>((IntPtr)ptr); } } private unsafe void WriteValue(BinaryWriter stream, T value) { Span<byte> span = stackalloc byte[PayloadCapacity]; fixed (byte* ptr = span) { Marshal.StructureToPtr(value, (IntPtr)ptr, fDeleteOld: false); stream.Write(span); } } } public record NetVarChangedEventArg { public bool IsRecall { get; init; } } public enum NetVarLifeTime { PerLobby, PerLevel } internal enum NetVarEventType : byte { ToMaster_Created, ToMaster_RequestChange, ToClient_Sync, ToClient_Sync_Recall } internal static class NetVarRegistry { public const string EVENTNAME = "NLiNV"; public const int EventTypeMaxValue = 8; public const int TypeIdMaxValue = 8192; private static readonly Dictionary<ushort, NetVar> _InLobbyReg = new Dictionary<ushort, NetVar>(); private static readonly Dictionary<ushort, NetVar> _InLevelReg = new Dictionary<ushort, NetVar>(); public static void Init() { NetworkAPI.RegisterFreeSizedEvent("NLiNV", (Action<ulong, byte[]>)OnReceiveEvent); } private static void OnReceiveEvent(ulong sender, byte[] bytes) { using MemoryStream input = new MemoryStream(bytes); using BinaryReader binaryReader = new BinaryReader(input); binaryReader.ReadByte(); } internal static void WriteEventHeader(BinaryWriter writer, NetVarEventType eventType, ushort typeID, ushort instanceID) { if ((int)eventType > 8) { throw new ArgumentOutOfRangeException("eventType", $"Argument is greater than acceptable range (> {8})"); } if (typeID > 8192) { throw new ArgumentOutOfRangeException("typeID", $"Argument is greater than acceptable range (> {8192})"); } ushort num = (ushort)(typeID << 3); num = (ushort)((uint)num | (uint)eventType); writer.Write(num); writer.Write(instanceID); } internal static void ReadEventHeader(BinaryReader reader, out NetVarEventType eventType, out ushort typeID, out ushort instanceID) { ushort num = reader.ReadUInt16(); eventType = (NetVarEventType)(num & 7u); typeID = (ushort)(num >> 3); instanceID = reader.ReadUInt16(); } internal static void SendEvent(byte[] bytes) { NetworkAPI.InvokeFreeSizedEvent("NLiNV", bytes, (SNet_ChannelType)2); } } } namespace LG.EXT.Comps { public sealed class LG_DynamicLight : MonoBehaviour { internal C_Light CullLight; private void Update() { if (((Component)this).transform.hasChanged && CullLight != null) { CullLight.UpdateDynamicLight_FrustumNodeIntersect(); ((Component)this).transform.hasChanged = false; } } } }
BepInEx/plugins/Nadir/Custom/PortalPuzzleChanger.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text.Json; using System.Text.Json.Serialization; using AK; using Agents; using AssetShards; using BepInEx; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using ChainedPuzzles; using Enemies; using FX_EffectSystem; using GTFO.API; using GTFO.API.Components; using GTFO.API.JSON.Converters; using GTFO.API.Wrappers; using GameData; using Gear; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using LevelGeneration; using MTFO.Managers; using Microsoft.CodeAnalysis; using Player; using PortalPuzzleChanger.ConfigFiles; using PortalPuzzleChanger.GameScripts; using PortalPuzzleChanger.Plugin; using SNetwork; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("PortalPuzzleChanger")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PortalPuzzleChanger")] [assembly: AssemblyTitle("PortalPuzzleChanger")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace PortalPuzzleChanger.Plugin { [BepInPlugin("com.Breeze.PortalPuzzleChanger", "PortalPuzzleChanger", "0.0.1")] [BepInProcess("GTFO.exe")] internal class EntryPoint : BasePlugin { public static Dictionary<string, Sprite> CachedSprites; public static readonly JsonSerializerOptions SerializerOptions = new JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip, PropertyNameCaseInsensitive = true, IncludeFields = true, AllowTrailingCommas = true, WriteIndented = true }; public static ManualLogSource? LogSource { get; private set; } public static Harmony? m_Harmony { get; private set; } public override void Load() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Expected O, but got Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown LogSource = ((BasePlugin)this).Log; m_Harmony = new Harmony("_PortalPuzzleChanger_"); m_Harmony.PatchAll(); SerializerOptions.Converters.Add((JsonConverter)new LocalizedTextConverter()); SerializerOptions.Converters.Add((JsonConverter)new Vector3Converter()); SerializerOptions.Converters.Add((JsonConverter)new Vector2Converter()); SerializerOptions.Converters.Add((JsonConverter)new ColorConverter()); PortalPuzzleChangerSetup.Load(); EnemyTagChangerConfigSetup.Load(); GrenadeLauncherConfigSetup.Load(); ClassInjector.RegisterTypeInIl2Cpp<GrenadeProjectile>(); AssetAPI.OnAssetBundlesLoaded += OnAssetsLoaded; } public void OnAssetsLoaded() { //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) List<EnemyTagChanger> list = EnemyTagChangerConfigSetup.EnabledConfigs.Values.ToList(); for (int i = 0; i < list.Count; i++) { if (!string.IsNullOrEmpty(list[i].CustomImagePath)) { Texture2D loadedAsset = AssetAPI.GetLoadedAsset<Texture2D>(list[i].CustomImagePath); Sprite val = Sprite.Create(loadedAsset, new Rect(0f, 0f, (float)((Texture)loadedAsset).width, (float)((Texture)loadedAsset).height), new Vector2(0.5f, 0.5f), 64f); ((Object)val).hideFlags = (HideFlags)61; ((Object)val).name = list[i].CustomImagePath; CachedSprites.Add(((Object)val).name, val); Debug("Created a sprite from path: " + list[i].CustomImagePath); } } } public static void Debug(string message) { LogSource.LogDebug((object)("[DEBUG] " + message)); } public static void DebugWarning(string message) { LogSource.LogWarning((object)("[WARNING] " + message)); } public static void DebugError(string message) { LogSource.LogError((object)("[ERROR] " + message)); } } public class PortalPuzzleChangerSetup { public static Dictionary<uint, List<PortalEntry>> EnabledConfigs = new Dictionary<uint, List<PortalEntry>>(); private static List<PortalChangerConfig>? Configs; public static string Name { get; } = "PortalPuzzleChanger.json"; public static void Load() { string path = Path.Combine(ConfigManager.CustomPath, Name); if (File.Exists(path)) { Configs = JsonSerializer.Deserialize<List<PortalChangerConfig>>(File.ReadAllText(path), EntryPoint.SerializerOptions); EntryPoint.Debug(Name + " has loaded successfully"); } else { Configs = new List<PortalChangerConfig> { new PortalChangerConfig() }; string contents = JsonSerializer.Serialize(Configs, EntryPoint.SerializerOptions); File.WriteAllText(path, contents); EntryPoint.DebugWarning(Name + " did not exist, creating it now"); } EnabledConfigs.Clear(); int count = Configs.Count; for (int i = 0; i < count; i++) { if (Configs[i].InternalEnabled) { EnabledConfigs.Add(Configs[i].MainLevelLayoutID, Configs[i].PortalEntries); } } } } public class EnemyTagChangerConfigSetup { public static Dictionary<uint, EnemyTagChanger> EnabledConfigs = new Dictionary<uint, EnemyTagChanger>(); private static List<EnemyTagChanger>? Configs; public static string Name { get; } = "EnemyTags.json"; public static void Load() { string path = Path.Combine(ConfigManager.CustomPath, Name); if (File.Exists(path)) { Configs = JsonSerializer.Deserialize<List<EnemyTagChanger>>(File.ReadAllText(path), EntryPoint.SerializerOptions); EntryPoint.Debug(Name + " has loaded successfully"); } else { Configs = new List<EnemyTagChanger> { new EnemyTagChanger() }; string contents = JsonSerializer.Serialize(Configs, EntryPoint.SerializerOptions); File.WriteAllText(path, contents); EntryPoint.DebugWarning(Name + " did not exist, creating it now"); } EnabledConfigs.Clear(); int count = Configs.Count; for (int i = 0; i < count; i++) { if (Configs[i].internalEnabled) { EnabledConfigs.Add(Configs[i].EnemyID, Configs[i]); } } } } public class GrenadeLauncherConfigSetup { public static Dictionary<uint, GrenadeLauncherConfig> EnabledConfigs = new Dictionary<uint, GrenadeLauncherConfig>(); private static List<GrenadeLauncherConfig>? Configs; public static string Name { get; } = "GrenadeLauncher.json"; public static void Load() { string path = Path.Combine(ConfigManager.CustomPath, Name); if (File.Exists(path)) { Configs = JsonSerializer.Deserialize<List<GrenadeLauncherConfig>>(File.ReadAllText(path), EntryPoint.SerializerOptions); EntryPoint.Debug(Name + " has loaded successfully"); } else { Configs = new List<GrenadeLauncherConfig> { new GrenadeLauncherConfig() }; string contents = JsonSerializer.Serialize(Configs, EntryPoint.SerializerOptions); File.WriteAllText(path, contents); EntryPoint.DebugWarning(Name + " did not exist, creating it now"); } EnabledConfigs.Clear(); int count = Configs.Count; for (int i = 0; i < count; i++) { if (Configs[i].internalEnabled) { EnabledConfigs.Add(Configs[i].PersistentID, Configs[i]); } } } } } namespace PortalPuzzleChanger.Patches { [HarmonyPatch(typeof(LG_DimensionPortal), "Setup")] public static class DimensionPortalPatch { public static void Prefix(LG_DimensionPortal __instance) { //IL_002e: 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_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) if (!PortalPuzzleChangerSetup.EnabledConfigs.ContainsKey(RundownManager.ActiveExpedition.LevelLayoutData)) { return; } (eDimensionIndex, LG_LayerType, eLocalZoneIndex) original = (__instance.SpawnNode.m_dimension.DimensionIndex, __instance.SpawnNode.LayerType, __instance.SpawnNode.m_zone.LocalIndex); List<PortalEntry> list = PortalPuzzleChangerSetup.EnabledConfigs[RundownManager.ActiveExpedition.LevelLayoutData]; foreach (PortalEntry item in list) { (eDimensionIndex, LG_LayerType, eLocalZoneIndex) comparingTo = (item.DimensionIndex, item.LayerType, item.ZoneIndex); if (DoesZoneMatch(original, comparingTo)) { __instance.m_targetDimension = item.TargetDimension; __instance.m_targetZone = item.TargetZoneIndex; __instance.PortalChainPuzzle = item.PortalChainedPuzzleId; EntryPoint.Debug("Changing the ChainedPuzzleID on " + __instance.PublicName); } } } public static void Postfix(LG_DimensionPortal __instance) { //IL_002e: 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_0049: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0091: 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) if (!PortalPuzzleChangerSetup.EnabledConfigs.ContainsKey(RundownManager.ActiveExpedition.LevelLayoutData)) { return; } (eDimensionIndex, LG_LayerType, eLocalZoneIndex) original = (__instance.SpawnNode.m_dimension.DimensionIndex, __instance.SpawnNode.LayerType, __instance.SpawnNode.m_zone.LocalIndex); List<PortalEntry> list = PortalPuzzleChangerSetup.EnabledConfigs[RundownManager.ActiveExpedition.LevelLayoutData]; foreach (PortalEntry item in list) { (eDimensionIndex, LG_LayerType, eLocalZoneIndex) comparingTo = (item.DimensionIndex, item.LayerType, item.ZoneIndex); if (DoesZoneMatch(original, comparingTo) && item.CreateTeamScanAsLast) { ChainedPuzzleInstance puzzleInstance = ChainedPuzzleManager.CreatePuzzleInstance(4u, __instance.SpawnNode.m_area, __instance.m_portalBioScanPoint.position, __instance.m_portalBioScanPoint); puzzleInstance.OnPuzzleSolved = __instance.m_portalChainPuzzleInstance.OnPuzzleSolved; __instance.m_portalChainPuzzleInstance.OnPuzzleSolved = Action.op_Implicit((Action)delegate { puzzleInstance.AttemptInteract((eChainedPuzzleInteraction)0); }); EntryPoint.Debug("Adding team scan on " + __instance.PublicName); } } } private static bool DoesZoneMatch((eDimensionIndex, LG_LayerType, eLocalZoneIndex) original, (eDimensionIndex, LG_LayerType, eLocalZoneIndex) comparingTo) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_0028: Unknown result type (might be due to invalid IL or missing references) (eDimensionIndex, LG_LayerType, eLocalZoneIndex) tuple = original; (eDimensionIndex, LG_LayerType, eLocalZoneIndex) tuple2 = comparingTo; return tuple.Item1 == tuple2.Item1 && tuple.Item2 == tuple2.Item2 && tuple.Item3 == tuple2.Item3; } } [HarmonyPatch(typeof(HackingTool), "Setup")] public static class HackingToolTest { public static void Postfix(HackingTool __instance) { } } [HarmonyPatch(typeof(EnemyAgent), "SyncPlaceNavMarkerTag")] internal static class EnemyTagPatch { public static void Postfix(EnemyAgent __instance) { //IL_006d: Unknown result type (might be due to invalid IL or missing references) if (EnemyTagChangerConfigSetup.EnabledConfigs.ContainsKey(__instance.EnemyDataID)) { EnemyTagChanger enemyTagChanger = EnemyTagChangerConfigSetup.EnabledConfigs[__instance.EnemyDataID]; NavMarker tagMarker = __instance.m_tagMarker; if (!string.IsNullOrEmpty(enemyTagChanger.CustomImagePath)) { SpriteRenderer component = ((Component)tagMarker.m_enemySubObj).GetComponent<SpriteRenderer>(); component.sprite = EntryPoint.CachedSprites[enemyTagChanger.CustomImagePath]; } tagMarker.SetColor(enemyTagChanger.TagColor); } } } [HarmonyPatch(typeof(GrenadeBase), "Awake")] internal static class GrenadeBase_Setup { public static void Postfix(GrenadeBase __instance) { GrenadeProjectile grenadeProjectile = ((Component)__instance).gameObject.AddComponent<GrenadeProjectile>(); ((Behaviour)grenadeProjectile).enabled = true; grenadeProjectile.GrenadeBase = __instance; } } [HarmonyPatch(typeof(GrenadeBase), "GrenadeDelay")] internal static class GrenadeBase_GrenadeDelay { public static bool Prefix() { return false; } } [HarmonyPatch(typeof(GrenadeBase), "Start")] internal static class GrenadeBase_Start { public static void Postfix(GrenadeBase __instance) { ((MonoBehaviour)__instance).CancelInvoke("GrenadeDelay"); } } [HarmonyPatch(typeof(BulletWeapon), "Fire")] internal static class BulletWeapon_Fire { public static void Prefix(BulletWeapon __instance) { if (GrenadeLauncherConfigSetup.EnabledConfigs.ContainsKey(((ItemEquippable)__instance).ArchetypeID)) { GrenadeLauncherConfig config = GrenadeLauncherConfigSetup.EnabledConfigs[((ItemEquippable)__instance).ArchetypeID]; GrenadeLauncherFire.Fire(__instance, config); } } } internal static class GrenadeLauncherFire { public static void Fire(BulletWeapon weapon, GrenadeLauncherConfig config) { //IL_0003: 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_0020: 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_0028: 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_0037: 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_004c: 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_005e: Unknown result type (might be due to invalid IL or missing references) pItemData val = default(pItemData); val.itemID_gearCRC = 136u; Vector3 targetLookDir = ((Agent)((Item)weapon).Owner).TargetLookDir; Vector3 normalized = ((Vector3)(ref targetLookDir)).normalized; ItemReplicationManager.ThrowItem(val, (delItemCallback)null, (ItemMode)3, ((Component)((ItemEquippable)weapon).MuzzleAlign).transform.position, ((Component)((ItemEquippable)weapon).MuzzleAlign).transform.rotation, normalized * config.ShootForce, ((Component)weapon).transform.position, ((Agent)((Item)weapon).Owner).CourseNode, ((Item)weapon).Owner); ((Weapon)weapon).MaxRayDist = 0f; } } } namespace PortalPuzzleChanger.GameScripts { public class GrenadeProjectile : ConsumableInstance { public GrenadeBase GrenadeBase; private static FX_Pool explosionPool; private float damageRadiusHigh; private float damageRadiusLow; private float damageValueHigh; private float damageValueLow; private float explosionForce; private readonly int explosionTargetMask = LayerManager.MASK_EXPLOSION_TARGETS; private readonly int explosionBlockMask = LayerManager.MASK_EXPLOSION_BLOCKERS; private bool madeNoise = false; private bool collision = false; private bool addForce = false; private float decayTime; private Rigidbody rigidbody; private CellSoundPlayer cellSoundPlayer; public GrenadeProjectile(IntPtr hdl) : base(hdl) { } private void Awake() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown rigidbody = ((Component)this).GetComponent<Rigidbody>(); cellSoundPlayer = new CellSoundPlayer(); if (!Object.op_Implicit((Object)(object)explosionPool)) { explosionPool = FX_Manager.GetEffectPool(AssetShardManager.GetLoadedAsset<GameObject>("Assets/AssetPrefabs/FX_Effects/FX_Tripmine.prefab", false)); } } private void Start() { GrenadeLauncherConfig grenadeLauncherConfig = GrenadeLauncherConfigSetup.EnabledConfigs[((Item)GrenadeBase).Owner.Inventory.WieldedItem.ArchetypeID]; damageRadiusHigh = grenadeLauncherConfig.MaximumDamageRange.Radius; damageRadiusLow = grenadeLauncherConfig.MinimumDamageRange.Radius; damageValueHigh = grenadeLauncherConfig.MaximumDamageRange.Damage; damageValueLow = grenadeLauncherConfig.MinimumDamageRange.Damage; explosionForce = grenadeLauncherConfig.ExplosionForce; } private void FixedUpdate() { //IL_0017: 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_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_0036: 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_005f: Unknown result type (might be due to invalid IL or missing references) if (rigidbody.useGravity) { Vector3 val = ((Component)this).transform.position + rigidbody.velocity * Time.fixedDeltaTime; } else if (!madeNoise) { MakeNoise(); ((Component)this).transform.position = Vector3.down * 100f; madeNoise = true; } } private void Update() { //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) if (rigidbody.useGravity) { cellSoundPlayer.UpdatePosition(((Component)this).transform.position); if (collision) { DetonateSequence(); } } else if (Time.time > decayTime) { ((Item)GrenadeBase).ReplicationWrapper.Replicator.Despawn(); } } private void OnCollisionEnter() { if (rigidbody.useGravity) { DetonateSequence(); } } private void DetonateSequence() { //IL_001f: 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) Detonate(); decayTime = Time.time + 10f; rigidbody.velocity = Vector3.zero; rigidbody.angularVelocity = Vector3.zero; rigidbody.useGravity = false; } private void Detonate() { //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_001e: 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_006e: Unknown result type (might be due to invalid IL or missing references) FX_EffectBase val = (FX_EffectBase)(object)explosionPool.AquireEffect(); val.Play((FX_Trigger)null, ((Component)this).transform.position, Quaternion.LookRotation(Vector3.up)); if (SNet.IsMaster) { DamageUtil.DoExplosionDamage(((Component)this).transform.position, damageRadiusHigh, damageValueHigh, explosionTargetMask, explosionBlockMask, addForce, explosionForce); DamageUtil.DoExplosionDamage(((Component)this).transform.position, damageRadiusLow, damageValueLow, explosionTargetMask, explosionBlockMask, addForce, explosionForce); } } private void MakeNoise() { //IL_000d: 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_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: 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_010d: 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_011f: Expected O, but got Unknown List<string> list = new List<string>(); Il2CppReferenceArray<Collider> val = Physics.OverlapSphere(((Component)this).transform.position, 50f, LayerManager.MASK_ENEMY_DAMAGABLE); foreach (Collider item in (Il2CppArrayBase<Collider>)(object)val) { Dam_EnemyDamageLimb component = ((Component)item).GetComponent<Dam_EnemyDamageLimb>(); if ((Object)(object)component == (Object)null) { continue; } EnemyAgent glueTargetEnemyAgent = component.GlueTargetEnemyAgent; if (!((Object)(object)glueTargetEnemyAgent == (Object)null) && !list.Contains(((Object)((Component)glueTargetEnemyAgent).gameObject).name)) { list.Add(((Object)((Component)glueTargetEnemyAgent).gameObject).name); if (!Physics.Linecast(((Component)this).transform.position, ((Agent)glueTargetEnemyAgent).EyePosition, LayerManager.MASK_WORLD)) { NM_NoiseData val2 = new NM_NoiseData { position = ((Agent)glueTargetEnemyAgent).EyePosition, node = ((Agent)glueTargetEnemyAgent).CourseNode, type = (NM_NoiseType)0, radiusMin = 0.01f, radiusMax = 100f, yScale = 1f, noiseMaker = null, raycastFirstNode = false, includeToNeightbourAreas = false }; NoiseManager.MakeNoise(val2); } } } cellSoundPlayer.Post(EVENTS.FRAGGRENADEEXPLODE, true); } public override void OnDespawn() { ((ItemWrapped)this).OnDespawn(); } } } namespace PortalPuzzleChanger.ConfigFiles { public class EnemyTagChanger { public bool internalEnabled { get; set; } public string internalName { get; set; } public uint EnemyID { get; set; } public Color TagColor { get; set; } public string CustomImagePath { get; set; } public EnemyTagChanger() { //IL_0025: Unknown result type (might be due to invalid IL or missing references) internalEnabled = false; internalName = string.Empty; EnemyID = 0u; TagColor = Color.red; CustomImagePath = string.Empty; } } public class GrenadeLauncherConfig { public DamageMinMax MaximumDamageRange { get; set; } public DamageMinMax MinimumDamageRange { get; set; } public float ExplosionForce { get; set; } public float ShootForce { get; set; } public uint PersistentID { get; set; } public string internalName { get; set; } public bool internalEnabled { get; set; } public GrenadeLauncherConfig() { MaximumDamageRange = new DamageMinMax(); MinimumDamageRange = new DamageMinMax(); ExplosionForce = 1000f; PersistentID = 0u; internalName = string.Empty; internalEnabled = false; } } public class DamageMinMax { public float Radius { get; set; } public float Damage { get; set; } public DamageMinMax() { Radius = 0f; Damage = 0f; } } public class PortalChangerConfig { public uint MainLevelLayoutID { get; set; } public bool InternalEnabled { get; set; } public string? InternalName { get; set; } public List<PortalEntry> PortalEntries { get; set; } public PortalChangerConfig() { PortalEntries = new List<PortalEntry> { new PortalEntry() }; InternalEnabled = false; InternalName = "Test"; MainLevelLayoutID = 0u; } } public class PortalEntry { public eLocalZoneIndex ZoneIndex { get; set; } public LG_LayerType LayerType { get; set; } public eDimensionIndex DimensionIndex { get; set; } public eDimensionIndex TargetDimension { get; set; } public eLocalZoneIndex TargetZoneIndex { get; set; } public uint PortalChainedPuzzleId { get; set; } public bool CreateTeamScanAsLast { get; set; } public PortalEntry() { ZoneIndex = (eLocalZoneIndex)0; LayerType = (LG_LayerType)0; DimensionIndex = (eDimensionIndex)0; TargetDimension = (eDimensionIndex)1; TargetZoneIndex = (eLocalZoneIndex)0; PortalChainedPuzzleId = 4u; CreateTeamScanAsLast = false; } } }
BepInEx/plugins/Nadir/Custom/Warren.CheckpointSensorVisual.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using AIGraph; using Agents; using BepInEx; using BepInEx.Configuration; using BepInEx.Unity.IL2CPP; using ChainedPuzzles; using EOSExt.SecuritySensor; using EOSExt.SecuritySensor.Definition; using ExtraObjectiveSetup.BaseClasses; using ExtraObjectiveSetup.JSON; using ExtraObjectiveSetup.Utils; using GTFO.API; using GTFO.API.Utilities; using GameData; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Reflection; using Localization; using Microsoft.CodeAnalysis; using Player; using SNetwork; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Warren.CheckpointSensorVisual")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+35456379119873132d3e4d2be6118c1334a3f0c6")] [assembly: AssemblyProduct("Warren.CheckpointSensorVisual")] [assembly: AssemblyTitle("Warren.CheckpointSensorVisual")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace CheckpointSensorVisual { internal static class CheckpointVisual { public const string CHECKPOINT_PREFAB = "Assets/AssetPrefabs/Complex/Generic/ChainedPuzzles/CP_Bioscan_Checkpoint.prefab"; private const float SENSOR_Y_OFFSET = 0.16216217f; private static bool s_dumped; private static bool s_distLogged; public const string CIRCLE_SENSOR_PREFAB = "Assets/SecuritySensor/CircleSensor.prefab"; private static bool s_discLogged; private static Shader? s_standard; private static bool s_ringLogged; private static bool s_skinLogged; private static Mesh? s_strippedMesh; private static Mesh? s_strippedSource; private static bool s_animLogged; private static CP_Bioscan_Graphics? GetSourceGraphics() { GameObject loadedAsset = AssetAPI.GetLoadedAsset<GameObject>("Assets/AssetPrefabs/Complex/Generic/ChainedPuzzles/CP_Bioscan_Checkpoint.prefab"); if ((Object)(object)loadedAsset == (Object)null) { EOSLogger.Error("CheckpointSensorVisual: prefab not loaded: Assets/AssetPrefabs/Complex/Generic/ChainedPuzzles/CP_Bioscan_Checkpoint.prefab"); return null; } if (EntryPoint.DumpHierarchy.Value && !s_dumped) { s_dumped = true; StringBuilder stringBuilder = new StringBuilder("CheckpointSensorVisual: prefab hierarchy\n"); Dump(loadedAsset.transform, 0, stringBuilder); EOSLogger.Log(stringBuilder.ToString()); } CP_Bioscan_Graphics componentInChildren = loadedAsset.GetComponentInChildren<CP_Bioscan_Graphics>(true); if ((Object)(object)componentInChildren == (Object)null) { EOSLogger.Error("CheckpointSensorVisual: CP_Bioscan_Graphics not found in checkpoint prefab"); } return componentInChildren; } private static void Dump(Transform t, int depth, StringBuilder sb) { //IL_0032: 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) StringBuilder stringBuilder = sb.Append(' ', depth * 2).Append(((Object)t).name); StringBuilder stringBuilder2 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(23, 3, stringBuilder); handler.AppendLiteral(" pos="); handler.AppendFormatted<Vector3>(t.localPosition); handler.AppendLiteral(" scale="); handler.AppendFormatted<Vector3>(t.localScale); handler.AppendLiteral(" active="); handler.AppendFormatted(((Component)t).gameObject.activeSelf); handler.AppendLiteral(" ["); stringBuilder2.Append(ref handler); foreach (Component component2 in ((Component)t).GetComponents<Component>()) { sb.Append(((MemberInfo)((Object)component2).GetIl2CppType()).Name).Append(' '); } sb.Append("]"); CP_Bioscan_Graphics component = ((Component)t).GetComponent<CP_Bioscan_Graphics>(); if ((Object)(object)component != (Object)null) { stringBuilder = sb; StringBuilder stringBuilder3 = stringBuilder; handler = new StringBuilder.AppendInterpolatedStringHandler(16, 2, stringBuilder); handler.AppendLiteral(" radius="); handler.AppendFormatted(component.m_radius); handler.AppendLiteral(" height="); handler.AppendFormatted(component.m_height); stringBuilder3.Append(ref handler); } sb.Append('\n'); for (int i = 0; i < t.childCount; i++) { Dump(t.GetChild(i), depth + 1, sb); } } public static void Apply(GameObject sensorRoot, SensorSettings setting, int groupIndex) { //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_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_024c: 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_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Unknown result type (might be due to invalid IL or missing references) CP_Bioscan_Graphics sourceGraphics = GetSourceGraphics(); if ((Object)(object)sourceGraphics == (Object)null) { return; } Transform child = sensorRoot.transform.GetChild(0); bool flag = EntryPoint.ShowSensorText.Value && HasSensorText(setting); bool value = EntryPoint.ShowZoneDisc.Value; HideOriginalVisual hideOriginalVisual = sensorRoot.AddComponent<HideOriginalVisual>(); hideOriginalVisual.Setup(flag, value); if (value && EntryPoint.PlainZoneDisc.Value) { UsePlainZoneDisc(HideOriginalVisual.FindZoneRenderer(child)); } GameObject gameObject = ((Component)sourceGraphics).gameObject; bool activeSelf = gameObject.activeSelf; gameObject.SetActive(false); GameObject val = Object.Instantiate<GameObject>(gameObject); gameObject.SetActive(activeSelf); ((Object)val).name = "CheckpointSensorVisual"; float vanillaCloseDistance = GetVanillaCloseDistance(gameObject); StripLogic(val); val.transform.SetParent(child, false); hideOriginalVisual.SetKeep(val.transform); val.transform.position = sensorRoot.transform.position - Vector3.up * 0.16216217f; val.transform.rotation = Quaternion.identity; CP_Bioscan_Graphics component = val.GetComponent<CP_Bioscan_Graphics>(); val.SetActive(true); component.Setup(); float num = ((component.m_radius > 0.01f) ? component.m_radius : 1f); float num2 = Mathf.Max(0.0001f, child.lossyScale.x); val.transform.localScale = val.transform.localScale * (setting.Radius / num) / num2; if ((Object)(object)component.m_txtScannerInformation != (Object)null) { component.m_txtScannerInformation.SetActive(false); } foreach (TextMeshPro componentsInChild in val.GetComponentsInChildren<TextMeshPro>(true)) { ((Component)componentsInChild).gameObject.SetActive(false); } component.SetVisible(true, false); ForceZoneAnimation(val); CollapseCenterQuad(val); Color val2 = setting.Color.ToUnityColor(); if (EntryPoint.UseSensorColor.Value) { if (EntryPoint.ZoneAlpha.Value >= 0f) { val2.a = Mathf.Clamp01(EntryPoint.ZoneAlpha.Value); } component.SetColor(val2); } else { component.SetColorMode((eChainedPuzzleGraphicsColorMode)1); } Material val3 = null; if (EntryPoint.RingStyle.Value == RingStyle.Emissive) { val3 = ApplyEmissiveRing(val, setting.Color.ToUnityColor()); } sensorRoot.AddComponent<DisabledLook>().Setup(groupIndex, setting.Radius, (Renderer?)(object)(((Object)(object)val3 != (Object)null) ? val.GetComponentInChildren<SkinnedMeshRenderer>(true) : null), ((Object)(object)val3 == (Object)null && EntryPoint.UseSensorColor.Value) ? component : null, val2, value ? HideOriginalVisual.FindZoneRenderer(child) : null); List<Renderer> list = new List<Renderer>(); List<TextMeshPro> list2 = new List<TextMeshPro>(); foreach (Renderer componentsInChild2 in val.GetComponentsInChildren<Renderer>(true)) { list.Add(componentsInChild2); } Renderer val4 = (value ? HideOriginalVisual.FindZoneRenderer(child) : null); if ((Object)(object)val4 != (Object)null) { list.Add(val4); } foreach (TextMeshPro componentsInChild3 in ((Component)child).GetComponentsInChildren<TextMeshPro>(true)) { if (!flag) { break; } if (!componentsInChild3.transform.IsChildOf(val.transform)) { list.Add(((Component)componentsInChild3).GetComponent<Renderer>()); list2.Add(componentsInChild3); } } float showDistance = ((EntryPoint.ShowDistance.Value > 0f) ? EntryPoint.ShowDistance.Value : vanillaCloseDistance); sensorRoot.AddComponent<CullingVisibility>().Setup(val.transform, list, list2, setting.Radius, showDistance); if (EntryPoint.DumpHierarchy.Value) { EOSLogger.Log($"CheckpointSensorVisual: applied {setting.SensorType} at {sensorRoot.transform.position} r={setting.Radius} active={val.activeInHierarchy} worldScale={val.transform.lossyScale}"); } } internal static string DescribeZone(Vector3 pos) { //IL_0001: 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_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected I4, but got Unknown try { AIG_CourseNode val = default(AIG_CourseNode); if (AIG_CourseNode.TryGetCourseNode((eDimensionIndex)0, pos, 5f, ref val) && val != null && (Object)(object)val.m_zone != (Object)null) { return $"ZONE {val.m_zone.Alias} ({val.LayerType}, LocalIndex {(int)val.m_zone.LocalIndex})"; } } catch (Exception ex) { return "lookup failed: " + ex.Message; } return "unknown"; } private static void UsePlainZoneDisc(Renderer? zone) { //IL_009f: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)zone == (Object)null) { return; } MeshFilter component = ((Component)zone).GetComponent<MeshFilter>(); if ((Object)(object)component == (Object)null) { return; } GameObject loadedAsset = AssetAPI.GetLoadedAsset<GameObject>("Assets/SecuritySensor/CircleSensor.prefab"); Transform val = (((Object)(object)loadedAsset != (Object)null) ? loadedAsset.transform.Find("Graphics/Zone") : null); MeshFilter val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<MeshFilter>() : null); if ((Object)(object)val2 == (Object)null || (Object)(object)val2.sharedMesh == (Object)null) { EOSLogger.Warning("CheckpointSensorVisual: plain disc source not found (Assets/SecuritySensor/CircleSensor.prefab)"); } else if (!((Object)(object)component.sharedMesh == (Object)(object)val2.sharedMesh)) { component.sharedMesh = val2.sharedMesh; ((Component)zone).transform.localScale = val.localScale; if (!s_discLogged) { s_discLogged = true; EOSLogger.Log("CheckpointSensorVisual: zone disc -> plain circle mesh '" + ((Object)val2.sharedMesh).name + "'"); } } } private static Material? ApplyEmissiveRing(GameObject clone, Color sensorColor) { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013c: 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_0151: Unknown result type (might be due to invalid IL or missing references) SkinnedMeshRenderer componentInChildren = clone.GetComponentInChildren<SkinnedMeshRenderer>(true); if ((Object)(object)componentInChildren == (Object)null) { return null; } if ((Object)(object)s_standard == (Object)null) { s_standard = Shader.Find("Standard"); } if ((Object)(object)s_standard == (Object)null) { EOSLogger.Warning("CheckpointSensorVisual: Standard shader not found, ring keeps hologram material"); return null; } Material val = new Material(s_standard) { name = "CheckpointSensorVisual_EmissiveRing" }; val.SetFloat("_Mode", 3f); val.SetFloat("_SrcBlend", 1f); val.SetFloat("_DstBlend", 10f); val.SetFloat("_ZWrite", 0f); val.SetFloat("_Glossiness", 0.191f); val.SetFloat("_Metallic", 0.081f); val.DisableKeyword("_ALPHATEST_ON"); val.DisableKeyword("_ALPHABLEND_ON"); val.EnableKeyword("_ALPHAPREMULTIPLY_ON"); val.EnableKeyword("_EMISSION"); val.renderQueue = 3000; val.SetColor("_Color", new Color(0f, 0f, 0f, 0.039f)); float num = Mathf.Max(0f, EntryPoint.EmissionIntensity.Value); val.SetColor("_EmissionColor", new Color(sensorColor.r * num, sensorColor.g * num, sensorColor.b * num, 1f)); ((Renderer)componentInChildren).sharedMaterial = val; if (!s_ringLogged) { s_ringLogged = true; EOSLogger.Log($"CheckpointSensorVisual: ring material -> Standard emissive (intensity {num})"); } return val; } private static void CollapseCenterQuad(GameObject clone) { //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_033d: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0247: Unknown result type (might be due to invalid IL or missing references) //IL_0254: 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_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) SkinnedMeshRenderer componentInChildren = clone.GetComponentInChildren<SkinnedMeshRenderer>(true); if ((Object)(object)componentInChildren == (Object)null) { return; } Il2CppReferenceArray<Transform> bones = componentInChildren.bones; if (!s_skinLogged) { s_skinLogged = true; StringBuilder stringBuilder = new StringBuilder("CheckpointSensorVisual: zone skin root='" + (((Object)(object)componentInChildren.rootBone != (Object)null) ? ((Object)componentInChildren.rootBone).name : "null") + "' bones=["); if (bones != null) { foreach (Transform item in (Il2CppArrayBase<Transform>)(object)bones) { stringBuilder.Append(((Object)(object)item != (Object)null) ? ((Object)item).name : "null").Append(' '); } } stringBuilder.Append(']'); Mesh sharedMesh = componentInChildren.sharedMesh; if ((Object)(object)sharedMesh != (Object)null) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(28, 3, stringBuilder2); handler.AppendLiteral(" verts="); handler.AppendFormatted(sharedMesh.vertexCount); handler.AppendLiteral(" submeshes="); handler.AppendFormatted(sharedMesh.subMeshCount); handler.AppendLiteral(" readable="); handler.AppendFormatted(sharedMesh.isReadable); stringBuilder3.Append(ref handler); if (sharedMesh.isReadable && bones != null) { Il2CppStructArray<BoneWeight> boneWeights = sharedMesh.boneWeights; Il2CppStructArray<Vector3> vertices = sharedMesh.vertices; int[] array = new int[((Il2CppArrayBase<Transform>)(object)bones).Length + 1]; Vector3[] array2 = (Vector3[])(object)new Vector3[((Il2CppArrayBase<Transform>)(object)bones).Length + 1]; Vector3[] array3 = (Vector3[])(object)new Vector3[((Il2CppArrayBase<Transform>)(object)bones).Length + 1]; for (int i = 0; i < array.Length; i++) { array2[i] = Vector3.one * 1E+09f; array3[i] = Vector3.one * -1E+09f; } for (int j = 0; j < ((Il2CppArrayBase<BoneWeight>)(object)boneWeights).Length && j < ((Il2CppArrayBase<Vector3>)(object)vertices).Length; j++) { BoneWeight val = ((Il2CppArrayBase<BoneWeight>)(object)boneWeights)[j]; int num; if (!(((BoneWeight)(ref val)).weight0 > 0f)) { num = ((Il2CppArrayBase<Transform>)(object)bones).Length; } else { val = ((Il2CppArrayBase<BoneWeight>)(object)boneWeights)[j]; num = ((BoneWeight)(ref val)).boneIndex0; } int num2 = num; if (num2 < 0 || num2 > ((Il2CppArrayBase<Transform>)(object)bones).Length) { num2 = ((Il2CppArrayBase<Transform>)(object)bones).Length; } array[num2]++; array2[num2] = Vector3.Min(array2[num2], ((Il2CppArrayBase<Vector3>)(object)vertices)[j]); array3[num2] = Vector3.Max(array3[num2], ((Il2CppArrayBase<Vector3>)(object)vertices)[j]); } for (int k = 0; k < array.Length; k++) { if (array[k] > 0) { stringBuilder2 = stringBuilder.Append('\n'); StringBuilder stringBuilder4 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(22, 4, stringBuilder2); handler.AppendLiteral(" "); handler.AppendFormatted((k < ((Il2CppArrayBase<Transform>)(object)bones).Length && (Object)(object)((Il2CppArrayBase<Transform>)(object)bones)[k] != (Object)null) ? ((Object)((Il2CppArrayBase<Transform>)(object)bones)[k]).name : "(none)"); handler.AppendLiteral(": "); handler.AppendFormatted(array[k]); handler.AppendLiteral(" verts, bounds "); handler.AppendFormatted<Vector3>(array2[k]); handler.AppendLiteral(" ~ "); handler.AppendFormatted<Vector3>(array3[k]); stringBuilder4.Append(ref handler); } } } } EOSLogger.Log(stringBuilder.ToString()); } if (EntryPoint.CollapseCenterQuad.Value && bones != null) { Mesh strippedMesh = GetStrippedMesh(componentInChildren); if ((Object)(object)strippedMesh != (Object)null) { componentInChildren.sharedMesh = strippedMesh; } } } private static Mesh? GetStrippedMesh(SkinnedMeshRenderer smr) { //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_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) Mesh sharedMesh = smr.sharedMesh; if ((Object)(object)sharedMesh == (Object)null) { return null; } if ((Object)(object)s_strippedMesh != (Object)null && (Object)(object)s_strippedSource == (Object)(object)sharedMesh) { return s_strippedMesh; } if (!sharedMesh.isReadable) { EOSLogger.Warning("CheckpointSensorVisual: zone mesh not readable, center quad not removed"); return null; } Il2CppReferenceArray<Transform> bones = smr.bones; int num = -1; for (int i = 0; i < ((Il2CppArrayBase<Transform>)(object)bones).Length; i++) { if ((Object)(object)((Il2CppArrayBase<Transform>)(object)bones)[i] != (Object)null && (Object)(object)((Il2CppArrayBase<Transform>)(object)bones)[i] == (Object)(object)smr.rootBone) { num = i; break; } } if (num < 0) { EOSLogger.Warning("CheckpointSensorVisual: root bone not in bone list, center quad not removed"); return null; } Il2CppStructArray<BoneWeight> boneWeights = sharedMesh.boneWeights; Mesh val = Object.Instantiate<Mesh>(sharedMesh); ((Object)val).name = ((Object)sharedMesh).name + "_NoCenterQuad"; int num2 = 0; for (int j = 0; j < val.subMeshCount; j++) { Il2CppStructArray<int> triangles = val.GetTriangles(j); List<int> list = new List<int>(((Il2CppArrayBase<int>)(object)triangles).Length); for (int k = 0; k + 2 < ((Il2CppArrayBase<int>)(object)triangles).Length; k += 3) { int num3 = ((Il2CppArrayBase<int>)(object)triangles)[k]; int num4 = ((Il2CppArrayBase<int>)(object)triangles)[k + 1]; int num5 = ((Il2CppArrayBase<int>)(object)triangles)[k + 2]; BoneWeight val2 = ((Il2CppArrayBase<BoneWeight>)(object)boneWeights)[num3]; if (((BoneWeight)(ref val2)).boneIndex0 == num) { val2 = ((Il2CppArrayBase<BoneWeight>)(object)boneWeights)[num4]; if (((BoneWeight)(ref val2)).boneIndex0 == num) { val2 = ((Il2CppArrayBase<BoneWeight>)(object)boneWeights)[num5]; if (((BoneWeight)(ref val2)).boneIndex0 == num) { num2++; continue; } } } list.Add(num3); list.Add(num4); list.Add(num5); } val.SetTriangles(Il2CppStructArray<int>.op_Implicit(list.ToArray()), j); } EOSLogger.Log($"CheckpointSensorVisual: removed {num2} center-quad triangles (root bone '{((Object)smr.rootBone).name}')"); s_strippedSource = sharedMesh; s_strippedMesh = val; return val; } private static void ForceZoneAnimation(GameObject clone) { //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) Animator componentInChildren = clone.GetComponentInChildren<Animator>(true); if ((Object)(object)componentInChildren == (Object)null) { return; } RuntimeAnimatorController runtimeAnimatorController = componentInChildren.runtimeAnimatorController; Il2CppReferenceArray<AnimationClip> val = (((Object)(object)runtimeAnimatorController != (Object)null) ? runtimeAnimatorController.animationClips : null); List<string> list = new List<string>(); if (val != null) { foreach (AnimationClip item in (Il2CppArrayBase<AnimationClip>)(object)val) { if ((Object)(object)item != (Object)null) { list.Add(((Object)item).name); } } } string text = list.Find((string n) => Regex.IsMatch(n, "idle|loop|active|visible|waiting", RegexOptions.IgnoreCase)); string text2 = list.Find((string n) => Regex.IsMatch(n, "reveal|appear|show|intro|open|spawn|in$", RegexOptions.IgnoreCase)); string value; try { if (text != null) { componentInChildren.Play(text, 0, 0f); value = "Play '" + text + "' @0"; } else if (text2 != null) { componentInChildren.Play(text2, 0, 1f); value = "Play '" + text2 + "' @end"; } else { value = "no matching clip"; } componentInChildren.Update(0f); } catch (Exception ex) { value = "play failed: " + ex.Message; } if (!s_animLogged || EntryPoint.DumpHierarchy.Value) { s_animLogged = true; AnimatorStateInfo currentAnimatorStateInfo = componentInChildren.GetCurrentAnimatorStateInfo(0); EOSLogger.Log($"CheckpointSensorVisual: zone animator ctrl='{(((Object)(object)runtimeAnimatorController != (Object)null) ? ((Object)runtimeAnimatorController).name : "null")}' clips=[{string.Join(", ", list)}] => {value} | state hash={((AnimatorStateInfo)(ref currentAnimatorStateInfo)).shortNameHash} t={((AnimatorStateInfo)(ref currentAnimatorStateInfo)).normalizedTime:F2} speed={componentInChildren.speed} enabled={((Behaviour)componentInChildren).enabled}"); } } private static bool HasSensorText(SensorSettings setting) { try { LocalizedText text = setting.Text; if (text == (LocalizedText)null || ((Il2CppObjectBase)text).Pointer == IntPtr.Zero) { return false; } if (text.Id != 0) { return true; } return !string.IsNullOrWhiteSpace(text.UntranslatedText); } catch { return false; } } private static float GetVanillaCloseDistance(GameObject src) { float num = 0f; CP_PlayerScanner componentInChildren = src.GetComponentInChildren<CP_PlayerScanner>(true); if ((Object)(object)componentInChildren != (Object)null) { num = componentInChildren.m_playerIsCloseDistance; } if (num <= 0.01f) { num = 10f; } if (!s_distLogged) { s_distLogged = true; EOSLogger.Log($"CheckpointSensorVisual: vanilla player-close distance = {(((Object)(object)componentInChildren != (Object)null) ? componentInChildren.m_playerIsCloseDistance : (-1f))} (using {num})"); } return num; } private static void StripLogic(GameObject go) { foreach (Collider componentsInChild in go.GetComponentsInChildren<Collider>(true)) { Object.DestroyImmediate((Object)(object)componentsInChild); } foreach (MonoBehaviour componentsInChild2 in go.GetComponentsInChildren<MonoBehaviour>(true)) { if (!((Object)(object)componentsInChild2 == (Object)null) && !((Object)(object)((Il2CppObjectBase)componentsInChild2).TryCast<CP_Bioscan_Graphics>() != (Object)null) && !((Object)(object)((Il2CppObjectBase)componentsInChild2).TryCast<TMP_Text>() != (Object)null) && !(((MemberInfo)((Object)componentsInChild2).GetIl2CppType()).Name == "RotateTowardsCurrentCamera")) { Object.DestroyImmediate((Object)(object)componentsInChild2); } } } } public enum VisibilityMode { Proximity, Raycast, Both, Always } public class CullingVisibility : MonoBehaviour { private const float CHECK_INTERVAL = 0.1f; private const float HIDE_HYSTERESIS = 1f; private const float SAMPLE_HEIGHT = 0.3f; private const float SAMPLE_HEIGHT_TOP = 1.2f; private const float HIT_TOLERANCE = 0.25f; private const int RING_SAMPLES = 8; private const float OCCLUDE_HIDE_DELAY = 0.4f; private const float TRANSITION_TIME = 0.35f; private const float DEBUG_LOG_INTERVAL = 5f; private readonly List<Renderer> m_renderers = new List<Renderer>(); private readonly List<TextMeshPro> m_texts = new List<TextMeshPro>(); private readonly List<Color> m_textBaseColors = new List<Color>(); private readonly Vector3[] m_samples = (Vector3[])(object)new Vector3[18]; private Transform? m_scaleTarget; private Vector3 m_baseScale = Vector3.one; private float m_radius = 1f; private float m_showDistance = 10f; private float m_nextCheck; private float m_nextDebugLog; private bool m_targetVisible; private float m_occludedSince = -1f; private float m_t; private float m_appliedT = -1f; private bool m_lastClose; private bool m_lastOccluded; private Vector3 m_startPos; private bool m_zoneLogged; static CullingVisibility() { ClassInjector.RegisterTypeInIl2Cpp<CullingVisibility>(); } internal void Setup(Transform scaleTarget, List<Renderer> renderers, List<TextMeshPro> texts, float radius, float showDistance) { //IL_0009: 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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) m_scaleTarget = scaleTarget; m_baseScale = scaleTarget.localScale; m_startPos = ((Component)this).transform.position; m_renderers.Clear(); foreach (Renderer renderer in renderers) { if ((Object)(object)renderer != (Object)null) { m_renderers.Add(renderer); } } m_texts.Clear(); m_textBaseColors.Clear(); foreach (TextMeshPro text in texts) { if (!((Object)(object)text == (Object)null)) { m_texts.Add(text); m_textBaseColors.Add(((Graphic)text).color); } } m_radius = Mathf.Max(0.1f, radius); m_showDistance = Mathf.Max(0.5f, showDistance); m_targetVisible = EntryPoint.Visibility.Value == VisibilityMode.Always; m_t = (m_targetVisible ? 1f : 0f); Apply(); } private void LateUpdate() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)GameStateManager.CurrentStateName == 10 && Time.time >= m_nextCheck) { m_nextCheck = Time.time + 0.1f; Evaluate(); } float num = (m_targetVisible ? 1f : 0f); m_t = Mathf.MoveTowards(m_t, num, Time.deltaTime / 0.35f); Apply(); } private void Evaluate() { //IL_0051: 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_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0220: Unknown result type (might be due to invalid IL or missing references) if (EntryPoint.DumpHierarchy.Value) { SkinnedMeshRenderer componentInChildren = ((Component)this).GetComponentInChildren<SkinnedMeshRenderer>(true); if ((Object)(object)componentInChildren != (Object)null) { MaterialProbe.DumpOnce((Renderer)(object)componentInChildren); } if (!m_zoneLogged) { m_zoneLogged = true; EOSLogger.Log($"CheckpointSensorVisual: sensor at {m_startPos} r={m_radius} zone={CheckpointVisual.DescribeZone(m_startPos)}"); } } VisibilityMode value = EntryPoint.Visibility.Value; if (value == VisibilityMode.Always) { m_targetVisible = true; return; } PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent(); if ((Object)(object)localPlayerAgent == (Object)null) { return; } bool flag = value == VisibilityMode.Proximity || value == VisibilityMode.Both; bool num = value == VisibilityMode.Raycast || value == VisibilityMode.Both; float num2 = Vector3.Distance(((Agent)localPlayerAgent).Position, ((Component)this).transform.position); float num3 = Mathf.Max(0f, num2 - m_radius); float num4 = (m_targetVisible ? (m_showDistance + 1f) : m_showDistance); m_lastClose = !flag || num3 <= num4; bool flag2 = false; if (num && m_lastClose) { m_lastOccluded = IsOccluded(GetCameraPos(localPlayerAgent)); if (m_lastOccluded) { if (m_occludedSince < 0f) { m_occludedSince = Time.time; } flag2 = Time.time - m_occludedSince >= 0.4f; } else { m_occludedSince = -1f; } } else { m_lastOccluded = false; m_occludedSince = -1f; } m_targetVisible = m_lastClose && !flag2; if (EntryPoint.DumpHierarchy.Value && Time.time >= m_nextDebugLog) { m_nextDebugLog = Time.time + 5f; if (num2 < 40f) { EOSLogger.Log($"CheckpointSensorVisual: vis {((Component)this).transform.position} dist={num2:F1} limit={m_showDistance:F1} close={m_lastClose} occluded={m_lastOccluded} => target={m_targetVisible} t={m_t:F2}"); } } } private void Apply() { //IL_008d: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) bool flag = m_t > 0.001f; if (!flag || Mathf.Abs(m_t - m_appliedT) > 0.0001f) { SetRenderers(flag); } if (Mathf.Abs(m_t - m_appliedT) <= 0.0001f) { return; } m_appliedT = m_t; float num = (m_targetVisible ? EaseOutBack(m_t) : Smooth(m_t)); if ((Object)(object)m_scaleTarget != (Object)null) { m_scaleTarget.localScale = m_baseScale * Mathf.Max(0.0001f, num); } float num2 = Smooth(m_t); for (int i = 0; i < m_texts.Count; i++) { TextMeshPro val = m_texts[i]; if (!((Object)(object)val == (Object)null)) { Color color = m_textBaseColors[i]; color.a *= num2; ((Graphic)val).color = color; } } } private static float Smooth(float x) { return x * x * (3f - 2f * x); } private static float EaseOutBack(float x) { float num = x - 1f; return 1f + 2.2f * num * num * num + 1.2f * num * num; } private static Vector3 GetCameraPos(PlayerAgent player) { //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) //IL_001f: 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) try { FPSCamera fPSCamera = player.FPSCamera; if ((Object)(object)fPSCamera != (Object)null) { return fPSCamera.Position; } } catch { } return ((Agent)player).EyePosition; } private bool IsOccluded(Vector3 camPos) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: 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_00f2: 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_00f8: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)this).transform.position; Vector3 val = position + Vector3.up * 0.3f; Vector3 val2 = position + Vector3.up * 1.2f; int num = 0; m_samples[num++] = val; m_samples[num++] = val2; for (int i = 0; i < 8; i++) { float num2 = (float)i * (float)Math.PI * 2f / 8f; Vector3 val3 = new Vector3(Mathf.Cos(num2), 0f, Mathf.Sin(num2)) * (m_radius * 0.9f); m_samples[num++] = val + val3; m_samples[num++] = val2 + val3; } int mASK_WORLD = LayerManager.MASK_WORLD; RaycastHit val5 = default(RaycastHit); for (int j = 0; j < num; j++) { Vector3 val4 = m_samples[j] - camPos; float magnitude = ((Vector3)(ref val4)).magnitude; if (magnitude < 0.01f) { return false; } if (!Physics.Raycast(camPos, val4 / magnitude, ref val5, magnitude, mASK_WORLD)) { return false; } if (((RaycastHit)(ref val5)).distance >= magnitude - 0.25f) { return false; } if ((Object)(object)((RaycastHit)(ref val5)).collider != (Object)null && ((Component)((RaycastHit)(ref val5)).collider).transform.IsChildOf(((Component)this).transform)) { return false; } } return true; } private void SetRenderers(bool on) { for (int num = m_renderers.Count - 1; num >= 0; num--) { Renderer val = m_renderers[num]; if ((Object)(object)val == (Object)null) { m_renderers.RemoveAt(num); } else if (val.enabled != on) { val.enabled = on; } } } } public class DisabledLook : MonoBehaviour { private const float COOLDOWN_WINDOW = 1f; private const float NEAR_MARGIN = 1.5f; private static readonly Dictionary<int, float> s_lastTrigger; private static readonly Dictionary<int, List<DisabledLook>> s_byGroup; private int m_group = -1; private float m_radius = 1f; private Renderer? m_ring; private Color m_ringEmission; private CP_Bioscan_Graphics? m_gfx; private Color m_gfxColor; private Renderer? m_zone; private Color m_zoneColor; private bool m_paused; private bool m_gray; internal int Group => m_group; static DisabledLook() { s_lastTrigger = new Dictionary<int, float>(); s_byGroup = new Dictionary<int, List<DisabledLook>>(); ClassInjector.RegisterTypeInIl2Cpp<DisabledLook>(); } public DisabledLook(IntPtr ptr) : base(ptr) { } internal void Setup(int group, float radius, Renderer? ring, CP_Bioscan_Graphics? gfx, Color gfxColor, Renderer? zone) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) m_group = group; m_radius = radius; if (!s_byGroup.TryGetValue(group, out List<DisabledLook> value)) { value = (s_byGroup[group] = new List<DisabledLook>()); } value.Add(this); m_ring = ring; if ((Object)(object)ring != (Object)null) { m_ringEmission = ring.sharedMaterial.GetColor("_EmissionColor"); } m_gfx = gfx; m_gfxColor = gfxColor; if ((Object)(object)zone != (Object)null) { m_zone = zone; m_zoneColor = zone.material.GetColor("_ColorA"); } } private void OnDestroy() { if (s_byGroup.TryGetValue(m_group, out List<DisabledLook> value)) { value.Remove(this); } } internal void OnPaused(GameObject graphics) { m_paused = true; if (InCooldownWindow(m_group) || AnyPlayerNear()) { ShowGray(graphics); } } internal void OnResumed() { m_paused = false; SetGray(gray: false); } private void ShowGray(GameObject graphics) { if (EntryPoint.ShowDisabledGray.Value) { graphics.SetActive(true); SetGray(gray: true); } } private void SetGray(bool gray) { //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_0058: 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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: 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_00f0: Unknown result type (might be due to invalid IL or missing references) if (m_gray != gray) { m_gray = gray; Color val = ParseColor(EntryPoint.DisabledColor.Value); if ((Object)(object)m_ring != (Object)null) { float num = Mathf.Max(0f, EntryPoint.EmissionIntensity.Value); m_ring.material.SetColor("_EmissionColor", (Color)(gray ? new Color(val.r * num, val.g * num, val.b * num, 1f) : m_ringEmission)); } else if ((Object)(object)m_gfx != (Object)null) { m_gfx.SetColor((Color)(gray ? new Color(val.r, val.g, val.b, m_gfxColor.a) : m_gfxColor)); } if ((Object)(object)m_zone != (Object)null) { m_zone.material.SetColor("_ColorA", (Color)(gray ? new Color(val.r, val.g, val.b, m_zoneColor.a) : m_zoneColor)); } } } private bool AnyPlayerNear() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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) Vector3 position = ((Component)this).transform.position; float num = m_radius + 1.5f; Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (!((Object)(object)current == (Object)null) && ((Agent)current).Alive && Vector3.Distance(((Agent)current).Position, position) <= num) { return true; } } return false; } internal static bool IsSpecialGroup(int group) { if (s_byGroup.TryGetValue(group, out List<DisabledLook> value)) { return value.Count > 0; } return false; } private static bool InCooldownWindow(int group) { if (s_lastTrigger.TryGetValue(group, out var value)) { return Time.time - value <= 1f; } return false; } internal static void OnGroupTriggered(int group) { s_lastTrigger[group] = Time.time; if (!s_byGroup.TryGetValue(group, out List<DisabledLook> value)) { return; } foreach (DisabledLook item in value) { if (!((Object)(object)item == (Object)null) && item.m_paused && !item.m_gray) { item.ShowGray(((Component)((Component)item).transform.GetChild(0)).gameObject); } } } internal static void Clear() { s_lastTrigger.Clear(); s_byGroup.Clear(); } private static Color ParseColor(string s) { //IL_009b: Unknown result type (might be due to invalid IL or missing references) string[] array = s.Split(','); Color result = default(Color); ((Color)(ref result))..ctor(0.5f, 0.5f, 0.5f, 1f); if (array.Length >= 3 && float.TryParse(array[0].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out var result2) && float.TryParse(array[1].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out var result3) && float.TryParse(array[2].Trim(), NumberStyles.Float, CultureInfo.InvariantCulture, out var result4)) { ((Color)(ref result))..ctor(Mathf.Clamp01(result2), Mathf.Clamp01(result3), Mathf.Clamp01(result4), 1f); } return result; } internal static DisabledLook? Of(MovableSensor sensor) { GameObject movableGO = sensor.movableGO; if (!((Object)(object)movableGO != (Object)null)) { return null; } return movableGO.GetComponent<DisabledLook>(); } internal static DisabledLook? Of(IntPtr sensorGO) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (sensorGO == IntPtr.Zero) { return null; } return new GameObject(sensorGO).GetComponent<DisabledLook>(); } } [HarmonyPatch(typeof(MovableSensor), "PauseMoving")] internal static class Patch_MovableSensor_PauseMoving { private static void Postfix(MovableSensor __instance) { DisabledLook.Of(__instance)?.OnPaused(((Component)__instance.movableGO.transform.GetChild(0)).gameObject); } } [HarmonyPatch(typeof(MovableSensor), "ResumeMoving")] internal static class Patch_MovableSensor_ResumeMoving { private static void Postfix(MovableSensor __instance) { DisabledLook.Of(__instance)?.OnResumed(); } } public enum RingStyle { Emissive, Hologram } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Warren.CheckpointSensorVisual", "CheckpointSensorVisual", "1.8.1")] public class EntryPoint : BasePlugin { public const string GUID = "Warren.CheckpointSensorVisual"; public const string NAME = "CheckpointSensorVisual"; public const string VERSION = "1.8.1"; internal static ConfigEntry<bool> UseSensorColor; internal static ConfigEntry<bool> ShowSensorText; internal static ConfigEntry<float> ZoneAlpha; internal static ConfigEntry<bool> CollapseCenterQuad; internal static ConfigEntry<VisibilityMode> Visibility; internal static ConfigEntry<float> ShowDistance; internal static ConfigEntry<bool> DumpHierarchy; internal static ConfigEntry<RingStyle> RingStyle; internal static ConfigEntry<float> EmissionIntensity; internal static ConfigEntry<bool> ShowZoneDisc; internal static ConfigEntry<bool> PlainZoneDisc; internal static ConfigEntry<bool> ShowDisabledGray; internal static ConfigEntry<string> DisabledColor; private Harmony m_Harmony; public override void Load() { //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Expected O, but got Unknown UseSensorColor = ((BasePlugin)this).Config.Bind<bool>("General", "UseSensorColor", true, "true = 센서 JSON의 Color 사용, false = 체크포인트 기본 색"); ZoneAlpha = ((BasePlugin)this).Config.Bind<float>("General", "ZoneAlpha", -1f, "원판 색 알파 덮어쓰기 (0~1). -1 = 센서 JSON Color의 a 그대로"); CollapseCenterQuad = ((BasePlugin)this).Config.Bind<bool>("General", "CollapseCenterQuad", false, "체크포인트 링 메시에서 루트 본(Zone) 평면 삼각형 제거 (Eternal은 안 함)"); RingStyle = ((BasePlugin)this).Config.Bind<RingStyle>("Look", "RingStyle", CheckpointSensorVisual.RingStyle.Emissive, "Emissive = Eternal 무빙 센서처럼 Standard 발광 재질 (중앙 네모 없음) / Hologram = 체크포인트 원래 홀로 재질"); EmissionIntensity = ((BasePlugin)this).Config.Bind<float>("Look", "EmissionIntensity", 0.1f, "링 발광 세기 = 센서 Color x 이 값 (Eternal 빨강 ≈ 0.1)"); ShowZoneDisc = ((BasePlugin)this).Config.Bind<bool>("Look", "ShowZoneDisc", true, "true = 원본 EOS 홀로 원판을 링 아래에 같이 표시 (Eternal 구조)"); ShowDisabledGray = ((BasePlugin)this).Config.Bind<bool>("Look", "ShowDisabledGray", true, "true = 센서 그룹이 비활성화(쿨타임)되면 숨기지 않고 그 자리에 회색으로 멈춰 있음"); DisabledColor = ((BasePlugin)this).Config.Bind<string>("Look", "DisabledColor", "0.5,0.5,0.5", "비활성화 상태 색 R,G,B (0~1). 알파는 원래 값 유지"); PlainZoneDisc = ((BasePlugin)this).Config.Bind<bool>("Look", "PlainZoneDisc", true, "true = 원판을 일반 동그란 스캔 메시로 (MOVABLE의 T스캔 방향표 제거)"); ShowSensorText = ((BasePlugin)this).Config.Bind<bool>("General", "ShowSensorText", true, "true = 원래 EOS 센서 텍스트 표시, false = 텍스트 숨김"); Visibility = ((BasePlugin)this).Config.Bind<VisibilityMode>("Visibility", "Mode", VisibilityMode.Proximity, "Proximity = 바닐라 OnlyShowHUDWhenPlayerIsClose처럼 가까이 있을 때만 / Raycast = 벽·사물 뒤면 숨김 / Both = 둘 다 / Always = 항상 보임"); ShowDistance = ((BasePlugin)this).Config.Bind<float>("Visibility", "ShowDistance", 0f, "표시 거리(m, 센서 가장자리 기준). 0 = 바닐라 체크포인트 값 사용"); DumpHierarchy = ((BasePlugin)this).Config.Bind<bool>("Debug", "DumpHierarchy", false, "체크포인트 프리팹 구조 / 적용 로그 출력"); m_Harmony = new Harmony("Warren.CheckpointSensorVisual"); m_Harmony.PatchAll(); Patch_SensorFileChanged.Apply(m_Harmony); SensorTriggerSync.Register(); SpecialSensorType.ReloadSensorDefinitions(); EOSLogger.Log("CheckpointSensorVisual 1.8.1 loaded."); } } public class HideOriginalVisual : MonoBehaviour { private const float RESCAN_INTERVAL = 1f; private const float DEBUG_DUMP_DELAY = 10f; private static bool s_debugDumped; private readonly List<Renderer> m_renderers = new List<Renderer>(); private Transform? m_keep; private bool m_keepText; private Renderer? m_keepZone; private float m_nextRescan; private float m_debugDumpAt = -1f; static HideOriginalVisual() { ClassInjector.RegisterTypeInIl2Cpp<HideOriginalVisual>(); } internal void Setup(bool keepText, bool keepZone) { m_keepText = keepText; m_keepZone = (keepZone ? FindZoneRenderer(((Component)this).transform.GetChild(0)) : null); Rescan(); Hide(); } internal void SetKeep(Transform keep) { m_keep = keep; Rescan(); if (EntryPoint.DumpHierarchy.Value && !s_debugDumped) { s_debugDumped = true; DumpRenderers("at setup"); m_debugDumpAt = Time.time + 10f; } } private void Rescan() { m_renderers.Clear(); foreach (Renderer componentsInChild in ((Component)this).GetComponentsInChildren<Renderer>(true)) { if ((!((Object)(object)m_keep != (Object)null) || !((Component)componentsInChild).transform.IsChildOf(m_keep)) && (!m_keepText || !((Object)(object)((Component)componentsInChild).GetComponent<TextMeshPro>() != (Object)null)) && (!((Object)(object)m_keepZone != (Object)null) || !((Object)(object)componentsInChild == (Object)(object)m_keepZone))) { m_renderers.Add(componentsInChild); } } } internal static Renderer? FindZoneRenderer(Transform gfxParent) { Transform val = gfxParent.Find("Zone"); if (!((Object)(object)val != (Object)null)) { return null; } return ((Component)val).GetComponent<Renderer>(); } private void LateUpdate() { if (Time.time >= m_nextRescan) { m_nextRescan = Time.time + 1f; Rescan(); } if (m_debugDumpAt > 0f && Time.time >= m_debugDumpAt) { m_debugDumpAt = -1f; DumpRenderers($"after {10f}s"); } Hide(); } private void Hide() { for (int num = m_renderers.Count - 1; num >= 0; num--) { Renderer val = m_renderers[num]; if ((Object)(object)val == (Object)null) { m_renderers.RemoveAt(num); } else if (val.enabled) { val.enabled = false; } } } private void DumpRenderers(string when) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder($"CheckpointSensorVisual: renderers on sensor {((Component)this).transform.position} ({when})\n"); foreach (Renderer componentsInChild in ((Component)this).GetComponentsInChildren<Renderer>(true)) { string text = ((Object)componentsInChild).name; Transform parent = ((Component)componentsInChild).transform.parent; while ((Object)(object)parent != (Object)null && (Object)(object)parent != (Object)(object)((Component)this).transform) { text = ((Object)parent).name + "/" + text; parent = parent.parent; } bool flag = (Object)(object)m_keep != (Object)null && ((Component)componentsInChild).transform.IsChildOf(m_keep); Material sharedMaterial = componentsInChild.sharedMaterial; StringBuilder stringBuilder2 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(36, 6, stringBuilder2); handler.AppendLiteral(" "); handler.AppendFormatted(flag ? "[checkpoint]" : "[original] "); handler.AppendLiteral(" "); handler.AppendFormatted(text); handler.AppendLiteral(" type="); handler.AppendFormatted(((MemberInfo)((Object)componentsInChild).GetIl2CppType()).Name); handler.AppendLiteral(" enabled="); handler.AppendFormatted(componentsInChild.enabled); handler.AppendLiteral(" active="); handler.AppendFormatted(((Component)componentsInChild).gameObject.activeInHierarchy); handler.AppendLiteral(" shader="); handler.AppendFormatted(((Object)(object)sharedMaterial != (Object)null && (Object)(object)sharedMaterial.shader != (Object)null) ? ((Object)sharedMaterial.shader).name : "-"); handler.AppendLiteral("\n"); stringBuilder2.Append(ref handler); } EOSLogger.Log(stringBuilder.ToString().TrimEnd()); } } internal static class MaterialProbe { private static readonly string[] s_floatProps = new string[54] { "_Progress", "_ScanProgress", "_Fill", "_FillAmount", "_Scan", "_Noise", "_NoiseAmount", "_NoiseScale", "_NoiseSpeed", "_Glitch", "_GlitchAmount", "_Pixel", "_PixelSize", "_Pixelate", "_GridSize", "_Grid", "_BlockSize", "_Blocks", "_Radius", "_Height", "_Fade", "_FadeDistance", "_Alpha", "_Opacity", "_Intensity", "_Emission", "_EmissionStrength", "_Speed", "_Tiling", "_Dissolve", "_Reveal", "_Distortion", "_Flicker", "_Cutoff", "_Visibility", "_Visible", "_Brightness", "_Power", "_RimPower", "_Fresnel", "_Thickness", "_Width", "_EdgeWidth", "_Density", "_Scale", "_Mode", "_ColorMode", "_State", "_Active", "_Alarm", "_Blink", "_TimeOffset", "_Seed", "_Random" }; private static readonly string[] s_colorProps = new string[6] { "_ColorA", "_ColorB", "_Color", "_TintColor", "_EmissionColor", "_MainColor" }; private static readonly string[] s_texProps = new string[7] { "_MainTex", "_NoiseTex", "_Noise", "_MaskTex", "_PatternTex", "_GridTex", "_DetailTex" }; private static bool s_dumped; internal static void DumpOnce(Renderer ours) { if (s_dumped) { return; } s_dumped = true; Log("ours", ours); int num = 0; foreach (CP_Bioscan_Graphics item in Object.FindObjectsOfType<CP_Bioscan_Graphics>()) { if ((Object)(object)item == (Object)null || ((Object)((Component)item).gameObject).name == "CheckpointSensorVisual") { continue; } Renderer val = (Renderer)(((object)((Component)item).GetComponentInChildren<SkinnedMeshRenderer>(true)) ?? ((object)((Component)item).GetComponentInChildren<Renderer>(true))); if (!((Object)(object)val == (Object)null)) { Log("vanilla '" + ((Object)((Component)item).gameObject).name + "'", val); if (++num >= 3) { break; } } } if (num == 0) { EOSLogger.Log("CheckpointSensorVisual: probe - no vanilla bioscan graphics found in scene"); } } private static void Log(string label, Renderer r) { //IL_00e8: 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_010a: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) Material sharedMaterial = r.sharedMaterial; Material material = r.material; DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(96, 8); defaultInterpolatedStringHandler.AppendLiteral("CheckpointSensorVisual: probe ["); defaultInterpolatedStringHandler.AppendFormatted(label); defaultInterpolatedStringHandler.AppendLiteral("] renderer='"); defaultInterpolatedStringHandler.AppendFormatted(((Object)r).name); defaultInterpolatedStringHandler.AppendLiteral("' mat='"); defaultInterpolatedStringHandler.AppendFormatted(((Object)(object)sharedMaterial != (Object)null) ? ((Object)sharedMaterial).name : "null"); defaultInterpolatedStringHandler.AppendLiteral("' shader='"); Shader shader = material.shader; defaultInterpolatedStringHandler.AppendFormatted((shader != null) ? ((Object)shader).name : null); defaultInterpolatedStringHandler.AppendLiteral("' queue="); defaultInterpolatedStringHandler.AppendFormatted(material.renderQueue); defaultInterpolatedStringHandler.AppendLiteral(" keywords=["); defaultInterpolatedStringHandler.AppendFormatted(string.Join(",", Il2CppArrayBase<string>.op_Implicit((Il2CppArrayBase<string>)(object)material.shaderKeywords))); defaultInterpolatedStringHandler.AppendLiteral("] scale="); defaultInterpolatedStringHandler.AppendFormatted<Vector3>(((Component)r).transform.lossyScale); defaultInterpolatedStringHandler.AppendLiteral(" bounds="); Bounds bounds = r.bounds; defaultInterpolatedStringHandler.AppendFormatted<Vector3>(((Bounds)(ref bounds)).size); defaultInterpolatedStringHandler.AppendLiteral("\n"); StringBuilder stringBuilder = new StringBuilder(defaultInterpolatedStringHandler.ToStringAndClear()); string[] array = s_floatProps; foreach (string text in array) { if (material.HasProperty(text)) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(4, 2, stringBuilder2); handler.AppendLiteral(" "); handler.AppendFormatted(text); handler.AppendLiteral("="); handler.AppendFormatted(material.GetFloat(text)); handler.AppendLiteral("\n"); stringBuilder3.Append(ref handler); } } array = s_colorProps; foreach (string text2 in array) { if (material.HasProperty(text2)) { StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder4 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(4, 2, stringBuilder2); handler.AppendLiteral(" "); handler.AppendFormatted(text2); handler.AppendLiteral("="); handler.AppendFormatted<Color>(material.GetColor(text2)); handler.AppendLiteral("\n"); stringBuilder4.Append(ref handler); } } array = s_texProps; foreach (string text3 in array) { if (material.HasProperty(text3)) { Texture texture = material.GetTexture(text3); StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder5 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(9, 4, stringBuilder2); handler.AppendLiteral(" "); handler.AppendFormatted(text3); handler.AppendLiteral("="); handler.AppendFormatted(((Object)(object)texture != (Object)null) ? ((Object)texture).name : "null"); handler.AppendLiteral(" st="); handler.AppendFormatted<Vector2>(material.GetTextureScale(text3)); handler.AppendLiteral("/"); handler.AppendFormatted<Vector2>(material.GetTextureOffset(text3)); handler.AppendLiteral("\n"); stringBuilder5.Append(ref handler); } } EOSLogger.Log(stringBuilder.ToString().TrimEnd()); } } [HarmonyPatch(typeof(SensorGroup), "Instantiate")] internal static class Patch_SensorGroup { [HarmonyPrefix] private static void Prefix(SensorGroupSettings sensorGroupSettings, out HashSet<SensorSettings> __state) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Invalid comparison between Unknown and I4 __state = new HashSet<SensorSettings>(); foreach (SensorSettings item in sensorGroupSettings.SensorGroup) { if ((int)item.SensorType == 2) { item.SensorType = (SensorType)(HasMovingPosition(item) ? 1 : 0); __state.Add(item); } } } [HarmonyPostfix] private static void Postfix(SensorGroupSettings sensorGroupSettings, SensorGroup __result, HashSet<SensorSettings> __state) { //IL_0050: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: 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_0077: Invalid comparison between Unknown and I4 if (__state.Count == 0) { return; } try { if (__result == null) { return; } List<GameObject> list = __result.BasicSensors.ToList(); List<MovableSensor> list2 = __result.MovableSensors.ToList(); int num = 0; int num2 = 0; foreach (SensorSettings item in sensorGroupSettings.SensorGroup) { if (item.Position.ToVector3() == Vector3.zero) { continue; } GameObject val = null; SensorType sensorType = item.SensorType; if ((int)sensorType != 0) { if ((int)sensorType != 1) { continue; } if (num2 < list2.Count) { val = list2[num2].movableGO; } num2++; } else { if (num < list.Count) { val = list[num]; } num++; } if (!((Object)(object)val == (Object)null) && __state.Contains(item)) { try { CheckpointVisual.Apply(val, item, __result.SensorGroupIndex); } catch (Exception value) { EOSLogger.Error($"CheckpointSensorVisual: failed on sensor group {__result.SensorGroupIndex}: {value}"); } } } } finally { foreach (SensorSettings item2 in __state) { item2.SensorType = (SensorType)2; } } } private static bool HasMovingPosition(SensorSettings s) { if (s.MovingPosition != null) { return s.MovingPosition.Any((Vec3 p) => p != null && p.ToVector3() != Vector3.zero); } return false; } } internal static class SensorTriggerSync { private struct TriggerPacket { public int Group; } private const string EVENT_NAME = "Warren.CheckpointSensorVisual.SensorTriggered"; private static readonly FieldInfo? s_groupIndex = AccessTools.Field(typeof(SecuritySensorManager), "sensorGroupIndex"); private static readonly FieldInfo? s_groups = AccessTools.Field(typeof(SecuritySensorManager), "sensorGroups"); internal static bool Enabled { get { if (s_groupIndex != null) { return s_groups != null; } return false; } } internal static void Register() { if (s_groupIndex == null || s_groups == null) { EOSLogger.Error("CheckpointSensorVisual: SecuritySensorManager fields not found, sensor trigger sync disabled"); } NetworkAPI.RegisterEvent<TriggerPacket>("Warren.CheckpointSensorVisual.SensorTriggered", (Action<ulong, TriggerPacket>)OnReceive); } internal static int GroupOf(IntPtr sensorGO) { SecuritySensorManager current = SecuritySensorManager.Current; if (current == null || !(s_groupIndex?.GetValue(current) is Dictionary<IntPtr, int> dictionary)) { return -1; } if (!dictionary.TryGetValue(sensorGO, out var value)) { return -1; } return value; } internal static void Broadcast(int group) { NetworkAPI.InvokeEvent<TriggerPacket>("Warren.CheckpointSensorVisual.SensorTriggered", new TriggerPacket { Group = group }, (SNet_ChannelType)4); } private static void OnReceive(ulong sender, TriggerPacket packet) { if (SNet.IsMaster) { return; } SecuritySensorManager current = SecuritySensorManager.Current; if (current == null || !(s_groups?.GetValue(current) is List<SensorGroup> list)) { return; } if (packet.Group < 0 || packet.Group >= list.Count) { EOSLogger.Error($"CheckpointSensorVisual: host sent invalid sensor group {packet.Group}"); return; } DisabledLook.OnGroupTriggered(packet.Group); list[packet.Group].Settings.EventsOnTrigger.ForEach(delegate(WardenObjectiveEventData e) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(e, e.Trigger, true, 0f); }); EOSLogger.Warning($"TriggerSensor: SensorGroup_{packet.Group} triggered (from host)"); } } [HarmonyPatch(typeof(SecuritySensorManager), "SensorTriggered")] internal static class Patch_SecuritySensorManager_SensorTriggered { private static bool Prefix(IntPtr pointer, out int __state) { __state = SensorTriggerSync.GroupOf(pointer); if (!SNet.IsMaster && SensorTriggerSync.Enabled) { return false; } if (__state >= 0) { DisabledLook.OnGroupTriggered(__state); } return true; } private static void Postfix(int __state) { if (SNet.IsMaster && __state >= 0) { SensorTriggerSync.Broadcast(__state); } } } internal static class SpecialSensorType { public const string KEYWORD = "SPECIAL"; public const SensorType SPECIAL = (SensorType)2; private static readonly Regex s_special = new Regex("(\"SensorType\"\\s*:\\s*)\"SPECIAL\"", RegexOptions.IgnoreCase | RegexOptions.Compiled); private static readonly MethodInfo? s_addDefinitions = AccessTools.Method(typeof(GenericExpeditionDefinitionManager<SensorGroupSettings>), "AddDefinitions", (Type[])null, (Type[])null); internal static bool HasSpecial(string json) { return s_special.IsMatch(json); } internal static string Preprocess(string json) { return s_special.Replace(json, "${1}2"); } internal static void Load(string json, string fileName) { SecuritySensorManager current = SecuritySensorManager.Current; if (current == null || s_addDefinitions == null) { EOSLogger.Error("CheckpointSensorVisual: cannot access SecuritySensorManager"); return; } GenericExpeditionDefinition<SensorGroupSettings> val = EOSJson.Deserialize<GenericExpeditionDefinition<SensorGroupSettings>>(Preprocess(json)); s_addDefinitions.Invoke(current, new object[1] { val }); EOSLogger.Log("CheckpointSensorVisual: loaded '" + fileName + "' with SPECIAL sensors"); } internal static void ReloadSensorDefinitions() { SecuritySensorManager current = SecuritySensorManager.Current; if (current == null) { return; } foreach (string item in Directory.EnumerateFiles(((GenericExpeditionDefinitionManager<SensorGroupSettings>)(object)current).DEFINITION_PATH, "*.json", SearchOption.AllDirectories)) { try { string json = File.ReadAllText(item); if (HasSpecial(json)) { Load(json, Path.GetFileName(item)); } } catch (Exception value) { EOSLogger.Error($"CheckpointSensorVisual: failed to load '{item}':\n{value}"); } } } } internal static class Patch_SensorFileChanged { internal static void Apply(Harmony harmony) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Expected O, but got Unknown try { MethodInfo methodInfo = AccessTools.Method(typeof(GenericExpeditionDefinitionManager<SensorGroupSettings>), "FileChanged", (Type[])null, (Type[])null); harmony.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(Patch_SensorFileChanged), "Prefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex) { EOSLogger.Warning("CheckpointSensorVisual: LiveEdit patch failed, SPECIAL은 게임 재시작 시에만 반영됨\n" + ex.Message); } } private static bool Prefix(object __instance, LiveEditEventArgs e) { if (!(__instance is SecuritySensorManager)) { return true; } string fullPath = e.FullPath; string json; try { json = File.ReadAllText(fullPath); } catch { return true; } if (!SpecialSensorType.HasSpecial(json)) { return true; } EOSLogger.Warning("LiveEdit File Changed: " + fullPath); try { SpecialSensorType.Load(json, Path.GetFileName(fullPath)); } catch (Exception value) { EOSLogger.Error($"CheckpointSensorVisual: failed to load '{fullPath}':\n{value}"); } return false; } } }
BepInEx/plugins/Nadir/Custom/Warren.EMPFlashlightFix.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using Agents; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using CullingSystem; using GameData; using Gear; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using LevelGeneration; using Microsoft.CodeAnalysis; using Player; using SNetwork; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Warren.EMPFlashlightFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+35456379119873132d3e4d2be6118c1334a3f0c6")] [assembly: AssemblyProduct("Warren.EMPFlashlightFix")] [assembly: AssemblyTitle("Warren.EMPFlashlightFix")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace EMPFlashlightFix { internal static class EMPLightFixes { private const string LIGHT_HANDLER = "EOSExt.EMP.Impl.Handlers.EMPLightHandler"; private const string PEMP = "EOSExt.EMP.Impl.PersistentEMP.pEMP"; private static FieldInfo? s_light; private static MethodInfo? s_unsynced; private static readonly Dictionary<object, bool> s_isPlayerLight = new Dictionary<object, bool>(); internal static void Apply(Harmony harmony) { //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Expected O, but got Unknown Type type = AccessTools.TypeByName("EOSExt.EMP.Impl.Handlers.EMPLightHandler"); s_light = ((type != null) ? AccessTools.Field(type, "_light") : null); bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2; if (s_light != null) { HarmonyMethod val = new HarmonyMethod(AccessTools.Method(typeof(EMPLightFixes), "Pre_SkipPlayerLight", (Type[])null, (Type[])null)); string[] array = new string[3] { "DeviceOff", "DeviceOn", "FlickerDevice" }; foreach (string text in array) { MethodInfo methodInfo = AccessTools.Method(type, text, (Type[])null, (Type[])null); if (methodInfo != null) { harmony.Patch((MethodBase)methodInfo, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } } else { ManualLogSource l = EntryPoint.L; val2 = new BepInExWarningLogInterpolatedStringHandler(51, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("EOSExt.EMP.Impl.Handlers.EMPLightHandler"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("._light not found - player light exclusion disabled"); } l.LogWarning(val2); } Type type2 = AccessTools.TypeByName("EOSExt.EMP.Impl.PersistentEMP.pEMP"); s_unsynced = ((type2 != null) ? AccessTools.Method(type2, "ChangeToStateUnsynced", (Type[])null, (Type[])null) : null); MethodInfo methodInfo2 = ((type2 != null) ? AccessTools.Method(type2, "OnStateChanged", (Type[])null, (Type[])null) : null); if (s_unsynced != null && methodInfo2 != null) { harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(AccessTools.Method(typeof(EMPLightFixes), "Post_OnStateChanged", (Type[])null, (Type[])null)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); return; } ManualLogSource l2 = EntryPoint.L; val2 = new BepInExWarningLogInterpolatedStringHandler(53, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("EOSExt.EMP.Impl.PersistentEMP.pEMP"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" methods not found - host-authoritative pEMP disabled"); } l2.LogWarning(val2); } private static bool Pre_SkipPlayerLight(object __instance) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected O, but got Unknown if (!s_isPlayerLight.TryGetValue(__instance, out var value)) { object? value2 = s_light.GetValue(__instance); LG_Light val = (LG_Light)((value2 is LG_Light) ? value2 : null); value = (Object)(object)val != (Object)null && IsOnPlayerOrGear(((Component)val).transform, out string _); if (value) { ManualLogSource l = EntryPoint.L; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(52, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("EMP: excluded player/gear light '"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(Path(((Component)val).transform)); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' from EnvLight EMP"); } l.LogInfo(val2); } s_isPlayerLight[__instance] = value; } return !value; } private static bool IsOnPlayerOrGear(Transform t, out string owner) { Transform val = t; while ((Object)(object)val != (Object)null) { if ((Object)(object)((Component)val).GetComponent<PlayerAgent>() != (Object)null) { owner = "PlayerAgent"; return true; } if ((Object)(object)((Component)val).GetComponent<ItemEquippable>() != (Object)null) { owner = "ItemEquippable"; return true; } if ((Object)(object)((Component)val).GetComponent<FPSCamera>() != (Object)null) { owner = "FPSCamera"; return true; } val = val.parent; } owner = ""; return false; } private static string Path(Transform t) { string text = ((Object)t).name; Transform parent = t.parent; while ((Object)(object)parent != (Object)null) { text = ((Object)parent).name + "/" + text; parent = parent.parent; } return text; } private static void Post_OnStateChanged(object __instance, object[] __args) { if (!(bool)__args[2] && !SNet.IsMaster) { object obj = __args[1]; object obj2 = AccessTools.Field(obj.GetType(), "status")?.GetValue(obj); if (obj2 != null) { s_unsynced.Invoke(__instance, new object[1] { obj2 }); } } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Warren.EMPFlashlightFix", "EMPFlashlightFix", "1.3.1")] public class EntryPoint : BasePlugin { public const string GUID = "Warren.EMPFlashlightFix"; public const string NAME = "EMPFlashlightFix"; public const string VERSION = "1.3.1"; private const string HANDLER_TYPE = "EOSExt.EMP.Impl.Handlers.EMPPlayerFlashLightHandler"; private const float MIN_VALID = 0.0001f; internal static float LastWieldedIntensity; private static FieldInfo? s_originalIntensity; private static bool s_fixLogged; internal static ManualLogSource L; internal static ConfigEntry<KeyCode> DiagKey; internal static ConfigEntry<bool> DiagLog; internal static ConfigEntry<KeyCode> RepairKey; private Harmony m_Harmony; public override void Load() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Expected O, but got Unknown //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Expected O, but got Unknown //IL_02a5: Unknown result type (might be due to invalid IL or missing references) //IL_02ac: Expected O, but got Unknown //IL_0267: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Expected O, but got Unknown L = ((BasePlugin)this).Log; DiagKey = ((BasePlugin)this).Config.Bind<KeyCode>("Debug", "DiagKey", (KeyCode)291, "누르면 손전등/EMP 상태를 로그에 남김 (FLDIAG)"); DiagLog = ((BasePlugin)this).Config.Bind<bool>("Debug", "LogFlashlightChanges", true, "손전등 켜기 요청 / EMP On·Off 때마다 FLDIAG 로그"); RepairKey = ((BasePlugin)this).Config.Bind<KeyCode>("Debug", "RepairKey", (KeyCode)292, "손전등이 켜졌는데 빛이 안 보일 때 누르면 그려지는 라이트를 다시 켜 보고 전/후를 로그에 남김"); m_Harmony = new Harmony("Warren.EMPFlashlightFix"); m_Harmony.PatchAll(typeof(Patch_FlashlightWielded)); if (DiagLog.Value) { m_Harmony.PatchAll(typeof(Patch_DiagHooks)); } FlashlightDiag.InitReflection(); EMPLightFixes.Apply(m_Harmony); ((BasePlugin)this).AddComponent<FlashlightDiag>(); Type type = AccessTools.TypeByName("EOSExt.EMP.Impl.Handlers.EMPPlayerFlashLightHandler"); s_originalIntensity = ((type != null) ? AccessTools.Field(type, "_originalIntensity") : null); bool flag = default(bool); if (type == null || s_originalIntensity == null) { ManualLogSource log = ((BasePlugin)this).Log; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(76, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("EOSExt.EMP.Impl.Handlers.EMPPlayerFlashLightHandler"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("._originalIntensity not found (EOSExt.EMP missing or changed) - fix disabled"); } log.LogWarning(val); return; } HarmonyMethod val2 = new HarmonyMethod(AccessTools.Method(typeof(EntryPoint), "Pre_FixOriginalIntensity", (Type[])null, (Type[])null)); string[] array = new string[2] { "DeviceOn", "FlickerDevice" }; foreach (string text in array) { MethodInfo methodInfo = AccessTools.Method(type, text, (Type[])null, (Type[])null); if (methodInfo != null) { m_Harmony.Patch((MethodBase)methodInfo, val2, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); continue; } ManualLogSource log2 = ((BasePlugin)this).Log; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(11, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("EOSExt.EMP.Impl.Handlers.EMPPlayerFlashLightHandler"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" not found"); } log2.LogWarning(val); } if (DiagLog.Value) { array = new string[2] { "DeviceOn", "DeviceOff" }; foreach (string text2 in array) { MethodInfo methodInfo2 = AccessTools.Method(type, text2, (Type[])null, (Type[])null); HarmonyMethod val3 = new HarmonyMethod(AccessTools.Method(typeof(EntryPoint), (text2 == "DeviceOn") ? "Post_DeviceOn" : "Post_DeviceOff", (Type[])null, (Type[])null)); if (methodInfo2 != null) { m_Harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, val3, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } } ManualLogSource log3 = ((BasePlugin)this).Log; BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(9, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>("EMPFlashlightFix"); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>("1.3.1"); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" loaded."); } log3.LogInfo(val4); } private static void Post_DeviceOn() { FlashlightDiag.Dump("EMP DeviceOn"); } private static void Post_DeviceOff() { FlashlightDiag.Dump("EMP DeviceOff"); } private static void Pre_FixOriginalIntensity(object __instance) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected O, but got Unknown if (s_originalIntensity == null || LastWieldedIntensity <= 0.0001f || (float)s_originalIntensity.GetValue(__instance) > 0.0001f) { return; } s_originalIntensity.SetValue(__instance, LastWieldedIntensity); if (!s_fixLogged) { s_fixLogged = true; ManualLogSource obj = Logger.CreateLogSource("EMPFlashlightFix"); bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(55, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("EMP flashlight original intensity was 0 -> restored to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<float>(LastWieldedIntensity); } obj.LogInfo(val); } } } [HarmonyPatch] internal static class Patch_FlashlightWielded { [HarmonyPostfix] [HarmonyWrapSafe] [HarmonyPatch(typeof(PlayerInventoryBase), "OnItemEquippableFlashlightWielded")] private static void Post_OnItemEquippableFlashlightWielded(PlayerInventoryBase __instance, GearPartFlashlight flashlight) { if (!((Object)(object)flashlight == (Object)null) && !((Object)(object)__instance.Owner == (Object)null) && ((Agent)__instance.Owner).IsLocallyOwned) { FlashlightSettingsDataBlock block = GameDataBlockBase<FlashlightSettingsDataBlock>.GetBlock(flashlight.m_settingsID); if (block != null && block.intensity > 0f) { EntryPoint.LastWieldedIntensity = block.intensity; } } } } public class FlashlightDiag : MonoBehaviour { private const string HANDLER_TYPE = "EOSExt.EMP.Impl.Handlers.EMPPlayerFlashLightHandler"; private static Type? s_handlerType; private static PropertyInfo? s_instance; private static MethodInfo? s_isEMPed; private static PropertyInfo? s_state; private static FieldInfo? s_origIntensity; private static FieldInfo? s_origState; private const float SYNC_INTERVAL = 0.2f; private float m_nextSync; private static float s_lastFixLog; static FlashlightDiag() { s_lastFixLog = -999f; ClassInjector.RegisterTypeInIl2Cpp<FlashlightDiag>(); } internal static void InitReflection() { s_handlerType = AccessTools.TypeByName("EOSExt.EMP.Impl.Handlers.EMPPlayerFlashLightHandler"); if (!(s_handlerType == null)) { s_instance = AccessTools.Property(s_handlerType, "Instance"); s_isEMPed = AccessTools.Method(s_handlerType, "IsEMPed", (Type[])null, (Type[])null); s_state = AccessTools.Property(s_handlerType, "State"); s_origIntensity = AccessTools.Field(s_handlerType, "_originalIntensity"); s_origState = AccessTools.Field(s_handlerType, "_originalFlashlightState"); } } private void Update() { //IL_0005: 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) if (Input.GetKeyDown(EntryPoint.DiagKey.Value)) { Dump("key"); } if (Input.GetKeyDown(EntryPoint.RepairKey.Value)) { Repair(); } if (Time.time >= m_nextSync) { m_nextSync = Time.time + 0.2f; SyncClusterLight(); } } private static void SyncClusterLight() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown if ((int)GameStateManager.CurrentStateName != 10) { return; } PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent(); PlayerInventoryBase val = (((Object)(object)localPlayerAgent != (Object)null) ? localPlayerAgent.Inventory : null); C_LightDynamic val2 = (((Object)(object)val != (Object)null) ? val.m_flashlightCLight : null); CL_Light val3 = ((val2 != null) ? ((C_Light)val2).m_clusterLight : null); if ((Object)(object)val == (Object)null || (Object)(object)val3 == (Object)null || !((C_Light)val2).m_isSetup || !val.FlashlightEnabled || val3.m_isOn) { return; } ((C_Light)val2).SetOn(true); if (Time.time - s_lastFixLog > 5f) { s_lastFixLog = Time.time; ManualLogSource l = EntryPoint.L; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(78, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("FLDIAG [autofix] flashlight on but cluster light off -> SetOn(true), now isOn="); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<bool>(val3.m_isOn); } l.LogInfo(val4); } } internal static void Repair() { //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown Dump("repair-before"); PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent(); PlayerInventoryBase val = (((Object)(object)localPlayerAgent != (Object)null) ? localPlayerAgent.Inventory : null); C_LightDynamic val2 = (((Object)(object)val != (Object)null) ? val.m_flashlightCLight : null); if ((Object)(object)val == (Object)null || val2 == null) { EntryPoint.L.LogInfo((object)"FLDIAG [repair] no inventory / CLight"); return; } bool flag = true; bool flag2 = default(bool); try { CL_Light clusterLight = ((C_Light)val2).m_clusterLight; if ((Object)(object)clusterLight != (Object)null && !((Component)clusterLight).gameObject.activeSelf) { ((Component)clusterLight).gameObject.SetActive(true); } if ((Object)(object)clusterLight != (Object)null && !((Behaviour)clusterLight).enabled) { ((Behaviour)clusterLight).enabled = true; } ((C_Light)val2).SetOn(flag); ManualLogSource l = EntryPoint.L; BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(28, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("FLDIAG [repair] SetOn("); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<bool>(flag); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(") done"); } l.LogInfo(val3); } catch (Exception ex) { ManualLogSource l2 = EntryPoint.L; BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(24, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("FLDIAG [repair] failed: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex.Message); } l2.LogWarning(val4); } Dump("repair-after"); } internal static void Dump(string why) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder($"FLDIAG [{why}] t={Clock.Time:F1}"); PlayerAgent localPlayerAgent = PlayerManager.GetLocalPlayerAgent(); if ((Object)(object)localPlayerAgent == (Object)null) { EntryPoint.L.LogInfo((object)stringBuilder.Append(" no local player").ToString()); return; } PlayerInventoryBase inventory = localPlayerAgent.Inventory; StringBuilder stringBuilder2 = stringBuilder; StringBuilder stringBuilder3 = stringBuilder2; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(38, 3, stringBuilder2); handler.AppendLiteral(" | inv FlashlightEnabled="); handler.AppendFormatted(inventory.FlashlightEnabled); handler.AppendLiteral(" Wants="); handler.AppendFormatted(inventory.WantsFlashlightEnabled); handler.AppendLiteral(" slot="); handler.AppendFormatted<InventorySlot>(inventory.WieldedSlot); stringBuilder3.Append(ref handler); Light flashlight = inventory.m_flashlight; if ((Object)(object)flashlight == (Object)null) { stringBuilder.Append(" | Light=null"); } else { stringBuilder2 = stringBuilder; StringBuilder stringBuilder4 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(59, 6, stringBuilder2); handler.AppendLiteral(" | Light enabled="); handler.AppendFormatted(((Behaviour)flashlight).enabled); handler.AppendLiteral(" goActive="); handler.AppendFormatted(((Component)flashlight).gameObject.activeInHierarchy); handler.AppendLiteral(" intensity="); handler.AppendFormatted(flashlight.intensity, "F3"); handler.AppendLiteral(" range="); handler.AppendFormatted(flashlight.range, "F1"); handler.AppendLiteral(" angle="); handler.AppendFormatted(flashlight.spotAngle, "F1"); handler.AppendLiteral(" color="); handler.AppendFormatted<Color>(flashlight.color); stringBuilder4.Append(ref handler); } C_LightDynamic flashlightCLight = inventory.m_flashlightCLight; if (flashlightCLight == null) { stringBuilder.Append(" | CLight=null"); } else { stringBuilder2 = stringBuilder; StringBuilder stringBuilder5 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(37, 4, stringBuilder2); handler.AppendLiteral(" | CLight setup="); handler.AppendFormatted(((C_Light)flashlightCLight).m_isSetup); handler.AppendLiteral(" fps="); handler.AppendFormatted(flashlightCLight.IsFPSPlayerLight); handler.AppendLiteral(" node="); handler.AppendFormatted((((C_Light)flashlightCLight).m_sourceNode != null) ? "ok" : "NULL"); handler.AppendLiteral(" goActive="); handler.AppendFormatted(((Object)(object)((C_Light)flashlightCLight).gameObject != (Object)null) ? ((C_Light)flashlightCLight).gameObject.activeInHierarchy.ToString() : "?"); stringBuilder5.Append(ref handler); stringBuilder2 = stringBuilder; StringBuilder stringBuilder6 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(16, 1, stringBuilder2); handler.AppendLiteral(" sameUnityLight="); handler.AppendFormatted((Object)(object)((C_Light)flashlightCLight).m_unityLight != (Object)null && (Object)(object)flashlight != (Object)null && ((Il2CppObjectBase)((C_Light)flashlightCLight).m_unityLight).Pointer == ((Il2CppObjectBase)flashlight).Pointer); stringBuilder6.Append(ref handler); CL_Light clusterLight = ((C_Light)flashlightCLight).m_clusterLight; if ((Object)(object)clusterLight == (Object)null) { stringBuilder.Append(" | CL=NULL"); } else { stringBuilder2 = stringBuilder; StringBuilder stringBuilder7 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(58, 6, stringBuilder2); handler.AppendLiteral(" | CL isOn="); handler.AppendFormatted(clusterLight.m_isOn); handler.AppendLiteral(" active="); handler.AppendFormatted(clusterLight.IsActive); handler.AppendLiteral(" id="); handler.AppendFormatted(clusterLight.ActiveID); handler.AppendLiteral(" enabled="); handler.AppendFormatted(((Behaviour)clusterLight).enabled); handler.AppendLiteral(" goActive="); handler.AppendFormatted(((Component)clusterLight).gameObject.activeInHierarchy); handler.AppendLiteral(" sameUnityLight="); handler.AppendFormatted((Object)(object)clusterLight.UnityLight != (Object)null && (Object)(object)flashlight != (Object)null && ((Il2CppObjectBase)clusterLight.UnityLight).Pointer == ((Il2CppObjectBase)flashlight).Pointer); stringBuilder7.Append(ref handler); } } object obj = s_instance?.GetValue(null); if (s_handlerType == null) { stringBuilder.Append(" | EMP handler type missing"); } else if (obj == null) { stringBuilder.Append(" | EMP handler=null"); } else { stringBuilder2 = stringBuilder; StringBuilder stringBuilder8 = stringBuilder2; handler = new StringBuilder.AppendInterpolatedStringHandler(43, 4, stringBuilder2); handler.AppendLiteral(" | EMP emped="); handler.AppendFormatted<object>(s_isEMPed?.Invoke(obj, null)); handler.AppendLiteral(" state="); handler.AppendFormatted<object>(s_state?.GetValue(obj)); handler.AppendLiteral(" origIntensity="); handler.AppendFormatted<object>(s_origIntensity?.GetValue(obj)); handler.AppendLiteral(" origOn="); handler.AppendFormatted<object>(s_origState?.GetValue(obj)); stringBuilder8.Append(ref handler); } EntryPoint.L.LogInfo((object)stringBuilder.ToString()); } } [HarmonyPatch] internal static class Patch_DiagHooks { [HarmonyPrefix] [HarmonyPriority(0)] [HarmonyPatch(typeof(PlayerSync), "WantsToSetFlashlightEnabled")] private static void Pre_WantsToSetFlashlightEnabled(PlayerSync __instance, bool enable) { if (!((Object)(object)__instance.m_agent == (Object)null) && ((Agent)__instance.m_agent).IsLocallyOwned) { FlashlightDiag.Dump($"WantsToSetFlashlightEnabled({enable})"); } } } }
BepInEx/plugins/Nadir/Custom/Warren.WorldEventAnimControl.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Diagnostics.Tracing; using System.Globalization; 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.Nodes; using System.Text.Json.Serialization; using System.Threading; using AIG_Voxelation; using AIGraph; using AK; using Agents; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using CellMenu; using ChainedPuzzles; using CullingSystem; using Decals; using EOSExt.SecuritySensor; using Enemies; using ExtraObjectiveSetup.ExtendedWardenEvents; using FloLib.Networks.Replications; using GTFO.API; using GameData; using Gear; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Reflection; using LevelGeneration; using LevelGeneration.Core; using Localization; using Microsoft.CodeAnalysis; using Player; using RootMotion.FinalIK; using SNetwork; using ShaderValueAnimation; using StateMachines; using TMPro; using UnityEngine; using UnityEngine.AI; using UnityEngine.Experimental.AI; using UnityEngine.Rendering; using UnityEngine.Rendering.PostProcessing; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.Video; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Warren.WorldEventAnimControl")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Warren.WorldEventAnimControl")] [assembly: AssemblyTitle("Warren.WorldEventAnimControl")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace WorldEventAnimControl { internal static class AnimationControl { private struct Pose { public Transform T; public Vector3 Pos; public Quaternion Rot; public Vector3 Scale; } private const int MAX_RESULTS = 64; private const int MAX_DEPTH = 8; private static readonly Dictionary<IntPtr, List<Pose>> s_poses = new Dictionary<IntPtr, List<Pose>>(); public static void Stop(WardenObjectiveEventData e) { Apply(e, stop: true); } public static void Start(WardenObjectiveEventData e) { Apply(e, stop: false); } public static void CaptureAll() { //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Expected O, but got Unknown s_poses.Clear(); WorldEventManager current = WorldEventManager.Current; if ((Object)(object)current == (Object)null || current.m_worldEventObjects == null) { return; } int num = 0; Enumerator<LG_WorldEventObject> enumerator = current.m_worldEventObjects.GetEnumerator(); while (enumerator.MoveNext()) { LG_WorldEventObject current2 = enumerator.Current; if ((Object)(object)current2 == (Object)null) { continue; } foreach (LG_WorldEventAnimationTrigger componentsInChild in ((Component)current2).GetComponentsInChildren<LG_WorldEventAnimationTrigger>(true)) { foreach (LG_AnimationSequencer item in Sequencers(componentsInChild)) { num += Capture(item, 0); } } } ManualLogSource l = EntryPoint.L; bool flag = default(bool); BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(37, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Captured initial pose of "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" animator(s)"); } l.LogDebug(val); } public static void Clear() { s_poses.Clear(); } private static void Apply(WardenObjectiveEventData e, bool stop) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Expected O, but got Unknown string worldEventObjectFilter = e.WorldEventObjectFilter; bool flag = default(bool); if (string.IsNullOrEmpty(worldEventObjectFilter)) { ManualLogSource l = EntryPoint.L; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(52, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(stop ? "Stop" : "Start"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("WorldEventAnimation: WorldEventObjectFilter is empty"); } l.LogWarning(val); return; } Il2CppReferenceArray<LG_WorldEventObject> val2 = new Il2CppReferenceArray<LG_WorldEventObject>(64L); int worldEventObjectsNonAlloc = WorldEventManager.GetWorldEventObjectsNonAlloc(worldEventObjectFilter, val2); int num = 0; int num2 = 0; for (int i = 0; i < worldEventObjectsNonAlloc && i < 64; i++) { LG_WorldEventObject val3 = ((Il2CppArrayBase<LG_WorldEventObject>)(object)val2)[i]; if ((Object)(object)val3 == (Object)null) { continue; } num++; foreach (LG_WorldEventAnimationTrigger componentsInChild in ((Component)val3).GetComponentsInChildren<LG_WorldEventAnimationTrigger>(true)) { foreach (LG_AnimationSequencer item in Sequencers(componentsInChild)) { num2 += (stop ? StopSequencer(item, 0) : StartSequencer(item)); } } } ManualLogSource l2 = EntryPoint.L; BepInExDebugLogInterpolatedStringHandler val4 = new BepInExDebugLogInterpolatedStringHandler(48, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(stop ? "Stop" : "Start"); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("WorldEventAnimation '"); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(worldEventObjectFilter); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("': "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" object(s), "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(num2); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" animator(s)"); } l2.LogDebug(val4); } private static int Capture(LG_AnimationSequencer seq, int depth) { //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_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) if ((Object)(object)seq == (Object)null || depth > 8) { return 0; } int num = 0; foreach (LG_AnimationSequencer item in ChildSequencers(seq)) { num += Capture(item, depth + 1); } Animator animator = seq.m_animator; if ((Object)(object)animator == (Object)null || s_poses.ContainsKey(((Il2CppObjectBase)animator).Pointer)) { return num; } List<Pose> list = new List<Pose>(); foreach (Transform componentsInChild in ((Component)animator).GetComponentsInChildren<Transform>(true)) { list.Add(new Pose { T = componentsInChild, Pos = componentsInChild.localPosition, Rot = componentsInChild.localRotation, Scale = componentsInChild.localScale }); } s_poses[((Il2CppObjectBase)animator).Pointer] = list; return num + 1; } private static int StopSequencer(LG_AnimationSequencer seq, int depth) { //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Expected O, but got Unknown //IL_00b7: 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_00dd: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)seq == (Object)null || depth > 8) { return 0; } seq.StopSequence(); int num = 0; foreach (LG_AnimationSequencer item in ChildSequencers(seq)) { num += StopSequencer(item, depth + 1); } Animator animator = seq.m_animator; if ((Object)(object)animator == (Object)null) { return num; } ((Behaviour)animator).enabled = true; animator.Rebind(); animator.Update(0f); if (s_poses.TryGetValue(((Il2CppObjectBase)animator).Pointer, out var value)) { foreach (Pose item2 in value) { if (!((Object)(object)item2.T == (Object)null)) { item2.T.localPosition = item2.Pos; item2.T.localRotation = item2.Rot; item2.T.localScale = item2.Scale; } } } else { ManualLogSource l = EntryPoint.L; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(51, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("No captured pose for animator '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)animator).name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("', stopping in place"); } l.LogWarning(val); } ((Behaviour)animator).enabled = false; return num + 1; } private static int StartSequencer(LG_AnimationSequencer seq) { if ((Object)(object)seq == (Object)null) { return 0; } int result = EnableAnimators(seq, 0); seq.StartSequence(); return result; } private static int EnableAnimators(LG_AnimationSequencer seq, int depth) { if ((Object)(object)seq == (Object)null || depth > 8) { return 0; } int num = 0; foreach (LG_AnimationSequencer item in ChildSequencers(seq)) { num += EnableAnimators(item, depth + 1); } if ((Object)(object)seq.m_animator != (Object)null) { ((Behaviour)seq.m_animator).enabled = true; num++; } return num; } private static IEnumerable<LG_AnimationSequencer> Sequencers(LG_WorldEventAnimationTrigger trigger) { Il2CppReferenceArray<LG_AnimationSequencer> animationsOnTrigger = trigger.m_animationsOnTrigger; if (animationsOnTrigger == null) { yield break; } foreach (LG_AnimationSequencer item in (Il2CppArrayBase<LG_AnimationSequencer>)(object)animationsOnTrigger) { if ((Object)(object)item != (Object)null) { yield return item; } } } private static IEnumerable<LG_AnimationSequencer> ChildSequencers(LG_AnimationSequencer seq) { Il2CppReferenceArray<LG_AnimationSequencerData> sequence = seq.m_sequence; if (sequence == null) { yield break; } foreach (LG_AnimationSequencerData item in (Il2CppArrayBase<LG_AnimationSequencerData>)(object)sequence) { LG_AnimationSequencer val = ((item != null) ? item.AnimationSequence : null); if ((Object)(object)val != (Object)null && ((Il2CppObjectBase)val).Pointer != ((Il2CppObjectBase)seq).Pointer) { yield return val; } } } } internal static class AreaDoorOpen { private class Rule { public uint LevelLayout { get; set; } public List<int> Zones { get; set; } = new List<int>(); public string Mode { get; set; } = "Hide"; } private class Config { public List<Rule> Rules { get; set; } = new List<Rule>(); } private static readonly JsonSerializerOptions s_json = new JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip, AllowTrailingCommas = true, PropertyNameCaseInsensitive = true }; private static readonly List<LG_WeakDoor> s_doors = new List<LG_WeakDoor>(); private static readonly List<Collider> s_buttonCols = new List<Collider>(); private static float s_nextTry; private static readonly List<LG_WeakDoor> s_hidden = new List<LG_WeakDoor>(); private static float s_nextHide; private static int s_rehideLogged; private static readonly List<Renderer> s_hiddenRends = new List<Renderer>(); private static float s_nextRescan; private static readonly List<Renderer> s_frameRends = new List<Renderer>(); private static readonly List<GameObject> s_frameLamps = new List<GameObject>(); private static readonly Dictionary<IntPtr, List<Transform>> s_candByGeo = new Dictionary<IntPtr, List<Transform>>(); private static List<Transform> s_candAll; private static int s_noMesh; private static string ConfigPath => Path.Combine(Path.GetDirectoryName(typeof(AreaDoorOpen).Assembly.Location) ?? "", "WorldEventAnimControl", "AreaDoorOpen.json"); public static void Setup() { //IL_07e6: Unknown result type (might be due to invalid IL or missing references) //IL_07ed: Expected O, but got Unknown //IL_079d: Unknown result type (might be due to invalid IL or missing references) //IL_07a4: Expected O, but got Unknown //IL_031a: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Expected O, but got Unknown //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0386: Unknown result type (might be due to invalid IL or missing references) //IL_05d8: Unknown result type (might be due to invalid IL or missing references) //IL_05df: Expected O, but got Unknown //IL_06c5: Unknown result type (might be due to invalid IL or missing references) //IL_06cc: Expected O, but got Unknown //IL_0702: Unknown result type (might be due to invalid IL or missing references) //IL_0709: Expected O, but got Unknown s_doors.Clear(); s_frameLamps.Clear(); s_candByGeo.Clear(); s_candAll = null; s_buttonCols.Clear(); bool flag = default(bool); try { if (!File.Exists(ConfigPath)) { return; } Config config = JsonSerializer.Deserialize<Config>(File.ReadAllText(ConfigPath), s_json); ExpeditionInTierData activeExpedition = RundownManager.ActiveExpedition; if (config == null || activeExpedition == null) { return; } Dictionary<int, string> dictionary = new Dictionary<int, string>(); foreach (Rule rule in config.Rules) { if (rule.LevelLayout != 0 && rule.LevelLayout != activeExpedition.LevelLayoutData) { continue; } foreach (int zone in rule.Zones) { dictionary[zone] = (string.IsNullOrEmpty(rule.Mode) ? "Hide" : rule.Mode); } } if (dictionary.Count == 0) { return; } Dictionary<IntPtr, int> dictionary2 = new Dictionary<IntPtr, int>(); Enumerator<LG_Zone> enumerator3 = Builder.CurrentFloor.allZones.GetEnumerator(); while (enumerator3.MoveNext()) { LG_Zone current3 = enumerator3.Current; if (((current3 != null) ? current3.m_areas : null) == null) { continue; } Enumerator<LG_Area> enumerator4 = current3.m_areas.GetEnumerator(); while (enumerator4.MoveNext()) { LG_Area current4 = enumerator4.Current; if ((Object)(object)current4 != (Object)null) { dictionary2[((Il2CppObjectBase)current4).Pointer] = current3.Alias; } } } BepInExInfoLogInterpolatedStringHandler val3; foreach (Object item in (Il2CppArrayBase<Object>)(object)Object.FindObjectsOfType(Il2CppType.Of<LG_WeakDoor>())) { LG_WeakDoor val = ((Il2CppObjectBase)item).TryCast<LG_WeakDoor>(); LG_Gate val2 = ((val != null) ? val.Gate : null); if ((Object)(object)val2 == (Object)null) { continue; } int num = -1; if ((Object)(object)((LG_ZoneExpander)val2).m_linksTo != (Object)null && dictionary2.TryGetValue(((Il2CppObjectBase)((LG_ZoneExpander)val2).m_linksTo).Pointer, out var value)) { num = value; } if ((Object)(object)((LG_ZoneExpander)val2).m_linksFrom != (Object)null && dictionary2.TryGetValue(((Il2CppObjectBase)((LG_ZoneExpander)val2).m_linksFrom).Pointer, out var value2)) { num = value2; } if (num < 0 || !dictionary.TryGetValue(num, out var value3) || ((Object)(object)((LG_ZoneExpander)val2).m_linksTo != (Object)null && (Object)(object)((LG_ZoneExpander)val2).m_linksFrom != (Object)null && dictionary2.TryGetValue(((Il2CppObjectBase)((LG_ZoneExpander)val2).m_linksTo).Pointer, out var value4) && dictionary2.TryGetValue(((Il2CppObjectBase)((LG_ZoneExpander)val2).m_linksFrom).Pointer, out var value5) && value4 != value5)) { continue; } StringBuilder stringBuilder = new StringBuilder(); foreach (Transform componentsInChild in ((Component)val).GetComponentsInChildren<Transform>(true)) { if (!((Object)(object)componentsInChild == (Object)(object)((Component)val).transform)) { stringBuilder.Append(((Object)componentsInChild).name).Append(", "); if (stringBuilder.Length > 400) { stringBuilder.Append("..."); break; } } } ManualLogSource l = EntryPoint.L; val3 = new BepInExInfoLogInterpolatedStringHandler(47, 6, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("AREADOOR ZONE "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" weak door '"); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(((Object)val).name); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("' at "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Vector3>(((Component)val).transform.position); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" status "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<eDoorStatus>(val.LastStatus); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" mode "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(value3); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<StringBuilder>(stringBuilder); } l.LogInfo(val3); if (value3.Equals("Hide", StringComparison.OrdinalIgnoreCase)) { string names; int num2 = HideRenderers(val, out names); StringBuilder stringBuilder2 = new StringBuilder(); StringBuilder stringBuilder3 = new StringBuilder(); int num3 = 0; int num4 = 0; foreach (Collider componentsInChild2 in ((Component)val).GetComponentsInChildren<Collider>(true)) { if ((Object)(object)componentsInChild2 == (Object)null) { continue; } bool flag2 = false; Transform val4 = ((Component)componentsInChild2).transform; while ((Object)(object)val4 != (Object)null && (Object)(object)val4 != (Object)(object)((Component)val).transform) { if (((Object)val4).name.IndexOf("crossing", StringComparison.OrdinalIgnoreCase) >= 0) { flag2 = true; break; } val4 = val4.parent; } if (componentsInChild2.isTrigger || flag2) { num4++; if (stringBuilder3.Length < 300) { StringBuilder stringBuilder4 = stringBuilder3; StringBuilder stringBuilder5 = stringBuilder4; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(11, 5, stringBuilder4); handler.AppendFormatted(((Object)componentsInChild2).name); handler.AppendLiteral("("); handler.AppendFormatted(((MemberInfo)((Object)componentsInChild2).GetIl2CppType()).Name); handler.AppendFormatted(componentsInChild2.isTrigger ? ",trigger" : ""); handler.AppendLiteral(",layer "); handler.AppendFormatted(((Component)componentsInChild2).gameObject.layer); handler.AppendLiteral(","); handler.AppendFormatted(componentsInChild2.enabled ? "on" : "off"); handler.AppendLiteral(") "); stringBuilder5.Append(ref handler); } } else { componentsInChild2.enabled = false; num3++; if (stringBuilder2.Length < 300) { StringBuilder stringBuilder4 = stringBuilder2; StringBuilder stringBuilder6 = stringBuilder4; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(9, 2, stringBuilder4); handler.AppendFormatted(((Object)componentsInChild2).name); handler.AppendLiteral("(layer "); handler.AppendFormatted(((Component)componentsInChild2).gameObject.layer); handler.AppendLiteral(") "); stringBuilder6.Append(ref handler); } } } ManualLogSource l2 = EntryPoint.L; val3 = new BepInExInfoLogInterpolatedStringHandler(65, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("AREADOOR colliders: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(num3); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" solid off ["); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<StringBuilder>(stringBuilder2); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("] | "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(num4); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" kept (trigger / crossing) ["); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<StringBuilder>(stringBuilder3); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("]"); } l2.LogInfo(val3); int num5 = 0; foreach (Collider componentsInChild3 in ((Component)val).GetComponentsInChildren<Collider>(true)) { if (!((Object)(object)componentsInChild3 == (Object)null) && ((Object)((Component)componentsInChild3).gameObject).name.StartsWith("LG_DoorButton", StringComparison.OrdinalIgnoreCase)) { componentsInChild3.enabled = false; s_buttonCols.Add(componentsInChild3); num5++; } } ManualLogSource l3 = EntryPoint.L; val3 = new BepInExInfoLogInterpolatedStringHandler(90, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("AREADOOR buttons: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(num5); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" button collider(s) off - the hidden door cannot be closed again by hand"); } l3.LogInfo(val3); ManualLogSource l4 = EntryPoint.L; val3 = new BepInExInfoLogInterpolatedStringHandler(32, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("AREADOOR hide: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(num2); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" renderers off ["); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(names); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("]"); } l4.LogInfo(val3); s_hidden.Add(val); HideFrames(val); } s_doors.Add(val); } s_nextTry = Time.time + 0.5f; ManualLogSource l5 = EntryPoint.L; val3 = new BepInExInfoLogInterpolatedStringHandler(32, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("AREADOOR "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(s_doors.Count); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" door(s) queued to open"); } l5.LogInfo(val3); } catch (Exception ex) { ManualLogSource l6 = EntryPoint.L; BepInExErrorLogInterpolatedStringHandler val5 = new BepInExErrorLogInterpolatedStringHandler(19, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("AREADOOR Setup 실패: "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<Exception>(ex); } l6.LogError(val5); } } private static List<Transform> CandidatesIn(Transform root) { if (s_candByGeo.TryGetValue(((Il2CppObjectBase)root).Pointer, out var value)) { return value; } value = new List<Transform>(); foreach (Transform componentsInChild in ((Component)root).GetComponentsInChildren<Transform>(true)) { if ((Object)(object)componentsInChild != (Object)null && ((Component)componentsInChild).gameObject.activeInHierarchy && IsFrameCandidate(((Object)componentsInChild).name)) { value.Add(componentsInChild); } } s_candByGeo[((Il2CppObjectBase)root).Pointer] = value; return value; } private static bool IsFrameCandidate(string n) { if (!n.StartsWith("env_WeakDoor", StringComparison.OrdinalIgnoreCase)) { return n.StartsWith("generic_light_wallLight", StringComparison.OrdinalIgnoreCase); } return true; } private static List<Transform> CandidatesAll() { if (s_candAll != null) { return s_candAll; } s_candAll = new List<Transform>(); foreach (Object item in (Il2CppArrayBase<Object>)(object)Object.FindObjectsOfType(Il2CppType.Of<Transform>())) { Transform val = ((Il2CppObjectBase)item).TryCast<Transform>(); if ((Object)(object)val != (Object)null && IsFrameCandidate(((Object)val).name)) { s_candAll.Add(val); } } return s_candAll; } private static void HideFrames(LG_WeakDoor door) { //IL_068b: Unknown result type (might be due to invalid IL or missing references) //IL_0692: Expected O, but got Unknown //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_055d: Unknown result type (might be due to invalid IL or missing references) //IL_0564: Expected O, but got Unknown //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_063d: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Expected O, but got Unknown //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Unknown result type (might be due to invalid IL or missing references) //IL_03e7: Unknown result type (might be due to invalid IL or missing references) //IL_03e9: Unknown result type (might be due to invalid IL or missing references) //IL_03ee: 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_0200: 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_0327: Unknown result type (might be due to invalid IL or missing references) //IL_0349: Unknown result type (might be due to invalid IL or missing references) //IL_0368: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Unknown result type (might be due to invalid IL or missing references) bool flag2 = default(bool); try { Stopwatch stopwatch = Stopwatch.StartNew(); List<Transform> pool = new List<Transform>(); HashSet<IntPtr> seenGeo = new HashSet<IntPtr>(); try { LG_Gate gate = door.Gate; object g; if (gate == null) { g = null; } else { LG_Area linksTo = ((LG_ZoneExpander)gate).m_linksTo; g = ((linksTo != null) ? linksTo.m_geomorph : null); } AddGeo((LG_Geomorph)g); object g2; if (gate == null) { g2 = null; } else { LG_Area linksFrom = ((LG_ZoneExpander)gate).m_linksFrom; g2 = ((linksFrom != null) ? linksFrom.m_geomorph : null); } AddGeo((LG_Geomorph)g2); AddGeo(((Component)door).GetComponentInParent<LG_Geomorph>()); } catch { } Vector3 position = ((Component)door).transform.position; bool flag = false; Vector3 val; foreach (Transform item in pool) { if ((Object)(object)item != (Object)null && !item.IsChildOf(((Component)door).transform)) { val = item.position - position; if (((Vector3)(ref val)).sqrMagnitude <= 16f) { flag = true; break; } } } string text = $"타일 {seenGeo.Count}개 안 후보 {pool.Count}개"; if (!flag) { pool = CandidatesAll(); text = $"타일 안에 없어서 레벨 전체에서 찾음 (후보 {pool.Count}개)"; } List<Transform> list = new List<Transform>(); foreach (Transform item2 in pool) { if ((Object)(object)item2 != (Object)null && ((Component)item2).gameObject.activeInHierarchy) { list.Add(item2); } } StringBuilder stringBuilder = new StringBuilder(); Vector3 position2 = ((Component)door).transform.position; int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; StringBuilder stringBuilder2 = new StringBuilder(); foreach (Transform item3 in list) { if ((Object)(object)item3 == (Object)null) { continue; } if (((Object)item3).name.StartsWith("generic_light_wallLight", StringComparison.OrdinalIgnoreCase) && !item3.IsChildOf(((Component)door).transform)) { val = item3.position - position2; if (((Vector3)(ref val)).sqrMagnitude <= 16f) { ((Component)item3).gameObject.SetActive(false); s_frameLamps.Add(((Component)item3).gameObject); num4++; try { if (stringBuilder.Length >= 600) { continue; } stringBuilder.Append(((Object)item3).name); int num5 = 0; Transform parent = item3.parent; while ((Object)(object)parent != (Object)null && num5 < 6) { stringBuilder.Append(" < ").Append(((Object)parent).name); if (((Object)parent).name.StartsWith("geo_", StringComparison.OrdinalIgnoreCase)) { break; } parent = parent.parent; num5++; } Vector3 position3 = item3.position; StringBuilder stringBuilder3 = stringBuilder; StringBuilder.AppendInterpolatedStringHandler handler = new StringBuilder.AppendInterpolatedStringHandler(9, 3, stringBuilder3); handler.AppendLiteral(" @("); handler.AppendFormatted(position3.x, "F1"); handler.AppendLiteral(","); handler.AppendFormatted(position3.y, "F1"); handler.AppendLiteral(","); handler.AppendFormatted(position3.z, "F1"); handler.AppendLiteral(") | "); stringBuilder3.Append(ref handler); } catch { } continue; } } if (!((Object)item3).name.StartsWith("env_WeakDoor", StringComparison.OrdinalIgnoreCase) || item3.IsChildOf(((Component)door).transform)) { continue; } val = item3.position - position2; if (((Vector3)(ref val)).sqrMagnitude > 16f || ((Object)(object)item3.parent != (Object)null && ((Object)item3.parent).name.StartsWith("env_WeakDoor", StringComparison.OrdinalIgnoreCase))) { continue; } num++; if (stringBuilder2.Length < 200) { stringBuilder2.Append(((Object)item3).name).Append(" (").Append(((Object)(object)item3.parent != (Object)null) ? ((Object)item3.parent).name : "-") .Append("), "); } foreach (Renderer componentsInChild in ((Component)item3).GetComponentsInChildren<Renderer>(true)) { if (!((Object)(object)componentsInChild == (Object)null)) { componentsInChild.enabled = false; componentsInChild.forceRenderingOff = true; NoMesh(componentsInChild); s_frameRends.Add(componentsInChild); num2++; } } foreach (Collider componentsInChild2 in ((Component)item3).GetComponentsInChildren<Collider>(true)) { if (!((Object)(object)componentsInChild2 == (Object)null)) { componentsInChild2.enabled = false; num3++; } } } ManualLogSource l = EntryPoint.L; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(95, 8, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("AREADOOR frame: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" object(s) near '"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)door).name); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' hidden ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(num2); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" renderers, "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(num3); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" colliders off) ["); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<StringBuilder>(stringBuilder2); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("], 문에 딸린 벽등 "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(num4); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("개 끔 - "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(", "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<long>(stopwatch.ElapsedMilliseconds); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" ms"); } l.LogInfo(val2); if (num4 > 0) { ManualLogSource l2 = EntryPoint.L; val2 = new BepInExInfoLogInterpolatedStringHandler(18, 2, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("AREADOOR 끈 벽등 ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(((Object)door).name); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("): "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<StringBuilder>(stringBuilder); } l2.LogInfo(val2); } void AddGeo(LG_Geomorph val4) { if ((Object)(object)val4 != (Object)null && seenGeo.Add(((Il2CppObjectBase)val4).Pointer)) { pool.AddRange(CandidatesIn(((Component)val4).transform)); } } } catch (Exception ex) { ManualLogSource l3 = EntryPoint.L; BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(23, 1, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("AREADOOR frame 숨기기 실패: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); } l3.LogError(val3); } } private static void NoMesh(Renderer r) { try { MeshFilter component = ((Component)r).GetComponent<MeshFilter>(); if ((Object)(object)component != (Object)null && (Object)(object)component.sharedMesh != (Object)null) { component.sharedMesh = null; s_noMesh++; } } catch { } } private static void NoShadow(Renderer r) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) try { if ((int)r.shadowCastingMode != 0) { r.shadowCastingMode = (ShadowCastingMode)0; } } catch { } } private static int HideDrawnObjects(LG_WeakDoor door) { int num = 0; foreach (Renderer componentsInChild in ((Component)door).GetComponentsInChildren<Renderer>(true)) { try { if ((Object)(object)componentsInChild == (Object)null) { continue; } GameObject gameObject = ((Component)componentsInChild).gameObject; if ((Object)(object)gameObject == (Object)(object)((Component)door).gameObject || !gameObject.activeSelf || gameObject.GetComponentsInChildren<Collider>(true).Length > 0) { continue; } bool flag = true; foreach (Component component in gameObject.GetComponents<Component>()) { if (!((Object)(object)component == (Object)null) && !((Object)(object)((Il2CppObjectBase)component).TryCast<Transform>() != (Object)null) && !((Object)(object)((Il2CppObjectBase)component).TryCast<Renderer>() != (Object)null) && !((Object)(object)((Il2CppObjectBase)component).TryCast<MeshFilter>() != (Object)null)) { flag = false; break; } } if (!flag) { continue; } bool flag2 = true; foreach (Component componentsInChild2 in gameObject.GetComponentsInChildren<Component>(true)) { if (!((Object)(object)componentsInChild2 == (Object)null) && !((Object)(object)componentsInChild2.gameObject == (Object)(object)gameObject) && !((Object)(object)((Il2CppObjectBase)componentsInChild2).TryCast<Transform>() != (Object)null) && !((Object)(object)((Il2CppObjectBase)componentsInChild2).TryCast<Renderer>() != (Object)null) && !((Object)(object)((Il2CppObjectBase)componentsInChild2).TryCast<MeshFilter>() != (Object)null)) { flag2 = false; break; } } if (flag2) { gameObject.SetActive(false); s_frameLamps.Add(gameObject); num++; } } catch { } } return num; } private static int HideRenderers(LG_WeakDoor door, out string names) { int num = 0; StringBuilder stringBuilder = new StringBuilder(); foreach (Renderer componentsInChild in ((Component)door).GetComponentsInChildren<Renderer>(true)) { if (!((Object)(object)componentsInChild == (Object)null)) { componentsInChild.enabled = false; componentsInChild.forceRenderingOff = true; num++; NoMesh(componentsInChild); if (stringBuilder.Length < 300) { stringBuilder.Append(((Object)componentsInChild).name).Append(", "); } } } names = stringBuilder.ToString(); return num; } public static void Tick() { //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Expected O, but got Unknown //IL_03ab: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Expected O, but got Unknown //IL_02ed: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: 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_02f8: Invalid comparison between Unknown and I4 //IL_031c: Unknown result type (might be due to invalid IL or missing references) //IL_0323: Expected O, but got Unknown //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_02fe: Invalid comparison between Unknown and I4 //IL_034f: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Invalid comparison between Unknown and I4 //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Expected O, but got Unknown bool flag = default(bool); if (s_hidden.Count > 0 && Time.time >= s_nextHide) { s_nextHide = 0f; try { int num = 0; if (s_hiddenRends.Count == 0 || Time.time >= s_nextRescan) { s_nextRescan = Time.time + 30f; s_hiddenRends.Clear(); foreach (LG_WeakDoor item in s_hidden) { if ((Object)(object)item == (Object)null) { continue; } foreach (Renderer componentsInChild in ((Component)item).GetComponentsInChildren<Renderer>(true)) { if ((Object)(object)componentsInChild != (Object)null) { s_hiddenRends.Add(componentsInChild); } } } s_hiddenRends.AddRange(s_frameRends); } for (int i = 0; i < s_hiddenRends.Count; i++) { Renderer val = s_hiddenRends[i]; if (!((Object)(object)val == (Object)null) && (val.enabled || !val.forceRenderingOff)) { val.enabled = false; val.forceRenderingOff = true; NoMesh(val); num++; } } for (int j = 0; j < s_frameLamps.Count; j++) { GameObject val2 = s_frameLamps[j]; if ((Object)(object)val2 != (Object)null && val2.activeSelf) { val2.SetActive(false); num++; } } for (int k = 0; k < s_buttonCols.Count; k++) { Collider val3 = s_buttonCols[k]; if ((Object)(object)val3 != (Object)null && val3.enabled) { val3.enabled = false; num++; } } if (num > 0 && s_rehideLogged++ < 5) { ManualLogSource l = EntryPoint.L; BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(53, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("AREADOOR re-hid "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" renderer(s) / lamp(s) that came back"); } l.LogInfo(val4); } } catch (Exception ex) { ManualLogSource l2 = EntryPoint.L; BepInExErrorLogInterpolatedStringHandler val5 = new BepInExErrorLogInterpolatedStringHandler(21, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("AREADOOR re-hide 실패: "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(ex.Message); } l2.LogError(val5); s_hidden.Clear(); } } if (s_doors.Count == 0 || Time.time < s_nextTry) { return; } s_nextTry = Time.time + 0.5f; if (!SNet.IsMaster) { if (Time.time > 60f) { s_doors.Clear(); } return; } try { for (int num2 = s_doors.Count - 1; num2 >= 0; num2--) { LG_WeakDoor val6 = s_doors[num2]; if ((Object)(object)val6 == (Object)null) { s_doors.RemoveAt(num2); } else { eDoorStatus lastStatus = val6.LastStatus; if ((int)lastStatus == 10 || (int)lastStatus == 16 || (int)lastStatus == 11) { s_doors.RemoveAt(num2); ManualLogSource l3 = EntryPoint.L; BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(16, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("AREADOOR '"); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(((Object)val6).name); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("' now "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<eDoorStatus>(lastStatus); } l3.LogInfo(val4); } else if (val6.m_sync != null) { val6.m_sync.AttemptDoorInteraction((eDoorInteractionType)0, 0f, 0f, Vector3.zero, (Agent)null); } else { val6.AttemptOpenCloseInteraction(true); } } } } catch (Exception ex2) { ManualLogSource l4 = EntryPoint.L; BepInExErrorLogInterpolatedStringHandler val5 = new BepInExErrorLogInterpolatedStringHandler(18, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("AREADOOR Tick 실패: "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(ex2.Message); } l4.LogError(val5); s_doors.Clear(); } } public static void Clear() { s_doors.Clear(); s_hidden.Clear(); s_hiddenRends.Clear(); s_frameRends.Clear(); s_nextRescan = 0f; s_rehideLogged = 0; s_candByGeo.Clear(); s_candAll = null; s_buttonCols.Clear(); } } internal class AreaDoorOpenTicker : MonoBehaviour { public AreaDoorOpenTicker(IntPtr ptr) : base(ptr) { } private void Update() { long t = Prof.Now(); AreaDoorOpen.Tick(); Prof.Add("AreaDoorOpen", t); } } [HarmonyPatch(typeof(LG_Area), "Setup")] internal static class AreaGraphSourceFix { [HarmonyPrefix] private static void Prefix(LG_Area __instance) { //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Expected O, but got Unknown //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_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_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) bool flag = default(bool); try { if (!((Object)(object)__instance == (Object)null) && !((Object)(object)((Component)__instance).GetComponentInChildren<LG_AreaAIGraphSource>(true) != (Object)null)) { Vector3 val = EstimateFloorCenter(((Component)__instance).transform); GameObject val2 = new GameObject("AIGraphSource (auto)"); val2.transform.SetParent(((Component)__instance).transform, false); val2.transform.position = val; val2.AddComponent<LG_AreaAIGraphSource>(); LG_Geomorph componentInParent = ((Component)__instance).GetComponentInParent<LG_Geomorph>(); string text = ((componentInParent != null) ? ((Object)componentInParent).name : null) ?? "?"; ManualLogSource l = EntryPoint.L; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(55, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("AreaGraphSourceFix: '"); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("/"); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(((Object)__instance).name); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("' 에 AIGraphSource 가 없어서 추가함 (위치 "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Vector3>(val); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(")"); } l.LogWarning(val3); } } catch (Exception ex) { ManualLogSource l2 = EntryPoint.L; BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(23, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("AreaGraphSourceFix 실패: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex.Message); } l2.LogError(val4); } } private static Vector3 EstimateFloorCenter(Transform area) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_008c: Unknown result type (might be due to invalid IL or missing references) Vector3 val = Vector3.zero; Vector3 val2 = Vector3.zero; int num = 0; int num2 = 0; foreach (Transform componentsInChild in ((Component)area).GetComponentsInChildren<Transform>(true)) { if (!((Object)(object)componentsInChild == (Object)(object)area)) { val2 += componentsInChild.position; num2++; if (((Object)componentsInChild).name.IndexOf("Floor", StringComparison.OrdinalIgnoreCase) >= 0) { val += componentsInChild.position; num++; } } } return ((num > 0) ? (val / (float)num) : ((num2 > 0) ? (val2 / (float)num2) : area.position)) + Vector3.up * 0.5f; } } internal static class AreaIntel { private class V3 { public float x { get; set; } public float y { get; set; } public float z { get; set; } public Vector3 V => new Vector3(x, y, z); } private class LineDef { public float Delay { get; set; } public string Text { get; set; } = ""; } private class MarkerDef { public V3 Pos { get; set; } = new V3(); public string Title { get; set; } = ""; public float Delay { get; set; } public List<float> Color { get; set; } = new List<float>(); public bool DropOnEnding { get; set; } = true; public int Style { get; set; } = -1; public string DropOn { get; set; } = ""; } private class SubObjDef { public float Delay { get; set; } public JsonElement Header { get; set; } public JsonElement Text { get; set; } } private class TrigDef { public string Name { get; set; } = ""; public int Zone { get; set; } = -1; public string Area { get; set; } = ""; public V3 Center { get; set; } public V3 Half { get; set; } public List<LineDef> Lines { get; set; } = new List<LineDef>(); public MarkerDef Marker { get; set; } public SubObjDef SubObjective { get; set; } } private class Config { public bool Enabled { get; set; } = true; public uint LevelLayout { get; set; } public List<TrigDef> Triggers { get; set; } = new List<TrigDef>(); } private class Live { public NavMarker M; public GameObject Go; public bool DropOnEnding; public string DropOn = ""; } private static readonly JsonSerializerOptions s_json = new JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip, AllowTrailingCommas = true, PropertyNameCaseInsensitive = true }; private static Config s_cfg; private static bool[] s_fired; private static int s_left; private static float s_next; private static readonly List<(float T, MarkerDef D)> s_markerLater = new List<(float, MarkerDef)>(); private static readonly List<Live> s_live = new List<Live>(); private static string ConfigPath => Path.Combine(Path.GetDirectoryName(typeof(AreaIntel).Assembly.Location) ?? "", "WorldEventAnimControl", "AreaIntel.json"); public static void Setup() { //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Expected O, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown Clear(); bool flag = default(bool); try { if (!File.Exists(ConfigPath)) { return; } Config config = JsonSerializer.Deserialize<Config>(File.ReadAllText(ConfigPath), s_json); ExpeditionInTierData activeExpedition = RundownManager.ActiveExpedition; if (config == null || !config.Enabled || config.Triggers.Count == 0 || activeExpedition == null || (config.LevelLayout != 0 && config.LevelLayout != activeExpedition.LevelLayoutData)) { return; } s_cfg = config; s_fired = new bool[config.Triggers.Count]; s_left = config.Triggers.Count; for (int i = 0; i < config.Triggers.Count; i++) { TrigDef trigDef = config.Triggers[i]; if (trigDef.Zone < 0 && trigDef.Area.Length == 0 && (trigDef.Center == null || trigDef.Half == null)) { s_fired[i] = true; s_left--; ManualLogSource l = EntryPoint.L; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(30, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("AREAINTEL '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(trigDef.Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("': 구역도 상자도 없음 - 안 씀"); } l.LogWarning(val); } } ManualLogSource l2 = EntryPoint.L; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(21, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("AREAINTEL 준비: 진입 인텔 "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(s_left); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("개"); } l2.LogInfo(val2); } catch (Exception ex) { ManualLogSource l3 = EntryPoint.L; BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(20, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("AREAINTEL 설정 읽기 실패: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); } l3.LogError(val3); s_cfg = null; } } public static void Clear() { DropMarkers("cleanup"); s_cfg = null; s_fired = null; s_left = 0; } internal static void Show(string text, float delay = 0f) { //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected O, but got Unknown //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown if (string.IsNullOrEmpty(text)) { return; } try { WardenObjectiveEventData val = new WardenObjectiveEventData(); val.Type = (eWardenObjectiveEventType)0; val.Trigger = (eWardenObjectiveEventTrigger)0; val.Delay = Mathf.Max(0f, delay); val.WardenIntel = Loc.Make(text); List<WardenObjectiveEventData> obj = new List<WardenObjectiveEventData>(); obj.Add(val); WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(obj, (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); } catch (Exception ex) { ManualLogSource l = EntryPoint.L; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(20, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("AREAINTEL 인텔 표시 실패: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } l.LogWarning(val2); } } internal static LocalizedText MakeText(JsonElement v, out string shown) { //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown LocalizedText val = Loc.NewText(); shown = ""; try { if (v.ValueKind == JsonValueKind.Number) { val.Id = v.GetUInt32(); shown = $"#{val.Id} " + ((val.Id != 0) ? Text.Get(val.Id) : ""); } else if (v.ValueKind == JsonValueKind.String) { string text = v.GetString() ?? ""; if (Loc.TryId(text, out var id)) { val.Id = id; shown = $"#{id} " + Text.Get(id); } else { val.UntranslatedText = text; shown = text; } } } catch (Exception ex) { ManualLogSource l = EntryPoint.L; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(25, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("AREAINTEL 진행 줄 글자 읽기 실패: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } l.LogWarning(val2); } return val; } internal static void SetSubObjective(JsonElement header, JsonElement text, float delay = 0f) { //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Expected O, but got Unknown //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown bool flag = default(bool); try { string shown; LocalizedText val = MakeText(header, out shown); string shown2; LocalizedText val2 = MakeText(text, out shown2); if (val.Id != 0 || !string.IsNullOrEmpty(val.UntranslatedText) || val2.Id != 0 || !string.IsNullOrEmpty(val2.UntranslatedText)) { WardenObjectiveEventData val3 = new WardenObjectiveEventData(); val3.Type = (eWardenObjectiveEventType)11; val3.Trigger = (eWardenObjectiveEventTrigger)0; val3.Delay = Mathf.Max(0f, delay); val3.Layer = (LG_LayerType)0; val3.CustomSubObjectiveHeader = val; val3.CustomSubObjective = val2; List<WardenObjectiveEventData> obj = new List<WardenObjectiveEventData>(); obj.Add(val3); WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(obj, (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); ManualLogSource l = EntryPoint.L; BepInExInfoLogInterpolatedStringHandler val4 = new BepInExInfoLogInterpolatedStringHandler(23, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("AREAINTEL 진행 줄 "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<float>(delay, "0.#"); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("초 뒤: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(shown.Replace('\n', '/')); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" | "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(shown2.Replace('\n', '/')); } l.LogInfo(val4); } } catch (Exception ex) { ManualLogSource l2 = EntryPoint.L; BepInExWarningLogInterpolatedStringHandler val5 = new BepInExWarningLogInterpolatedStringHandler(19, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("AREAINTEL 진행 줄 실패: "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(ex.Message); } l2.LogWarning(val5); } } private static bool Inside(PlayerAgent p, TrigDef t) { //IL_0011: 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_0026: 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_003f: 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_00cc: Unknown result type (might be due to invalid IL or missing references) if (t.Center != null && t.Half != null) { Vector3 val = ((Agent)p).Position - t.Center.V; if (Mathf.Abs(val.x) > t.Half.x || Mathf.Abs(val.y) > t.Half.y || Mathf.Abs(val.z) > t.Half.z) { return false; } } if (t.Zone >= 0 || t.Area.Length > 0) { AIG_CourseNode courseNode = ((Agent)p).CourseNode; if (courseNode == null) { return false; } if (t.Zone >= 0) { LG_Zone zone = courseNode.m_zone; if ((Object)(object)zone == (Object)null || zone.Alias != t.Zone || zone.Layer == null || (int)zone.Layer.m_type != 0) { return false; } } if (t.Area.Length > 0 && ((Object)(object)courseNode.m_area == (Object)null || !((Object)((Component)courseNode.m_area).gameObject).name.Contains(t.Area))) { return false; } } return true; } internal static void Tick() { //IL_032e: Unknown result type (might be due to invalid IL or missing references) //IL_0335: Expected O, but got Unknown //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Expected O, but got Unknown //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) if (s_cfg == null) { return; } bool flag = default(bool); try { for (int num = s_markerLater.Count - 1; num >= 0; num--) { if (Time.time >= s_markerLater[num].T) { MarkerDef item = s_markerLater[num].D; s_markerLater.RemoveAt(num); MakeMarker(item); } } if (s_left <= 0 || Time.time < s_next) { return; } s_next = Time.time + 0.25f; List<PlayerAgent> playerAgentsInLevel = PlayerManager.PlayerAgentsInLevel; if (playerAgentsInLevel == null) { return; } for (int i = 0; i < s_cfg.Triggers.Count; i++) { if (s_fired[i]) { continue; } TrigDef trigDef = s_cfg.Triggers[i]; for (int j = 0; j < playerAgentsInLevel.Count; j++) { PlayerAgent val = playerAgentsInLevel[j]; if ((Object)(object)val == (Object)null || (Object)(object)val.Owner == (Object)null || val.Owner.IsBot || !((Agent)val).Alive || !Inside(val, trigDef)) { continue; } s_fired[i] = true; s_left--; Vector3 position = ((Agent)val).Position; ManualLogSource l = EntryPoint.L; BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(31, 8, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("AREAINTEL '"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(trigDef.Name); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("': '"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(val.PlayerName); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' 진입 ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(position.x, "F1"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(position.y, "F1"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<float>(position.z, "F1"); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") - 인텔 "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(trigDef.Lines?.Count ?? 0); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("줄"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>((trigDef.Marker != null) ? ", 내비 마커" : ""); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>((trigDef.SubObjective != null) ? ", 진행 줄" : ""); } l.LogInfo(val2); if (trigDef.Lines != null) { foreach (LineDef line in trigDef.Lines) { Show(line.Text, line.Delay); } } if (trigDef.SubObjective != null) { SetSubObjective(trigDef.SubObjective.Header, trigDef.SubObjective.Text, trigDef.SubObjective.Delay); } if (trigDef.Marker != null) { s_markerLater.Add((Time.time + Mathf.Max(0f, trigDef.Marker.Delay), trigDef.Marker)); } break; } } } catch (Exception ex) { ManualLogSource l2 = EntryPoint.L; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(17, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("AREAINTEL 갱신 실패: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); } l2.LogWarning(val3); } } private static void MakeMarker(MarkerDef d) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Expected O, but got Unknown //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0169: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Expected O, but got Unknown bool flag = default(bool); try { GameObject val = new GameObject("WarrenAreaIntelMarker"); val.transform.position = d.Pos.V; string text = Loc.T(d.Title ?? ""); NavMarker val2; if (d.Style >= 0) { val2 = GuiManager.NavMarkerLayer.PlaceCustomMarker((NavMarkerOption)d.Style, val, text, 0f, false); } else { val2 = GuiManager.NavMarkerLayer.PrepareGenericMarker(val); if ((Object)(object)val2 != (Object)null) { val2.SetStyle((eNavMarkerStyle)6); val2.SetTitle(text); } } if ((Object)(object)val2 == (Object)null) { Object.Destroy((Object)(object)val); EntryPoint.L.LogWarning((object)"AREAINTEL 내비 마커 생성 실패"); return; } Color color = ((d.Color != null && d.Color.Count >= 3) ? new Color(d.Color[0], d.Color[1], d.Color[2], 1f) : new Color(1f, 0.82f, 0.2f, 1f)); val2.SetColor(color); val2.SetPinEnabled(true); val2.SetAlpha(1f); val2.SetVisible(true); s_live.Add(new Live { M = val2, Go = val, DropOnEnding = d.DropOnEnding, DropOn = (d.DropOn ?? "") }); ManualLogSource l = EntryPoint.L; BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(23, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("AREAINTEL 내비 마커 ("); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(d.Pos.x, "F1"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(d.Pos.y, "F1"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<float>(d.Pos.z, "F1"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(") '"); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(d.Title); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("'"); } l.LogInfo(val3); } catch (Exception ex) { ManualLogSource l2 = EntryPoint.L; BepInExWarningLogInterpolatedStringHandler val4 = new BepInExWarningLogInterpolatedStringHandler(20, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("AREAINTEL 내비 마커 실패: "); ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex.Message); } l2.LogWarning(val4); } } internal static void DropMarkers(string why) { //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Expected O, but got Unknown bool ending = why == "ending"; int num = 0; bool named = !ending && s_cfg != null && s_cfg.Triggers.Exists((TrigDef t) => t.Marker != null && t.Marker.DropOn == why); if (!ending && !named && why != "cleanup") { return; } for (int num2 = s_markerLater.Count - 1; num2 >= 0; num2--) { if (Hit(s_markerLater[num2].D.DropOnEnding, s_markerLater[num2].D.DropOn ?? "")) { s_markerLater.RemoveAt(num2); } } for (int num3 = s_live.Count - 1; num3 >= 0; num3--) { Live live = s_live[num3]; if (Hit(live.DropOnEnding, live.DropOn)) { try { if ((Object)(object)live.M != (Object)null) { live.M.SetVisible(false); GuiManager.NavMarkerLayer.RemoveMarker(live.M); } } catch { } try { if ((Object)(object)live.Go != (Object)null) { Object.Destroy((Object)(object)live.Go); } } catch { } s_live.RemoveAt(num3); num++; } } if (num > 0) { ManualLogSource l = EntryPoint.L; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(23, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("AREAINTEL 내비 마커 "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("개 지움 ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(why); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")"); } l.LogInfo(val); } bool Hit(bool dropOnEnding, string dropOn) { if (!ending) { if (!named) { return true; } return dropOn == why; } return dropOnEnding; } } } internal class AreaIntelTicker : MonoBehaviour { public AreaIntelTicker(IntPtr ptr) : base(ptr) { } private void Update() { long t = Prof.Now(); AreaIntel.Tick(); Prof.Add("AreaIntel", t); } } [HarmonyPatch(typeof(LG_Geomorph), "ScanChildrenAreas")] internal static class AreaMerge { private class Config { public List<string> Geomorphs { get; set; } = new List<string>(); } private static readonly JsonSerializerOptions s_json = new JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip, AllowTrailingCommas = true, PropertyNameCaseInsensitive = true }; private static List<string> s_geomorphs = new List<string>(); private static string ConfigPath => Path.Combine(Path.GetDirectoryName(typeof(AreaMerge).Assembly.Location) ?? "", "WorldEventAnimControl", "AreaMerge.json"); public static void Reload() { //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected O, but got Unknown bool flag = default(bool); try { s_geomorphs = ((!File.Exists(ConfigPath)) ? new List<string>() : (JsonSerializer.Deserialize<Config>(File.ReadAllText(ConfigPath), s_json)?.Geomorphs ?? new List<string>())); ManualLogSource l = EntryPoint.L; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(23, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("AreaMerge: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(s_geomorphs.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" geomorph(s)"); } l.LogInfo(val); } catch (Exception ex) { s_geomorphs = new List<string>(); ManualLogSource l2 = EntryPoint.L; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(24, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("AreaMerge: 설정 읽기 실패 ("); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ConfigPath); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("): "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } l2.LogError(val2); } } [HarmonyPrefix] private static void Prefix(LG_Geomorph __instance) { //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Expected O, but got Unknown //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Expected O, but got Unknown if ((Object)(object)__instance == (Object)null || s_geomorphs.Count == 0) { return; } string text = ((Object)__instance).name.Replace("(Clone)", "").Trim(); if (!s_geomorphs.Contains(text)) { return; } bool flag = default(bool); try { Il2CppArrayBase<LG_Area> componentsInChildren = ((Component)__instance).GetComponentsInChildren<LG_Area>(true); if (componentsInChildren.Length < 2) { return; } LG_Area val = null; foreach (LG_Area item in componentsInChildren) { if (((Object)item).name == "Area A") { val = item; break; } } if (val == null) { val = componentsInChildren[0]; } int num = 0; foreach (LG_Area item2 in componentsInChildren) { if ((Object)(object)item2 == (Object)(object)val) { continue; } Transform transform = ((Component)item2).transform; List<Transform> list = new List<Transform>(); for (int i = 0; i < transform.childCount; i++) { list.Add(transform.GetChild(i)); } foreach (Transform item3 in list) { item3.SetParent(((Component)val).transform, true); num++; } Object.DestroyImmediate((Object)(object)item2); } int num2 = 0; foreach (LG_InternalGate componentsInChild in ((Component)__instance).GetComponentsInChildren<LG_InternalGate>(true)) { Object.DestroyImmediate((Object)(object)componentsInChild); num2++; } ManualLogSource l = EntryPoint.L; BepInExWarningLogInterpolatedStringHandler val2 = new BepInExWarningLogInterpolatedStringHandler(54, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("AreaMerge: '"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("' Area "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(componentsInChildren.Length); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("개 → 1개로 합침 (오브젝트 "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(num); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("개 이동, 내부 게이트 "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(num2); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("개 제거)"); } l.LogWarning(val2); } catch (Exception ex) { ManualLogSource l2 = EntryPoint.L; BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(17, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("AreaMerge '"); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("' 실패: "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(ex.Message); } l2.LogError(val3); } } } [HarmonyPatch] internal static class AreaNoResources { private class Rule { public uint LevelLayout { get; set; } public int Zone { get; set; } public List<string> ExcludeAreas { get; set; } = new List<string>(); public bool Pickups { get; set; } = true; public Dictionary<string, int> MaxContainers { get; set; } = new Dictionary<string, int>(); public List<string> OverflowTo { get; set; } = new List<string>(); public List<string> DisinfectionOnlyIn { get; set; } = new List<string>(); public Dictionary<string, float[]> KeepPacks { get; set; } = new Dictionary<string, float[]>(); public bool KeepWholePacks { get; set; } } private class NoMarker { public uint LevelLayout { get; set; } public float[] Pos { get; set; } public float Radius { get; set; } = 1.2f; public string Note { get; set; } = ""; } private class Config { public List<Rule> Rules { get; set; } = new List<Rule>(); public List<NoMarker> NoMarkers { get; set; } = new List<NoMarker>(); } private static List<NoMarker> s_noMarkers; private static readonly JsonSerializerOptions s_json = new JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip, AllowTrailingCommas = true, PropertyNameCaseInsensitive = true }; private static List<Rule> s_rules; private static readonly HashSet<string> s_logged = new HashSet<string>(); private static readonly HashSet<IntPtr> s_keepDone = new HashSet<IntPtr>(); private static string ConfigPath => Path.Combine(Path.GetDirectoryName(typeof(AreaNoResources).Assembly.Location) ?? "", "WorldEventAnimControl", "AreaNoResources.json"); private static List<NoMarker> NoMarkers() { //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Expected O, but got Unknown if (s_noMarkers != null) { return s_noMarkers; } s_noMarkers = new List<NoMarker>(); try { ExpeditionInTierData activeExpedition = RundownManager.ActiveExpedition; uint num = ((activeExpedition != null) ? activeExpedition.LevelLayoutData : 0u); if (!File.Exists(ConfigPath)) { return s_noMarkers; } Config config = JsonSerializer.Deserialize<Config>(File.ReadAllText(ConfigPath), s_json); if (config?.NoMarkers != null) { foreach (NoMarker noMarker in config.NoMarkers) { if (noMarker != null && noMarker.Pos != null && noMarker.Pos.Length >= 3 && (noMarker.LevelLayout == 0 || noMarker.LevelLayout == num)) { s_noMarkers.Add(noMarker); } } } } catch (Exception ex) { ManualLogSource l = EntryPoint.L; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(27, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("AREANORES NoMarkers 읽기 실패: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } l.LogError(val); } return s_noMarkers; } private static void RemoveNoMarkers(LG_Zone zone) { //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a2: Expected O, but got Unknown //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Expected O, but got Unknown //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0229: 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_036d: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0185: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) List<NoMarker> list = NoMarkers(); if (list.Count == 0 || (Object)(object)zone == (Object)null || zone.m_areas == null) { return; } Enumerator<LG_Area> enumerator = zone.m_areas.GetEnumerator(); Vector3 val4 = default(Vector3); bool flag = default(bool); while (enumerator.MoveNext()) { LG_Area current = enumerator.Current; if ((Object)(object)current == (Object)null || current.m_markerSpawnerGroups == null) { continue; } List<(LG_MarkerSpawner, NoMarker, Vector3, float)> list2 = new List<(LG_MarkerSpawner, NoMarker, Vector3, float)>(); HashSet<IntPtr> hashSet = new HashSet<IntPtr>(); foreach (LG_MarkerSpawnerGroup item5 in (Il2CppArrayBase<LG_MarkerSpawnerGroup>)(object)current.m_markerSpawnerGroups) { List<LG_MarkerSpawner> val = ((item5 != null) ? item5.m_spawners : null); if (val == null) { continue; } for (int i = 0; i < val.Count; i++) { LG_MarkerSpawner val2 = val[i]; if (val2 == null || !hashSet.Add(((Il2CppObjectBase)val2).Pointer)) { continue; } Vector3 val3; try { if ((Object)(object)val2.m_producerSource != (Object)null) { val3 = ((Component)val2.m_producerSource).transform.position; goto IL_0114; } if ((Object)(object)val2.m_parent != (Object)null) { val3 = val2.m_parent.transform.TransformPoint(val2.m_localPosition); goto IL_0114; } } catch { } continue; IL_0114: foreach (NoMarker item6 in list) { ((Vector3)(ref val4))..ctor(item6.Pos[0], item6.Pos[1], item6.Pos[2]); Vector2 val5 = new Vector2(val3.x - val4.x, val3.z - val4.z); float magnitude = ((Vector2)(ref val5)).magnitude; if (!(magnitude > item6.Radius) && !(Mathf.Abs(val3.y - val4.y) > 2f)) { list2.Add((val2, item6, val3, magnitude)); break; } } } } foreach (var item7 in list2) { LG_MarkerSpawner item = item7.Item1; NoMarker item2 = item7.Item2; Vector3 item3 = item7.Item3; float item4 = item7.Item4; string text = "?"; try { text = (((Object)(object)item.m_producerSource != (Object)null) ? ((Object)((Component)item.m_producerSource).gameObject).name : (((Object)(object)item.m_parent != (Object)null) ? ((Object)item.m_parent).name : "?")); } catch { } try { current.RemoveMarkerSpawner(item); } catch (Exception ex) { ManualLogSource l = EntryPoint.L; BepInExWarningLogInterpolatedStringHandler val6 = new BepInExWarningLogInterpolatedStringHandler(24, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("AREANORES 마커 비우기 실패 '"); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val6).AppendLiteral("': "); ((BepInExLogInterpolatedStringHandler)val6).AppendFormatted<string>(ex.Message); } l.LogWarning(val6); continue; } ManualLogSource l2 = EntryPoint.L; BepInExInfoLogInterpolatedStringHandler val7 = new BepInExInfoLogInterpolatedStringHandler(34, 8, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val7).AppendLiteral("AREANORES 마커 비움: ZONE "); ((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<int>(zone.Alias); ((BepInExLogInterpolatedStringHandler)val7).AppendLiteral(" "); ((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<string>(Letter(current)); ((BepInExLogInterpolatedStringHandler)val7).AppendLiteral(" '"); ((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val7).AppendLiteral("' ("); ((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<float>(item3.x, "F2"); ((BepInExLogInterpolatedStringHandler)val7).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<float>(item3.y, "F2"); ((BepInExLogInterpolatedStringHandler)val7).AppendLiteral(","); ((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<float>(item3.z, "F2"); ((BepInExLogInterpolatedStringHandler)val7).AppendLiteral(") "); ((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<float>(item4, "F2"); ((BepInExLogInterpolatedStringHandler)val7).AppendLiteral(" m"); ((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<string>(string.IsNullOrEmpty(item2.Note) ? "" : (" - " + item2.Note)); } l2.LogInfo(val7); } } } public static void Clear() { s_rules = null; s_noMarkers = null; s_logged.Clear(); s_keepDone.Clear(); } private static List<int> BestSubset(List<float> amounts, float target) { int count = amounts.Count; List<int> list = new List<int>(); float num = 0f; if (count == 0) { return list; } if (count > 16) { List<int> list2 = (from i in Enumerable.Range(0, count) orderby amounts[i] descending select i).ToList(); float num2 = 0f; { foreach (int item in list2) { if (num2 + amounts[item] <= target + 0.001f) { num2 += amounts[item]; list.Add(item); } } return list; } } int num3 = 0; int num4 = int.MaxValue; for (int num5 = 1; num5 < 1 << count; num5++) { float num6 = 0f; int num7 = 0; for (int num8 = 0; num8 < count; num8++) { if ((num5 & (1 << num8)) != 0) { num6 += amounts[num8]; num7++; } } if (!(num6 > target + 0.001f) && (num6 > num + 0.001f || (Mathf.Abs(num6 - num) <= 0.001f && num7 < num4))) { num = num6; num3 = num5; num4 = num7; } } for (int num9 = 0; num9 < count; num9++) { if ((num3 & (1 << num9)) != 0) { list.Add(num9); } } return list; } private static List<Rule> Rules() { //IL_0104: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Expected O, but got Unknown if (s_rules != null) { return s_rules; } s_rules = new List<Rule>(); bool flag = default(bool); try { ExpeditionInTierData activeExpedition = RundownManager.ActiveExpedition; uint num = ((activeExpedition != null) ? activeExpedition.LevelLayoutData : 0u); if (!File.Exists(ConfigPath)) { return s_rules; } Config config = JsonSerializer.Deserialize<Config>(File.ReadAllText(ConfigPath), s_json); if (config != null) { foreach (Rule rule in config.Rules) { if (rule.LevelLayout == 0 || rule.LevelLayout == num) { s_rules.Add(rule); } } } ManualLogSource l = EntryPoint.L; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(31, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("AREANORES: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(s_rules.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" rule(s) for layout "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(num); } l.LogInfo(val); } catch (Exception ex) { ManualLogSource l2 = EntryPoint.L; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(20, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("AREANORES 설정 읽기 실패: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } l2.LogError(val2); } return s_rules; } private static string Letter(LG_Area area) { if ((Object)(object)area == (Object)null) { return ""; } string name = ((Object)area).name; int num = name.LastIndexOf("Area "); if (num < 0) { num = name.LastIndexOf("Area_"); } if (num >= 0 && num + 5 < name.Length) { return name.Substring(num + 5, 1); } return ""; } private static List<T> Items<T>(Queue<T> q) where T : Il2CppObjectBase { List<T> list = new List<T>(); if (q == null) { return list; } Il2CppArrayBase<T> array = q._array; int size = q._size; int head = q._head; if (array == null) { return list; } int length = array.Length; if (length == 0) { return list; } for (int i = 0; i < size; i++) { T val = array[(head + i) % length]; if (val != null) { list.Add(val); } } return list; } [HarmonyPatch(typeof(LG_PopulateFunctionMarkersInZoneJob), "Build")] [HarmonyPrefix] private static void PreBuild(LG_PopulateFunctionMarkersInZoneJob __instance) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown //IL_0379: Unknown result type (might be due to invalid IL or missing references) //IL_0380: Expected O, but got Unknown //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Expected O, but got Unknown //IL_052f: Unknown result type (might be due to invalid IL or missing references) //IL_0536: Expected O, but got Unknown //IL_1141: Unknown result type (might be due to invalid IL or missing references) //IL_1148: Expected O, but got Unknown //IL_138b: Unknown result type (might be due to invalid IL or missing references) //IL_1392: Expected O, but got Unknown //IL_11ab: Unknown result type (might be due to invalid IL or missing references) //IL_11b2: Expected O, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_072e: Unknown result type (might be due to invalid IL or missing references) //IL_0735: Expected O, but got Unknown //IL_0fd8: Unknown result type (might be due to invalid IL or missing references) //IL_0fdf: Expected O, but got Unknown //IL_0f3a: Unknown result type (might be due to invalid IL or missing references) //IL_0f41: Expected I4, but got Unknown //IL_0832: Unknown result type (might be due to invalid IL or missing references) //IL_0839: Invalid comparison between Unknown and I4 //IL_08b4: Unknown result type (might be due to invalid IL or missing references) //IL_08bb: Invalid comparison between Unknown and I4 //IL_0939: Unknown result type (might be due to invalid IL or missing references) //IL_0940: Invalid comparison between Unknown and I4 //IL_0b2d: Unknown result type (might be due to invalid IL or missing references) //IL_0b34: Expected O, but got Unknown //IL_0b38: Unknown result type (might be due to invalid IL or missing references) //IL_0b46: Unknown result type (might be due to invalid IL or missing references) //IL_0e50: Unknown result type (might be due to invalid IL or missing references) //IL_0e57: Invalid comparison between Unknown and I4 bool flag = default(bool); try { LG_Zone val = ((__instance != null) ? __instance.m_zone : null); try { RemoveNoMarkers(val); } catch (Exception ex) { if (s_logged.Add("nomark")) { ManualLogSource l = EntryPoint.L; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(21, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("AREANORES 마커 비우기 실패: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } l.LogError(val2); } } if ((Object)(object)val == (Object)null || val.Layer == null || (int)val.Layer.m_type != 0) { return; } Rule rule = null; foreach (Rule item3 in Rules()) { if (item3.Zone == val.Alias) { rule = item3; break; } } if (rule == null) { return; } List<AIG_CourseNode> list = new List<AIG_CourseNode>(); List<AIG_CourseNode> list2 = new List<AIG_CourseNode>(); Enumerator<AIG_CourseNode> enumerator2 = val.m_courseNodes.GetEnumerator(); while (enumerator2.MoveNext()) { AIG_CourseNode current2 = enumerator2.Current; if (current2 != null) { list.Add(current2); if (!rule.ExcludeAreas.Contains(Letter(current2.m_area))) { list2.Add(current2); } } } if (list2.Count == 0 || list2.Count == list.Count) { return; } Dictionary<IntPtr, int> count = new Dictionary<IntPtr, int>(); foreach (AIG_CourseNode item4 in list2) { count[((Il2CppObjectBase)item4).Pointer] = 0; } int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; SortedDictionary<string, int> to = new SortedDictionary<string, int>(); Dictionary<string, int> kept = new Dictionary<string, int>(); int num5 = 0; int disMoved = 0; List<AIG_CourseNode> overflow = new List<AIG_CourseNode>(); foreach (AIG_CourseNode item5 in list2) { string text = Letter(item5.m_area); if ((rule.OverflowTo.Count > 0) ? rule.OverflowTo.Contains(text) : (!rule.MaxContainers.ContainsKey(text))) { overflow.Add(item5); } } List<AIG_CourseNode> targets = ((rule.MaxContainers.Count > 0 && overflow.Count > 0) ? overflow : list2); LG_ZoneDistribution[] array = (LG_ZoneDistribution[])(object)new LG_ZoneDistribution[2] { val.DistributionData, val.DistributionDataFallback }; LG_ZoneDistribution[] array2 = array; foreach (LG_ZoneDistribution val3 in array2) { if (val3 == null) { continue; } try { Queue<LG_DistributeResourceContainer> val4 = val3.ResourceContainerItems?.m_itemQueue; if (val4 == null) { continue; } foreach (LG_DistributeResourceContainer item6 in Items<LG_DistributeResourceContainer>(val4)) { AIG_CourseNode val5 = ((item6 != null) ? ((LG_DistributeItem)item6).m_assignedNode : null); if (val5 != null && count.ContainsKey(((Il2CppObjectBase)val5).Pointer)) { count[((Il2CppObjectBase)val5).Pointer]++; } } } catch (Exception ex2) { if (s_logged.Add("q1")) { ManualLogSource l2 = EntryPoint.L; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(24, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("AREANORES 보관함 목록 읽기 실패: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex2.Message); } l2.LogError(val2); } } } array2 = array; foreach (LG_ZoneDistribution val6 in array2) { if (val6 == null) { continue; } try { Queue<LG_DistributeResourceContainer> val7 = val6.ResourceContainerItems?.m_itemQueue; if (val7 != null) { foreach (LG_DistributeResourceContainer item7 in Items<LG_DistributeResourceContainer>(val7)) { if (item7 != null) { num2++; if (Rehome((LG_DistributeItem)(object)item7, targets)) { num++; } else if (Cap((LG_DistributeItem)(object)item7)) { num5++; } } } } } catch (Exception ex3) { if (s_logged.Add("q2")) { ManualLogSource l3 = EntryPoint.L; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(22, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("AREANORES 보관함 옮기기 실패: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex3.Message); } l3.LogError(val2); } } if (!rule.Pickups) { continue; } try { Queue<LG_DistributePickUpItem> val8 = val6.PickupItems?.m_itemQueue; if (val8 == null) { continue; } foreach (LG_DistributePickUpItem item8 in Items<LG_DistributePickUpItem>(val8)) { if (item8 != null) { num4++; if (Rehome((LG_DistributeItem)(object)item8, list2)) { num3++; } } } } catch (Exception ex4) { if (s_logged.Add("q3")) { ManualLogSource l4 = EntryPoint.L; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(25, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("AREANORES 줍는 아이템 옮기기 실패: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex4.Message); } l4.LogError(val2); } } } BepInExInfoLogInterpolatedStringHandler val21; if (rule.KeepPacks != null && rule.KeepPacks.Count > 0 && (Object)(object)val != (Object)null && s_keepDone.Add(((Il2CppObjectBase)val).Pointer)) { try { ExpeditionBalanceDataBlock activeExpeditionBalanceData = RundownManager.ActiveExpeditionBalanceData; float[] per = new float[3] { activeExpeditionBalanceData.HealthPerZone, activeExpeditionBalanceData.WeaponAmmoPerZone, activeExpeditionBalanceData.ToolAmmoPerZone }; List<LG_DistributeResourceContainer> list3 = new List<LG_DistributeResourceContainer>(); array2 = array; foreach (LG_ZoneDistribution val9 in array2) { if (val9 == null) { continue; } Queue<LG_DistributeResourceContainer> val10 = val9.ResourceContainerItems?.m_itemQueue; if (val10 == null) { continue; } foreach (LG_DistributeResourceContainer item9 in Items<LG_DistributeResourceContainer>(val10)) { LG_DistributeResourceContainer val11 = ((item9 != null) ? ((Il2CppObjectBase)item9).TryCast<LG_DistributeResourceContainer>() : null); if (val11 != null && val11.m_packs != null && ((LG_DistributeItem)val11).m_assignedNode != null) { list3.Add(val11); } } } foreach (KeyValuePair<string, float[]> keepPack in rule.KeepPacks) { string L = keepPack.Key; float[] value = keepPack.Value; if (value == null) { continue; }
BepInEx/plugins/Nadir/Custom/Warren.ZoneTickDamage.dll
Decompiled a day agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using AIGraph; using Agents; using BepInEx; using BepInEx.Configuration; using BepInEx.Unity.IL2CPP; using ExtraObjectiveSetup.BaseClasses; using ExtraObjectiveSetup.ExtendedWardenEvents; using ExtraObjectiveSetup.Utils; using GTFO.API; using GTFO.API.Utilities; using GameData; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppSystem.Collections.Generic; using LevelGeneration; using Microsoft.CodeAnalysis; using Player; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Warren.ZoneTickDamage")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Warren.ZoneTickDamage")] [assembly: AssemblyTitle("Warren.ZoneTickDamage")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace ZoneTickDamage { public class ZoneTickDamageDefinition { public List<ZoneDamageRule> Rules { get; set; } = new List<ZoneDamageRule> { new ZoneDamageRule() }; } public class DamageZone { public eDimensionIndex DimensionIndex { get; set; } public LG_LayerType LayerType { get; set; } public eLocalZoneIndex LocalIndex { get; set; } public int AreaIndex { get; set; } = -1; } public class ZoneDamageRule { public string Name { get; set; } = "Rule_0"; public bool EnabledOnStart { get; set; } public List<DamageZone> Zones { get; set; } = new List<DamageZone> { new DamageZone() }; public List<uint> CarryItemIds { get; set; } = new List<uint>(); public float DamagePerTick { get; set; } = 2f; public float TickInterval { get; set; } = 1f; public float MinHealthRemaining { get; set; } = 10f; public string WarningText { get; set; } = "<color=red>오염 구역: 체력이 감소합니다</color>"; } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Warren.ZoneTickDamage", "ZoneTickDamage", "1.0.0")] public class EntryPoint : BasePlugin { public const string GUID = "Warren.ZoneTickDamage"; public const string NAME = "ZoneTickDamage"; public const string VERSION = "1.0.0"; internal static ConfigEntry<uint> EventID; private Harmony m_Harmony; public override void Load() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown EventID = ((BasePlugin)this).Config.Bind<uint>("General", "WardenEventID", 8650u, "규칙 On/Off 워든 이벤트 Type 번호. EOS 규칙상 10000 미만, 다른 EOS 확장과 겹치지 않게"); ((GenericDefinitionManager<ZoneTickDamageDefinition>)(object)ZoneTickDamageManager.Current).Init(); m_Harmony = new Harmony("Warren.ZoneTickDamage"); m_Harmony.PatchAll(); EOSLogger.Log("ZoneTickDamage 1.0.0 loaded."); } } [HarmonyPatch] internal static class Patch_PlayerAgent { [HarmonyPostfix] [HarmonyWrapSafe] [HarmonyPatch(typeof(PlayerAgent), "Setup")] private static void Post_Setup(PlayerAgent __instance) { if (((Agent)__instance).IsLocallyOwned && !((Object)(object)((Component)__instance).gameObject.GetComponent<PlayerZoneDamage>() != (Object)null)) { ((Component)__instance).gameObject.AddComponent<PlayerZoneDamage>().Setup(__instance); } } } public class PlayerZoneDamage : MonoBehaviour { private const int MESSAGE_PRIORITY = 10; private PlayerAgent m_agent; private readonly Dictionary<ZoneDamageRule, float> m_nextTick = new Dictionary<ZoneDamageRule, float>(); private readonly List<ZoneDamageRule> m_matched = new List<ZoneDamageRule>(); private readonly List<ZoneDamageRule> m_toRemove = new List<ZoneDamageRule>(); private bool m_messageShown; static PlayerZoneDamage() { ClassInjector.RegisterTypeInIl2Cpp<PlayerZoneDamage>(); } internal void Setup(PlayerAgent agent) { m_agent = agent; } private void Update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)GameStateManager.CurrentStateName != 10 || (Object)(object)m_agent == (Object)null || !((Agent)m_agent).Alive) { Reset(); return; } List<ZoneDamageRule> activeLevelRules = ZoneTickDamageManager.Current.ActiveLevelRules; if (activeLevelRules.Count == 0) { Reset(); return; } CollectMatchedRules(activeLevelRules); m_toRemove.Clear(); foreach (ZoneDamageRule key in m_nextTick.Keys) { if (!m_matched.Contains(key)) { m_toRemove.Add(key); } } foreach (ZoneDamageRule item in m_toRemove) { m_nextTick.Remove(item); } string text = null; float time = Time.time; foreach (ZoneDamageRule item2 in m_matched) { if (text == null && !string.IsNullOrEmpty(item2.WarningText)) { text = item2.WarningText; } if (!m_nextTick.TryGetValue(item2, out var value)) { m_nextTick[item2] = time + item2.TickInterval; } else if (!(time < value)) { m_nextTick[item2] = time + item2.TickInterval; ApplyTick(item2); } } UpdateMessage(text); } private void CollectMatchedRules(List<ZoneDamageRule> rules) { m_matched.Clear(); AIG_CourseNode courseNode = ((Agent)m_agent).CourseNode; LG_Zone zone = ((courseNode != null) ? courseNode.m_zone : null); LG_Area area = ((courseNode != null) ? courseNode.m_area : null); uint carriedItemId = GetCarriedItemId(); foreach (ZoneDamageRule rule in rules) { if (ZoneTickDamageManager.Current.IsRuleEnabled(rule) && MatchCarry(rule, carriedItemId) && MatchZone(rule, zone, area)) { m_matched.Add(rule); } } } private static bool MatchCarry(ZoneDamageRule rule, uint carryId) { if (rule.CarryItemIds.Count == 0) { return true; } if (carryId != 0) { return rule.CarryItemIds.Contains(carryId); } return false; } private static bool MatchZone(ZoneDamageRule rule, LG_Zone? zone, LG_Area? area) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003f: 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_0058: Unknown result type (might be due to invalid IL or missing references) if (rule.Zones.Count == 0) { return true; } if ((Object)(object)zone == (Object)null) { return false; } foreach (DamageZone zone2 in rule.Zones) { if (zone2.DimensionIndex == zone.DimensionIndex && zone2.LayerType == zone.Layer.m_type && zone2.LocalIndex == zone.LocalIndex) { if (zone2.AreaIndex < 0) { return true; } if ((Object)(object)area != (Object)null && GetAreaIndex(zone, area) == zone2.AreaIndex) { return true; } } } return false; } private static int GetAreaIndex(LG_Zone zone, LG_Area area) { List<LG_Area> areas = zone.m_areas; for (int i = 0; i < areas.Count; i++) { if (((Il2CppObjectBase)areas[i]).Pointer == ((Il2CppObjectBase)area).Pointer) { return i; } } return -1; } private static uint GetCarriedItemId() { PlayerBackpack localBackpack = PlayerBackpackManager.LocalBackpack; if (localBackpack == null) { return 0u; } BackpackItem val = default(BackpackItem); if (!localBackpack.TryGetBackpackItem((InventorySlot)8, ref val) || val == null) { return 0u; } Item instance = val.Instance; return ((GameDataBlockBase<ItemDataBlock>)(object)((instance != null) ? instance.ItemDataBlock : null))?.persistentID ?? val.ItemID; } private void ApplyTick(ZoneDamageRule rule) { Dam_PlayerDamageBase damage = m_agent.Damage; float healthMax = ((Dam_SyncedDamageBase)damage).HealthMax; float num = healthMax * rule.MinHealthRemaining / 100f; float num2 = Mathf.Min(healthMax * rule.DamagePerTick / 100f, ((Dam_SyncedDamageBase)damage).Health - num); if (!(num2 <= 0.001f)) { ((Dam_SyncedDamageBase)damage).NoAirDamage(num2); } } private void UpdateMessage(string? text) { InteractionGuiLayer interactionLayer = GuiManager.InteractionLayer; if (interactionLayer != null) { if (text != null) { interactionLayer.SetMessage(text, (ePUIMessageStyle)3, 10); interactionLayer.MessageVisible = true; m_messageShown = true; } else if (m_messageShown) { interactionLayer.MessageVisible = false; m_messageShown = false; } } } private void Reset() { m_nextTick.Clear(); m_matched.Clear(); UpdateMessage(null); } private void OnDestroy() { Reset(); } } public class ZoneTickDamageManager : GenericDefinitionManager<ZoneTickDamageDefinition> { private readonly Dictionary<string, bool> m_ruleStates = new Dictionary<string, bool>(); public static ZoneTickDamageManager Current { get; } = new ZoneTickDamageManager(); protected override string DEFINITION_NAME => "ZoneTickDamage"; public List<ZoneDamageRule> ActiveLevelRules { get; private set; } = new List<ZoneDamageRule>(); private ZoneTickDamageManager() { LevelAPI.OnBuildDone += OnBuildDone; LevelAPI.OnBuildStart += Clear; LevelAPI.OnLevelCleanup += Clear; } public override void Init() { uint value = EntryPoint.EventID.Value; EOSWardenEventManager.Current.AddEventDefinition("ZoneTickDamage", value, (Action<WardenObjectiveEventData>)ToggleRule); EOSLogger.Log($"ZoneTickDamage: registered warden event id {value}"); } protected override void AddDefinitions(GenericDefinition<ZoneTickDamageDefinition> definition) { if (definition?.Definition?.Rules == null) { return; } foreach (ZoneDamageRule rule in definition.Definition.Rules) { ZoneDamageRule zoneDamageRule = rule; if (zoneDamageRule.Name == null) { string text = (zoneDamageRule.Name = string.Empty); } zoneDamageRule = rule; if (zoneDamageRule.Zones == null) { List<DamageZone> list = (zoneDamageRule.Zones = new List<DamageZone>()); } zoneDamageRule = rule; if (zoneDamageRule.CarryItemIds == null) { List<uint> list3 = (zoneDamageRule.CarryItemIds = new List<uint>()); } zoneDamageRule = rule; if (zoneDamageRule.WarningText == null) { string text = (zoneDamageRule.WarningText = string.Empty); } rule.TickInterval = Math.Max(0.05f, rule.TickInterval); rule.DamagePerTick = Math.Max(0f, rule.DamagePerTick); rule.MinHealthRemaining = Math.Clamp(rule.MinHealthRemaining, 0f, 100f); } base.AddDefinitions(definition); } protected override void FileChanged(LiveEditEventArgs e) { base.FileChanged(e); LoadLevelRules(keepStates: true); } private void OnBuildDone() { LoadLevelRules(keepStates: false); } private void LoadLevelRules(bool keepStates) { ActiveLevelRules = base.GetDefinition(base.CurrentMainLevelLayout)?.Definition?.Rules ?? new List<ZoneDamageRule>(); if (!keepStates) { m_ruleStates.Clear(); } foreach (ZoneDamageRule activeLevelRule in ActiveLevelRules) { string key = activeLevelRule.Name.ToLowerInvariant(); if (!m_ruleStates.ContainsKey(key)) { m_ruleStates[key] = activeLevelRule.EnabledOnStart; } } if (ActiveLevelRules.Count > 0) { EOSLogger.Log($"ZoneTickDamage: loaded {ActiveLevelRules.Count} rule(s) for layout {base.CurrentMainLevelLayout}"); } } private void Clear() { ActiveLevelRules = new List<ZoneDamageRule>(); m_ruleStates.Clear(); } public bool IsRuleEnabled(ZoneDamageRule rule) { bool value; return m_ruleStates.TryGetValue(rule.Name.ToLowerInvariant(), out value) && value; } private void ToggleRule(WardenObjectiveEventData e) { string text = e.WorldEventObjectFilter ?? string.Empty; string key = text.ToLowerInvariant(); if (!m_ruleStates.ContainsKey(key)) { EOSLogger.Error("ZoneTickDamage: rule '" + text + "' not found in current level"); return; } m_ruleStates[key] = e.Enabled; EOSLogger.Debug("ZoneTickDamage: rule '" + text + "' -> " + (e.Enabled ? "ON" : "OFF")); } } }