Decompiled source of INTEGER v0.0.10
Plugins/SimpleProgression.dll
Decompiled 2 weeks 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.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using AssetShards; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BoosterImplants; using CellMenu; using Clonesoft.Json; using DropServer; using DropServer.BoosterImplants; using DropServer.VanityItems; 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.Threading.Tasks; using Microsoft.CodeAnalysis; using PlayFab.ClientModels; using SimpleProgression.Core; using SimpleProgression.Impl; using SimpleProgression.Interfaces; using SimpleProgression.Models.Boosters; using SimpleProgression.Models.Progression; using SimpleProgression.Models.Vanity; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyFileVersion("2025.1.0")] [assembly: AssemblyInformationalVersion("2025.1.0")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyVersion("2025.1.0.0")] [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; } } } internal class ManifestInfo { internal const string TSName = "Simple_Progression"; internal const string TSDescription = "Description"; internal const string TSVersion = "2025.1.0"; internal const string TSAuthor = "AuriRex"; internal const string TSWebsite = "https://github.com/AuriRex/GTFO_SimpleProgression"; } namespace SimpleProgression { public static class Extensions { [CompilerGenerated] private sealed class <>c__DisplayClass1_0 { public uint item; internal bool <GetNonOwned>b__0(LocalVanityItemStorage.LocalVanityItem i) { return i.ItemID != item; } } [CompilerGenerated] private sealed class <GetNonOwned>d__1 : IEnumerable<uint>, IEnumerable, IEnumerator<uint>, IEnumerator, IDisposable { private int <>1__state; private uint <>2__current; private int <>l__initialThreadId; private VanityItemsGroupDataBlock self; public VanityItemsGroupDataBlock <>3__self; private LocalVanityItemStorage playerData; public LocalVanityItemStorage <>3__playerData; private Enumerator<uint> <>s__1; private <>c__DisplayClass1_0 <>8__2; uint IEnumerator<uint>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GetNonOwned>d__1(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>s__1 = null; <>8__2 = null; <>1__state = -2; } private bool MoveNext() { int num = <>1__state; if (num != 0) { if (num != 1) { return false; } <>1__state = -1; goto IL_00a6; } <>1__state = -1; <>s__1 = self.Items.GetEnumerator(); goto IL_00ae; IL_00a6: <>8__2 = null; goto IL_00ae; IL_00ae: if (<>s__1.MoveNext()) { <>8__2 = new <>c__DisplayClass1_0(); <>8__2.item = <>s__1.Current; if (playerData.Items.All((LocalVanityItemStorage.LocalVanityItem i) => i.ItemID != <>8__2.item)) { <>2__current = <>8__2.item; <>1__state = 1; return true; } goto IL_00a6; } <>s__1 = null; 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(); } [DebuggerHidden] IEnumerator<uint> IEnumerable<uint>.GetEnumerator() { <GetNonOwned>d__1 <GetNonOwned>d__; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; <GetNonOwned>d__ = this; } else { <GetNonOwned>d__ = new <GetNonOwned>d__1(0); } <GetNonOwned>d__.self = <>3__self; <GetNonOwned>d__.playerData = <>3__playerData; return <GetNonOwned>d__; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<uint>)this).GetEnumerator(); } } public static bool TryPickRandom<T>(this IEnumerable<T> enumerable, out T value) { T[] array = enumerable.ToArray(); if (array.Length == 0) { value = default(T); return false; } value = array[Random.Range(0, array.Length)]; return true; } [IteratorStateMachine(typeof(<GetNonOwned>d__1))] public static IEnumerable<uint> GetNonOwned(this VanityItemsGroupDataBlock self, LocalVanityItemStorage playerData) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GetNonOwned>d__1(-2) { <>3__self = self, <>3__playerData = playerData }; } public static bool HasAllOwned(this VanityItemsGroupDataBlock self, LocalVanityItemStorage playerData) { Enumerator<uint> enumerator = self.Items.GetEnumerator(); while (enumerator.MoveNext()) { uint itemId = enumerator.Current; if (playerData.Items.All((LocalVanityItemStorage.LocalVanityItem i) => i.ItemID != itemId)) { return false; } } return true; } } public class Logger : ILogger { private readonly ManualLogSource _log; public Logger(ManualLogSource logger) { _log = logger; } public void Debug(string msg) { _log.LogDebug((object)msg); } public void Error(string msg) { _log.LogError((object)msg); } public void Exception(Exception ex) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ManualLogSource log = _log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(3, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.GetType().Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\n"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.StackTrace); } log.LogError(val); } public void Fail(string msg) { _log.LogError((object)msg); } public void Info(string msg) { _log.LogMessage((object)msg); } public void Msg(ConsoleColor col, string msg) { _log.LogMessage((object)msg); } public void Notice(string msg) { _log.LogWarning((object)msg); } public void Success(string msg) { _log.LogMessage((object)msg); } public void Warning(string msg) { _log.LogWarning((object)msg); } } internal class Paths { private static string _saveFolderPath; private static string _vanityItemsLayerDropsPath; private static string _vanityItemsFilePath; private static string _vanityUnlockGroupsFilePath; private static string _vanityFolderPath; private static string _boostersPath; private static string _titleDataPath; public static string SaveFolderPath { get { if (string.IsNullOrWhiteSpace(_saveFolderPath)) { _saveFolderPath = Path.Combine(Paths.BepInExRootPath, "LocalProgression/"); Directory.CreateDirectory(_saveFolderPath); } return _saveFolderPath; } } public static string VanityItemsLayerDropsPath { get { if (string.IsNullOrWhiteSpace(_vanityItemsLayerDropsPath)) { _vanityItemsLayerDropsPath = Path.Combine(VanityFolderPath, "VanityLayerDrops.json"); } return _vanityItemsLayerDropsPath; } } public static string VanityItemsFilePath { get { if (string.IsNullOrWhiteSpace(_vanityItemsFilePath)) { _vanityItemsFilePath = Path.Combine(VanityFolderPath, "VanityData.json"); } return _vanityItemsFilePath; } } public static string VanityUnlockGroupsFilePath { get { if (string.IsNullOrWhiteSpace(_vanityUnlockGroupsFilePath)) { _vanityUnlockGroupsFilePath = Path.Combine(Paths.ConfigPath, "SimpleProgression_VanityGroupUnlockData.json"); } return _vanityUnlockGroupsFilePath; } } public static string VanityFolderPath { get { if (string.IsNullOrWhiteSpace(_vanityFolderPath)) { _vanityFolderPath = Path.Combine(SaveFolderPath, "Vanity/"); Directory.CreateDirectory(_vanityFolderPath); } return _vanityFolderPath; } } public static string BoostersFilePath { get { if (string.IsNullOrWhiteSpace(_boostersPath)) { string text = Path.Combine(SaveFolderPath, "Boosters/"); Directory.CreateDirectory(text); _boostersPath = Path.Combine(text, "BoosterData.json"); } return _boostersPath; } } public static string LocalTitleDataFolderPath { get { if (string.IsNullOrWhiteSpace(_titleDataPath)) { _titleDataPath = Path.Combine(SaveFolderPath, "TitleData/"); Directory.CreateDirectory(_titleDataPath); } return _titleDataPath; } } } [BepInPlugin("dev.aurirex.gtfo.simpleprogression", "Simple_Progression", "2025.1.0")] public class Plugin : BasePlugin { public const string ALLVANITY_GUID = "dev.aurirex.gtfo.allvanity"; public const string GUID = "dev.aurirex.gtfo.simpleprogression"; public const string MOD_NAME = "Simple_Progression"; public const string VERSION = "2025.1.0"; internal static Logger L; private static readonly Harmony _harmony = new Harmony("dev.aurirex.gtfo.simpleprogression"); internal static bool IsAllVanityLoaded => ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.Any((KeyValuePair<string, PluginInfo> kvp) => string.Equals(kvp.Key, "dev.aurirex.gtfo.allvanity", StringComparison.InvariantCultureIgnoreCase)); public override void Load() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown L = new Logger(((BasePlugin)this).Log); ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(13, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Initializing "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Simple_Progression"); } log.LogMessage(val); RegisterTypeOptions val2 = new RegisterTypeOptions(); val2.set_Interfaces(Il2CppInterfaceCollection.op_Implicit(new Type[1] { typeof(IDropServerClientAPI) })); val2.set_LogSuccess(true); ClassInjector.RegisterTypeInIl2Cpp<LocalDropServerAPI>(val2); _harmony.PatchAll(Assembly.GetExecutingAssembly()); } internal static void OnDataBlocksReady() { try { LocalVanityItemDropper.Instance.Init(); LocalBoosterDropper.Instance.Init(); } catch (Exception ex) { L.Exception(ex); } } } } namespace SimpleProgression.Patches { [HarmonyWrapSafe] [HarmonyPatch(typeof(ArtifactInventory), "OnStateChange")] public static class ArtifactInventory_OnStateChange_Patch { public static void Postfix(ArtifactInventory __instance) { LocalProgressionManager.Instance.ArtifactCountUpdated(__instance.CommonCount, __instance.UncommonCount, __instance.RareCount); } } [HarmonyWrapSafe] [HarmonyPatch(typeof(AssetShardManager), "Setup")] internal class LocalizationManager_Setup_Patch { [HarmonyPriority(0)] public static void Postfix() { Plugin.OnDataBlocksReady(); } } [HarmonyWrapSafe] [HarmonyPatch(typeof(CheckpointManager), "StoreCheckpoint")] public class CheckpointManager_StoreCheckpoint_Patch { public static void Prefix() { LocalProgressionManager.Instance.SaveAtCheckpoint(); } } [HarmonyWrapSafe] [HarmonyPatch(typeof(CheckpointManager), "ReloadCheckpoint")] public class CheckpointManager_ReloadCheckpoint_Patch { public static void Prefix() { LocalProgressionManager.Instance.ReloadFromCheckpoint(); } } [HarmonyWrapSafe] [HarmonyPatch(typeof(DropServerManager), "OnTitleDataUpdated")] internal class DropServerManager__OnTitleDataUpdated__Patch { public static bool Prefix(DropServerManager __instance) { __instance.ClientApi = ((Il2CppObjectBase)new LocalDropServerAPI()).TryCast<IDropServerClientAPI>(); return false; } } [HarmonyWrapSafe] [HarmonyPatch(typeof(DropServerManager), "GetStatusText")] internal class DropServerManager__GetStatusText__Patch { public static bool Prefix(DropServerManager __instance, ref string __result) { if (!__instance.IsBusy) { __result = null; return false; } __result = "STORAGE SYNC"; return false; } } [HarmonyPatch(typeof(GameDataInit), "Initialize")] public class GameDataInitPatch { private static bool _first = true; public static void Postfix() { if (_first) { _first = false; return; } Plugin.L.Warning("MTFO Hot-Relead triggered, reloading templates, groups and drop data ..."); LocalVanityItemDropper.Instance.LoadTemplatesGroupsAndDropData(); LocalBoosterDropper.Instance.Load(); } } [HarmonyWrapSafe] [HarmonyPatch(typeof(GS_InLevel), "Enter")] public class GS_InLevel_Enter_Patch { public static void Postfix() { LocalProgressionManager.Instance.OnLevelEntered(); } } [HarmonyPatch(typeof(PlayFabManager), "TryGetRundownTimerData")] internal static class PlayFabManager__TryGetRundownTimerData__Patch { public static bool Prefix(ref bool __result, out RundownTimerData data) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown data = new RundownTimerData(); data.ShowScrambledTimer = true; data.ShowCountdownTimer = true; DateTime dateTime = DateTime.Today.AddDays(20.0); data.UTC_Target_Day = dateTime.Day; data.UTC_Target_Hour = dateTime.Hour; data.UTC_Target_Minute = dateTime.Minute; data.UTC_Target_Month = dateTime.Month; data.UTC_Target_Year = dateTime.Year; __result = true; return false; } } [HarmonyPatch(typeof(PlayFabManager), "TryGetStartupScreenData")] internal static class PlayFabManager__TryGetStartupScreenData__Patch { public static bool Prefix(ref bool __result, out StartupScreenData data) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown data = new StartupScreenData(); data.AllowedToStartGame = true; data.ShowOvertoneButton = false; data.IntroText = "Startup Override :)"; data.ShowBugReportButton = false; data.ShowIntroText = false; data.ShowRoadmapButton = false; data.ShowDiscordButton = false; __result = true; return false; } } [HarmonyPatch(typeof(PlayFabManager), "OnGetAuthSessionTicketResponse")] internal static class PlayFabManager__OnGetAuthSessionTicketResponse__Patch { public static string PLAYFAB_ID = "idk_lol"; private static string _entityId; private static string _entityToken; public static string EntityID => _entityId ?? (_entityId = "Player_" + new Random().Next(int.MinValue, int.MaxValue)); public static string EntityToken => _entityToken ?? (_entityToken = "EntityToken_" + new Random().Next(int.MinValue, int.MaxValue)); public static bool Prefix() { //IL_006c: 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) Plugin.L.Notice("Tricking the game into thinking we're logged in ..."); PlayFabManager current = PlayFabManager.Current; current.m_globalTitleDataLoaded = true; current.m_playerDataLoaded = true; current.m_entityId = EntityID; current.m_entityType = "Player"; current.m_entityToken = EntityToken; current.m_entityLoggedIn = true; current.m_globalTitleData = new Dictionary<string, string>(); PlayFabManager.PlayFabId = PLAYFAB_ID; PlayFabManager.LoggedInDateTime = default(DateTime); PlayFabManager.LoggedInSeconds = Clock.Time; PlayFabFilesManager.OnLoggedIn(); PlayFabManager.GlobalTitleData["DropServer"] = "https://localhost:12345"; Action onLoginSuccess = PlayFabManager.OnLoginSuccess; if (onLoginSuccess != null) { onLoginSuccess.Invoke(); } Action onTitleDataUpdated = PlayFabManager.OnTitleDataUpdated; if (onTitleDataUpdated != null) { onTitleDataUpdated.Invoke(); } return false; } } [HarmonyPatch(typeof(PlayFabManager), "GetEntityTokenAsync")] internal static class PlayFabManager__GetEntityTokenAsync__Patch { public static bool Prefix(ref Task<string> __result) { __result = Task.FromResult<string>(PlayFabManager__OnGetAuthSessionTicketResponse__Patch.EntityToken); return false; } } [HarmonyPatch(typeof(PlayFabManager), "RefreshGlobalTitleDataForKeys")] internal static class PlayFabManager__RefreshGlobalTitleDataForKeys_Patch { public static bool Prefix(List<string> keys, Action OnSuccess) { if (keys != null) { Enumerator<string> enumerator = keys.GetEnumerator(); while (enumerator.MoveNext()) { string current = enumerator.Current; Plugin.L.Msg(ConsoleColor.DarkYellow, "RefreshGlobalTitleDataForKeys -> Key:" + current); } } if (OnSuccess != null) { OnSuccess.Invoke(); } return false; } } [HarmonyPatch(typeof(PlayFabManager), "AddToOrUpdateLocalPlayerTitleData", new Type[] { typeof(string), typeof(string), typeof(Action) })] internal static class PlayFabManager__AddToOrUpdateLocalPlayerTitleData__Patch { public static bool Prefix(string key, string value, Action OnSuccess) { Plugin.L.Debug("Canceled AddToOrUpdateLocalPlayerTitleData: Key:" + key + " - Value:" + value); PlayFabFilesManager.UpdateLocalPlayerTitleData(key, value); if (OnSuccess != null) { OnSuccess.Invoke(); } return false; } } [HarmonyPatch(typeof(PlayFabManager), "AddToOrUpdateLocalPlayerTitleData", new Type[] { typeof(Dictionary<string, string>), typeof(Action) })] internal static class PlayFabManager__AddToOrUpdateLocalPlayerTitleDataOverload__Patch { public static bool Prefix(Dictionary<string, string> keys, Action OnSuccess) { Plugin.L.Debug($"Canceled AddToOrUpdateLocalPlayerTitleData(OverloadMethod): Count:{keys?.Count}"); if (keys != null) { Enumerator<string, string> enumerator = keys.GetEnumerator(); while (enumerator.MoveNext()) { KeyValuePair<string, string> current = enumerator.Current; PlayFabFilesManager.UpdateLocalPlayerTitleData(current.Key, current.Value); } } if (OnSuccess != null) { OnSuccess.Invoke(); } return false; } } [HarmonyPatch(typeof(PlayFabManager), "CloudGiveAlwaysInInventory")] internal static class PlayFabManager__CloudGiveAlwaysInInventory__Patch { public static bool Prefix(Action onSucess) { return PlayFabFilesManager.SkipOriginalAndInvoke(onSucess); } } [HarmonyPatch(typeof(PlayFabManager), "CloudGiveItemToLocalPlayer")] internal static class PlayFabManager__CloudGiveItemToLocalPlayer__Patch { public static bool Prefix(string ItemId, Action onSucess) { return PlayFabFilesManager.SkipOriginalAndInvoke(onSucess); } } [HarmonyPatch(typeof(PlayFabManager), "JSONTest")] internal static class PlayFabManager__JSONTest__Patch { public static bool Prefix() { return false; } } [HarmonyPatch(typeof(PlayFabManager), "RefreshItemCatalog")] internal static class PlayFabManager__RefreshItemCatalog__Patch { public static bool Prefix(delUpdateItemCatalogDone OnSuccess, string catalogVersion) { return false; } } [HarmonyPatch(typeof(PlayFabManager), "RefreshLocalPlayerInventory")] internal static class PlayFabManager__RefreshLocalPlayerInventory__Patch { public static bool Prefix(delUpdatePlayerInventoryDone OnSuccess) { return false; } } [HarmonyPatch(typeof(PlayFabManager), "RefreshLocalPlayerTitleData")] internal static class PlayFabManager__RefreshLocalPlayerTitleData__Patch { public static bool Prefix(Action OnSuccess) { return PlayFabFilesManager.SkipOriginalAndInvoke(OnSuccess); } } [HarmonyPatch(typeof(PlayFabManager), "RefreshGlobalTitleData")] internal static class PlayFabManager__RefreshGlobalTitleData__Patch { public static bool Prefix(Action OnSuccess) { return PlayFabFilesManager.SkipOriginalAndInvoke(OnSuccess); } } [HarmonyPatch(typeof(PlayFabManager), "RefreshStoreItems")] internal static class PlayFabManager__RefreshStoreItems__Patch { public static bool Prefix(string storeID, delUpdateStoreItemsDone OnSuccess) { if (OnSuccess != null) { OnSuccess.Invoke((Dictionary<string, StoreItem>)null); } return false; } } [HarmonyPatch(typeof(CM_PageRundown_New), "Setup")] public static class CM_PageRundown_New__Setup__Patch { public static readonly Vector3 YEET_VECTOR = new Vector3(-5000f, -20000f, 0f); public static void Postfix(CM_PageRundown_New __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) ((Component)__instance.m_matchmakeAllButton).gameObject.transform.position = YEET_VECTOR; } } [HarmonyPatch(typeof(CM_PlayerLobbyBar), "SetupFromPage")] public static class CM_PlayerLobbyBar__SetupFromPage__Patch { public static void Postfix(CM_PlayerLobbyBar __instance) { //IL_0011: 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) ((Component)__instance.m_matchmakeButton).gameObject.transform.position = CM_PageRundown_New__Setup__Patch.YEET_VECTOR; __instance.m_matchmakeIcon.gameObject.transform.position = CM_PageRundown_New__Setup__Patch.YEET_VECTOR; } } [HarmonyPatch(typeof(RundownManager), "OnExpeditionEnded")] public class TestingPatch { public static void Prefix() { Clock.ExpeditionProgressionTime = 31f; } } } namespace SimpleProgression.Models.Vanity { public class AllVanityGroupsToUnlock { [JsonIgnore] public static readonly IReadOnlyList<string> GAME_DEFAULT_GROUPS = new List<string> { "Initial Helmet DONOTDELETE", "Initial Torso DONOTDELETE", "Initial Legs DONOTDELETE", "Initial Backpack DONOTDELETE", "Initial Palette DONOTDELETE", "MainDrops", "MainStoryDrops", "SecondaryDrops", "OverloadDrops", "MainCompletedDrops", "StoryCompletedDrops", "SecondaryCompletedDrops", "OverloadCompletedDrops", "R7MainStoryDrops", "R7SecondaryDrops", "R7OverloadDrops", "R7MainCompletedDrops", "R7StoryCompletedDrops", "R7SecondaryCompletedDrops", "R7OverloadCompletedDrops", "R1Completion", "R2Completion", "R3Completion", "R4Completion", "R5Completion", "R6Completion", "R8Completion", "EarlyAccessDrops DONOTDELETE", "ChineseNewYear2022 DONOTDELETE", "ExtraExpeditions6.5 DONOTDELETE", "Gamescom2022 DONOTDELETE", "Halloween2022 DONOTDELETE", "BlackFriday2022 DONOTDELETE", "ChineseNewYear2023 DONOTDELETE", "ALT R4 Timed Drop 2023 DONOTDELETE", "Halloween2023 DONOTDELETE" }; public string Comment { get; set; } = "This are all the VanityItemsGroupDataBlocks (name) that will be unlocked by Simple Progression if AllVanity is installed."; public List<string> GroupsToUnlock { get; set; } = new List<string>(GAME_DEFAULT_GROUPS); } public class LocalVanityAcquiredLayerDrops { public HashSet<string> ClaimedDrops { get; set; } = new HashSet<string>(); public bool HasBeenClaimed(string key) { return ClaimedDrops.Contains(key); } public void Claim(string key) { ClaimedDrops.Add(key); } } public class LocalVanityItemStorage { public class LocalVanityItem { public uint ItemID { get; set; } = 0u; public VanityItemFlags Flags { get; set; } = VanityItemFlags.None; [JsonIgnore] public bool IsCustom => !string.IsNullOrWhiteSpace(CustomKey); public string CustomKey { get; set; } = null; } [Flags] public enum VanityItemFlags { None = 0, Acknowledged = 1, Touched = 2, ALL = 3 } [CompilerGenerated] private sealed class <GetValidItemsAndFixCustomIDs>d__6 : IEnumerable<LocalVanityItem>, IEnumerable, IEnumerator<LocalVanityItem>, IEnumerator, IDisposable { private int <>1__state; private LocalVanityItem <>2__current; private int <>l__initialThreadId; public LocalVanityItemStorage <>4__this; private List<LocalVanityItem>.Enumerator <>s__1; private LocalVanityItem <item>5__2; private VanityItemsTemplateDataBlock <block>5__3; LocalVanityItem IEnumerator<LocalVanityItem>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <GetValidItemsAndFixCustomIDs>d__6(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { int num = <>1__state; if (num == -3 || num == 1) { try { } finally { <>m__Finally1(); } } <>s__1 = default(List<LocalVanityItem>.Enumerator); <item>5__2 = null; <block>5__3 = null; <>1__state = -2; } private bool MoveNext() { try { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>s__1 = <>4__this.Items.GetEnumerator(); <>1__state = -3; break; case 1: <>1__state = -3; <item>5__2 = null; break; } while (<>s__1.MoveNext()) { <item>5__2 = <>s__1.Current; if (<item>5__2.IsCustom) { if (!LocalVanityItemDropper.Instance.TryGetBlockFromCustomKey(<item>5__2.CustomKey, out <block>5__3)) { Plugin.L.Warning("Could not find custom item \"" + <item>5__2.CustomKey + "\"! It won't be in your inventory in game!"); continue; } <item>5__2.ItemID = ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)<block>5__3).persistentID; <block>5__3 = null; } <>2__current = <item>5__2; <>1__state = 1; return true; } <>m__Finally1(); <>s__1 = default(List<LocalVanityItem>.Enumerator); return false; } catch { //try-fault ((IDisposable)this).Dispose(); throw; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } private void <>m__Finally1() { <>1__state = -1; ((IDisposable)<>s__1).Dispose(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<LocalVanityItem> IEnumerable<LocalVanityItem>.GetEnumerator() { <GetValidItemsAndFixCustomIDs>d__6 result; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; result = this; } else { result = new <GetValidItemsAndFixCustomIDs>d__6(0) { <>4__this = <>4__this }; } return result; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<LocalVanityItem>)this).GetEnumerator(); } } public List<LocalVanityItem> Items { get; set; } = new List<LocalVanityItem>(); public void SetFlag(uint id, VanityItemFlags flag) { Items.Where((LocalVanityItem x) => x.ItemID == id).ToList().ForEach(delegate(LocalVanityItem x) { x.Flags |= flag; }); } public void UnsetFlag(uint id, VanityItemFlags flag) { Items.Where((LocalVanityItem x) => x.ItemID == id).ToList().ForEach(delegate(LocalVanityItem x) { x.Flags &= ~flag; }); } [IteratorStateMachine(typeof(<GetValidItemsAndFixCustomIDs>d__6))] public IEnumerable<LocalVanityItem> GetValidItemsAndFixCustomIDs() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <GetValidItemsAndFixCustomIDs>d__6(-2) { <>4__this = this }; } public VanityItemPlayerData ToBaseGame() { return ToBaseGame(this); } public static VanityItemPlayerData ToBaseGame(LocalVanityItemStorage customData) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected O, but got Unknown //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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Expected O, but got Unknown List<LocalVanityItem> validItems = customData.GetValidItemsAndFixCustomIDs().ToList(); if (Plugin.IsAllVanityLoaded) { AddNonOwnedBlocks(ref validItems); } VanityItemPlayerData val = new VanityItemPlayerData(ClassInjector.DerivedConstructorPointer<VanityItemPlayerData>()); val.Items = new Il2CppReferenceArray<VanityItem>((long)validItems.Count); for (int i = 0; i < validItems.Count; i++) { LocalVanityItem localVanityItem = validItems[i]; VanityItem val2 = new VanityItem { ItemId = localVanityItem.ItemID, Flags = (InventoryItemFlags)(byte)localVanityItem.Flags }; ((Il2CppArrayBase<VanityItem>)(object)val.Items)[i] = val2; } return val; } private static void AddNonOwnedBlocks(ref List<LocalVanityItem> validItems) { List<string> groupsToUnlock = LocalVanityItemManager.Instance.AllVanityGroupsToUnlock.GroupsToUnlock; HashSet<uint> allTemplateIds = new HashSet<uint>(); foreach (VanityItemsGroupDataBlock allBlock in GameDataBlockBase<VanityItemsGroupDataBlock>.GetAllBlocks()) { if (groupsToUnlock.Contains(((GameDataBlockBase<VanityItemsGroupDataBlock>)(object)allBlock).name)) { Enumerator<uint> enumerator2 = allBlock.Items.GetEnumerator(); while (enumerator2.MoveNext()) { uint current2 = enumerator2.Current; allTemplateIds.Add(current2); } } } List<LocalVanityItem> list = validItems; IEnumerable<VanityItemsTemplateDataBlock> enumerable = ((IEnumerable<VanityItemsTemplateDataBlock>)GameDataBlockBase<VanityItemsTemplateDataBlock>.GetAllBlocks()).Where((VanityItemsTemplateDataBlock block) => allTemplateIds.Contains(((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)block).persistentID) && list.All((LocalVanityItem vi) => vi.ItemID != ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)block).persistentID)); foreach (VanityItemsTemplateDataBlock item in enumerable) { validItems.Add(new LocalVanityItem { ItemID = ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)item).persistentID, Flags = VanityItemFlags.ALL }); } } public static LocalVanityItemStorage FromBaseGame(VanityItemPlayerData vanityPlayerData) { //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected I4, but got Unknown List<LocalVanityItem> list = new List<LocalVanityItem>(); foreach (VanityItem item in (Il2CppArrayBase<VanityItem>)(object)vanityPlayerData.Items) { list.Add(new LocalVanityItem { ItemID = item.ItemId, Flags = (VanityItemFlags)item.Flags }); } return new LocalVanityItemStorage { Items = list }; } } } namespace SimpleProgression.Models.Progression { public struct ExpeditionCompletionData { public readonly bool Success => RawSessionData.ExpeditionSurvived; public readonly string RundownKey => RawSessionData.RundownKey; public uint RundownId { get; internal set; } public eRundownTier ExpeditionTier { get; internal set; } public int ExpeditionIndex { get; internal set; } public readonly string ExpeditionId => RawSessionData.ExpeditionId; public readonly string SessionId => RawSessionData.SessionId; public readonly int ArtifactsCollected => RawSessionData.ArtifactsCollected; public readonly bool WasPrisonerEfficiencyClear => RawSessionData.PrisonerEfficiencyCompleted; public bool WasFirstTimeCompletion { get; internal set; } public ExpeditionSession RawSessionData { get; internal set; } public float PreArtifactHeat { get; internal set; } public float NewArtifactHeat { get; internal set; } } public class ExpeditionSession { public class ExpeditionSessionData { private readonly ILogger _logger; public Dictionary<Layers, LayerState> LayerStates { get; private set; } = new Dictionary<Layers, LayerState>(); internal ExpeditionSessionData(ILogger logger) { _logger = logger; } internal void SetOnlyIncreaseLayerState(Layers layer, LayerState state) { if (LayerStates.TryGetValue(layer, out var value)) { if (value < state) { LayerStates.Remove(layer); _logger.Debug($"[{"ExpeditionSessionData"}] Set layer {layer} from {value} to {state}"); LayerStates.Add(layer, state); } } else { _logger.Debug($"[{"ExpeditionSessionData"}] Set layer {layer} to {state}"); LayerStates.Add(layer, state); } } internal void SetLayerState(Layers layer, LayerState state) { if (LayerStates.TryGetValue(layer, out var value)) { LayerStates.Remove(layer); _logger.Debug($"[{"ExpeditionSessionData"}] Set layer {layer} from {value} to {state}"); } else { _logger.Debug($"[{"ExpeditionSessionData"}] Set layer {layer} to {state}"); } LayerStates.Add(layer, state); } public override string ToString() { string text = string.Empty; foreach (KeyValuePair<Layers, LayerState> layerState in LayerStates) { text += $"{layerState.Key}: {layerState.Value}, "; } return text.Substring(0, text.Length - 2); } public ExpeditionSessionData Clone() { ExpeditionSessionData expeditionSessionData = new ExpeditionSessionData(_logger); foreach (KeyValuePair<Layers, LayerState> layerState in LayerStates) { expeditionSessionData.LayerStates.Add(layerState.Key, layerState.Value); } return expeditionSessionData; } } private readonly ILogger _logger; private ExpeditionSessionData SavedData { get; set; } public ExpeditionSessionData CurrentData { get; private set; } public bool HasCheckpointBeenUsed { get; private set; } public bool ExpeditionSurvived { get; private set; } public DateTimeOffset DropTime { get; private set; } public DateTimeOffset StartTime { get; private set; } public DateTimeOffset EndTime { get; private set; } public string RundownKey { get; private set; } public string ExpeditionId { get; private set; } public string SessionId { get; private set; } public int ArtifactsCollected => MutedArtifactsCollected + BoldArtifactsCollected + AggressiveArtifactsCollected; public int MutedArtifactsCollected { get; internal set; } public int BoldArtifactsCollected { get; internal set; } public int AggressiveArtifactsCollected { get; internal set; } public bool PrisonerEfficiencyCompleted => CurrentData.LayerStates.Count() == 3 && CurrentData.LayerStates.All((KeyValuePair<Layers, LayerState> x) => x.Value == LayerState.Completed); private ExpeditionSession(string rundownKey, string expeditionId, string sessionId, ILogger logger) { RundownKey = rundownKey; ExpeditionId = expeditionId; SessionId = sessionId; _logger = logger; DropTime = DateTimeOffset.UtcNow; CurrentData = new ExpeditionSessionData(logger); SetLayer(Layers.Main, LayerState.Entered); } internal static ExpeditionSession InitNewSession(string rundownKey, string expeditionId, string sessionId, ILogger logger) { ExpeditionSession result = new ExpeditionSession(rundownKey, expeditionId, sessionId, logger); logger.Info($"[{"ExpeditionSession"}] New expedition session started! (R:{rundownKey}, E:{expeditionId}, S:{sessionId})"); return result; } internal void OnLevelEntered() { StartTime = DateTimeOffset.UtcNow; } internal void OnCheckpointSave() { _logger.Info("Saving current ExpeditionSessionData at checkpoint."); SavedData = CurrentData.Clone(); } internal void OnCheckpointReset() { if (!HasCheckpointBeenUsed) { _logger.Notice("Checkpoint has been used!"); } HasCheckpointBeenUsed = true; if (SavedData != null) { _logger.Info("Resetting previous ExpeditionSessionData from checkpoint."); CurrentData = SavedData.Clone(); } } internal void OnExpeditionCompleted(bool success) { EndTime = DateTimeOffset.UtcNow; _logger.Info($"[{"ExpeditionSession"}] Expedition session has ended! (R:{RundownKey}, E:{ExpeditionId}, S:{SessionId}){(success ? " Expedition Successful!" : string.Empty)}"); if (success) { ExpeditionSurvived = true; SetLayer(Layers.Main, LayerState.Completed); } _logger.Info($"[{"ExpeditionSession"}] Data: {CurrentData}"); } internal void SetLayer(Layers layer, LayerState state) { CurrentData.SetOnlyIncreaseLayerState(layer, state); } public bool HasLayerBeenCompleted(Layers layer) { if (!CurrentData.LayerStates.TryGetValue(layer, out var value)) { return false; } return value == LayerState.Completed; } } public static class LayerExtensions { public static Layers ToCustom(this ExpeditionLayers layer) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Expected I4, but got Unknown return (Layers)layer; } public static ExpeditionLayers ToBasegame(this Layers layer) { return (ExpeditionLayers)layer; } public static LayerState ToCustom(this LayerProgressionState state) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Expected I4, but got Unknown return (LayerState)state; } public static LayerProgressionState ToBasegame(this LayerState layer) { return (LayerProgressionState)layer; } } [Flags] public enum LayerFlags { None = 0, Main = 1, Secondary = 2, Third = 4, All = 7 } public enum Layers { Main, Secondary, Third } public enum LayerState { Undiscovered, Discovered, Entered, Completed } public class LocalRundownProgression { public class Expedition { public class Layer { public LayerState State = LayerState.Undiscovered; public int CompletionCount = 0; public void IncreaseStateAndCompletion(LayerState newState) { if (State < newState) { State = newState; } if (newState == LayerState.Completed) { CompletionCount++; } } public static Layer FromBaseGame(Layer baseGameType) { //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_0018: Unknown result type (might be due to invalid IL or missing references) return new Layer { State = baseGameType.State.ToCustom(), CompletionCount = baseGameType.CompletionCount }; } public Layer ToBaseGame() { //IL_0003: 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_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_002c: Unknown result type (might be due to invalid IL or missing references) Layer result = default(Layer); result.CompletionCount = CompletionCount; result.State = State.ToBasegame(); return result; } } public int AllLayerCompletionCount = 0; public LayerSet Layers = new LayerSet(); public float ArtifactHeat = 1f; public bool HasBeenCompletedBefore() { return (Layers?.Main?.CompletionCount).GetValueOrDefault() > 0; } public static Expedition FromBaseGame(Expedition baseGameExpedition) { return new Expedition { AllLayerCompletionCount = baseGameExpedition.AllLayerCompletionCount, Layers = LayerSet.FromBaseGame(baseGameExpedition.Layers) }; } public Expedition ToBaseGame() { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Expected O, but got Unknown return new Expedition(ClassInjector.DerivedConstructorPointer<Expedition>()) { AllLayerCompletionCount = AllLayerCompletionCount, Layers = (Layers?.ToBaseGameLayers() ?? new LayerSet<Layer>()) }; } } public class LayerSet { public Expedition.Layer Main { get; set; } public Expedition.Layer Secondary { get; set; } public Expedition.Layer Third { get; set; } public static LayerSet FromBaseGame(LayerSet<Layer> baseGameLayers) { //IL_0008: 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_002c: Unknown result type (might be due to invalid IL or missing references) return new LayerSet { Main = Expedition.Layer.FromBaseGame(baseGameLayers.Main), Secondary = Expedition.Layer.FromBaseGame(baseGameLayers.Secondary), Third = Expedition.Layer.FromBaseGame(baseGameLayers.Third) }; } public Expedition.Layer GetOrAddLayer(Layers layer) { Expedition.Layer layer2 = GetLayer(layer); if (layer2 == null) { layer2 = new Expedition.Layer(); SetLayer(layer, layer2); } return layer2; } public Expedition.Layer GetLayer(Layers layer) { if (1 == 0) { } Expedition.Layer result = layer switch { Layers.Main => Main, Layers.Secondary => Secondary, Layers.Third => Third, _ => throw new Exception($"Unknown layer enum {layer}"), }; if (1 == 0) { } return result; } public void SetLayer(Layers layer, Expedition.Layer data) { switch (layer) { case Layers.Main: Main = data; break; case Layers.Secondary: Secondary = data; break; case Layers.Third: Third = data; break; default: throw new Exception($"Unknown layer enum {layer}"); } } public LayerSet<Layer> ToBaseGameLayers() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_0034: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) return new LayerSet<Layer> { Main = (Layer)(((??)Main?.ToBaseGame()) ?? default(Layer)), Secondary = (Layer)(((??)Secondary?.ToBaseGame()) ?? default(Layer)), Third = (Layer)(((??)Third?.ToBaseGame()) ?? default(Layer)) }; } } public Dictionary<string, Expedition> Expeditions = new Dictionary<string, Expedition>(); private ILogger _logger = null; public static float ARTIFACT_HEAT_MIN { get; set; } = 0.2f; public static float ARTIFACT_HEAT_UNCOMPLETED_MIN { get; set; } = 0.5f; public int GetUniqueExpeditionLayersStateCount(Layers layer = Layers.Main, LayerState state = LayerState.Completed) { return Expeditions.Count(delegate(KeyValuePair<string, Expedition> x) { Expedition value = x.Value; return value != null && value.Layers?.GetLayer(layer)?.State == state; }); } internal bool AddSessionResults(ExpeditionSession session, out ExpeditionCompletionData completionData) { //IL_0321: 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) if (session == null) { completionData = default(ExpeditionCompletionData); return false; } if (Expeditions == null) { Expeditions = new Dictionary<string, Expedition>(); } Expedition orAdd = GetOrAdd(Expeditions, session.ExpeditionId); bool flag = !orAdd.HasBeenCompletedBefore(); foreach (KeyValuePair<Layers, LayerState> layerState2 in session.CurrentData.LayerStates) { Layers key = layerState2.Key; LayerState layerState = layerState2.Value; if (!session.ExpeditionSurvived && layerState == LayerState.Completed) { layerState = LayerState.Entered; } Expedition.Layer orAddLayer = orAdd.Layers.GetOrAddLayer(key); orAddLayer.IncreaseStateAndCompletion(layerState); } if (session.ExpeditionSurvived && session.PrisonerEfficiencyCompleted) { orAdd.AllLayerCompletionCount++; } float artifactHeat = orAdd.ArtifactHeat; if (session.ArtifactsCollected > 0) { float val = (flag ? ARTIFACT_HEAT_MIN : ARTIFACT_HEAT_UNCOMPLETED_MIN); float val2 = orAdd.ArtifactHeat - (float)session.ArtifactsCollected * 1.5f / 100f; orAdd.ArtifactHeat = Math.Max(val, val2); foreach (Expedition value2 in Expeditions.Values) { if (value2 != orAdd && value2 != null && !(value2.ArtifactHeat >= 1f)) { float val3 = value2.ArtifactHeat + (float)session.ArtifactsCollected * 0.5f / 100f; value2.ArtifactHeat = Math.Min(1f, val3); } } } if (!uint.TryParse(session.RundownKey.Replace("Local_", string.Empty), out var result)) { _logger?.Error($"[{"LocalRundownProgression"}.{"AddSessionResults"}] Could not parse rundown id from \"{session.RundownKey}\"!"); result = 0u; } char value = session.ExpeditionId[0]; int result2 = ((!int.TryParse(session.ExpeditionId.Substring(1), out result2)) ? (-1) : (result2 - 1)); if (!Enum.TryParse<eRundownTier>($"Tier{value}", out eRundownTier result3)) { result3 = (eRundownTier)1; } completionData = new ExpeditionCompletionData { RundownId = result, ExpeditionIndex = result2, ExpeditionTier = result3, PreArtifactHeat = artifactHeat, NewArtifactHeat = orAdd.ArtifactHeat, WasFirstTimeCompletion = flag, RawSessionData = session }; return true; } public RundownProgression ToBaseGameProgression() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Expected O, but got Unknown RundownProgression val = new RundownProgression(ClassInjector.DerivedConstructorPointer<RundownProgression>()); val.Expeditions = new Dictionary<string, Expedition>(); if (Expeditions == null) { Expeditions = new Dictionary<string, Expedition>(); } foreach (KeyValuePair<string, Expedition> expedition in Expeditions) { string key = expedition.Key; Expedition value = expedition.Value; Expedition val2 = new Expedition(ClassInjector.DerivedConstructorPointer<Expedition>()); val2.AllLayerCompletionCount = value.AllLayerCompletionCount; SetArtifactHeat(val2, value); val2.Layers = value.Layers.ToBaseGameLayers(); val.Expeditions.Add(key, val2); } return val; } [MethodImpl(MethodImplOptions.NoInlining)] private void SetArtifactHeat(Expedition bgExp, Expedition cExp) { bgExp.ArtifactHeat = cExp.ArtifactHeat; } public Expedition GetOrAdd(Dictionary<string, Expedition> dict, string keyName) { if (dict.TryGetValue(keyName, out var value)) { return value; } Expedition expedition = new Expedition(); dict.Add(keyName, expedition); return expedition; } } } namespace SimpleProgression.Models.Boosters { public class LocalBoosterImplant { public struct Effect { public uint Id; public float Value; } public enum SaveBoosterImplantCategory { Muted, Bold, Aggressive } public static string TraitConditionColor { get; private set; } public static string TraitNegativeColor { get; private set; } public static string TraitPositiveColor { get; private set; } public uint TemplateId { get; set; } public SaveBoosterImplantCategory Category { get; set; } public int Uses { get; set; } public Effect[] Effects { get; set; } [JsonIgnore] public BoosterImplantTemplateDataBlock Template { get; set; } public uint InstanceId { get; set; } public uint[] Conditions { get; set; } public LocalBoosterImplant() { } public LocalBoosterImplant(uint templateId, uint instanceId, int uses, Effect[] effects, uint[] conditions) { TemplateId = templateId; InstanceId = instanceId; Uses = uses; Effects = effects ?? Array.Empty<Effect>(); Conditions = conditions ?? Array.Empty<uint>(); } public static void CopyTraitColorsFromBasegame() { TraitConditionColor = BoosterImplant.TraitConditionColor; TraitNegativeColor = BoosterImplant.TraitNegativeColor; TraitPositiveColor = BoosterImplant.TraitPositiveColor; } protected static BoosterImplantInventoryItem ToBaseGame(LocalDropServerBoosterImplantInventoryItem custom, BoosterImplantInventoryItem baseGame) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0040: 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) BoosterImplantInventoryItem val = new BoosterImplantInventoryItem(ClassInjector.DerivedConstructorPointer<BoosterImplantInventoryItem>()); ((BoosterImplantBase)val).Effects = Il2CppStructArray<BoosterImplantEffect>.op_Implicit((BoosterImplantEffect[])(object)new BoosterImplantEffect[custom.Effects.Length]); for (int i = 0; i < custom.Effects.Length; i++) { Effect effect = custom.Effects[i]; ((Il2CppArrayBase<BoosterImplantEffect>)(object)((BoosterImplantBase)val).Effects)[i] = new BoosterImplantEffect { Id = effect.Id, Param = effect.Value }; } ((BoosterImplantBase)val).TemplateId = custom.TemplateId; ((BoosterImplantBase)val).Id = custom.InstanceId; ((BoosterImplantBase)val).Conditions = Il2CppStructArray<uint>.op_Implicit(new uint[custom.Conditions.Length]); for (int j = 0; j < custom.Conditions.Length; j++) { ((Il2CppArrayBase<uint>)(object)((BoosterImplantBase)val).Conditions)[j] = custom.Conditions[j]; } ((BoosterImplantBase)val).UsesRemaining = custom.Uses; return val; } } public class LocalBoosterImplantPlayerData { public class CustomCategory { [JsonIgnore] public const int MAX_BOOSTERS_R5 = 10; [JsonIgnore] public const int MAX_BOOSTERS_R6 = 20; private int _currency = 0; public LocalBoosterImplant.SaveBoosterImplantCategory CategoryType { get; set; } = LocalBoosterImplant.SaveBoosterImplantCategory.Muted; public int Currency { get { return _currency; } set { _currency = ((value > 0) ? value : 0); } } public int Missed { get; set; } = 0; public int MissedAck { get; set; } = 0; public LocalDropServerBoosterImplantInventoryItem[] Inventory { get; set; } = new LocalDropServerBoosterImplantInventoryItem[0]; [JsonIgnore] public static int MaxBoostersInCategoryInventory => GetMaxBoostersInCategory(); [JsonIgnore] public bool InventoryIsFull => Inventory.Length >= MaxBoostersInCategoryInventory; [JsonIgnore] public bool HasEnoughCurrencyForDrop => Currency >= CurrencyNewBoosterCost; public CustomCategory() { } public CustomCategory(LocalBoosterImplant.SaveBoosterImplantCategory cat) { CategoryType = cat; } public uint[] GetUsedIds() { uint[] array = new uint[Inventory.Length]; for (int i = 0; i < Inventory.Length; i++) { array[i] = Inventory[i].InstanceId; } return array; } public bool TryAddBooster(LocalDropServerBoosterImplantInventoryItem newBooster) { if (InventoryIsFull) { return false; } LocalDropServerBoosterImplantInventoryItem[] array = new LocalDropServerBoosterImplantInventoryItem[Inventory.Length + 1]; for (int i = 0; i < Inventory.Length; i++) { array[i] = Inventory[i]; } array[^1] = newBooster; Inventory = array; return true; } internal void ConsumeOrDropBoostersWithIds(uint[] boostersToBeConsumed) { List<LocalDropServerBoosterImplantInventoryItem> list = new List<LocalDropServerBoosterImplantInventoryItem>(); LocalDropServerBoosterImplantInventoryItem[] inventory = Inventory; foreach (LocalDropServerBoosterImplantInventoryItem item in inventory) { if (boostersToBeConsumed.Any((uint toConsumeId) => item.InstanceId == toConsumeId)) { if (item.Uses <= 1) { continue; } item.Uses--; } list.Add(item); } Inventory = list.ToArray(); } internal void DropBoostersWithIds(uint[] boostersToBeDropped) { List<LocalDropServerBoosterImplantInventoryItem> list = new List<LocalDropServerBoosterImplantInventoryItem>(); LocalDropServerBoosterImplantInventoryItem[] inventory = Inventory; foreach (LocalDropServerBoosterImplantInventoryItem item in inventory) { if (!boostersToBeDropped.Any((uint toDropId) => item.InstanceId == toDropId)) { list.Add(item); } } Inventory = list.ToArray(); } internal void SetBoostersTouchedWithIds(uint[] boostersThatWereTouched) { LocalDropServerBoosterImplantInventoryItem[] inventory = Inventory; foreach (LocalDropServerBoosterImplantInventoryItem item in inventory) { if (boostersThatWereTouched.Any((uint toTouchId) => item.InstanceId == toTouchId)) { item.IsTouched = true; } } } public Category ToBaseGame() { return ToBaseGame(this); } public static Category ToBaseGame(CustomCategory customCat) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown Category val = new Category(ClassInjector.DerivedConstructorPointer<Category>()); val.Currency = customCat.Currency; val.Missed = customCat.Missed; val.Inventory = new Il2CppReferenceArray<BoosterImplantInventoryItem>((long)customCat.Inventory.Length); for (int i = 0; i < customCat.Inventory.Length; i++) { ((Il2CppArrayBase<BoosterImplantInventoryItem>)(object)val.Inventory)[i] = customCat.Inventory[i].ToBaseGame(); } return val; } public static CustomCategory FromBaseGame(Category cat) { CustomCategory customCategory = new CustomCategory(); customCategory.Currency = cat.Currency; customCategory.Missed = cat.Missed; customCategory.MissedAck = cat.MissedAck; List<LocalDropServerBoosterImplantInventoryItem> list = new List<LocalDropServerBoosterImplantInventoryItem>(); foreach (BoosterImplantInventoryItem item in (Il2CppArrayBase<BoosterImplantInventoryItem>)(object)cat.Inventory) { list.Add(LocalDropServerBoosterImplantInventoryItem.FromBaseGame(item)); } customCategory.Inventory = list.ToArray(); return customCategory; } public static int GetMaxBoostersInCategory() { return 20; } } public static int CurrencyNewBoosterCost { get; set; } = 1000; public static float CurrencyGainMultiplier { get; set; } = 1f; public CustomCategory Basic { get; set; } = new CustomCategory(LocalBoosterImplant.SaveBoosterImplantCategory.Muted); public CustomCategory Advanced { get; set; } = new CustomCategory(LocalBoosterImplant.SaveBoosterImplantCategory.Bold); public CustomCategory Specialized { get; set; } = new CustomCategory(LocalBoosterImplant.SaveBoosterImplantCategory.Aggressive); public uint[] New { get; set; } = new uint[0]; public void AcknowledgeMissedBoostersWithIds(Missed acknowledgeMissed) { Basic.MissedAck = acknowledgeMissed.Basic; Advanced.MissedAck = acknowledgeMissed.Advanced; Specialized.MissedAck = acknowledgeMissed.Specialized; } public CustomCategory[] GetCategoriesWhereCurrencyCostHasBeenReached() { List<CustomCategory> list = new List<CustomCategory>(); if (Basic.Currency >= CurrencyNewBoosterCost) { list.Add(Basic); } if (Advanced.Currency >= CurrencyNewBoosterCost) { list.Add(Advanced); } if (Specialized.Currency >= CurrencyNewBoosterCost) { list.Add(Specialized); } return list.ToArray(); } public void AcknowledgeBoostersWithIds(uint[] boostersToAcknowledge) { List<uint> list = new List<uint>(); uint[] @new = New; foreach (uint id in @new) { if (!boostersToAcknowledge.Any((uint idToAcknowledge) => id == idToAcknowledge)) { list.Add(id); } } New = list.ToArray(); } public void SetBoostersTouchedWithIds(uint[] boostersThatWereTouched) { Basic.SetBoostersTouchedWithIds(boostersThatWereTouched); Advanced.SetBoostersTouchedWithIds(boostersThatWereTouched); Specialized.SetBoostersTouchedWithIds(boostersThatWereTouched); } public void ConsumeBoostersWithIds(uint[] boostersToBeConsumed) { Basic.ConsumeOrDropBoostersWithIds(boostersToBeConsumed); Advanced.ConsumeOrDropBoostersWithIds(boostersToBeConsumed); Specialized.ConsumeOrDropBoostersWithIds(boostersToBeConsumed); } public void DropBoostersWithIds(uint[] boostersToBeDropped) { Basic.DropBoostersWithIds(boostersToBeDropped); Advanced.DropBoostersWithIds(boostersToBeDropped); Specialized.DropBoostersWithIds(boostersToBeDropped); } public void AddCurrency(PerBoosterCategoryInt boosterCurrency) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) Basic.Currency += (int)((float)boosterCurrency.Basic * CurrencyGainMultiplier); Advanced.Currency += (int)((float)boosterCurrency.Advanced * CurrencyGainMultiplier); Specialized.Currency += (int)((float)boosterCurrency.Specialized * CurrencyGainMultiplier); } public bool TryAddBooster(LocalDropServerBoosterImplantInventoryItem newBooster) { if (!GetCategory(newBooster.Category).TryAddBooster(newBooster)) { return false; } uint[] array = new uint[New.Length + 1]; for (int i = 0; i < New.Length; i++) { array[i] = New[i]; } array[New.Length] = newBooster.InstanceId; New = array; return true; } public uint[] GetUsedIds() { CustomCategory[] allCategories = GetAllCategories(); List<uint> list = new List<uint>(); CustomCategory[] array = allCategories; foreach (CustomCategory customCategory in array) { uint[] usedIds = customCategory.GetUsedIds(); foreach (uint item in usedIds) { list.Add(item); } } return list.ToArray(); } public CustomCategory[] GetAllCategories() { return new CustomCategory[3] { Basic, Advanced, Specialized }; } public CustomCategory GetCategory(LocalBoosterImplant.SaveBoosterImplantCategory category) { return category switch { LocalBoosterImplant.SaveBoosterImplantCategory.Muted => Basic, LocalBoosterImplant.SaveBoosterImplantCategory.Bold => Advanced, LocalBoosterImplant.SaveBoosterImplantCategory.Aggressive => Specialized, _ => null, }; } public BoosterImplantPlayerData ToBaseGame() { return ToBaseGame(this); } public static BoosterImplantPlayerData ToBaseGame(LocalBoosterImplantPlayerData customData) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown BoosterImplantPlayerData val = new BoosterImplantPlayerData(ClassInjector.DerivedConstructorPointer<BoosterImplantPlayerData>()); val.New = Il2CppStructArray<uint>.op_Implicit(customData.New); val.Basic = customData.Basic.ToBaseGame(); val.Advanced = customData.Advanced.ToBaseGame(); val.Specialized = customData.Specialized.ToBaseGame(); return val; } public static LocalBoosterImplantPlayerData FromBaseGame(BoosterImplantPlayerData data) { LocalBoosterImplantPlayerData localBoosterImplantPlayerData = new LocalBoosterImplantPlayerData(); localBoosterImplantPlayerData.Basic = CustomCategory.FromBaseGame(data.Basic); localBoosterImplantPlayerData.Basic.CategoryType = LocalBoosterImplant.SaveBoosterImplantCategory.Muted; localBoosterImplantPlayerData.Advanced = CustomCategory.FromBaseGame(data.Advanced); localBoosterImplantPlayerData.Advanced.CategoryType = LocalBoosterImplant.SaveBoosterImplantCategory.Bold; localBoosterImplantPlayerData.Specialized = CustomCategory.FromBaseGame(data.Specialized); localBoosterImplantPlayerData.Specialized.CategoryType = LocalBoosterImplant.SaveBoosterImplantCategory.Aggressive; localBoosterImplantPlayerData.New = new uint[((Il2CppArrayBase<uint>)(object)data.New).Count]; for (int i = 0; i < ((Il2CppArrayBase<uint>)(object)data.New).Count; i++) { localBoosterImplantPlayerData.New[i] = ((Il2CppArrayBase<uint>)(object)data.New)[i]; } return localBoosterImplantPlayerData; } } public class LocalDropServerBoosterImplantInventoryItem : LocalBoosterImplant { public uint Flags { get; set; } = 0u; [JsonIgnore] public bool IsTouched { get { return (Flags & 1) != 0; } set { if (value) { Flags |= 1u; return; } uint num = 4294967294u; Flags &= num; } } [JsonConstructor] public LocalDropServerBoosterImplantInventoryItem() { } public LocalDropServerBoosterImplantInventoryItem(uint templateId, uint instanceId, int uses, Effect[] effects, uint[] conditions) : base(templateId, instanceId, uses, effects, conditions) { } public BoosterImplantInventoryItem ToBaseGame() { return ToBaseGame(this); } public static BoosterImplantInventoryItem ToBaseGame(LocalDropServerBoosterImplantInventoryItem custom) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Expected O, but got Unknown //IL_0040: 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) BoosterImplantInventoryItem val = new BoosterImplantInventoryItem(ClassInjector.DerivedConstructorPointer<BoosterImplantInventoryItem>()); ((BoosterImplantBase)val).Effects = Il2CppStructArray<BoosterImplantEffect>.op_Implicit((BoosterImplantEffect[])(object)new BoosterImplantEffect[custom.Effects.Length]); for (int i = 0; i < custom.Effects.Length; i++) { Effect effect = custom.Effects[i]; ((Il2CppArrayBase<BoosterImplantEffect>)(object)((BoosterImplantBase)val).Effects)[i] = new BoosterImplantEffect { Id = effect.Id, Param = effect.Value }; } ((BoosterImplantBase)val).TemplateId = custom.TemplateId; ((BoosterImplantBase)val).Id = custom.InstanceId; ((BoosterImplantBase)val).Conditions = Il2CppStructArray<uint>.op_Implicit(new uint[custom.Conditions.Length]); for (int j = 0; j < custom.Conditions.Length; j++) { ((Il2CppArrayBase<uint>)(object)((BoosterImplantBase)val).Conditions)[j] = custom.Conditions[j]; } ((BoosterImplantBase)val).UsesRemaining = custom.Uses; val.Flags = custom.Flags; return val; } public static LocalDropServerBoosterImplantInventoryItem FromBaseGame(BoosterImplantInventoryItem implant) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_003d: 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) LocalDropServerBoosterImplantInventoryItem localDropServerBoosterImplantInventoryItem = new LocalDropServerBoosterImplantInventoryItem(); Effect[] array = new Effect[((Il2CppArrayBase<BoosterImplantEffect>)(object)((BoosterImplantBase)implant).Effects).Length]; LocalBoosterImplant localBoosterImplant = new LocalBoosterImplant(); for (int i = 0; i < ((Il2CppArrayBase<BoosterImplantEffect>)(object)((BoosterImplantBase)implant).Effects).Length; i++) { BoosterImplantEffect val = ((Il2CppArrayBase<BoosterImplantEffect>)(object)((BoosterImplantBase)implant).Effects)[i]; array[i] = new Effect { Value = val.Param, Id = val.Id }; } localBoosterImplant.TemplateId = ((BoosterImplantBase)implant).TemplateId; localBoosterImplant.InstanceId = ((BoosterImplantBase)implant).Id; localBoosterImplant.Uses = ((BoosterImplantBase)implant).UsesRemaining; localBoosterImplant.Effects = array; localBoosterImplant.Conditions = Il2CppArrayBase<uint>.op_Implicit((Il2CppArrayBase<uint>)(object)((BoosterImplantBase)implant).Conditions); localDropServerBoosterImplantInventoryItem.Flags = implant.Flags; return localDropServerBoosterImplantInventoryItem; } } } namespace SimpleProgression.Interfaces { public interface ILogger { void Success(string msg); void Notice(string msg); void Msg(ConsoleColor col, string msg); void Info(string msg); void Fail(string msg); void Debug(string msg); void Warning(string msg); void Error(string msg); void Exception(Exception ex); } } namespace SimpleProgression.Impl { internal class LocalDropServerAPI : Object { public LocalDropServerAPI() : base(ClassInjector.DerivedConstructorPointer<LocalDropServerAPI>()) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public LocalDropServerAPI(IntPtr ptr) : base(ptr) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public Task<RundownProgressionResult> RundownProgressionAsync(RundownProgressionRequest request) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown Plugin.L.Warning($"{"LocalDropServerAPI"}: {"RundownProgressionAsync"}: {request.Rundown}"); LocalRundownProgression orCreateLocalProgression = LocalProgressionManager.Instance.GetOrCreateLocalProgression(request.Rundown); return Task.FromResult<RundownProgressionResult>(new RundownProgressionResult { Rundown = orCreateLocalProgression.ToBaseGameProgression() }); } public Task<ClearRundownProgressionResult> ClearRundownProgressionAsync(ClearRundownProgressionRequest request) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Plugin.L.Warning("LocalDropServerAPI: ClearRundownProgressionAsync"); return Task.FromResult<ClearRundownProgressionResult>(new ClearRundownProgressionResult()); } public Task<NewSessionResult> NewSessionAsync(NewSessionRequest request) { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown Plugin.L.Warning($"{"LocalDropServerAPI"}: {"NewSessionAsync"}: {request.Rundown} {request.Expedition} {request.SessionId}"); LocalProgressionManager.Instance.StartNewExpeditionSession(request.Rundown, request.Expedition, request.SessionId); LocalBoosterManager.Instance.StartSession(Il2CppArrayBase<uint>.op_Implicit((Il2CppArrayBase<uint>)(object)request.BoosterIds), request.SessionId); return Task.FromResult<NewSessionResult>(new NewSessionResult { SessionBlob = "Chat, is this real?! " + request.SessionId }); } public Task<LayerProgressionResult> LayerProgressionAsync(LayerProgressionRequest request) { //IL_0091: 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_00a8: Expected O, but got Unknown Plugin.L.Warning($"{"LocalDropServerAPI"}: {"LayerProgressionAsync"} Layer: {request.Layer}, State: {request.LayerProgressionState}"); LocalProgressionManager.Instance.IncreaseLayerProgression(request.Layer, request.LayerProgressionState); return Task.FromResult<LayerProgressionResult>(new LayerProgressionResult { SessionBlob = ((SessionRequestBase)request).SessionBlob }); } public Task<EndSessionResult> EndSessionAsync(EndSessionRequest request) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Expected O, but got Unknown PerBoosterCategoryInt boosterCurrency = request.BoosterCurrency; Plugin.L.Warning($"{"LocalDropServerAPI"}: {"EndSessionAsync"} Success: {request.Success}, BoosterCurrency: M:{boosterCurrency.Basic}, B:{boosterCurrency.Advanced}, A:{boosterCurrency.Specialized}"); LocalProgressionManager.Instance.EndCurrentExpeditionSession(request.Success); LocalBoosterManager.Instance.EndSession(request.BoosterCurrency); return Task.FromResult<EndSessionResult>(new EndSessionResult()); } public Task<GetBoosterImplantPlayerDataResult> GetBoosterImplantPlayerDataAsync(GetBoosterImplantPlayerDataRequest request) { //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_0032: Expected O, but got Unknown Plugin.L.Warning("LocalDropServerAPI: GetBoosterImplantPlayerDataAsync"); return Task.FromResult<GetBoosterImplantPlayerDataResult>(new GetBoosterImplantPlayerDataResult { Data = LocalBoosterManager.Instance.GetBoosterImplantPlayerData(request.MaxBackendTemplateId) }); } public Task<UpdateBoosterImplantPlayerDataResult> UpdateBoosterImplantPlayerDataAsync(UpdateBoosterImplantPlayerDataRequest request) { //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_0032: Expected O, but got Unknown Plugin.L.Warning("LocalDropServerAPI: UpdateBoosterImplantPlayerDataAsync"); return Task.FromResult<UpdateBoosterImplantPlayerDataResult>(new UpdateBoosterImplantPlayerDataResult { Data = LocalBoosterManager.Instance.UpdateBoosterImplantPlayerData(request.Transaction) }); } public Task<ConsumeBoostersResult> ConsumeBoostersAsync(ConsumeBoostersRequest request) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Expected O, but got Unknown Plugin.L.Warning("LocalDropServerAPI: ConsumeBoostersAsync"); LocalBoosterManager.Instance.ConsumeBoosters(((SessionRequestBase)request).SessionBlob); return Task.FromResult<ConsumeBoostersResult>(new ConsumeBoostersResult { SessionBlob = ((SessionRequestBase)request).SessionBlob }); } public Task<GetInventoryPlayerDataResult> GetInventoryPlayerDataAsync(GetInventoryPlayerDataRequest request) { //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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown Plugin.L.Warning("LocalDropServerAPI: GetInventoryPlayerDataAsync"); return Task.FromResult<GetInventoryPlayerDataResult>(new GetInventoryPlayerDataResult { Boosters = LocalBoosterManager.Instance.GetBoosterImplantPlayerData(request.MaxBackendTemplateId), VanityItems = LocalVanityItemManager.Instance.GetVanityItemPlayerData() }); } public Task<UpdateVanityItemPlayerDataResult> UpdateVanityItemPlayerDataAsync(UpdateVanityItemPlayerDataRequest request) { //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_0032: Expected O, but got Unknown Plugin.L.Warning("LocalDropServerAPI: UpdateVanityItemPlayerDataAsync"); return Task.FromResult<UpdateVanityItemPlayerDataResult>(new UpdateVanityItemPlayerDataResult { Data = LocalVanityItemManager.Instance.ProcessTransaction(request.Transaction) }); } public Task<DebugBoosterImplantResult> DebugBoosterImplantAsync(DebugBoosterImplantRequest request) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Plugin.L.Warning("LocalDropServerAPI: DebugBoosterImplantAsync"); return Task.FromResult<DebugBoosterImplantResult>(new DebugBoosterImplantResult()); } public Task<DebugVanityItemResult> DebugVanityItemAsync(DebugVanityItemRequest request) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown Plugin.L.Warning("LocalDropServerAPI: DebugVanityItemAsync"); return Task.FromResult<DebugVanityItemResult>(new DebugVanityItemResult()); } public Task<AddResult> AddAsync(AddRequest request) { //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_002f: Expected O, but got Unknown Plugin.L.Warning("LocalDropServerAPI: AddAsync"); return Task.FromResult<AddResult>(new AddResult { Sum = request.X + request.Y }); } public Task<IsTesterResult> IsTesterAsync(IsTesterRequest request) { //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_0023: Expected O, but got Unknown Plugin.L.Warning("LocalDropServerAPI: IsTesterAsync"); return Task.FromResult<IsTesterResult>(new IsTesterResult { IsTester = false }); } } } namespace SimpleProgression.Core { public class LocalBoosterDropper { private static LocalBoosterDropper _instance; private readonly ILogger _logger; public static LocalBoosterDropper Instance => _instance ?? (_instance = new LocalBoosterDropper(Plugin.L)); public bool Inited { get; private set; } = false; public BoosterImplantTemplateDataBlock[] MutedTemplates { get; private set; } public BoosterImplantTemplateDataBlock[] BoldTemplates { get; private set; } public BoosterImplantTemplateDataBlock[] AgrressiveTemplates { get; private set; } public BoosterImplantEffectDataBlock[] Effects { get; private set; } public BoosterImplantConditionDataBlock[] Conditions { get; private set; } public static int BOOSTER_DROP_MAX_REROLL_COUNT { get; internal set; } = 25; private LocalBoosterDropper(ILogger logger) { _logger = logger; } public void Init() { if (Inited) { _logger.Info("LocalBoosterDropper already setup, skipping ..."); return; } _logger.Info("Setting up LocalBoosterDropper ..."); Load(); Inited = true; } internal void Load() { BoosterImplantTemplateDataBlock[] source = Il2CppArrayBase<BoosterImplantTemplateDataBlock>.op_Implicit(GameDataBlockBase<BoosterImplantTemplateDataBlock>.GetAllBlocks()); MutedTemplates = source.Where((BoosterImplantTemplateDataBlock t) => (int)t.ImplantCategory == 0).ToArray(); BoldTemplates = source.Where((BoosterImplantTemplateDataBlock t) => (int)t.ImplantCategory == 1).ToArray(); AgrressiveTemplates = source.Where((BoosterImplantTemplateDataBlock t) => (int)t.ImplantCategory == 2).ToArray(); Effects = Il2CppArrayBase<BoosterImplantEffectDataBlock>.op_Implicit(GameDataBlockBase<BoosterImplantEffectDataBlock>.GetAllBlocks()); Conditions = Il2CppArrayBase<BoosterImplantConditionDataBlock>.op_Implicit(GameDataBlockBase<BoosterImplantConditionDataBlock>.GetAllBlocks()); if (MutedTemplates.Length == 0 && BoldTemplates.Length == 0 && AgrressiveTemplates.Length == 0) { LocalBoosterManager.Instance.Disabled = true; _logger.Msg(ConsoleColor.Magenta, "LocalBoosterDropper.Init() complete, no templates set -> boosters disabled!"); return; } _logger.Msg(ConsoleColor.Magenta, $"{"LocalBoosterDropper"}.{"Init"}() complete, retrieved {MutedTemplates.Length} Muted, {BoldTemplates.Length} Bold and {AgrressiveTemplates.Length} Agrressive Templates as well as {Effects?.Length} Effects and {Conditions?.Length} Conditions."); } private void InitCheck() { if (!Inited) { throw new InvalidOperationException("LocalVanityItemDropper has not been initialized yet!"); } } public LocalDropServerBoosterImplantInventoryItem GenerateBooster(LocalBoosterImplant.SaveBoosterImplantCategory category, uint[] usedIds) { InitCheck(); float num = 1f; int num2 = 0; BoosterImplantTemplateDataBlock val; do { val = (BoosterImplantTemplateDataBlock)(category switch { LocalBoosterImplant.SaveBoosterImplantCategory.Bold => BoldTemplates[Random.Range(0, BoldTemplates.Length)], LocalBoosterImplant.SaveBoosterImplantCategory.Aggressive => AgrressiveTemplates[Random.Range(0, AgrressiveTemplates.Length)], _ => MutedTemplates[Random.Range(0, MutedTemplates.Length)], }); if (val != null) { if (num2 > BOOSTER_DROP_MAX_REROLL_COUNT) { break; } num = 1f; if (val.DropWeight != 0f) { num = 1f / val.DropWeight; } num2++; } } while (val == null || Random.Range(0f, 1f) > num); int uses = category switch { LocalBoosterImplant.SaveBoosterImplantCategory.Bold => Random.Range(1, 3), LocalBoosterImplant.SaveBoosterImplantCategory.Aggressive => Random.Range(2, 4), _ => 1, }; List<uint> conditionIds = new List<uint>(); List<LocalBoosterImplant.Effect> effects = new List<LocalBoosterImplant.Effect>(); Enumerator<BoosterImplantEffectInstance> enumerator = val.Effects.GetEnumerator(); while (enumerator.MoveNext()) { BoosterImplantEffectInstance current = enumerator.Current; effects.Add(new LocalBoosterImplant.Effect { Id = current.BoosterImplantEffect, Value = Random.Range(current.MinValue, current.MaxValue) }); } Enumerator<List<BoosterImplantEffectInstance>> enumerator2 = val.RandomEffects.GetEnumerator(); while (enumerator2.MoveNext()) { List<BoosterImplantEffectInstance> current2 = enumerator2.Current; if (current2 != null && current2.Count >= 1) { BoosterImplantEffectInstance val2 = current2[Random.Range(0, current2.Count)]; effects.Add(new LocalBoosterImplant.Effect { Id = val2.BoosterImplantEffect, Value = Random.Range(val2.MinValue, val2.MaxValue) }); } } Enumerator<uint> enumerator3 = val.Conditions.GetEnumerator(); while (enumerator3.MoveNext()) { uint current3 = enumerator3.Current; conditionIds.Add(current3); } if (val.RandomConditions != null && val.RandomConditions.Count > 0) { conditionIds.Add(val.RandomConditions[Random.Range(0, val.RandomConditions.Count)]); } uint instanceId = GenerateInstanceId(usedIds); LocalDropServerBoosterImplantInventoryItem localDropServerBoosterImplantInventoryItem = new LocalDropServerBoosterImplantInventoryItem(((GameDataBlockBase<BoosterImplantTemplateDataBlock>)(object)val).persistentID, instanceId, uses, effects.ToArray(), conditionIds.ToArray()); localDropServerBoosterImplantInventoryItem.Category = category; localDropServerBoosterImplantInventoryItem.Template = val; BoosterImplantEffectDataBlock val3 = null; BoosterImplantConditionDataBlock val4 = null; try { if (effects.Count > 0) { val3 = Effects.First((BoosterImplantEffectDataBlock ef) => ((GameDataBlockBase<BoosterImplantEffectDataBlock>)(object)ef).persistentID == effects[0].Id); } if (conditionIds.Count > 0) { val4 = Conditions.First((BoosterImplantConditionDataBlock cd) => ((GameDataBlockBase<BoosterImplantConditionDataBlock>)(object)cd).persistentID == conditionIds[0]); } } catch (Exception) { } _logger.Msg(ConsoleColor.Magenta, $"Generated booster: {val.PublicName} - {((val3 != null) ? val3.PublicShortName : null)} {((val4 != null) ? val4.PublicShortName : null)} ({((val3 != null) ? val3.PublicName : null)} when {((val4 != null) ? val4.PublicName : null)})"); return localDropServerBoosterImplantInventoryItem; } private static uint GenerateInstanceId(uint[] usedIds) { if (usedIds == null || usedIds.Length == 0) { return 1u; } uint count; for (count = 1u; usedIds.Any((uint i) => i == count); count++) { } return count; } public void GenerateAndAddBooster(ref LocalBoosterImplantPlayerData data, LocalBoosterImplant.SaveBoosterImplantCategory category) { InitCheck(); LocalDropServerBoosterImplantInventoryItem newBooster = GenerateBooster(category, data.GetUsedIds()); if (!data.TryAddBooster(newBooster)) { _logger.Info($"Did not add Booster as the inventory for category {category} is full! (This message should not appear!)"); } } } public class LocalBoosterManager { private static LocalBoosterManager _instance; private readonly ILogger _logger; private static LocalBoosterImplantPlayerData _localBoosterImplantPlayerData = null; public static LocalBoosterManager Instance => _instance ?? (_instance = new LocalBoosterManager(Plugin.L)); public bool Disabled { get; internal set; } = false; public static bool DoConsumeBoosters { get; set; } = true; public static LocalBoosterImplantPlayerData LocalBoosterImplantPlayerData => _localBoosterImplantPlayerData ?? (_localBoosterImplantPlayerData = LoadFromBoosterFile()); public static uint[] BoostersToBeConsumed { get; private set; } = Array.Empty<uint>(); public static LocalBoosterDropper BoosterDropper => LocalBoosterDropper.Instance; private LocalBoosterManager(ILogger logger) { _logger = logger; } internal static void SaveBoostersToDisk() { SaveToBoosterFile(LocalBoosterImplantPlayerData); } internal BoosterImplantPlayerData UpdateBoosterImplantPlayerData(BoosterImplantTransaction transaction) { if (Instance.Disabled) { return LocalBoosterImplantPlayerData.ToBaseGame(); } if (transaction.DropIds != null) { LocalBoosterImplantPlayerData.DropBoostersWithIds(((IEnumerable<uint>)transaction.DropIds).ToArray()); } if (transaction.TouchIds != null) { LocalBoosterImplantPlayerData.SetBoostersTouchedWithIds(((IEnumerable<uint>)transaction.TouchIds).ToArray()); } if (transaction.AcknowledgeIds != null) { LocalBoosterImplantPlayerData.AcknowledgeBoostersWithIds(((IEnumerable<uint>)transaction.AcknowledgeIds).ToArray()); } if (transaction.AcknowledgeMissed != null) { LocalBoosterImplantPlayerData.AcknowledgeMissedBoostersWithIds(transaction.AcknowledgeMissed); } SaveBoostersToDisk(); return LocalBoosterImplantPlayerData.ToBaseGame(); } public BoosterImplantPlayerData GetBoosterImplantPlayerData(uint maxBackendTemplateId) { SaveBoostersToDisk(); return LocalBoosterImplantPlayerData.ToBaseGame(); } public void ConsumeBoosters(string sessionBlob) { if (!Instance.Disabled) { if (DoConsumeBoosters) { LocalBoosterImplantPlayerData.ConsumeBoostersWithIds(BoostersToBeConsumed); SaveBoostersToDisk(); } BoostersToBeConsumed = Array.Empty<uint>(); } } internal void EndSession(PerBoosterCategoryInt boosterCurrency) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) if (Instance.Disabled) { return; } LocalBoosterImplantPlayerData.AddCurrency(boosterCurrency); LocalBoosterImplantPlayerData.CustomCategory[] categoriesWhereCurrencyCostHasBeenReached = LocalBoosterImplantPlayerData.GetCategoriesWhereCurrencyCostHasBeenReached(); LocalBoosterImplantPlayerData.CustomCategory[] array = categoriesWhereCurrencyCostHasBeenReached; foreach (LocalBoosterImplantPlayerData.CustomCategory customCategory in array) { while (customCategory.HasEnoughCurrencyForDrop) { customCategory.Currency -= LocalBoosterImplantPlayerData.CurrencyNewBoosterCost; if (customCategory.InventoryIsFull) { _logger.Warning($"Inventory full, missed 1 {customCategory.CategoryType} booster."); customCategory.Missed++; } else { _logger.Notice($"Generating 1 {customCategory.CategoryType} booster ... [CurrencyRemaining:{customCategory.Currency}]"); BoosterDropper.GenerateAndAddBooster(ref _localBoosterImplantPlayerData, customCategory.CategoryType); } } } SaveBoostersToDisk(); } internal void StartSession(uint[] boosterIds, string sessionId) { BoostersToBeConsumed = boosterIds; } private static void SaveToBoosterFile(LocalBoosterImplantPlayerData data) { if (!Instance.Disabled) { if (data == null) { throw new ArgumentNullException("data"); } Instance._logger.Msg(ConsoleColor.DarkRed, "Saving boosters to disk at: " + Paths.BoostersFilePath); string contents = JsonConvert.SerializeObject((object)data, (Formatting)1); File.WriteAllText(Paths.BoostersFilePath, contents); } } private static LocalBoosterImplantPlayerData LoadFromBoosterFile() { if (Instance.Disabled) { return new LocalBoosterImplantPlayerData(); } Instance._logger.Msg(ConsoleColor.Green, "Loading boosters from disk at: " + Paths.BoostersFilePath); if (!File.Exists(Paths.BoostersFilePath)) { return new LocalBoosterImplantPlayerData(); } string text = File.ReadAllText(Paths.BoostersFilePath); return JsonConvert.DeserializeObject<LocalBoosterImplantPlayerData>(text); } } public class LocalProgressionManager { private static LocalProgressionManager _instance; private readonly ILogger _logger; public static LocalProgressionManager Instance => _instance ?? (_instance = new LocalProgressionManager(Plugin.L)); public ExpeditionSession CurrentActiveSession { get; private set; } public Dictionary<string, LocalRundownProgression> LoadedProgressionData { get; } = new Dictionary<string, LocalRundownProgression>(); public static event Action<ExpeditionSession> OnExpeditionEntered; public static event Action<ExpeditionCompletionData> OnExpeditionCompleted; private LocalProgressionManager(ILogger logger) { _logger = logger; } public bool TryGetLocalProgression(string rundownKey, out LocalRundownProgression progression) { return LoadedProgressionData.TryGetValue(rundownKey, out progression); } public LocalRundownProgression GetOrCreateLocalProgression(uint rundownDataBlockPersistentId) { return GetOrCreateLocalProgression($"Local_{rundownDataBlockPersistentId}"); } public LocalRundownProgression GetOrCreateLocalProgression(string rundownKeyToLoad) { if (string.IsNullOrWhiteSpace(rundownKeyToLoad)) { throw new ArgumentException(null, "rundownKeyToLoad"); } if (TryGetLocalProgression(rundownKeyToLoad, out var progression)) { return progression; } LocalRundownProgression localRundownProgression = LoadFromProgressionFile(rundownKeyToLoad); LoadedProgressionData.Add(rundownKeyToLoad, localRundownProgression); return localRundownProgression; } public void StartNewExpeditionSession(string rundownKey, string expeditionId, string sessionId) { CurrentActiveSession = ExpeditionSession.InitNewSession(rundownKey, expeditionId, sessionId, _logger); } public void OnLevelEntered() { CurrentActiveSession?.OnLevelEntered(); LocalProgressionManager.OnExpeditionEntered?.Invoke(CurrentActiveSession); } internal void IncreaseLayerProgression(string strLayer, string strState) { if (!Enum.TryParse<Layers>(strLayer, out var result) | !Enum.TryParse<LayerState>(strState, out var result2)) { _logger.Error($"Either {"Layers"} and/or {"LayerState"} could not be parsed! ({strLayer}, {strState})"); } else { CurrentActiveSession?.SetLayer(result, result2); } } internal void SaveAtCheckpoint() { CurrentActiveSession?.OnCheckpointSave(); } internal void ReloadFromCheckpoint() { CurrentActiveSession?.OnCheckpointReset(); } internal void ArtifactCountUpdated(int mutedCount, int boldCount, int aggressiveCount) { if (CurrentActiveSession != null) { CurrentActiveSession.MutedArtifactsCollected = mutedCount; CurrentActiveSession.BoldArtifactsCollected = boldCount; CurrentActiveSession.AggressiveArtifactsCollected = aggressiveCount; _logger.Info($"current Artifact count: Muted:{mutedCount}, Bold:{boldCount}, Aggressive:{aggressiveCount}"); } } internal void EndCurrentExpeditionSession(bool success) { CurrentActiveSession?.OnExpeditionCompleted(success); string text = CurrentActiveSession?.RundownKey; LocalRundownProgression orCreateLocalProgression = GetOrCreateLocalProgression(text); ExpeditionCompletionData completionData; bool flag = orCreateLocalProgression.AddSessionResults(CurrentActiveSession, out completionData); SaveToProgressionFile(orCreateLocalProgression, text); CurrentActiveSession = null; if (flag) { _logger.Notice($"Expedition time: {completionData.RawSessionData.EndTime - completionData.RawSessionData.StartTime}"); LocalProgressionManager.OnExpeditionCompleted?.Invoke(completionData); } } private void SaveToProgressionFile(LocalRundownProgression data, string rundownKey) { SaveToProgressionFile(data, rundownKey, out var path); Instance._logger.Msg(ConsoleColor.DarkRed, "Saved progression file to disk at: " + path); } private static void SaveToProgressionFile(LocalRundownProgression data, string rundownKeyToSave, out string path) { if (data == null) { throw new ArgumentNullException("data"); } if (string.IsNullOrEmpty(rundownKeyToSave)) { throw new InvalidOperationException("rundownKeyToSave"); } path = GetLocalProgressionFilePath(rundownKeyToSave); string contents = JsonConvert.SerializeObject((object)data, (Formatting)1); File.WriteAllText(path, contents); } private static string GetLocalProgressionFilePath(string rundownKey) { char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); foreach (char oldChar in invalidFileNameChars) { rundownKey = rundownKey.Replace(oldChar, '_'); } return Path.Combine(Paths.SaveFolderPath, rundownKey + ".json"); } private LocalRundownProgression LoadFromProgressionFile(string rundownKey) { string path; bool isNew; LocalRundownProgression localRundownProgression = LoadFromProgressionFile(rundownKey, out path, out isNew); if (isNew) { Instance._logger.Msg(ConsoleColor.Green, "Created progression file at: " + path); SaveToProgressionFile(localRundownProgression, rundownKey, out var path2); Instance._logger.Msg(ConsoleColor.DarkRed, "Saved fresh progression file to disk at: " + path2); } else { Instance._logger.Msg(ConsoleColor.Green, "Loaded progression file from disk at: " + path); } return localRundownProgression; } private static LocalRundownProgression LoadFromProgressionFile(string rundownKey, out string path, out bool isNew) { path = GetLocalProgressionFilePath(rundownKey); if (!File.Exists(path)) { isNew = true; return new LocalRundownProgression(); } isNew = false; string text = File.ReadAllText(path); return JsonConvert.DeserializeObject<LocalRundownProgression>(text); } } public class LocalVanityItemDropper { private static LocalVanityItemDropper _instance; private readonly ILogger _logger; public static LocalVanityItemDropper Instance => _instance ?? (_instance = new LocalVanityItemDropper(Plugin.L)); public bool IsSetup { get; private set; } public VanityItemsGroupDataBlock[] ItemGroups { get; private set; } public VanityItemsTemplateDataBlock[] ItemTemplates { get; private set; } public VanityItemsLayerDropsDataBlock[] ItemDropData { get; private set; } public static event Action<LocalVanityItemDropper> OnSetupDone; private LocalVanityItemDropper(ILogger logger) { _logger = logger; } private void InitCheck() { if (!IsSetup) { throw new InvalidOperationException("LocalVanityItemDropper has not been initialized yet!"); } } internal void Init() { if (IsSetup) { _logger.Info("LocalVanityItemDropper already setup, skipping ..."); return; } LoadTemplatesGroupsAndDropData(); IsSetup = true; LocalVanityItemDropper.OnSetupDone?.Invoke(this); } internal void LoadTemplatesGroupsAndDropData() { ItemGroups = Il2CppArrayBase<VanityItemsGroupDataBlock>.op_Implicit(GameDataBlockBase<VanityItemsGroupDataBlock>.GetAllBlocks()); ItemTemplates = Il2CppArrayBase<VanityItemsTemplateDataBlock>.op_Implicit(GameDataBlockBase<VanityItemsTemplateDataBlock>.GetAllBlocks()); ItemDropData = Il2CppArrayBase<VanityItemsLayerDropsDataBlock>.op_Implicit(GameDataBlockBase<VanityItemsLayerDropsDataBlock>.GetAllBlocks()); if (ItemGroups.Length == 0 && ItemDropData.Length == 0) { _logger.Msg(ConsoleColor.Magenta, $"{"LocalVanityItemDropper"}.{"Init"}() complete, no groups or layer drops set! (Found {ItemTemplates.Length} Templates)"); return; } _logger.Msg(ConsoleColor.Magenta, $"{"LocalVanityItemDropper"}.{"Init"}() complete, retrieved {ItemTemplates.Length} Templates, {ItemGroups.Length} Groups and {ItemDropData.Length} Layer Drops. Layer Drops:"); VanityItemsLayerDropsDataBlock[] itemDropData = ItemDropData; foreach (VanityItemsLayerDropsDataBlock val in itemDropData) { _logger.Info($" > {((GameDataBlockBase<VanityItemsLayerDropsDataBlock>)(object)val).name}: #Drops: {val.LayerDrops?.Count ?? 0}, Enabled: {((GameDataBlockBase<VanityItemsLayerDropsDataBlock>)(object)val).internalEnabled}"); } } public bool TryGetGroup(uint persistentID, out VanityItemsGroupDataBlock itemGroup) { InitCheck(); VanityItemsGroupDataBlock[] itemGroups = ItemGroups; foreach (VanityItemsGroupDataBlock val in itemGroups) { if (((GameDataBlockBase<VanityItemsGroupDataBlock>)(object)val).persistentID == persistentID) { itemGroup = val; return true; } } itemGroup = null; return false; } public bool DropRandomFromGroup(uint groupID, LocalVanityItemStorage playerData, bool silentDrop = false) { InitCheck(); if (!TryGetGroup(groupID, out var itemGroup) || itemGroup.HasAllOwned(playerData)) { return false; } _logger.Msg(ConsoleColor.Magenta, $"Attempting drop of 1 Vanity Item from group \"{((GameDataBlockBase<VanityItemsGroupDataBlock>)(object)itemGroup).name}\" (ID:{groupID})"); if (!itemGroup.GetNonOwned(playerData).TryPickRandom(out var value)) { _logger.Info("All items in group already in local player inventory, not dropping!"); return false; } if (!TryGetTemplate(value, out var template)) { _logger.Warning($"Template with ID {value} wasn't found!"); } LocalVanityItemStorage.LocalVanityItem item = new LocalVanityItemStorage.LocalVanityItem { ItemID = value, Flags = (silentDrop ? LocalVanityItemStorage.VanityItemFlags.ALL : LocalVanityItemStorage.VanityItemFlags.None), CustomKey = (IsCustomGroup(itemGroup) ? ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)template).name : null) }; playerData.Items.Add(item); _logger.Info("Dropped Vanity Item \"" + (((template != null) ? template.publicName : null) ?? $"ID:{value}") + "\"!"); return true; } public bool TryDropCustomItem(VanityItemsTemplateDataBlock template, bool silentDrop = false, bool doDropAlreadyOwnedItem = false) { InitCheck(); LocalVanityItemStorage localVanityItemPlayerData = LocalVanityItemManager.Instance.LocalVanityItemPlayerData; if (doDropAlreadyOwnedItem || localVanityItemPlayerData.Items.FirstOrDefault((LocalVanityItemStorage.LocalVanityItem item) => item.IsCustom && item.CustomKey == ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)template).name) == null) { LocalVanityItemStorage.LocalVanityItem item2 = new LocalVanityItemStorage.LocalVanityItem { CustomKey = ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)template).name, ItemID = ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)template).persistentID, Flags = (silentDrop ? LocalVanityItemStorage.VanityItemFlags.ALL : LocalVanityItemStorage.VanityItemFlags.None) }; localVanityItemPlayerData.Items.Add(item2); ILogger logger = _logger; VanityItemsTemplateDataBlock obj = template; logger.Info("Dropped Custom Vanity Item \"" + (((obj != null) ? obj.publicName : null) ?? $"ID:{((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)template)?.persistentID ?? 0}") + "\"!"); return true; } ILogger logger2 = _logger; VanityItemsTemplateDataBlock obj2 = template; logger2.Info("Aborted drop of Custom Vanity Item \"" + (((obj2 != null) ? obj2.publicName : null) ?? $"ID:{((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)template)?.persistentID ?? 0}") + "\" because it's already owned!"); return false; } public bool TryGetTemplate(uint persistentID, out VanityItemsTemplateDataBlock template) { InitCheck(); template = ((IEnumerable<VanityItemsTemplateDataBlock>)ItemTemplates).FirstOrDefault((Func<VanityItemsTemplateDataBlock, bool>)((VanityItemsTemplateDataBlock t) => ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)t).persistentID == persistentID)); return template != null; } public bool HasAllItemsInGroup(uint groupID, LocalVanityItemStorage playerData) { InitCheck(); if (TryGetGroup(groupID, out var itemGroup)) { return itemGroup.HasAllOwned(playerData); } return false; } internal void DropFirstTimePlayingItems(LocalVanityItemStorage playerData) { InitCheck(); _logger.Warning("Dropping initial Vanity Items ..."); DropRandomFromGroup(3u, playerData, silentDrop: true); DropRandomFromGroup(4u, playerData, silentDrop: true); DropRandomFromGroup(5u, playerData, silentDrop: true); DropRandomFromGroup(6u, playerData, silentDrop: true); DropRandomFromGroup(7u, playerData, silentDrop: true); } internal bool TryGetBlockFromCustomKey(string customKey, out VanityItemsTemplateDataBlock block) { block = ((IEnumerable<VanityItemsTemplateDataBlock>)ItemTemplates).FirstOrDefault((Func<VanityItemsTemplateDataBlock, bool>)((VanityItemsTemplateDataBlock template) => ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)template).name == customKey)); return block != null; } internal bool IsCustomGroup(uint groupId) { if (!TryGetGroup(groupId, out var itemGroup)) { return false; } return IsCustomGroup(itemGroup); } internal bool IsCustomGroup(VanityItemsGroupDataBlock group) { return !AllVanityGroupsToUnlock.GAME_DEFAULT_GROUPS.Contains(((GameDataBlockBase<VanityItemsGroupDataBlock>)(object)group).name); } } public class LocalVanityItemManager { private static LocalVanityItemManager _instance; private readonly ILogger _logger; private LocalVanityItemStorage _localVanityItemStorage; private AllVanityGroupsToUnlock _allVanityGroupsToUnlock; private LocalVanityAcquiredLayerDrops _acquiredLayerDrops; public static LocalVanityItemManager Instance =>
Plugins/CustomPalettes.dll
Decompiled 2 weeks 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 AssetShards; using BepInEx; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using Clonesoft.Json; using CustomPalettes.Core; using CustomPalettes.Data; using GameData; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes.Arrays; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyFileVersion("1.1.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("CustomPalettes")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyProduct("CustomPalettes")] [assembly: AssemblyTitle("CustomPalettes")] [assembly: AssemblyVersion("1.1.0.0")] namespace CustomPalettes { [BepInPlugin("dev.aurirex.gtfo.custompalettes", "Custom Palettes", "1.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class EntryPoint : BasePlugin { public const string GUID = "dev.aurirex.gtfo.custompalettes"; public const string NAME = "Custom Palettes"; public const string VERSION = "1.1.0"; private Harmony _harmonyInstance; private static bool _hasInitedOnce; public override void Load() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected O, but got Unknown L.Logger = ((BasePlugin)this).Log; _harmonyInstance = new Harmony("dev.aurirex.gtfo.custompalettes"); _harmonyInstance.PatchAll(Assembly.GetExecutingAssembly()); PaletteManager.Setup(); PaletteManager.LoadPalettes(); } internal static void OnAssetShardManagerReady() { L.Debug("AssetShardManager ready, Injecting Palettes"); TextureLoader.Setup(PaletteManager.Palettes); PaletteManager.InjectPalettes(); } internal static void OnGameDataInit() { L.Debug("GameDataInit.Initialize called."); if (_hasInitedOnce) { L.Warning("Reloading Custom Palettes ..."); PaletteManager.LoadPalettes(); TextureLoader.Setup(PaletteManager.Palettes, doCleanup: true); PaletteManager.InjectPalettes(forceRegeneration: true); PersistentInventoryManager.m_dirty = true; } _hasInitedOnce = true; } } internal static class L { internal static ManualLogSource Logger { private get; set; } internal static void Info(string msg) { Logger.LogInfo((object)msg); } internal static void Msg(string msg) { Logger.LogMessage((object)msg); } internal static void Debug(string msg) { Logger.LogDebug((object)msg); } internal static void Warning(string msg) { Logger.LogWarning((object)msg); } internal static void Error(string msg) { Logger.LogError((object)msg); } internal static void Exception(Exception ex) { Logger.LogError((object)ex.Message); Logger.LogWarning((object)("StackTrace:\n" + ex.StackTrace)); } } public static class Patches { [HarmonyPatch(typeof(AssetShardManager), "Setup")] internal static class AssetShardManager_Setup_Patch { [HarmonyPriority(600)] public static void Postfix() { EntryPoint.OnAssetShardManagerReady(); } } [HarmonyPatch(typeof(GameDataInit), "Initialize")] internal static class GameDataInit_Initialize_Patch { [HarmonyPriority(600)] public static void Postfix() { EntryPoint.OnGameDataInit(); } } } } namespace CustomPalettes.Data { public class CustomPalette { public string Name { get; set; } = "Custom Palette"; public string Author { get; set; } = string.Empty; public string SortingName { get; set; } = "MyCustomPalette"; public uint VanityGroupID { get; set; } = 0u; public PaletteData Data { get; set; } = new PaletteData(); [JsonIgnore] public string FileName { get; internal set; } = string.Empty; } public class PaletteData { public class Tone { public string HexColor { get; set; } = "#FFFFFF"; public string TextureFile { get; set; } = string.Empty; public int MaterialOverride { get; set; } = -1; } [CompilerGenerated] private sealed class <get_Tones>d__27 : IEnumerable<Tone>, IEnumerable, IEnumerator<Tone>, IEnumerator, IDisposable { private int <>1__state; private Tone <>2__current; private int <>l__initialThreadId; public PaletteData <>4__this; Tone IEnumerator<Tone>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <get_Tones>d__27(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (<>4__this.PrimaryTone != null) { <>2__current = <>4__this.PrimaryTone; <>1__state = 1; return true; } goto IL_0079; case 1: <>1__state = -1; goto IL_0079; case 2: <>1__state = -1; goto IL_00ac; case 3: <>1__state = -1; goto IL_00df; case 4: <>1__state = -1; goto IL_0114; case 5: { <>1__state = -1; break; } IL_00df: if (<>4__this.QuaternaryTone != null) { <>2__current = <>4__this.QuaternaryTone; <>1__state = 4; return true; } goto IL_0114; IL_0079: if (<>4__this.SecondaryTone != null) { <>2__current = <>4__this.SecondaryTone; <>1__state = 2; return true; } goto IL_00ac; IL_00ac: if (<>4__this.TertiaryTone != null) { <>2__current = <>4__this.TertiaryTone; <>1__state = 3; return true; } goto IL_00df; IL_0114: if (<>4__this.QuinaryTone != null) { <>2__current = <>4__this.QuinaryTone; <>1__state = 5; return true; } break; } 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(); } [DebuggerHidden] IEnumerator<Tone> IEnumerable<Tone>.GetEnumerator() { <get_Tones>d__27 result; if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; result = this; } else { result = new <get_Tones>d__27(0) { <>4__this = <>4__this }; } return result; } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<Tone>)this).GetEnumerator(); } } [JsonIgnore] private static readonly Tone _errorTone = new Tone { m_color = Color.magenta, m_texture = Texture2D.whiteTexture, m_materialOverride = -1 }; public Tone PrimaryTone { get; set; } = new Tone(); public Tone SecondaryTone { get; set; } = new Tone(); public Tone TertiaryTone { get; set; } = new Tone(); public Tone QuaternaryTone { get; set; } = new Tone(); public Tone QuinaryTone { get; set; } = new Tone(); public float TextureTiling { get; set; } = 1f; [JsonIgnore] public IEnumerable<Tone> Tones { [IteratorStateMachine(typeof(<get_Tones>d__27))] get { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() <get_Tones>d__27 <get_Tones>d__ = new <get_Tones>d__27(-2); <get_Tones>d__.<>4__this = this; return <get_Tones>d__; } } internal Tone GetTone(int v) { return (Tone)(v switch { 2 => GetTone(SecondaryTone), 3 => GetTone(TertiaryTone), 4 => GetTone(QuaternaryTone), 5 => GetTone(QuinaryTone), _ => GetTone(PrimaryTone), }); } private static Tone GetTone(Tone tone) { //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_0063: 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_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown if (tone == null) { return _errorTone; } Color color = default(Color); if (!ColorUtility.TryParseHtmlString(tone.HexColor, ref color) && !ColorUtility.TryParseHtmlString("#" + tone.HexColor, ref color)) { return _errorTone; } Texture2D texture = TextureLoader.GetTexture(tone.TextureFile); return new Tone { m_color = color, m_texture = texture, m_materialOverride = tone.MaterialOverride }; } } } namespace CustomPalettes.Core { public class PaletteManager { private static string _path; private static readonly Dictionary<string, CustomPalette> _nameToPalette = new Dictionary<string, CustomPalette>(); private static readonly List<CustomPalette> _palettes = new List<CustomPalette>(); private static readonly JsonSerializerSettings _jsonSettings = new JsonSerializerSettings { Formatting = (Formatting)1 }; private const string TEMPLATE_FILE_NAME = "_template_palette.json"; public static string CustomPalettesPath => _path ?? (_path = Path.Combine(Paths.BepInExRootPath, "Assets", "CustomPalettes")); public static string BLOCK_PREFIX => "CustomPalette_".ToUpper(); public static bool DoLoadTemplateFile { get; set; } = false; public static IEnumerable<CustomPalette> Palettes => _palettes; public static bool TryGetPaletteFromBlock(VanityItemsTemplateDataBlock block, out CustomPalette palette) { return TryGetPaletteFromId(((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)block).name, out palette); } public static bool TryGetPaletteFromId(string identifier, out CustomPalette palette) { return _nameToPalette.TryGetValue(identifier, out palette); } internal static void Setup() { if (!Directory.Exists(CustomPalettesPath)) { Directory.CreateDirectory(CustomPalettesPath); } string path = Path.Combine(CustomPalettesPath, "_template_palette.json"); if (!File.Exists(path)) { string contents = JsonConvert.SerializeObject((object)GetTemplate(), _jsonSettings); File.WriteAllText(path, contents); } } internal static void LoadPalettes() { _palettes.Clear(); L.Info("Loading Custom Palettes from [" + CustomPalettesPath + "]!"); string[] files = Directory.GetFiles(CustomPalettesPath); foreach (string path in files) { string fileName = Path.GetFileName(path); if (Path.HasExtension(path) && !(Path.GetExtension(path) != ".json") && (!(fileName == "_template_palette.json") || DoLoadTemplateFile)) { try { CustomPalette customPalette = JsonConvert.DeserializeObject<CustomPalette>(File.ReadAllText(path), _jsonSettings); L.Info($"Loaded Custom Palette: ({customPalette.SortingName}): {customPalette.Author} | {customPalette.Name}"); customPalette.FileName = fileName; Sanitize(customPalette); _palettes.Add(customPalette); } catch (Exception ex) { L.Exception(ex); } } } } internal static void Sanitize(CustomPalette pal) { IEnumerable<PaletteData.Tone> enumerable = pal?.Data?.Tones; if (enumerable == null) { return; } foreach (PaletteData.Tone item in enumerable) { item.TextureFile = SanitizePath(item.TextureFile); } } internal static string SanitizePath(string tex) { char[] invalidPathChars = Path.GetInvalidPathChars(); foreach (char oldChar in invalidPathChars) { tex = tex.Replace(oldChar, '_'); } while (tex.Contains("..")) { tex = tex.Replace("..", ""); } return tex.Replace(":", ""); } private static CustomPalette GetTemplate() { return new CustomPalette { Author = "YourNameHere", Name = "Template Palette", SortingName = "UsedToSort", Data = new PaletteData { PrimaryTone = new PaletteData.Tone { HexColor = "#FF0000" }, SecondaryTone = new PaletteData.Tone { HexColor = "#00FF00" }, TertiaryTone = new PaletteData.Tone { HexColor = "#0000FF" }, QuaternaryTone = new PaletteData.Tone { HexColor = "#FFFF00" }, QuinaryTone = new PaletteData.Tone { HexColor = "#00FFFF" } } }; } private static bool TryGetBlock(string name, out VanityItemsTemplateDataBlock block) { block = GameDataBlockBase<VanityItemsTemplateDataBlock>.GetBlock(GameDataBlockBase<VanityItemsTemplateDataBlock>.GetBlockID(name)); return block != null; } internal static void InjectPalettes(bool forceRegeneration = false) { //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Expected O, but got Unknown L.Info($"Injecting {_palettes.Count} Custom Palettes ..."); IOrderedEnumerable<CustomPalette> orderedEnumerable = _palettes.OrderBy((CustomPalette pal) => $"{pal.Author}_{pal.SortingName}_{pal.FileName}"); _nameToPalette.Clear(); foreach (VanityItemsTemplateDataBlock allBlock in GameDataBlockBase<VanityItemsTemplateDataBlock>.GetAllBlocks()) { if (((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)allBlock).name.StartsWith(BLOCK_PREFIX)) { ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)allBlock).internalEnabled = false; } } foreach (CustomPalette item in orderedEnumerable) { try { string text = BLOCK_PREFIX + item.FileName.ToUpper(); if (TryGetBlock(text, out var block)) { L.Info($"Found existing block for \"{text}\". ({((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)block).persistentID})"); block.prefab = GeneratePrefab(text, item.Data, forceRegeneration); block.publicName = item.Name; ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)block).internalEnabled = true; _nameToPalette[text] = item; continue; } block = new VanityItemsTemplateDataBlock(); ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)block).name = text; ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)block).internalEnabled = true; block.DropWeight = 1f; block.type = (ClothesType)4; block.publicName = item.Name; block.prefab = GeneratePrefab(text, item.Data, forceRegeneration); _nameToPalette[text] = item; GameDataBlockBase<VanityItemsTemplateDataBlock>.AddBlock(block, -1); L.Info($"Injected new palette \"{text}\". ({((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)block).persistentID})"); uint num = item.VanityGroupID; if (num == 0) { num = 36u; } if (!GameDataBlockBase<VanityItemsGroupDataBlock>.HasBlock(num)) { L.Warning($"Tried to add Palette \"{item?.Name ?? "Unnamed"}\" into group with ID {num} that doesn't exist!"); } else { GameDataBlockBase<VanityItemsGroupDataBlock>.GetBlock(num).Items.Add(((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)block).persistentID); L.Info($"Added Palette \"{item?.Name ?? "Unnamed"}\" into group with ID {num}."); } } catch (Exception ex) { L.Warning($"Failed to load Custom Palette \"{item?.Name ?? "Unnamed"}\" ({item.FileName})."); L.Exception(ex); } } } private static string GeneratePrefab(string identifier, PaletteData data, bool forceRegeneration = false) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown if (string.IsNullOrWhiteSpace(identifier)) { throw new ArgumentException("Identifier may not be null or whitespace.", "identifier"); } if (data == null) { throw new ArgumentNullException("data"); } if (AssetShardManager.s_loadedAssetsLookup.ContainsKey(identifier)) { if (!forceRegeneration) { return identifier; } L.Debug("Regenerating Palette prefab for \"" + identifier + "\" ..."); Object.Destroy(AssetShardManager.s_loadedAssetsLookup[identifier]); } GameObject val = new GameObject(identifier); ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val); ClothesPalette val2 = val.AddComponent<ClothesPalette>(); val2.m_textureTiling = data.TextureTiling; val2.m_primaryTone = data.GetTone(1); val2.m_secondaryTone = data.GetTone(2); val2.m_tertiaryTone = data.GetTone(3); val2.m_quaternaryTone = data.GetTone(4); val2.m_quinaryTone = data.GetTone(5); AssetShardManager.s_loadedAssetsLookup[identifier] = (Object)(object)val; return identifier; } } public class TextureLoader { private static readonly Dictionary<string, TextureData> _textures = new Dictionary<string, TextureData>(); public static void Setup(IEnumerable<CustomPalette> palletes, bool doCleanup = false) { foreach (CustomPalette pallete in palletes) { if (pallete != null) { ProcessPaletteData(pallete); } } if (doCleanup) { CleanupUnusedTextures(palletes); } } private static void CleanupUnusedTextures(IEnumerable<CustomPalette> palletes) { HashSet<string> hashSet = new HashSet<string>(_textures.Keys); foreach (CustomPalette pallete in palletes) { IEnumerable<PaletteData.Tone> enumerable = pallete?.Data?.Tones; if (enumerable == null) { continue; } foreach (PaletteData.Tone item in enumerable) { if (!string.IsNullOrWhiteSpace(item.TextureFile) && hashSet.Contains(item.TextureFile)) { hashSet.Remove(item.TextureFile); } } } if (hashSet.Count == 0) { return; } L.Debug($"Found {hashSet.Count} unused Textures."); foreach (string item2 in hashSet) { if (_textures.TryGetValue(item2, out var value)) { Object.Destroy((Object)(object)value.Texture); _textures.Remove(item2); L.Debug("Unloaded \"" + item2 + "\"!"); } } } private static void ProcessPaletteData(CustomPalette pal) { PaletteData data = pal.Data; if (data == null) { return; } foreach (PaletteData.Tone tone in data.Tones) { string textureFile = tone.TextureFile; if (!string.IsNullOrWhiteSpace(textureFile) && AttemptLoad(textureFile, pal)) { L.Msg("Loaded Texture \"" + textureFile + "\" for Palette " + pal.FileName); } } } private static bool AttemptLoad(string tex, CustomPalette pal) { //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown string path = Path.Combine(PaletteManager.CustomPalettesPath, tex); if (!File.Exists(path)) { PrintLoadError("File doesn't exist!", tex, pal); return false; } DateTime lastWriteTimeUtc = File.GetLastWriteTimeUtc(path); if (_textures.TryGetValue(tex, out var value)) { if (lastWriteTimeUtc == value.EditedTime) { return true; } Object.Destroy((Object)(object)value.Texture); _textures.Remove(tex); } string extension = Path.GetExtension(path); if (extension.ToLower() != ".png" && extension.ToLower() != ".jpg") { PrintLoadError("TextureFile is not a valid image file.", tex, pal); return false; } try { Texture2D val = new Texture2D(2, 2); byte[] array = File.ReadAllBytes(path); if (!ImageConversion.LoadImage(val, Il2CppStructArray<byte>.op_Implicit(array), false)) { PrintLoadError("Image data can't be loaded!", tex, pal); Object.Destroy((Object)(object)val); return false; } ((Object)val).hideFlags = (HideFlags)61; Object.DontDestroyOnLoad((Object)(object)val); _textures.Add(tex, new TextureData { Texture = val, EditedTime = lastWriteTimeUtc }); return true; } catch (Exception ex) { PrintLoadError(ex.Message, tex, pal); } return false; } private static void PrintLoadError(string message, string tex, CustomPalette pal) { L.Error($"Texture \"{tex}\" could not be loaded for Palette \"{pal?.Name}\" ({pal.FileName}): {message}"); } public static Texture2D GetTexture(string textureFile) { if (string.IsNullOrWhiteSpace(textureFile)) { return Texture2D.whiteTexture; } if (_textures.TryGetValue(textureFile, out var value)) { return value.Texture; } return Texture2D.whiteTexture; } } public class TextureData { public Texture2D Texture { get; internal set; } public DateTime EditedTime { get; internal set; } } }
Plugins/PortalPuzzleChanger.dll
Decompiled 2 weeks 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; } } }
Plugins/ExpeditionSectorIconOverride.dll
Decompiled 2 weeks 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 BepInEx; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using CellMenu; using Clonesoft.Json; using ExSeIcOv.Components; using ExSeIcOv.Core; using ExSeIcOv.Core.Info; using ExSeIcOv.Core.Inspectors; using ExSeIcOv.Core.Loaders; using ExSeIcOv.Extensions; using ExSeIcOv.Interfaces; using ExSeIcOv.Models; using HarmonyLib; using Il2CppInterop.Runtime.Attributes; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppInterop.Runtime.InteropTypes.Fields; using Il2CppSystem.Collections.Generic; using LevelGeneration; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyFileVersion("0.0.1")] [assembly: AssemblyInformationalVersion("0.0.1")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("ExpeditionSectorIconOverride")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyProduct("ExpeditionSectorIconOverride")] [assembly: AssemblyTitle("ExpeditionSectorIconOverride")] [assembly: AssemblyVersion("0.0.1.0")] namespace ExSeIcOv { [HarmonyPatch(typeof(StartMainGame), "Awake")] public static class StartMainGame__Awake__Patch { public static void Postfix() { Plugin.Init(); } } [HarmonyPatch(typeof(GlobalPopupMessageManager), "Setup")] public class GlobalPopupMessageManager__Setup__Patch { public static void Postfix() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown Dictionary<PopupType, CM_GlobalPopup> popupTypeToPrefabMap = GlobalPopupMessageManager.m_popupTypeToPrefabMap; bool flag = default(bool); if (popupTypeToPrefabMap == null) { ManualLogSource l = Plugin.L; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(30, 0, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Popup Prefab Map is null?!??!!"); } l.LogError(val); return; } CM_GlobalPopup val2 = popupTypeToPrefabMap[(PopupType)1]; if ((Object)(object)val2 == (Object)null) { ManualLogSource l2 = Plugin.L; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(38, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("RundownInfo"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Popup Prefab could not be found?!??!!"); } l2.LogError(val); return; } foreach (Transform item in ((Component)val2).transform.FindChild("ContentGroup").Children()) { IntelImageType intelImageType = IntelImageType.None; switch (((Object)item).name) { case "IntelPicture_Muted": intelImageType = IntelImageType.Top; break; case "IntelPicture_Bold": intelImageType = IntelImageType.Middle; break; case "IntelPicture_Aggressive": intelImageType = IntelImageType.Bottom; break; } if (intelImageType != 0) { ((Component)item).gameObject.GetOrAddComponent<IntelImageSetter>().SetType(intelImageType); } } } } [HarmonyPatch(typeof(GameStateManager), "ChangeState")] public class GameStateManager__ChangeState__Patch { public static void Postfix(eGameStateName nextState) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0035: Unknown result type (might be due to invalid IL or missing references) if ((int)nextState != 5) { if ((int)nextState == 6) { SectorIconImageLoader.IsInExpedition = true; string[] array = RundownManager.ActiveExpeditionUniqueKey.Split("_").Skip(2).ToArray(); if (Enum.TryParse<eRundownTier>(array[0], out eRundownTier result)) { SectorIconImageLoader.ExpeditionTier = result; } if (int.TryParse(array[1], out var result2)) { SectorIconImageLoader.ExpeditionIndex = result2; } } } else { SectorIconImageLoader.IsInExpedition = false; } } } [HarmonyPatch(typeof(CM_ExpeditionSectorIcon), "Setup")] public class CM_ExpeditionSectorIcon__Setup__Patch { public static void Postfix(CM_ExpeditionSectorIcon __instance, LG_LayerType type) { //IL_0000: 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_0004: Expected I4, but got Unknown SectorIconType sectorIconType = (SectorIconType)(type + 1); SpriteRenderer skull; SpriteRenderer bg; switch (sectorIconType) { default: skull = __instance.m_iconMainSkull; bg = __instance.m_iconMainBG; break; case SectorIconType.Extreme: skull = __instance.m_iconSecondarySkull; bg = __instance.m_iconSecondaryBG; break; case SectorIconType.Overload: skull = __instance.m_iconThirdSkull; bg = __instance.m_iconThirdBG; break; } AddSectorSetterComponent(__instance, sectorIconType, skull, bg); } internal static void AddSectorSetterComponent(CM_ExpeditionSectorIcon __instance, SectorIconType sectorIconType, SpriteRenderer skull, SpriteRenderer bg) { if (!((Object)__instance).name.StartsWith("CUSTOM_")) { bool onRundownScreen = (Object)null != (Object)(object)CustomExtensions.GetComponentInParents<CM_RundownTierMarker>(((Component)__instance).gameObject); SectorIconSetter orAddComponent = ((Component)__instance).gameObject.GetOrAddComponent<SectorIconSetter>(); orAddComponent.Setup(sectorIconType, skull, bg, onRundownScreen); orAddComponent.AssignSprites(); } } } [HarmonyPatch(typeof(CM_ExpeditionSectorIcon), "SetupAsFinishedAll")] public class CM_ExpeditionSectorIcon__SetupAsFinishedAll__Patch { public static void Postfix(CM_ExpeditionSectorIcon __instance) { SectorIconType sectorIconType = SectorIconType.PrisonerEfficiency; SpriteRenderer iconFinishedAllSkull = __instance.m_iconFinishedAllSkull; SpriteRenderer iconFinishedAllBG = __instance.m_iconFinishedAllBG; CM_ExpeditionSectorIcon__Setup__Patch.AddSectorSetterComponent(__instance, sectorIconType, iconFinishedAllSkull, iconFinishedAllBG); } } [HarmonyPatch(typeof(CM_ExpeditionWindow), "SetVisible")] public class CM_ExpeditionWindow__SetVisible__Patch { public static void Prefix(CM_ExpeditionWindow __instance, bool visible, bool inMenuBar) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (!inMenuBar) { SectorIconImageLoader.IsExpeditionDetailsWindowActive = visible; SectorIconImageLoader.ExpeditionTier = __instance.m_tier; SectorIconImageLoader.ExpeditionIndex = __instance.m_expIndex; } } } [BepInPlugin("dev.aurirex.gtfo.exseicov", "ExSeIcOv", "0.0.1")] public class Plugin : BasePlugin { public const string GUID = "dev.aurirex.gtfo.exseicov"; public const string NAME = "ExSeIcOv"; public const string NAME_FULL = "ExpeditionSectorIconOverride"; public const string VERSION = "0.0.1"; public const string ASSETS_SUB_FOLDER = "Overrides"; internal static ManualLogSource L; private static Harmony _harmony; public override void Load() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Expected O, but got Unknown L = ((BasePlugin)this).Log; ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(8, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loading "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ExpeditionSectorIconOverride"); } log.LogMessage(val); ClassInjector.RegisterTypeInIl2Cpp<IntelImageSetter>(); ClassInjector.RegisterTypeInIl2Cpp<SectorIconSetter>(); _harmony = new Harmony("dev.aurirex.gtfo.exseicov"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); } internal static void Init() { L.LogInfo((object)"Loading Override assets ..."); FileIterator.Register<RundownIntelImageLoader>(); FileIterator.Register<SectorIconConfigLoader>(); FileIterator.Register<SectorIconImageLoader>(); FileIterator.Init(); L.LogInfo((object)"Override asset loading complete!"); } } } namespace ExSeIcOv.Models { internal class IntelImageData { public Sprite Top; public Sprite Middle; public Sprite Bottom; public bool HasData { get { if (!((Object)(object)Top != (Object)null) && !((Object)(object)Middle != (Object)null)) { return (Object)(object)Bottom != (Object)null; } return true; } } } public class SectorIconOverride { public class Layer { public Sprite Skull { get; set; } public Sprite Background { get; set; } public bool HasData { get { if (!((Object)(object)Skull != (Object)null)) { return (Object)(object)Background != (Object)null; } return true; } } } public Layer Main { get; set; } = new Layer(); public Layer Extreme { get; set; } = new Layer(); public Layer Overload { get; set; } = new Layer(); public Layer PrisonerEfficiency { get; set; } = new Layer(); public bool HasData { get { if (!Main.HasData && !Extreme.HasData && !Overload.HasData) { return PrisonerEfficiency.HasData; } return true; } } public SectorIconOverride() { } public SectorIconOverride(SectorSpecialOverrideConfig.TierEntry.Overrides configOverrides, string basePath) { configOverrides.LoadSpritesInto(this, basePath); } public Sprite Get(SectorIconType type, bool skull) { if (!TryGetLayer(type, out var layer)) { return null; } if (!skull) { return layer.Background; } return layer.Skull; } public void SetSkull(SectorIconType type, Sprite sprite) { Set(type, skull: true, sprite); } public void SetBackground(SectorIconType type, Sprite sprite) { Set(type, skull: false, sprite); } public void Set(SectorIconType type, bool skull, Sprite sprite) { if (TryGetLayer(type, out var layer)) { if (skull) { layer.Skull = sprite; } else { layer.Background = sprite; } } } private bool TryGetLayer(SectorIconType type, out Layer layer) { switch (type) { default: layer = null; return false; case SectorIconType.Main: layer = Main; break; case SectorIconType.Extreme: layer = Extreme; break; case SectorIconType.Overload: layer = Overload; break; case SectorIconType.PrisonerEfficiency: layer = PrisonerEfficiency; break; } return true; } } public class SectorOverrideImageData { public SectorIconOverride Override = new SectorIconOverride(); public SectorIconOverride RundownTierMarker = new SectorIconOverride(); public bool HasData { get { if (!Override.HasData) { return RundownTierMarker.HasData; } return true; } } } public class SectorSpecialOverrideConfig { public class TierEntry { public class Overrides { public class LayerEntry { public string Skull { get; set; } = string.Empty; public string Background { get; set; } = string.Empty; } public LayerEntry Main { get; set; } = new LayerEntry(); public LayerEntry Extreme { get; set; } = new LayerEntry(); public LayerEntry Overload { get; set; } = new LayerEntry(); public LayerEntry PrisonerEfficiency { get; set; } = new LayerEntry(); public LayerEntry GetLayer(SectorIconType layer) { return layer switch { SectorIconType.None => null, SectorIconType.Main => Main, SectorIconType.Extreme => Extreme, SectorIconType.Overload => Overload, SectorIconType.PrisonerEfficiency => PrisonerEfficiency, _ => throw new ArgumentException("Invalid Layer", "layer"), }; } public void LoadSpritesInto(SectorIconOverride sectorIconOverride, string basePath) { for (int i = 1; i < Enum.GetNames<SectorIconType>().Length; i++) { SectorIconType sectorIconType = (SectorIconType)i; LayerEntry layer = GetLayer(sectorIconType); if (TryLoadImage(basePath, layer.Skull, out var sprite)) { sectorIconOverride.SetSkull(sectorIconType, sprite); } if (TryLoadImage(basePath, layer.Background, out var sprite2)) { sectorIconOverride.SetBackground(sectorIconType, sprite2); } } } private static bool TryLoadImage(string basePath, string fileName, out Sprite sprite) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown if (string.IsNullOrWhiteSpace(fileName)) { sprite = null; return false; } string text = Path.Combine(basePath, fileName); if (!File.Exists(text)) { ManualLogSource l = Plugin.L; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(29, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("File at path does not exist: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text); } l.LogError(val); sprite = null; return false; } sprite = ImageLoader.LoadSprite(text); return true; } } public Dictionary<int, Overrides> ExpeditionOverrides { get; set; } = new Dictionary<int, Overrides>(); public bool TryGetData(int expeditionIndex, out Overrides value) { return ExpeditionOverrides.TryGetValue(expeditionIndex, out value); } } public Dictionary<char, TierEntry> ExpeditionTiers { get; set; } = new Dictionary<char, TierEntry>(); [JsonIgnore] public IEnumerable<(eRundownTier Tier, TierEntry Entry)> Tiers { get { foreach (KeyValuePair<char, TierEntry> expeditionTier in ExpeditionTiers) { eRundownTier item = (eRundownTier)(expeditionTier.Key - 64); yield return (item, expeditionTier.Value); } } } public bool TryGetData(eRundownTier tier, int expeditionIndex, out TierEntry.Overrides data) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0019: 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) if ((int)tier >= 27 || (int)tier <= 0) { throw new ArgumentException("Invalid RundownTier", "tier"); } char key = (char)(tier + 64); if (ExpeditionTiers.TryGetValue(key, out var value)) { return value.TryGetData(expeditionIndex, out data); } data = null; return false; } } } namespace ExSeIcOv.Interfaces { public interface IFileInspector { string FolderName { get; } void Init(uint rundownID, string path); void InspectFile(uint rundownId, GenericFileInfo genericFile); void Finalize(uint rundownID); } } namespace ExSeIcOv.Extensions { internal static class ExtensionMethods { public static IEnumerable<Transform> Children(this Transform self) { for (int i = 0; i < self.childCount; i++) { yield return self.GetChild(i); } } public static T GetOrAddComponent<T>(this GameObject self) where T : Component { T val = self.GetComponent<T>(); if ((Object)(object)val == (Object)null) { val = self.AddComponent<T>(); } return val; } public static void DontDestroyAndSetHideFlags(this Object obj) { Object.DontDestroyOnLoad(obj); obj.hideFlags = (HideFlags)61; } } } namespace ExSeIcOv.Core { public class Cache<T> { private Dictionary<string, T> _data = new Dictionary<string, T>(); public bool TryGetCached(string id, out T data) { return _data.TryGetValue(id, out data); } public void DoCache(string id, T data) { _data.TryAdd(id, data); } } public static class FileIterator { private static readonly List<IFileInspector> _fileInspectors = new List<IFileInspector>(); private static string _assetsPath; private static string _rundownFoldersPath; public static string AssetsPath => _assetsPath ?? (_assetsPath = Path.Combine(Paths.BepInExRootPath, "Assets", "Overrides")); public static string RundownRootPath => _rundownFoldersPath ?? (_rundownFoldersPath = Path.Combine(AssetsPath, "Rundowns/")); public static T Register<T>() where T : class, new() { object? obj = Activator.CreateInstance(typeof(T)); Register(obj); return obj as T; } public static void Register(object instance) { Type type = instance.GetType(); if (!type.IsAssignableTo(typeof(IFileInspector))) { throw new ArgumentException("Type \"" + type.FullName + "\" is invalid."); } if (_fileInspectors.Any((IFileInspector p) => p.GetType() == type)) { throw new ArgumentException("Type \"" + type.FullName + "\" is already registered."); } _fileInspectors.Add(instance as IFileInspector); } internal static void Init() { if (!Directory.Exists(RundownRootPath)) { Directory.CreateDirectory(RundownRootPath); } IterateRundownRootFolder(); } private static void IterateRundownRootFolder() { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown bool flag = default(bool); foreach (string item in Directory.EnumerateDirectories(RundownRootPath)) { string fileName = Path.GetFileName(item); ManualLogSource l = Plugin.L; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(20, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Inspecting path ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(fileName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("): "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(item); } l.LogInfo(val); if (!string.IsNullOrWhiteSpace(fileName) && uint.TryParse(fileName, out var result)) { IterateRundownFolder(result); } } } private static void IterateRundownFolder(uint rundownID) { string text = Path.Combine(RundownRootPath, $"{rundownID}/"); if (!Directory.Exists(text)) { return; } foreach (IFileInspector fileInspector in _fileInspectors) { string path = text; string folderName = fileInspector.FolderName; if (!string.IsNullOrWhiteSpace(folderName)) { path = Path.Combine(text, folderName + "/"); } if (!Directory.Exists(path)) { continue; } try { fileInspector.Init(rundownID, path); } catch (Exception exception) { LogError(fileInspector.GetType().FullName + ".Init", exception); } foreach (string item in Directory.EnumerateFiles(path)) { GenericFileInfo genericFile = new GenericFileInfo(item); try { fileInspector.InspectFile(rundownID, genericFile); } catch (Exception exception2) { LogError(fileInspector.GetType().FullName + ".InspectFile", exception2); } } try { fileInspector.Finalize(rundownID); } catch (Exception exception3) { LogError(fileInspector.GetType().FullName + ".Finalize", exception3); } } } private static void LogError(string method, Exception exception) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown ManualLogSource l = Plugin.L; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(17, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(exception.GetType().Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" has occured in "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(method); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } l.LogError(val); Plugin.L.LogError((object)exception.Message); Plugin.L.LogWarning((object)exception.StackTrace); } } public class HiINeedDataStoredPerExpeditionTooPlease<T> where T : class, new() { private readonly Dictionary<string, T> _data = new Dictionary<string, T>(); public string GetExpeditionKey(uint rundownID, eRundownTier expeditionTier, int expeditionIndex) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) return $"{rundownID}_{expeditionTier}_{expeditionIndex}"; } public void InsertData(string key, T data) { if (!_data.TryAdd(key, data)) { throw new ArgumentException(); } } public T GetOrCreateExpeditionData(string key) { if (_data.TryGetValue(key, out var value)) { return value; } value = new T(); _data.Add(key, value); return value; } public bool TryGetExpeditionData(string key, out T data) { _data.TryGetValue(key, out data); return data != null; } } public class HiINeedDataStoredPerRundownPlease<T> where T : class, new() { private readonly Dictionary<uint, T> _rundownDataDict = new Dictionary<uint, T>(); public T GetOrCreate(uint rundownId) { if (_rundownDataDict.TryGetValue(rundownId, out var value)) { return value; } value = new T(); _rundownDataDict.Add(rundownId, value); return value; } public void InsertData(uint rundownId, T data) { if (!_rundownDataDict.TryAdd(rundownId, data)) { throw new ArgumentException(); } } public bool TryGetData(uint rundownId, out T data) { _rundownDataDict.TryGetValue(rundownId, out data); return data != null; } public bool TryGetDataOrFallback(uint rundownId, out T data) { if (TryGetData(rundownId, out data)) { return true; } if (TryGetData(0u, out data)) { return true; } return false; } public void Remove(uint rundownID) { _rundownDataDict.Remove(rundownID); } } public static class ImageLoader { private static readonly Cache<Texture2D> _textureCache = new Cache<Texture2D>(); private static readonly Cache<Sprite> _spriteCache = new Cache<Sprite>(); public static Sprite LoadSprite(string filePath, bool useCache = true) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown if (useCache && _spriteCache.TryGetCached(filePath, out var data)) { return data; } LoadNewImageSprite(File.ReadAllBytes(filePath), out var sprite); ((Object)sprite).name = "sprite_" + filePath.Replace("\\", ".").Replace("/", "."); _spriteCache.DoCache(filePath, sprite); ManualLogSource l = Plugin.L; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(14, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loaded sprite "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)sprite).name); } l.LogInfo(val); return sprite; } public static Texture2D LoadTex2D(string filePath, bool useCache = true) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Expected O, but got Unknown if (useCache && _textureCache.TryGetCached(filePath, out var data)) { return data; } LoadNewImage(File.ReadAllBytes(filePath), out var tex); ((Object)tex).name = "tex2d_" + filePath.Replace("\\", ".").Replace("/", "."); _textureCache.DoCache(filePath, tex); ManualLogSource l = Plugin.L; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(15, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loaded texture "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(((Object)tex).name); } l.LogInfo(val); return tex; } public static void LoadNewImage(byte[] bytes, out Texture2D tex) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Expected O, but got Unknown tex = new Texture2D(2, 2); ImageConversion.LoadImage(tex, Il2CppStructArray<byte>.op_Implicit(bytes), false); ((Object)(object)tex).DontDestroyAndSetHideFlags(); } public static void LoadNewImageSprite(byte[] bytes, out Sprite sprite) { //IL_0022: 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) LoadNewImage(bytes, out var tex); sprite = Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), new Vector2(0.5f, 0.5f)); ((Object)(object)sprite).DontDestroyAndSetHideFlags(); } } public enum IntelImageType { None, Top, Middle, Bottom } public enum SectorIconType { None, Main, Extreme, Overload, PrisonerEfficiency } public static class Utils { public static bool TryGetActiveRundownID(out uint rundownID) { return uint.TryParse(RundownManager.ActiveRundownKey.Replace("Local_", string.Empty), out rundownID); } } } namespace ExSeIcOv.Core.Loaders { internal class RundownIntelImageLoader : ImageFileInspector { private static HiINeedDataStoredPerRundownPlease<IntelImageData> _rundownStorage; public override string FolderName => "Intel"; public RundownIntelImageLoader() { _rundownStorage = new HiINeedDataStoredPerRundownPlease<IntelImageData>(); } public override void InspectFile(uint rundownId, ImageFileInfo file) { IntelImageData orCreate = _rundownStorage.GetOrCreate(rundownId); switch (file.FileNameLower) { case "intel_top": orCreate.Top = file.LoadAsSprite(); break; case "intel_mid": orCreate.Middle = file.LoadAsSprite(); break; case "intel_bot": orCreate.Bottom = file.LoadAsSprite(); break; } } public override void Finalize(uint rundownID) { if (_rundownStorage.TryGetData(rundownID, out var data) && !data.HasData) { _rundownStorage.Remove(rundownID); } } internal static void ApplyRundownIntelImage(IntelImageType type, SpriteRenderer renderer) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Expected O, but got Unknown //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Expected O, but got Unknown bool flag = default(bool); if (!Utils.TryGetActiveRundownID(out var rundownID)) { ManualLogSource l = Plugin.L; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(20, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not parse "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("ActiveRundownKey"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": \""); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(RundownManager.ActiveRundownKey); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\""); } l.LogError(val); } else { if (!_rundownStorage.TryGetDataOrFallback(rundownID, out var data)) { return; } Sprite val2 = null; switch (type) { case IntelImageType.Top: val2 = data.Top; break; case IntelImageType.Middle: val2 = data.Middle; break; case IntelImageType.Bottom: val2 = data.Bottom; break; default: { ManualLogSource l2 = Plugin.L; BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(32, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Unsupported "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("IntelImageType"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" passed with value: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<IntelImageType>(type); } l2.LogError(val); return; } } if ((Object)(object)val2 == (Object)null) { ManualLogSource l3 = Plugin.L; BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(45, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("No Image for Rundown "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<uint>(rundownID); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(", Type "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<IntelImageType>(type); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" found, ignoring."); } l3.LogInfo(val3); ((Renderer)renderer).enabled = false; } else { renderer.sprite = val2; ((Renderer)renderer).enabled = true; } } } } public class SectorIconConfigLoader : ConfigFileInspector { public const string CONFIG_FILE_NAME = "sectoriconconfig"; private static HiINeedDataStoredPerRundownPlease<SectorSpecialOverrideConfig> _rundownStorage; public override string FolderName => "SectorOverride"; public SectorIconConfigLoader() { _rundownStorage = new HiINeedDataStoredPerRundownPlease<SectorSpecialOverrideConfig>(); } public override void InspectFile(uint rundownId, ConfigFileInfo file) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown if (!(file.FileNameLower != "sectoriconconfig")) { ManualLogSource l = Plugin.L; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(37, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loading config file '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(file.FileName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' for rundown '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(rundownId); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'"); } l.LogInfo(val); _rundownStorage.InsertData(rundownId, file.LoadAsJSONConfig<SectorSpecialOverrideConfig>()); } } public static bool TryGetConfig(uint rundownId, out SectorSpecialOverrideConfig config) { return _rundownStorage.TryGetData(rundownId, out config); } } internal class SectorIconImageLoader : ImageFileInspector { public const string SECTOR_OVERRIDE_FOLDER = "SectorOverride"; public const string SKULL = "skull"; public const string BG = "bg"; public const string MAIN = "main"; public const string SECONDARY = "secondary"; public const string OVERLOAD = "overload"; public const string PE = "pe"; public const string RUNDOWN_TIER_MARKER = "rtm_"; private static readonly SectorIconOverride _baseGameSprites = new SectorIconOverride(); private static HiINeedDataStoredPerRundownPlease<SectorOverrideImageData> _rundownStorage; private static HiINeedDataStoredPerExpeditionTooPlease<SectorIconOverride> _expeditionStorage; private SectorSpecialOverrideConfig _config; private string _basePath; public override string FolderName => "SectorOverride"; private bool HasConfig => _config != null; internal static bool IsExpeditionDetailsWindowActive { get; set; } internal static bool IsInExpedition { get; set; } internal static bool UseExpeditionSprites { get { if (!IsInExpedition) { return IsExpeditionDetailsWindowActive; } return true; } } public static eRundownTier ExpeditionTier { get; internal set; } public static int ExpeditionIndex { get; internal set; } public SectorIconImageLoader() { _rundownStorage = new HiINeedDataStoredPerRundownPlease<SectorOverrideImageData>(); _expeditionStorage = new HiINeedDataStoredPerExpeditionTooPlease<SectorIconOverride>(); } public override void Init(uint rundownID, string path) { SectorIconConfigLoader.TryGetConfig(rundownID, out _config); _basePath = path; } public override void InspectFile(uint rundownId, ImageFileInfo file) { SectorOverrideImageData orCreate = _rundownStorage.GetOrCreate(rundownId); SectorIconOverride sectorIconOverride = orCreate.Override; string text = file.FileNameLower; if (text.StartsWith("rtm_")) { text = text.Substring("rtm_".Length); sectorIconOverride = orCreate.RundownTierMarker; } switch (text) { case "skull_main": sectorIconOverride.Main.Skull = file.LoadAsSprite(); break; case "skull_secondary": sectorIconOverride.Extreme.Skull = file.LoadAsSprite(); break; case "skull_overload": sectorIconOverride.Overload.Skull = file.LoadAsSprite(); break; case "skull_pe": sectorIconOverride.PrisonerEfficiency.Skull = file.LoadAsSprite(); break; case "bg_main": sectorIconOverride.Main.Background = file.LoadAsSprite(); break; case "bg_secondary": sectorIconOverride.Extreme.Background = file.LoadAsSprite(); break; case "bg_overload": sectorIconOverride.Overload.Background = file.LoadAsSprite(); break; case "bg_pe": sectorIconOverride.PrisonerEfficiency.Background = file.LoadAsSprite(); break; } if (HasConfig) { DoConfigThingies(rundownId); } } private void DoConfigThingies(uint rundownId) { //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_0051: Unknown result type (might be due to invalid IL or missing references) foreach (var tier in _config.Tiers) { var (expeditionTier, _) = tier; foreach (KeyValuePair<int, SectorSpecialOverrideConfig.TierEntry.Overrides> expeditionOverride in tier.Entry.ExpeditionOverrides) { expeditionOverride.Deconstruct(out var key, out var value); int expeditionIndex = key; SectorSpecialOverrideConfig.TierEntry.Overrides overrides = value; string expeditionKey = _expeditionStorage.GetExpeditionKey(rundownId, expeditionTier, expeditionIndex); SectorIconOverride orCreateExpeditionData = _expeditionStorage.GetOrCreateExpeditionData(expeditionKey); overrides.LoadSpritesInto(orCreateExpeditionData, _basePath); } } } public override void Finalize(uint rundownID) { if (_rundownStorage.TryGetData(rundownID, out var data) && !data.HasData) { _rundownStorage.Remove(rundownID); } } public static void ApplySkull(SectorIconType type, SpriteRenderer rendererSkull, bool isRundownTierMarker) { Apply(type, rendererSkull, isRundownTierMarker, isSkull: true); } public static void ApplyBackground(SectorIconType type, SpriteRenderer rendererBG, bool isRundownTierMarker) { Apply(type, rendererBG, isRundownTierMarker, isSkull: false); } private static void Apply(SectorIconType type, SpriteRenderer renderer, bool isRundownTierMarker, bool isSkull) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) TrySetBaseGameSprites(type, renderer, isSkull); if (!Utils.TryGetActiveRundownID(out var rundownID)) { return; } Sprite val = null; if (UseExpeditionSprites) { string expeditionKey = _expeditionStorage.GetExpeditionKey(rundownID, ExpeditionTier, ExpeditionIndex); if (_expeditionStorage.TryGetExpeditionData(expeditionKey, out var data)) { val = data.Get(type, isSkull); } } if ((Object)(object)val == (Object)null) { SectorIconOverride sectorIconOverride = _baseGameSprites; if (_rundownStorage.TryGetDataOrFallback(rundownID, out var data2)) { sectorIconOverride = (isRundownTierMarker ? data2.RundownTierMarker : data2.Override); } val = sectorIconOverride.Get(type, isSkull); } if ((Object)(object)val == (Object)null) { val = _baseGameSprites.Get(type, isSkull); } renderer.sprite = val; } private static void TrySetBaseGameSprites(SectorIconType type, SpriteRenderer renderer, bool isSkull) { if ((Object)(object)_baseGameSprites.Get(type, isSkull) == (Object)null) { _baseGameSprites.Set(type, isSkull, renderer.sprite); } } } } namespace ExSeIcOv.Core.Inspectors { public abstract class ConfigFileInspector : IFileInspector { private static readonly HashSet<string> _validExtensions = new HashSet<string> { ".json", ".jsonc" }; public abstract string FolderName { get; } public virtual void Init(uint rundownID, string path) { } public void InspectFile(uint rundownId, GenericFileInfo genericFile) { if (_validExtensions.Any((string ext) => genericFile.FilePath.ToLower().EndsWith(ext))) { ConfigFileInfo file = new ConfigFileInfo(genericFile); InspectFile(rundownId, file); } } public abstract void InspectFile(uint rundownId, ConfigFileInfo file); public virtual void Finalize(uint rundownID) { } } public abstract class ImageFileInspector : IFileInspector { private static readonly HashSet<string> _validImageFileExtensions = new HashSet<string> { ".png", ".jpg", ".exr" }; public abstract string FolderName { get; } public virtual void Init(uint rundownID, string path) { } public void InspectFile(uint rundownId, GenericFileInfo genericFile) { if (_validImageFileExtensions.Any((string ext) => genericFile.FilePath.ToLower().EndsWith(ext))) { ImageFileInfo file = new ImageFileInfo(genericFile); InspectFile(rundownId, file); } } public abstract void InspectFile(uint rundownId, ImageFileInfo file); public virtual void Finalize(uint rundownID) { } } } namespace ExSeIcOv.Core.Info { public class ConfigFileInfo : GenericFileInfo { public ConfigFileInfo(string filePath) : base(filePath) { } public ConfigFileInfo(GenericFileInfo fileInfo) : base(fileInfo.FilePath) { } public T LoadAsJSONConfig<T>() { return JsonConvert.DeserializeObject<T>(File.ReadAllText(base.FilePath)); } } public class GenericFileInfo { public string FileName { get; init; } public string FileNameLower => FileName.ToLower(); public string FilePath { get; init; } public GenericFileInfo(string filePath) { FileName = Path.GetFileNameWithoutExtension(filePath); FilePath = filePath; } } public class ImageFileInfo : GenericFileInfo { public ImageFileInfo(string filePath) : base(filePath) { } public ImageFileInfo(GenericFileInfo genericFile) : base(genericFile.FilePath) { } public Sprite LoadAsSprite() { return ImageLoader.LoadSprite(base.FilePath); } public Texture2D LoadAsTex2D() { return ImageLoader.LoadTex2D(base.FilePath); } } } namespace ExSeIcOv.Components { internal class IntelImageSetter : MonoBehaviour { public Il2CppValueField<int> typeAsInt; private SpriteRenderer _renderer; [HideFromIl2Cpp] public IntelImageType Type { get; private set; } [HideFromIl2Cpp] public void SetType(IntelImageType type) { Type = type; typeAsInt.Set((int)type); } public void Awake() { Type = (IntelImageType)typeAsInt.Get(); _renderer = ((Component)this).GetComponent<SpriteRenderer>(); RundownIntelImageLoader.ApplyRundownIntelImage(Type, _renderer); } } internal class SectorIconSetter : MonoBehaviour { public Il2CppValueField<int> _typeIL2CPP; public Il2CppValueField<bool> _isRundownTierMarkerIL2CPP; public Il2CppReferenceField<SpriteRenderer> _rendererBGIL2CPP; public Il2CppReferenceField<SpriteRenderer> _rendererSkullIL2CPP; [HideFromIl2Cpp] public SectorIconType Type { get { return (SectorIconType)_typeIL2CPP.Get(); } set { _typeIL2CPP.Set((int)value); } } [HideFromIl2Cpp] private bool IsRundownTierMarker { get { return _isRundownTierMarkerIL2CPP.Get(); } set { _isRundownTierMarkerIL2CPP.Set(value); } } [HideFromIl2Cpp] private SpriteRenderer RendererBG { get { return _rendererBGIL2CPP.Get(); } set { _rendererBGIL2CPP.Set(value); } } [HideFromIl2Cpp] private SpriteRenderer RendererSkull { get { return _rendererSkullIL2CPP.Get(); } set { _rendererSkullIL2CPP.Set(value); } } [HideFromIl2Cpp] public void Setup(SectorIconType type, SpriteRenderer skull, SpriteRenderer background, bool onRundownScreen = false) { Type = type; RendererSkull = skull; RendererBG = background; IsRundownTierMarker = onRundownScreen; } public void Awake() { AssignSprites(); } public void AssignSprites() { if (Type == SectorIconType.None) { return; } if (((Object)this).name.StartsWith("CUSTOM_")) { Object.Destroy((Object)(object)this); return; } if ((Object)(object)RendererSkull != (Object)null) { SectorIconImageLoader.ApplySkull(Type, RendererSkull, IsRundownTierMarker); } if ((Object)(object)RendererBG != (Object)null) { SectorIconImageLoader.ApplyBackground(Type, RendererBG, IsRundownTierMarker); } } } }
Plugins/RundownTitleFix.dll
Decompiled 2 weeks agousing System; using System.CodeDom.Compiler; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Unity.IL2CPP; using CellMenu; using HarmonyLib; using Microsoft.CodeAnalysis; 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("RundownTitleFix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("RundownTitleFix")] [assembly: AssemblyTitle("RundownTitleFix")] [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 RundownTitleFix { [BepInPlugin("AbsolutelyMarvelousFix", "AbsolutelyMarvelousFix", "0.0.1")] public class Plugin : BasePlugin { [HarmonyPatch] private class rtfpatches { [HarmonyPatch(typeof(CM_PageRundown_New), "ResetElements")] [HarmonyPostfix] private static void Postfix(CM_PageRundown_New __instance) { ((Component)__instance.m_textRundownHeader).gameObject.active = true; } } public override void Load() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) new Harmony("AbsolutelyMarvelousFix").PatchAll(); } } [GeneratedCode("VersionInfoGenerator", "2.0.0+git50a4b1a-master")] [CompilerGenerated] internal static class VersionInfo { public const string RootNamespace = "RundownTitleFix"; 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 bool GitIsDirty = false; } }
Plugins/WeaponIconPlus.dll
Decompiled 2 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Il2CppSystem.Collections.Generic; 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("WeaponIconPlus")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("WeaponIconPlus")] [assembly: AssemblyTitle("WeaponIconPlus")] [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 WeaponIconPlus { [BepInPlugin("WeaponIconPlus", "WeaponIconPlus", "1.8.0")] public class Plugin : BasePlugin { private static readonly Vector3 Size = new Vector3(145f, 145f); private static readonly Vector3 Angle = Vector3.zero; private static readonly Color DefaultColor = new Color(1f, 1f, 1f, 0.3921f); public override void Load() { Harmony.CreateAndPatchAll(typeof(Plugin), "WeaponIconPlus"); } [HarmonyPatch(typeof(PUI_Inventory), "UpdateInfoForItem")] [HarmonyPostfix] private static void Postfix__PUI_Inventory__UpdateInfoForItem(PUI_Inventory __instance, bool visible, InventorySlot selectedSlot) { //IL_0004: 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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_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_0056: 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) if (visible && __instance.TryGetItemSlot(selectedSlot, out PUI_InventoryItem item) && !((Object)(object)((item != null) ? item.m_selected_icon.sprite : null) == (Object)null)) { Vector3 size = default(Vector3); if ((byte)(selectedSlot - 1) <= 2 || (int)selectedSlot == 10) { size = Size; } else { Rect rect = item.m_selected_icon.sprite.rect; Vector2 size2 = ((Rect)(ref rect)).size; float num = size2.x / size2.y; ((Vector3)(ref size))..ctor(69f * num, 69f); } item.m_selected_icon.Modify(size, Angle, DefaultColor, enabled: true, (RotationOrder)0); } } } public static class Extension { public static void Modify(this SpriteRenderer sprite, Vector3 size, Vector3 angle, Color color, bool enabled = true, RotationOrder order = 0) { //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_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) sprite.size = Vector2.op_Implicit(size); ((Renderer)sprite).enabled = enabled; ((Component)sprite).transform.SetLocalEulerAngles(angle, order); sprite.color = color; } public static bool TryGetItemSlot(this PUI_Inventory inventory, InventorySlot slot, out PUI_InventoryItem? item) { //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) Enumerator<InventorySlot, PUI_InventoryItem> enumerator = inventory.m_inventorySlots.GetEnumerator(); while (enumerator.MoveNext()) { if (enumerator.Current.Key == slot) { item = enumerator.Current.Value; return true; } } item = null; return false; } } }
Plugins/old_main_menu_launch.dll
Decompiled 2 weeks agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using CellMenu; using HarmonyLib; using Il2CppSystem; using Microsoft.CodeAnalysis; 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("test")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("test")] [assembly: AssemblyTitle("test")] [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 old_main_menu_launch { [BepInPlugin("old_main_menu_launch", "old_main_menu_launch", "1.0.0")] public class Plugin : BasePlugin { public override void Load() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(17, 0, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin is loaded!"); } log.LogInfo(val); new Harmony("SoundReplace.Harmony").PatchAll(); Harmony.CreateAndPatchAll(typeof(Patch), "qewradfzdcvdrfbhateht"); } } [HarmonyPatch(typeof(CellSoundPlayer), "Post")] [HarmonyPatch(new Type[] { typeof(uint), typeof(bool) })] internal static class PatchSound { private static void Prefix(ref uint eventID) { if (eventID == 15378500) { eventID = 2513434463u; } } } } namespace test { internal static class Patch { [HarmonyPatch(typeof(CM_PageRundown_New), "Setup")] [HarmonyPostfix] public static void MyPatch(CM_PageRundown_New __instance) { __instance.m_aboutTheRundownButton.OnBtnPressCallback = Action<int>.op_Implicit((Action<int>)delegate { Application.ForceCrash(2); }); } } }
Plugins/SecDoorTerminalInterface.dll
Decompiled 2 weeks agousing System; using System.CodeDom.Compiler; using System.Collections; 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.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Utils.Collections; using ChainedPuzzles; using GTFO.API; using GameData; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using LevelGeneration; using Localization; using Microsoft.CodeAnalysis; using Player; using SNetwork; using SecDoorTerminalInterface.Inject; using TMPro; 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("SecDoorTerminalInterface")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+git6952937-master")] [assembly: AssemblyProduct("SecDoorTerminalInterface")] [assembly: AssemblyTitle("SecDoorTerminalInterface")] [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] [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 SecDoorTerminalInterface { internal static class Assets { public static GameObject SecDoorTerminalPrefab; public static void Init() { SecDoorTerminalPrefab = AssetAPI.GetLoadedAsset<GameObject>("Assets/Modding/SecDoorTerminal/Terminal_SecDoor.prefab"); } } public struct CommandDescriptor { public TERM_Command Type; public string Command; public string Description; public TERM_CommandRule Rule; } public enum CPSolvedBehaviour { OpenDoor, AddOpenCommand, Nothing } [BepInPlugin("SecDoorTerminalInterface", "SecDoorTerminalInterface", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class EntryPoint : BasePlugin { private 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 AssetAPI.OnAssetBundlesLoaded += AssetAPI_OnAssetBundlesLoaded; _Harmony = new Harmony("SecDoorTerminalInterface.Harmony"); _Harmony.PatchAll(); } private void AssetAPI_OnAssetBundlesLoaded() { Assets.Init(); } } 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("SecDoorTerminalInterface"); 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) { } } public sealed class SecDoorTerminal { public const TERM_Command COMMAND_OPEN = 255; public const TERM_Command COMMAND_OVERRIDE = 254; private LocalizedText _GCTextHolder; private Vector3 _SavedIntOpenDoorPos; private Vector3 _SavedIntUseKeyPos; private Vector3 _SavedIntCustomMessagePos; private Vector3 _SavedIntHackPos; private SDT_StateBehaviour _StateBehaviour; private static readonly Vector3 BEGONE = Vector3.one * 10000f; public string OpenCommandName { get; set; } = "OPEN_LINKED"; public string OpenCommandDescription { get; set; } = "Open the linked security door"; public LG_SecurityDoor LinkedDoor { get; private set; } public LG_SecurityDoor_Locks LinkedDoorLocks { get; private set; } public LG_ComputerTerminal ComputerTerminal { get; private set; } public LG_ComputerTerminalCommandInterpreter CmdProcessor { get; private set; } public Interact_ComputerTerminal Interaction { get; private set; } public TextMeshPro IdleText { get; private set; } public SpriteRenderer IdleIcon { get; private set; } public AIG_CourseNode SpawnNode => ComputerTerminal.m_terminalItem.SpawnNode; public bool IsTerminalActive { get; private set; } = true; public CPSolvedBehaviour BioscanScanSolvedBehaviour { get; set; } = CPSolvedBehaviour.AddOpenCommand; public SDT_StateBehaviour StateBehaviour { get { return _StateBehaviour; } set { _StateBehaviour?.SetContext(null); _StateBehaviour = value; _StateBehaviour?.SetContext(this); } } public event Action<TERM_Command, string, string, string> OnCmdUsed; private void Setup_CommandModule() { Inject_Terminal_ReceiveCmd.OnCmdUsed_LevelInstanced += OnReceiveCommand; } private void OnReceiveCommand(LG_ComputerTerminalCommandInterpreter interpreter, TERM_Command cmd, string inputLine, string param1, string param2) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (interpreter.m_terminal.m_syncID == ComputerTerminal.m_syncID) { this.OnCmdUsed?.Invoke(cmd, inputLine, param1, param2); } } public void AddCommand(CommandDescriptor descriptor, Action<LG_ComputerTerminalCommandInterpreter> onCommandUsed = null) { //IL_0027: 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_0075: 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_0092: Expected O, but got Unknown //IL_009e: 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_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (CmdProcessor.HasRegisteredCommand(descriptor.Type)) { bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(33, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Command Type: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<TERM_Command>(descriptor.Type); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is Already Added!!"); } Logger.Error(val); return; } _GCTextHolder = new LocalizedText { UntranslatedText = descriptor.Description, Id = 0u }; CmdProcessor.AddCommand(descriptor.Type, descriptor.Command, _GCTextHolder, descriptor.Rule); OnCmdUsed += delegate(TERM_Command cmdType, string cmdStr, string param1, string param2) { //IL_0000: 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) if (cmdType == descriptor.Type) { onCommandUsed?.Invoke(CmdProcessor); } }; } public void AddOverrideCommand(string cmd, string helpText, Action<LG_ComputerTerminalCommandInterpreter> onCommandUsed = null) { //IL_0023: 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) CommandDescriptor commandDescriptor = default(CommandDescriptor); commandDescriptor.Type = (TERM_Command)254; commandDescriptor.Command = cmd; commandDescriptor.Description = helpText; commandDescriptor.Rule = (TERM_CommandRule)1; CommandDescriptor descriptor = commandDescriptor; AddCommand(descriptor, delegate(LG_ComputerTerminalCommandInterpreter interpreter) { onCommandUsed?.Invoke(CmdProcessor); interpreter.AddOutput((TerminalLineType)0, "Desired Action: <color=orange>OVERRIDE</color>", 0.5f, (TerminalSoundType)0, (TerminalSoundType)0); interpreter.AddOutput((TerminalLineType)4, "Decrypting Authorize ID..", 0.85f, (TerminalSoundType)0, (TerminalSoundType)0); interpreter.AddOutput((TerminalLineType)2, "Sending..", 1.2f, (TerminalSoundType)0, (TerminalSoundType)0); interpreter.AddOutput((TerminalLineType)5, "<color=orange>OVERRIDE</color> Action sent!", 0.65f, (TerminalSoundType)0, (TerminalSoundType)0); SetEndOfQueue(delegate { if (SNet.IsMaster) { LinkedDoorLocks.m_intOpenDoor.OnInteractionTriggered.Invoke(PlayerManager.GetLocalPlayerAgent()); } }); }); } public void AddOpenCommand(string cmd, string helpText, Action<LG_ComputerTerminalCommandInterpreter> onCommandUsed = null) { //IL_0023: 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) CommandDescriptor commandDescriptor = default(CommandDescriptor); commandDescriptor.Type = (TERM_Command)255; commandDescriptor.Command = cmd; commandDescriptor.Description = helpText; commandDescriptor.Rule = (TERM_CommandRule)1; CommandDescriptor descriptor = commandDescriptor; AddCommand(descriptor, delegate(LG_ComputerTerminalCommandInterpreter interpreter) { onCommandUsed?.Invoke(interpreter); interpreter.AddOutput((TerminalLineType)0, "Desired Action: <color=orange>OPEN</color>", 0.5f, (TerminalSoundType)0, (TerminalSoundType)0); interpreter.AddOutput((TerminalLineType)4, "Decrypting Authorize ID..", 0.85f, (TerminalSoundType)0, (TerminalSoundType)0); interpreter.AddOutput((TerminalLineType)2, "Sending..", 1.2f, (TerminalSoundType)0, (TerminalSoundType)0); interpreter.AddOutput((TerminalLineType)5, "<color=orange>OVERRIDE</color> Action sent!", 0.65f, (TerminalSoundType)0, (TerminalSoundType)0); SetEndOfQueue(delegate { if (SNet.IsMaster) { LinkedDoorLocks.m_intOpenDoor.OnInteractionTriggered.Invoke(PlayerManager.GetLocalPlayerAgent()); } }); }); } public void SetEndOfQueue(Action onEndOfQueue) { CmdProcessor.OnEndOfQueue = Action.op_Implicit(onEndOfQueue); } private void Setup() { Setup_GraphicModule(); Setup_DoorInteractModule(); Setup_DoorStateModule(); Setup_CommandModule(); } public void SetTerminalActive(bool active) { IsTerminalActive = active; ((Behaviour)ComputerTerminal).enabled = active; Interact_ComputerTerminal componentInChildren = ((Component)ComputerTerminal).GetComponentInChildren<Interact_ComputerTerminal>(true); if ((Object)(object)componentInChildren != (Object)null) { ((Behaviour)componentInChildren).enabled = active; ((Interact_Base)componentInChildren).SetActive(active); } if (!active) { PlayerAgent localInteractionSource = ComputerTerminal.m_localInteractionSource; if ((Object)(object)localInteractionSource != (Object)null && localInteractionSource.FPItemHolder.InTerminalTrigger) { ComputerTerminal.ExitFPSView(); } if (SNet.IsMaster) { ComputerTerminal.ChangeState((TERM_State)0); } } } public void SetSpawnNode(AIG_CourseNode node) { ComputerTerminal.m_terminalItem.SpawnNode = node; } public void SetLocationTextToSpawnZone() { SetLocationText(SpawnNode.m_zone.NavInfo.GetFormattedText((LG_NavInfoFormat)7)); } public void SetLocationText(string text) { ComputerTerminal.m_terminalItem.FloorItemLocation = text; } private SecDoorTerminal() { } public void SetOpenInteractActive(bool active) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) Interact_Timed intOpenDoor = LinkedDoorLocks.m_intOpenDoor; ((Component)intOpenDoor).transform.position = (active ? _SavedIntOpenDoorPos : BEGONE); ((Interact_Base)intOpenDoor).SetActive(active); } public void SetUseKeyInteractActive(bool active) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) Interact_RequireKeyItem intUseKeyItem = LinkedDoorLocks.m_intUseKeyItem; ((Component)intUseKeyItem).transform.position = (active ? _SavedIntUseKeyPos : BEGONE); ((Interact_Base)intUseKeyItem).SetActive(active); } public void SetHackingInteractActive(bool active) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) Interact_Hack intHack = LinkedDoorLocks.m_intHack; ((Component)intHack).transform.position = (active ? _SavedIntHackPos : BEGONE); ((Interact_Base)intHack).SetActive(active); } public void SetCustomMessageActive(bool active) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) Interact_MessageOnScreen intCustomMessage = LinkedDoorLocks.m_intCustomMessage; ((Component)intCustomMessage).transform.position = (active ? _SavedIntCustomMessagePos : BEGONE); ((Interact_Base)intCustomMessage).SetActive(active); } public void OpenOrStartChainPuzzle() { //IL_005b: 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_0035: 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) ChainedPuzzleInstance chainedPuzzleToSolve = LinkedDoorLocks.ChainedPuzzleToSolve; if ((Object)(object)chainedPuzzleToSolve != (Object)null && !chainedPuzzleToSolve.IsSolved) { LinkedDoor.m_sync.AttemptDoorInteraction((eDoorInteractionType)4, 0f, 0f, default(Vector3), (Agent)null); } else { LinkedDoor.m_sync.AttemptDoorInteraction((eDoorInteractionType)0, 0f, 0f, default(Vector3), (Agent)null); } } public void ForceOpenDoor(float delay) { if (delay > 0f) { CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(OpenDoorWithDelay(delay)), (Action)null); } else { ForceOpenDoor(); } } private IEnumerator OpenDoorWithDelay(float delay) { yield return (object)new WaitForSeconds(delay); LinkedDoor.m_sync.AttemptDoorInteraction((eDoorInteractionType)0, 0f, 0f, default(Vector3), (Agent)null); } public void ForceOpenDoor() { //IL_0018: 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) LinkedDoor.m_sync.AttemptDoorInteraction((eDoorInteractionType)0, 0f, 0f, default(Vector3), (Agent)null); } private void Setup_DoorInteractModule() { //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_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_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_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) _SavedIntOpenDoorPos = ((Component)LinkedDoorLocks.m_intOpenDoor).transform.position; _SavedIntUseKeyPos = ((Component)LinkedDoorLocks.m_intUseKeyItem).transform.position; _SavedIntCustomMessagePos = ((Component)LinkedDoorLocks.m_intCustomMessage).transform.position; _SavedIntHackPos = ((Component)LinkedDoorLocks.m_intHack).transform.position; } private void Setup_DoorStateModule() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) StateBehaviour = new SDT_StateBehaviour(); LinkedDoor.m_sync.OnDoorStateChange += Action<pDoorState, bool>.op_Implicit((Action<pDoorState, bool>)OnStateChange); LinkedDoorLocks.OnChainedPuzzleSolved += Action.op_Implicit((Action)OnChainedPuzzleSolved); OnStateChange(LinkedDoor.m_sync.GetCurrentSyncState(), isRecall: false); } private void OnChainedPuzzleSolved() { switch (BioscanScanSolvedBehaviour) { case CPSolvedBehaviour.OpenDoor: if (SNet.IsMaster) { ForceOpenDoor(0.25f); } break; case CPSolvedBehaviour.AddOpenCommand: CmdProcessor.AddOutput((TerminalLineType)5, "Bioscan Sequence Completed - <color=orange>" + OpenCommandName + "</color> Command is now accessible!", 0f, (TerminalSoundType)0, (TerminalSoundType)0); AddOpenCommand(OpenCommandName, OpenCommandDescription); break; } } private void OnStateChange(pDoorState state, bool isRecall) { //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_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) if (StateBehaviour != null) { ActiveEnemyWaveData activeEnemyWaveData = LinkedDoor.ActiveEnemyWaveData; bool isBloodyDoor = activeEnemyWaveData != null && activeEnemyWaveData.HasActiveEnemyWave; SecDoorState secDoorState = default(SecDoorState); secDoorState.Status = state.status; secDoorState.State = state; secDoorState.IsBloodyDoor = isBloodyDoor; SecDoorState state2 = secDoorState; StateBehaviour.UpdateInteractionState(state2, isRecall); StateBehaviour.UpdateGraphicState(state2, isRecall); } } private void Setup_GraphicModule() { CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(ForceScreenOffOnDeactive()), (Action)null); } private IEnumerator ForceScreenOffOnDeactive() { while (true) { if (IsTerminalActive) { ((Behaviour)ComputerTerminal.m_text).enabled = true; } else { ((Behaviour)ComputerTerminal.m_text).enabled = false; ComputerTerminal.m_loginScreen.SetActive(true); ComputerTerminal.m_interfaceScreen.SetActive(true); } yield return null; } } public void SetIdleIconColor(Color color) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) IdleIcon.color = color; } public void SetIdleText(string text) { ((TMP_Text)IdleText).text = text; } public void SetIdleTextFontSize(float size) { ((TMP_Text)IdleText).fontSize = size; } public static SecDoorTerminal Place(LG_SecurityDoor secDoor, TerminalStartStateData startData = null, TerminalPlacementData placementData = null) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) if ((int)secDoor.m_securityDoorType != 0) { return null; } Transform val = CustomExtensions.FindChildRecursive(((Component)secDoor).transform, "InteractionInterface", true); if ((Object)(object)val == (Object)null) { return null; } ((Component)val).gameObject.SetActiveRecursively(false); ((Component)val).gameObject.SetActive(true); GameObject obj = Object.Instantiate<GameObject>(Assets.SecDoorTerminalPrefab, val); obj.transform.localPosition = (((int)secDoor.Gate.Type == 0) ? new Vector3(0f, -0.006f, 0f) : new Vector3(0f, -0.026f, 0f)); obj.transform.localRotation = Quaternion.identity; obj.transform.localScale = Vector3.one; iTerminalItem componentInChildren = obj.GetComponentInChildren<iTerminalItem>(); if (componentInChildren != null && TryGetSecDoorSpawnedNode(secDoor, out var spawnedNode)) { componentInChildren.SpawnNode = spawnedNode; } LG_ComputerTerminal component = obj.GetComponent<LG_ComputerTerminal>(); component.Setup(startData, placementData); MeshFilter[] array = Il2CppArrayBase<MeshFilter>.op_Implicit(((Component)secDoor).GetComponentsInChildren<MeshFilter>(true)); foreach (MeshFilter val2 in array) { if (!((Object)(object)val2.sharedMesh == (Object)null)) { string name = ((Object)val2.sharedMesh).name; if (!string.IsNullOrEmpty(name) && name.Equals("g_security_door_display")) { Transform transform = ((Component)val2).gameObject.transform; transform.localPosition += BEGONE; } } } SecDoorTerminal secDoorTerminal = new SecDoorTerminal(); secDoorTerminal.LinkedDoor = secDoor; secDoorTerminal.LinkedDoorLocks = ((Il2CppObjectBase)secDoor.m_locks).Cast<LG_SecurityDoor_Locks>(); secDoorTerminal.ComputerTerminal = component; secDoorTerminal.CmdProcessor = component.m_command; secDoorTerminal.Interaction = ((Component)component).GetComponentInChildren<Interact_ComputerTerminal>(true); secDoorTerminal.IdleIcon = component.m_loginScreen.GetComponent<SpriteRenderer>(); secDoorTerminal.IdleText = component.m_loginScreen.GetComponentInChildren<TextMeshPro>(); secDoorTerminal.Setup(); return secDoorTerminal; } private static bool TryGetSecDoorSpawnedNode(LG_SecurityDoor secDoor, out AIG_CourseNode spawnedNode) { if ((Object)(object)secDoor == (Object)null) { spawnedNode = null; return false; } if ((Object)(object)secDoor.Gate == (Object)null) { spawnedNode = null; return false; } if ((Object)(object)((LG_ZoneExpander)secDoor.Gate).m_linksFrom == (Object)null) { spawnedNode = null; return false; } spawnedNode = ((LG_ZoneExpander)secDoor.Gate).m_linksFrom.m_courseNode; return spawnedNode != null; } } public class SDT_StateBehaviour { public SecDoorTerminal Context { get; private set; } internal void SetContext(SecDoorTerminal secDoorTerminal) { Context = secDoorTerminal; } public virtual void UpdateInteractionState(SecDoorState state, bool isRecall) { //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_0051: Expected I4, but got Unknown eDoorStatus status = state.Status; switch ((int)status) { case 0: case 1: case 2: case 4: case 5: case 7: case 9: case 12: case 13: case 14: Context.SetTerminalActive(active: true); Context.SetOpenInteractActive(active: false); Context.SetHackingInteractActive(active: false); Context.SetUseKeyInteractActive(active: false); Context.SetCustomMessageActive(active: false); break; case 3: Context.SetTerminalActive(active: false); Context.SetOpenInteractActive(active: false); Context.SetHackingInteractActive(active: false); Context.SetUseKeyInteractActive(active: true); Context.SetCustomMessageActive(active: false); break; case 6: case 15: Context.SetTerminalActive(active: false); Context.SetOpenInteractActive(active: false); Context.SetHackingInteractActive(active: false); Context.SetUseKeyInteractActive(active: false); Context.SetCustomMessageActive(active: true); break; case 8: case 10: case 11: case 16: Context.SetTerminalActive(active: false); Context.SetOpenInteractActive(active: false); Context.SetHackingInteractActive(active: false); Context.SetUseKeyInteractActive(active: false); Context.SetCustomMessageActive(active: false); break; } } public virtual void UpdateGraphicState(SecDoorState state, bool isRecall) { //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_004f: Expected I4, but got Unknown //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0073: 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_008a: 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_00d4: 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_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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) eDoorStatus status = state.Status; string text; Color? val; switch (status - 1) { case 14: text = "::<color=orange>Bulkhead Override</color> Required::"; val = Color.yellow; break; case 2: text = "::<color=orange>Keycard</color> Required::"; val = Color.red; break; case 4: text = "<color=orange>BIOSCAN Protocol</color> pending..."; val = Color.cyan; break; case 3: text = "<color=orange>BIOSCAN Protocol</color> pending..."; val = Color.red; break; case 5: text = "BOOT ERR://Power Level - <color=red>LOW</color>"; val = ColorExt.Hex("#FFA500"); break; case 6: text = "<color=orange>LOCKDOWN Protocol</color> engaged!"; val = Color.red; break; case 7: if (Context.LinkedDoorLocks.ChainedPuzzleToSolve.Data.TriggerAlarmOnActivate) { text = "<color=red>BIOSCAN Protocol</color> processing!"; val = Color.red; } else { text = "<color=blue>BIOSCAN Protocol</color> processing!"; val = Color.cyan; } break; case 9: case 15: text = "::DOOR OVERRIDING::"; val = Color.cyan; break; case 0: text = "::DOOR LOCKING::"; val = Color.cyan; break; default: text = "Waiting..."; val = Color.green; break; } if (val.HasValue) { Context.SetIdleIconColor(val.Value); } if (text != null) { Context.SetIdleText(text); } } } public struct SecDoorState { public eDoorStatus Status; public pDoorState State; public bool IsBloodyDoor; } [GeneratedCode("VersionInfoGenerator", "2.1.3+git35c0c2a-master")] [CompilerGenerated] internal static class VersionInfo { public const string RootNamespace = "SecDoorTerminalInterface"; public const string Version = "1.0.0"; public const string VersionPrerelease = null; public const string VersionMetadata = "git6952937-master"; public const string SemVer = "1.0.0+git6952937-master"; public const string GitRevShort = "6952937"; public const string GitRevLong = "69529374dcbe6b589a13bfc0c363675c5cd3e803"; public const string GitBranch = "master"; public const string GitTag = null; public const int GitCommitsSinceTag = 0; public const bool GitIsDirty = false; } } namespace SecDoorTerminalInterface.Inject { [HarmonyPatch(typeof(LG_ComputerTerminalCommandInterpreter), "ReceiveCommand")] internal class Inject_Terminal_ReceiveCmd { public static event Action<LG_ComputerTerminalCommandInterpreter, TERM_Command, string, string, string> OnCmdUsed_LevelInstanced; static Inject_Terminal_ReceiveCmd() { LevelAPI.OnLevelCleanup += delegate { Inject_Terminal_ReceiveCmd.OnCmdUsed_LevelInstanced = null; }; } private static void Prefix(LG_ComputerTerminalCommandInterpreter __instance, TERM_Command cmd, string inputLine, string param1, string param2) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) Inject_Terminal_ReceiveCmd.OnCmdUsed_LevelInstanced?.Invoke(__instance, cmd, inputLine, param1, param2); } } }
Plugins/Doughnut.dll
Decompiled 2 weeks agousing System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using AK; using Agents; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Utils.Collections; using BoosterImplants; using CellMenu; using Clonesoft.Json; using Clonesoft.Json.Converters; using Doughnut.Data; using Doughnut.Interop; using Doughnut.Resources; using Doughnut.UI; using GameData; using HarmonyLib; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections; using LevelGeneration; using Microsoft.CodeAnalysis; using Player; using SimpleProgression.Core; using UnityEngine; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyFileVersion("0.1.0")] [assembly: AssemblyInformationalVersion("0.1.0")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("Doughnut")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyProduct("Doughnut")] [assembly: AssemblyTitle("Doughnut")] [assembly: AssemblyVersion("0.1.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 Doughnut { internal class AssetLoader { private static bool _loaded = false; private const string DonutPrefabAssetPath = "assets/doughnut/donutprefab.prefab"; private static Shader _shader; private static readonly JsonSerializerSettings _jsonSerializerSettings = new JsonSerializerSettings { Formatting = (Formatting)1, Converters = new List<JsonConverter> { (JsonConverter)new StringEnumConverter() } }; private static AssetBundle _donutBundle; internal static GameObject donutPrefab; internal static GameObject donutPrefab2; internal static GameObject donutPrefab3; internal static ArtifactSoundData soundData = new ArtifactSoundData(); internal static GlucoseUnlockCriterias unlockCriteriasData = new GlucoseUnlockCriterias(); private static string _glucoseStoragePath; internal static GlucoseStorage glucoseStorage = new GlucoseStorage(); internal static Sprite sugarSprite; private const string GLUCOSE_STORAGE_FILENAME = "GlucoseStorage.json"; private const string GLUCOSE_UNLOCK_COND_FILENAME = "GlucoseUnlockCriterias.json"; private const string SOUND_DATA_FILENAME = "SoundData.json"; public static void SaveGlucose() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown try { File.WriteAllText(_glucoseStoragePath, JsonConvert.SerializeObject((object)glucoseStorage, (Formatting)1)); } catch (Exception ex) { ManualLogSource l = Plugin.L; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(41, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to save glucose storage!! ;-; ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.GetType().Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")"); } l.LogError(val); } } public static void Load() { //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0273: Expected O, but got Unknown //IL_02b5: Unknown result type (might be due to invalid IL or missing references) //IL_02bc: Expected O, but got Unknown //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Expected O, but got Unknown //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Expected O, but got Unknown //IL_0222: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Expected O, but got Unknown if (_loaded) { return; } string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); string text = Path.Combine(Paths.BepInExRootPath, "LocalProgression/"); Directory.CreateDirectory(text); _glucoseStoragePath = Path.Combine(text, "GlucoseStorage.json"); Plugin.L.LogMessage((object)"Loading assetbundle and data ..."); LoadBundle(Doughnut.Resources.Data.donutbundle, out _donutBundle); donutPrefab = ((Il2CppObjectBase)LoadAsset(_donutBundle, "assets/doughnut/donutprefab.prefab")).Cast<GameObject>(); ReplaceMatShader(donutPrefab); donutPrefab.GetComponentInChildren<Renderer>().shadowCastingMode = (ShadowCastingMode)0; donutPrefab.SetActive(false); donutPrefab2 = Object.Instantiate<GameObject>(donutPrefab); Material val = ((Il2CppObjectBase)LoadAsset(_donutBundle, "assets/doughnut/doughnutmat2.mat")).Cast<Material>(); ReplaceMatShader(val); Renderer componentInChildren = donutPrefab2.GetComponentInChildren<Renderer>(); componentInChildren.sharedMaterial = val; componentInChildren.shadowCastingMode = (ShadowCastingMode)0; DontDestroyAndSetHideFlags((Object)(object)donutPrefab2); donutPrefab2.SetActive(false); donutPrefab3 = Object.Instantiate<GameObject>(donutPrefab); Material val2 = ((Il2CppObjectBase)LoadAsset(_donutBundle, "assets/doughnut/doughnutmat3.mat")).Cast<Material>(); ReplaceMatShader(val2); Renderer componentInChildren2 = donutPrefab2.GetComponentInChildren<Renderer>(); componentInChildren2.sharedMaterial = val2; componentInChildren2.shadowCastingMode = (ShadowCastingMode)0; DontDestroyAndSetHideFlags((Object)(object)donutPrefab3); donutPrefab3.SetActive(false); bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val4; if ((Object)(object)donutPrefab == (Object)null) { ManualLogSource l = Plugin.L; BepInExWarningLogInterpolatedStringHandler val3 = new BepInExWarningLogInterpolatedStringHandler(16, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>("NAME"); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" Prefab is null!"); } l.LogWarning(val3); } else { ManualLogSource l2 = Plugin.L; val4 = new BepInExInfoLogInterpolatedStringHandler(24, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>("NAME"); ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(" Prefab has been loaded."); } l2.LogInfo(val4); } soundData = LoadData<ArtifactSoundData>("SoundData.json", directoryName); unlockCriteriasData = LoadData<GlucoseUnlockCriterias>("GlucoseUnlockCriterias.json", directoryName); ManualLogSource l3 = Plugin.L; val4 = new BepInExInfoLogInterpolatedStringHandler(43, 0, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Retrieving secured glucose storage data ..."); } l3.LogInfo(val4); glucoseStorage = LoadData<GlucoseStorage>("GlucoseStorage.json", text); try { ImageChain(); } catch (Exception ex) { ManualLogSource l4 = Plugin.L; BepInExErrorLogInterpolatedStringHandler val5 = new BepInExErrorLogInterpolatedStringHandler(8, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>("ImageChain"); ((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" error: "); ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(ex.Message); } l4.LogError(val5); ManualLogSource l5 = Plugin.L; val5 = new BepInExErrorLogInterpolatedStringHandler(0, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(ex.StackTrace); } l5.LogError(val5); } _loaded = true; } private static T LoadData<T>(string fileName, string folderPath = null) where T : new() { //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown if (string.IsNullOrEmpty(folderPath)) { folderPath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); } try { string path = Path.Combine(folderPath, fileName); if (!File.Exists(path)) { T val = new T(); File.WriteAllText(path, JsonConvert.SerializeObject((object)val, _jsonSerializerSettings)); return val; } return JsonConvert.DeserializeObject<T>(File.ReadAllText(path), _jsonSerializerSettings); } catch (Exception ex) { ManualLogSource l = Plugin.L; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(16, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Couldn't load "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(typeof(T).Name); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); } l.LogError(val2); ManualLogSource l2 = Plugin.L; val2 = new BepInExErrorLogInterpolatedStringHandler(0, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.StackTrace); } l2.LogError(val2); } return new T(); } private static void ImageChain() { LoadImageSprite(Doughnut.Resources.Data.sugar, out sugarSprite); } private static void LoadImage(byte[] bytes, out Texture2D tex) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown tex = new Texture2D(2, 2); ImageConversion.LoadImage(tex, Il2CppStructArray<byte>.op_Implicit(bytes), false); DontDestroyAndSetHideFlags((Object)(object)tex); } private static void LoadImageSprite(byte[] bytes, out Sprite sprite) { //IL_0024: 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) LoadImage(bytes, out var tex); sprite = Sprite.Create(tex, new Rect(0f, 0f, (float)((Texture)tex).width, (float)((Texture)tex).height), new Vector2(0.5f, 0.5f)); DontDestroyAndSetHideFlags((Object)(object)sprite); } private static void ReplaceMatShader(GameObject go) { ReplaceMatShader(go.GetComponentInChildren<Renderer>().sharedMaterial); } private static void ReplaceMatShader(Material mat) { if ((Object)(object)_shader == (Object)null) { _shader = Shader.Find("GTFO/Standard"); } mat.shader = _shader; } public static void LoadBundle(byte[] bytes, out AssetBundle bundle) { bundle = AssetBundle.LoadFromMemory(Il2CppStructArray<byte>.op_Implicit(bytes)); DontDestroyAndSetHideFlags((Object)(object)bundle); } public static void DontDestroyAndSetHideFlags(Object obj) { Object.DontDestroyOnLoad(obj); obj.hideFlags = (HideFlags)61; } public static Object LoadAsset(AssetBundle bundle, string path) { Object val = bundle.LoadAsset(path); DontDestroyAndSetHideFlags(val); return val; } } internal class Patches { [HarmonyWrapSafe] [HarmonyPatch(typeof(GameDataInit), "Initialize")] internal static class GameDataInit__Initialize__Patch { public static void Postfix() { AssetLoader.Load(); } } [HarmonyWrapSafe] [HarmonyPatch(typeof(CM_PageRundown_New), "UpdateExpeditionIconProgression")] public static class CM_PageRundown_New__UpdateExpeditionIconProgression__Patch { public static void Postfix(CM_PageRundown_New __instance) { UIManager.Setup(__instance); } } [HarmonyWrapSafe] [HarmonyPatch(typeof(RundownManager), "EndGameSession")] public class RundownManager__EndGameSession__Patch { public static bool Prefix() { return Plugin.IsSProgInstalled; } } [HarmonyWrapSafe] [HarmonyPatch(typeof(RundownManager), "ConsumeBoostersForCurrentGameSession")] public class RundownManager__ConsumeBoostersForCurrentGameSession__Patch { public static bool Prefix() { return Plugin.IsSProgInstalled; } } [HarmonyWrapSafe] [HarmonyPatch(typeof(RundownManager), "NewGameSession")] public class RundownManager__NewGameSession__Patch { public static bool Prefix() { Plugin.OnSessionStart(); return Plugin.IsSProgInstalled; } } [HarmonyWrapSafe] [HarmonyPatch(typeof(RundownManager), "OnExpeditionEnded")] public class RundownManager__OnExpeditionEnded__Patch { public static bool Prefix(ExpeditionEndState endState) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) ArtifactInventory artifactInventory = BoosterImplantManager.ArtifactInventory; (int, int, int) artifacts = (artifactInventory.GetArtifactCount((ArtifactCategory)0), artifactInventory.GetArtifactCount((ArtifactCategory)1), artifactInventory.GetArtifactCount((ArtifactCategory)2)); Plugin.OnSessionEnd(endState, artifacts); UIManager.UpdateGlucoseLevels(); return Plugin.IsSProgInstalled; } } [HarmonyWrapSafe] [HarmonyPatch(typeof(ArtifactPickup_Core), "Setup")] internal static class ArtifactPickup_Core__Setup__Patch { public static void Postfix(ArtifactPickup_Core __instance, ArtifactCategory category) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: 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_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected I4, but got Unknown //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) Vector3 position = ((Component)__instance).gameObject.transform.position; __instance.m_sync.OnSyncStateChange += Action<ePickupItemStatus, pPickupPlacement, PlayerAgent, bool>.op_Implicit((Action<ePickupItemStatus, pPickupPlacement, PlayerAgent, bool>)delegate(ePickupItemStatus status, pPickupPlacement placement, PlayerAgent player, bool isRecall) { //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) OnSyncStateChanged(__instance, status, placement, player, isRecall); }); IEnumerator enumerator = ((Component)__instance).transform.GetEnumerator(); try { while (enumerator.MoveNext()) { Object current = enumerator.Current; Transform val = ((Il2CppObjectBase)current).TryCast<Transform>(); if (((Object)val).name == "artifact_shape" || ((Object)val).name == "artifact_shape_b" || ((Object)val).name == "artifact_shape_c") { ((Component)val).gameObject.SetActive(false); } } } finally { if (enumerator is IDisposable disposable) { disposable.Dispose(); } } GameObject val2 = ((Il2CppObjectBase)Object.Instantiate<GameObject>((GameObject)((int)category switch { 1 => AssetLoader.donutPrefab3, 2 => AssetLoader.donutPrefab, _ => AssetLoader.donutPrefab2, }))).TryCast<GameObject>(); val2.transform.parent = ((Component)__instance).gameObject.transform; val2.transform.localPosition = Vector3.zero; val2.transform.localRotation = Quaternion.EulerRotation(0f, Random.Range(0f, 360f), 0f); val2.SetActive(true); } private static void OnSyncStateChanged(ArtifactPickup_Core self, ePickupItemStatus status, pPickupPlacement placement, PlayerAgent player, bool isRecall) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Expected I4, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) if ((int)status == 1 && !isRecall && !((Object)(object)player == (Object)null)) { bool flag = !((Agent)player).IsLocallyOwned; ArtifactCategory artifactCategory = self.m_artifactCategory; ArtifactCategory val = artifactCategory; PostSound(sound: (int)val switch { 1 => flag ? EVENTS.COMMODITY_ACQUIRED_VALUE_2_PASSIVE : EVENTS.COMMODITY_ACQUIRED_VALUE_2, 2 => flag ? EVENTS.COMMODITY_ACQUIRED_VALUE_3_PASSIVE : EVENTS.COMMODITY_ACQUIRED_VALUE_3, _ => flag ? EVENTS.COMMODITY_ACQUIRED_VALUE_1_PASSIVE : EVENTS.COMMODITY_ACQUIRED_VALUE_1, }, player: player, cat: self.m_artifactCategory, passive: flag); } } private static void PostSound(PlayerAgent player, ArtifactCategory cat, bool passive, uint sound) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) sound = AssetLoader.soundData.Get(cat, passive, sound); player.Sound.Post(sound, true); } } } [BepInPlugin("dev.aurirex.gtfo.doughnut", "Glucose Torus", "0.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BasePlugin { public const string GUID = "dev.aurirex.gtfo.doughnut"; public const string NAME = "Glucose Torus"; public const string VERSION = "0.1.0"; private const string SPROG_GUID = "dev.AuriRex.gtfo.SimpleProgression"; internal static ManualLogSource L; private static Harmony _harmony; public static bool IsSProgInstalled { get; private set; } public override void Load() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Expected O, but got Unknown L = ((BasePlugin)this).Log; ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExMessageLogInterpolatedStringHandler val = new BepInExMessageLogInterpolatedStringHandler(13, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Initializing "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("Glucose Torus"); } log.LogMessage(val); IsSProgInstalled = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.Any((KeyValuePair<string, PluginInfo> kvp) => string.Equals(kvp.Key, "dev.AuriRex.gtfo.SimpleProgression", StringComparison.CurrentCultureIgnoreCase)); _harmony = new Harmony("dev.aurirex.gtfo.doughnut"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); if (IsSProgInstalled) { ProgressionInterop.Init(); } } internal static void OnSessionStart() { L.LogInfo((object)"Session started."); } internal static void OnSessionEnd(ExpeditionEndState endState, (int Muted, int Bold, int Aggressive) artifacts) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_0081: 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) ManualLogSource l = L; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(45, 4, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Session has ended ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ExpeditionEndState>(endState); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")! Glucose collected: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(artifacts.Muted); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(artifacts.Bold); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(", "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(artifacts.Aggressive); } l.LogInfo(val); AssetLoader.glucoseStorage.AddValue(endState, artifacts); AssetLoader.SaveGlucose(); if (IsSProgInstalled) { ProgressionInterop.CheckUnlockConditions(); } } } } namespace Doughnut.UI { internal static class UIManager { [CompilerGenerated] private sealed class <DelayedToggle>d__7 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DelayedToggle>d__7(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(4f); <>1__state = 1; return true; case 1: <>1__state = -1; CoroutineManager.BlinkIn(_go, 0f); _routine = null; 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(); } } private static GameObject _go; private static CM_RundownTierMarker _rundownTierMarker; private static CM_ExpeditionSectorIcon _extractedGlucose; private static CM_ExpeditionSectorIcon _lostGlucose; private static Coroutine _routine; internal static void Setup(CM_PageRundown_New instance) { //IL_0080: 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_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_0311: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_go != (Object)null || (Object)(object)instance == (Object)null || (Object)(object)instance.m_tierMarkerSectorSummary == (Object)null) { return; } Plugin.L.LogDebug((object)"Setting up UI"); try { _go = Object.Instantiate<GameObject>(((Component)instance.m_tierMarkerSectorSummary).gameObject, (Transform)(object)((CM_PageBase)instance).m_movingContentHolder, true); _rundownTierMarker = _go.GetComponent<CM_RundownTierMarker>(); _go.transform.localScale = Vector3.one; _go.transform.localPosition = new Vector3(0f, 300f, 0f); _go.SetActive(false); ((Component)_go.transform.GetChild(0).GetChild(0)).gameObject.SetActive(false); Il2CppArrayBase<CM_ExpeditionSectorIcon> componentsInChildren = _go.GetComponentsInChildren<CM_ExpeditionSectorIcon>(); _rundownTierMarker.SetTierName("<u><size=135%><#fff>GLUCOSE EXTRACTION PROGRESS</color></size></u>"); _extractedGlucose = ((Il2CppObjectBase)componentsInChildren[0]).TryCast<CM_ExpeditionSectorIcon>(); _lostGlucose = ((Il2CppObjectBase)componentsInChildren[1]).TryCast<CM_ExpeditionSectorIcon>(); ((Object)_extractedGlucose).name = "CUSTOM_" + ((Object)_extractedGlucose).name; ((Object)_lostGlucose).name = "CUSTOM_" + ((Object)_extractedGlucose).name; _extractedGlucose.SetText("Secured"); _lostGlucose.SetText("Lost"); RectTransform component = ((Component)_extractedGlucose.m_title.transform.GetChild(0)).GetComponent<RectTransform>(); component.sizeDelta = new Vector2(868.673f, 150f); ((Transform)component).localPosition = ((Transform)component).localPosition - new Vector3(575f, 0f, 0f); RectTransform component2 = ((Component)_lostGlucose.m_title.transform.GetChild(0)).GetComponent<RectTransform>(); component2.sizeDelta = new Vector2(868.673f, 150f); ((Transform)component2).localPosition = ((Transform)component2).localPosition - new Vector3(575f, 0f, 0f); UpdateGlucoseLevels(); CM_Item buttonConnect = instance.m_buttonConnect; buttonConnect.OnBtnPressCallback += Action<int>.op_Implicit((Action<int>)OnRevealButtonPressed); _extractedGlucose.m_iconMainSkull.sprite = AssetLoader.sugarSprite; _extractedGlucose.m_iconMainSkull.color = new Color(0.8f, 0.8f, 0.8f); _lostGlucose.m_iconSecondarySkull.sprite = AssetLoader.sugarSprite; _lostGlucose.m_iconSecondarySkull.color = new Color(0.3f, 0.3f, 0.3f); ((Component)_extractedGlucose.m_iconMainBG).gameObject.SetActive(false); ((Component)_extractedGlucose.m_iconFinishedAllBG).gameObject.SetActive(true); _extractedGlucose.m_iconFinishedAllBG.color = new Color(0.3f, 0f, 0.25f); _lostGlucose.m_bgHolder.SetActive(false); ((Component)_lostGlucose.m_cross).gameObject.SetActive(true); ((Component)componentsInChildren[2]).gameObject.SetActive(false); ((Component)componentsInChildren[3]).gameObject.SetActive(false); } catch (Exception ex) { Plugin.L.LogError((object)(ex.GetType().Name + ": " + ex.Message)); Plugin.L.LogError((object)ex.StackTrace); } } private static void OnRevealButtonPressed(int _) { if (_routine == null) { _routine = CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DelayedToggle()), (Action)null); } } [IteratorStateMachine(typeof(<DelayedToggle>d__7))] private static IEnumerator DelayedToggle() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DelayedToggle>d__7(0); } public static void UpdateGlucoseLevels() { _extractedGlucose.SetRightSideText("<color=#FFFFFFCC><color=orange>[" + GetGlucoseString(GlucoseStorage.GlucoseStorageCategory.Success) + "]</color></color>"); _lostGlucose.SetRightSideText("<color=#FFFFFFCC><color=orange>[" + GetGlucoseString(GlucoseStorage.GlucoseStorageCategory.Failed) + "]</color></color>"); } public static string GetGlucoseString(GlucoseStorage.GlucoseStorageCategory cat) { GlucoseStorage glucoseStorage = AssetLoader.glucoseStorage; return glucoseStorage.Get(cat, (ArtifactCategory)0) + ", " + glucoseStorage.Get(cat, (ArtifactCategory)1) + ", " + glucoseStorage.Get(cat, (ArtifactCategory)2); } public static void SetActive(bool active) { _go.SetActive(active); } } } namespace Doughnut.Resources { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Data { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("Doughnut.Resources.Data", typeof(Data).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] donutbundle { get { object @object = ResourceManager.GetObject("donutbundle", resourceCulture); return (byte[])@object; } } internal static byte[] sugar { get { object @object = ResourceManager.GetObject("sugar", resourceCulture); return (byte[])@object; } } internal Data() { } } } namespace Doughnut.Interop { internal static class ProgressionInterop { private static class Impl { internal static void RegisterEvent() { LocalVanityItemDropper.OnSetupDone += OnSetupDone; } internal static void OnSetupDone(LocalVanityItemDropper dropper) { CheckUnlockConditions(); } internal static void CheckUnlockConditions() { //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown Plugin.L.LogWarning((object)"Checking for any met unlock conditions ..."); bool flag = default(bool); try { LocalVanityItemDropper instance = LocalVanityItemDropper.Instance; VanityItemsTemplateDataBlock[] source = ((IEnumerable<VanityItemsTemplateDataBlock>)GameDataBlockBase<VanityItemsTemplateDataBlock>.GetAllBlocks()).ToArray(); foreach (GlucoseUnlockCriterias.Criteria criteria in AssetLoader.unlockCriteriasData.UnlockCriterias) { ManualLogSource l = Plugin.L; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(10, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Criteria: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<GlucoseUnlockCriterias.Criteria>(criteria); } l.LogWarning(val); if (criteria.IsMet(AssetLoader.glucoseStorage)) { VanityItemsTemplateDataBlock val2 = ((IEnumerable<VanityItemsTemplateDataBlock>)source).FirstOrDefault((Func<VanityItemsTemplateDataBlock, bool>)((VanityItemsTemplateDataBlock block) => ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)block).name == criteria.UnlockKey)); if (val2 != null) { instance.TryDropCustomItem(val2, false, false); } } } } catch (Exception ex) { ManualLogSource l2 = Plugin.L; BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(41, 0, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Failed while trying to drop custom items!"); } l2.LogError(val3); Plugin.L.LogWarning((object)(ex.GetType().FullName + ": " + ex.Message)); Plugin.L.LogError((object)ex.StackTrace); } } } [MethodImpl(MethodImplOptions.NoInlining)] public static void Init() { Impl.RegisterEvent(); } [MethodImpl(MethodImplOptions.NoInlining)] public static void CheckUnlockConditions() { Impl.CheckUnlockConditions(); } } } namespace Doughnut.Data { public class ArtifactSoundData { public uint Muted { get; set; } = 0u; public uint Muted_Passive { get; set; } = 0u; public uint Bold { get; set; } = 0u; public uint Bold_Passive { get; set; } = 0u; public uint Aggressive { get; set; } = 0u; public uint Aggressive_Passive { get; set; } = 0u; public uint Get(ArtifactCategory cat, bool passive, uint alternative) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) uint num = Get(cat, passive); if (num != 0) { return num; } return alternative; } public uint Get(ArtifactCategory cat, bool passive) { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected I4, but got Unknown //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Expected I4, but got Unknown uint result; if (passive) { if (1 == 0) { } result = (int)cat switch { 0 => Muted_Passive, 1 => Bold_Passive, 2 => Aggressive_Passive, _ => 0u, }; if (1 == 0) { } return result; } if (1 == 0) { } result = (int)cat switch { 0 => Muted, 1 => Bold, 2 => Aggressive, _ => 0u, }; if (1 == 0) { } return result; } } public class GlucoseStorage { public enum GlucoseStorageCategory { Total, Success, Failed, Aborted } public class Data { public int Muted { get; set; } = 0; public int Bold { get; set; } = 0; public int Aggressive { get; set; } = 0; public int Get(ArtifactCategory category) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected I4, but got Unknown if (1 == 0) { } int result = (int)category switch { 0 => Muted, 1 => Bold, 2 => Aggressive, _ => Muted, }; if (1 == 0) { } return result; } internal void AddValue((int Muted, int Bold, int Aggressive) artifacts) { Muted += artifacts.Muted; Bold += artifacts.Bold; Aggressive += artifacts.Aggressive; } } public Data Total { get; set; } = new Data(); public Data Success { get; set; } = new Data(); public Data Failed { get; set; } = new Data(); public Data Aborted { get; set; } = new Data(); public int Get(GlucoseStorageCategory storageCategory, ArtifactCategory artifactCategory) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0041: 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_005f: Unknown result type (might be due to invalid IL or missing references) if (1 == 0) { } int result = storageCategory switch { GlucoseStorageCategory.Total => Total.Get(artifactCategory), GlucoseStorageCategory.Success => Success.Get(artifactCategory), GlucoseStorageCategory.Failed => Failed.Get(artifactCategory), GlucoseStorageCategory.Aborted => Aborted.Get(artifactCategory), _ => Total.Get(artifactCategory), }; if (1 == 0) { } return result; } internal void AddValue(ExpeditionEndState endState, (int Muted, int Bold, int Aggressive) artifacts) { //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_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_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected I4, but got Unknown Total.AddValue(artifacts); switch ((int)endState) { case 0: Success.AddValue(artifacts); break; case 1: Failed.AddValue(artifacts); break; case 2: Failed.AddValue(artifacts); Aborted.AddValue(artifacts); break; } } } public class GlucoseUnlockCriterias { public record Criteria { public string UnlockKey { get; set; } = string.Empty; public GlucoseStorage.GlucoseStorageCategory Category { get; set; } public GlucoseRequirement Requirements { get; set; } = new GlucoseRequirement(); public bool IsMet(GlucoseStorage storage) { int num = storage.Get(Category, (ArtifactCategory)0); int num2 = storage.Get(Category, (ArtifactCategory)1); int num3 = storage.Get(Category, (ArtifactCategory)2); int num4 = num + num2 + num3; return num >= Requirements.Muted && num2 >= Requirements.Bold && num3 >= Requirements.Aggressive && num4 >= Requirements.Any; } } public class GlucoseRequirement { public int Muted { get; set; } = 0; public int Bold { get; set; } = 0; public int Aggressive { get; set; } = 0; public int Any { get; set; } = 0; } public List<Criteria> UnlockCriterias { get; set; } = new List<Criteria> { new Criteria() }; } }
Plugins/AllVanity.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; 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 AllVanity.Interop; using AllVanity.Patches; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Hook; using DropServer.VanityItems; using GameData; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppInterop.Runtime.Runtime; using Il2CppSystem.Collections.Generic; using SimpleProgression.Core; using SimpleProgression.Models.Vanity; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyFileVersion("1.2.0")] [assembly: AssemblyInformationalVersion("1.2.0")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("AllVanity")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyProduct("AllVanity")] [assembly: AssemblyTitle("AllVanity")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.2.0.0")] [module: UnverifiableCode] namespace AllVanity { [BepInPlugin("dev.aurirex.gtfo.allvanity", "All Vanity", "1.2.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInIncompatibility("com.mccad00.AmongDrip")] public class Plugin : BasePlugin { public const string GUID = "dev.aurirex.gtfo.allvanity"; public const string NAME = "All Vanity"; public const string VERSION = "1.2.0"; public const string DEVIOUSLICK_GUID = "com.mccad00.AmongDrip"; public const string NOBOOSTERS_GUID = "dev.aurirex.gtfo.noboosters"; public const string SIMPLEPROGRESSION_GUID = "dev.aurirex.gtfo.simpleprogression"; private Harmony _harmonyInstance; internal static ManualLogSource L; internal static bool noboostersLoaded = false; internal static bool simpleProgressionLoaded = false; internal static string hexColorUnlocked = "faa"; public override void Load() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown L = ((BasePlugin)this).Log; noboostersLoaded = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.Any((KeyValuePair<string, PluginInfo> kvp) => string.Equals(kvp.Key, "dev.aurirex.gtfo.noboosters", StringComparison.InvariantCultureIgnoreCase)); simpleProgressionLoaded = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.Any((KeyValuePair<string, PluginInfo> kvp) => string.Equals(kvp.Key, "dev.aurirex.gtfo.simpleprogression", StringComparison.InvariantCultureIgnoreCase)); if (simpleProgressionLoaded) { ((BasePlugin)this).Log.LogInfo((object)"Simple Progression is installed, doing nothing :) ..."); return; } _harmonyInstance = new Harmony("dev.aurirex.gtfo.allvanity"); if (noboostersLoaded) { ((BasePlugin)this).Log.LogInfo((object)"NoBoosters is installed, harmony patching ..."); _harmonyInstance.PatchAll(typeof(Managed.PersistentInventoryManager_CommitPendingTransactions_Patch)); if (simpleProgressionLoaded) { _harmonyInstance.PatchAll(typeof(Managed.PersistentInventoryManager_TouchVanityItem_Patch)); } } else { ((BasePlugin)this).Log.LogInfo((object)"NoBoosters is NOT installed, native patching ..."); Native.ApplyNative(); } } } public static class Unlock { private static readonly HashSet<Func<VanityItemsTemplateDataBlock, UnlockState>> _lockStateFuncs = new HashSet<Func<VanityItemsTemplateDataBlock, UnlockState>>(); public static void RegisterUnlockMethod(Func<VanityItemsTemplateDataBlock, UnlockState> func) { if (func != null) { _lockStateFuncs.Add(func); } } public static bool IsAllowedToUnlock(VanityItemsTemplateDataBlock block) { //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Expected O, but got Unknown if (block == null) { return false; } if (_lockStateFuncs.Count == 0) { if (((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)block).name.StartsWith("LOCK_")) { return false; } return true; } bool flag = false; bool flag2 = false; bool flag3 = false; bool flag4 = default(bool); foreach (Func<VanityItemsTemplateDataBlock, UnlockState> lockStateFunc in _lockStateFuncs) { try { switch (lockStateFunc(block)) { case UnlockState.Skip: break; case UnlockState.TryUnlock: flag = true; break; case UnlockState.TryLock: flag2 = true; break; case UnlockState.ForceLock: flag3 = true; break; case UnlockState.ForceUnlock: return true; } } catch (Exception ex) { ManualLogSource l = Plugin.L; BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(24, 1, ref flag4); if (flag4) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("A provided "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("IsAllowedToUnlock"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" func failed!"); } l.LogWarning(val); ManualLogSource l2 = Plugin.L; BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(3, 3, ref flag4); if (flag4) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.GetType().Name); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("\n"); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.StackTrace); } l2.LogError(val2); } } if (flag3) { return false; } if (flag) { return true; } if (((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)block).name.StartsWith("LOCK_")) { return false; } return !flag2; } public static void ReloadInventory() { PersistentInventoryManager.SetInventoryDirty(true); } } public enum UnlockState { Skip, TryUnlock, TryLock, ForceUnlock, ForceLock } } namespace AllVanity.Patches { internal class Managed { [HarmonyPatch(typeof(PersistentInventoryManager), "CommitPendingTransactions")] internal static class PersistentInventoryManager_CommitPendingTransactions_Patch { [HarmonyPriority(500)] public static bool Prefix() { if (PersistentInventoryManager.m_dirty) { SetupVanityInventory(); PersistentInventoryManager.m_dirty = false; return false; } return true; } } [HarmonyPatch(typeof(PersistentInventoryManager), "TouchVanityItem")] internal static class PersistentInventoryManager_TouchVanityItem_Patch { public static bool Prefix(uint vanityItemId) { SimpleProgressionInterop.TouchAndAckIds(vanityItemId); PersistentInventoryManager.m_dirty = true; return false; } } public static void SetupVanityInventory() { Plugin.L.LogWarning((object)"Setting up Vanity Item Inventory!"); PersistentInventoryManager.Current.m_vanityItemsInventory.UpdateItems(CreateVanityPlayerData()); } internal static VanityItemPlayerData CreateVanityPlayerData() { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Expected O, but got Unknown if (Plugin.simpleProgressionLoaded) { return SimpleProgressionInterop.GetVanityPlayerData(); } Il2CppArrayBase<VanityItemsTemplateDataBlock> allBlocks = GameDataBlockBase<VanityItemsTemplateDataBlock>.GetAllBlocks(); List<VanityItemsTemplateDataBlock> list = new List<VanityItemsTemplateDataBlock>(); foreach (VanityItemsTemplateDataBlock item in allBlocks) { if (Unlock.IsAllowedToUnlock(item)) { list.Add(item); } } VanityItemPlayerData val = new VanityItemPlayerData(ClassInjector.DerivedConstructorPointer<VanityItemPlayerData>()); Il2CppReferenceArray<VanityItem> val2 = new Il2CppReferenceArray<VanityItem>((long)list.Count); int num = 0; foreach (VanityItemsTemplateDataBlock item2 in list) { VanityItem val3 = new VanityItem(ClassInjector.DerivedConstructorPointer<VanityItem>()) { Flags = (InventoryItemFlags)3, ItemId = ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)item2).persistentID }; ((Il2CppArrayBase<VanityItem>)(object)val2)[num] = val3; num++; } val.Items = val2; return val; } } internal class Native { public unsafe delegate void UpdateItems(IntPtr _this, IntPtr data, Il2CppMethodInfo* methodInfo); private static readonly List<INativeDetour> _detours = new List<INativeDetour>(); private static UpdateItems _originalUpdateItems; public unsafe static void* GetIl2CppMethod<T>(string methodName, string returnTypeName, bool isGeneric, params string[] argTypes) where T : Il2CppObjectBase { void** ptr = (void**)IL2CPP.GetIl2CppMethod(Il2CppClassPointerStore<T>.NativeClassPtr, isGeneric, methodName, returnTypeName, argTypes).ToPointer(); if (ptr == null) { return ptr; } return *ptr; } internal unsafe static void ApplyNative() { _detours.Add(INativeDetour.CreateAndApply<UpdateItems>((IntPtr)(nint)Native.GetIl2CppMethod<VanityItemInventory>("UpdateItems", "System.Void", isGeneric: false, new string[1] { "VanityItemPlayerData" }), (UpdateItems)UpdateItemsPatch, ref _originalUpdateItems)); } public unsafe static void UpdateItemsPatch(IntPtr self, IntPtr vanityItemPlayerData, Il2CppMethodInfo* methodInfo) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Expected O, but got Unknown //IL_012c: Unknown result type (might be due to invalid IL or missing references) VanityItemInventory val = new VanityItemInventory(self); _originalUpdateItems(self, vanityItemPlayerData, methodInfo); List<uint> list = new List<uint>(); if (val.m_backednItems == null) { val.m_backednItems = new List<VanityItem>(0); } Enumerator<VanityItem> enumerator = val.m_backednItems.GetEnumerator(); while (enumerator.MoveNext()) { VanityItem current = enumerator.Current; list.Add(current.id); } foreach (VanityItemsTemplateDataBlock allBlock in GameDataBlockBase<VanityItemsTemplateDataBlock>.GetAllBlocks()) { if (allBlock != null && !list.Contains(((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)allBlock).persistentID) && Unlock.IsAllowedToUnlock(allBlock)) { VanityItem val2 = new VanityItem(ClassInjector.DerivedConstructorPointer<VanityItem>()); val2.publicName = $"<#{Plugin.hexColorUnlocked}>{allBlock.publicName}</color>"; val2.type = allBlock.type; val2.prefab = allBlock.prefab; val2.flags = (VanityItemFlags)3; val2.id = ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)allBlock).persistentID; val.m_backednItems.Add(val2); } } } } } namespace AllVanity.Interop { internal static class SimpleProgressionInterop { private static class Impl { internal static VanityItemPlayerData Get() { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Expected O, but got Unknown //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: 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_011b: Expected O, but got Unknown IEnumerable<LocalVanityItem> validItemsAndFixCustomIDs = LocalVanityItemManager.Instance.LocalVanityItemPlayerData.GetValidItemsAndFixCustomIDs(); Il2CppArrayBase<VanityItemsTemplateDataBlock> allBlocks = GameDataBlockBase<VanityItemsTemplateDataBlock>.GetAllBlocks(); List<VanityItemsTemplateDataBlock> list = new List<VanityItemsTemplateDataBlock>(); foreach (VanityItemsTemplateDataBlock block2 in allBlocks) { if (Unlock.IsAllowedToUnlock(block2) || validItemsAndFixCustomIDs.Any((LocalVanityItem i) => i.ItemID == ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)block2).persistentID)) { list.Add(block2); } } VanityItemPlayerData val = new VanityItemPlayerData(ClassInjector.DerivedConstructorPointer<VanityItemPlayerData>()); Il2CppReferenceArray<VanityItem> val2 = new Il2CppReferenceArray<VanityItem>((long)list.Count); int num = 0; foreach (VanityItemsTemplateDataBlock block in list) { LocalVanityItem val3 = validItemsAndFixCustomIDs.FirstOrDefault((Func<LocalVanityItem, bool>)((LocalVanityItem i) => i.ItemID == ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)block).persistentID)); VanityItem val4 = new VanityItem(ClassInjector.DerivedConstructorPointer<VanityItem>()) { Flags = (InventoryItemFlags)((val3 == null) ? 3 : ((byte)val3.Flags)), ItemId = ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)block).persistentID }; ((Il2CppArrayBase<VanityItem>)(object)val2)[num] = val4; num++; } val.Items = val2; return val; } internal static void TouchAndAckIds(params uint[] ids) { LocalVanityItemManager instance = LocalVanityItemManager.Instance; instance.TouchIds(ids); instance.AcknowledgeIds(ids); } } [MethodImpl(MethodImplOptions.NoInlining)] public static VanityItemPlayerData GetVanityPlayerData() { return Impl.Get(); } [MethodImpl(MethodImplOptions.NoInlining)] internal static void TouchAndAckIds(params uint[] touchIds) { Impl.TouchAndAckIds(touchIds); } } }
Plugins/LEGACY.FogBeaconOnly.dll
Decompiled 2 weeks agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using AIGraph; using AK; using Agents; using AssetShards; using BepInEx; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Utils.Collections; using ChainedPuzzles; using Enemies; using ExtraObjectiveSetup.BaseClasses; using ExtraObjectiveSetup.ExtendedWardenEvents; using ExtraObjectiveSetup.JSON; using ExtraObjectiveSetup.Utils; using GTFO.API; 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.LegacyOverride; using LEGACY.LegacyOverride.EnemyTagger; using LEGACY.LegacyOverride.FogBeacon; using LEGACY.Utils; using LevelGeneration; using Localization; using MTFO.API; 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("LEGACY.FogBeaconOnly")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+427ba9cccf55339cb42caf5966ac66be5a73096b")] [assembly: AssemblyProduct("LEGACY.FogBeaconOnly")] [assembly: AssemblyTitle("LEGACY.FogBeaconOnly")] [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 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; } internal static GameObject RestartPage { 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"); RestartPage = AssetAPI.GetLoadedAsset<GameObject>("Assets/Misc/CM_PageRestart_CellUI.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.*/)] [BepInPlugin("Inas.LEGACY.FogBeaconOnly", "LEGACY.FogBeaconOnly", "4.4.5")] public class EntryPoint : BasePlugin { public const string AUTHOR = "Inas"; public const string RUNDOWN_NAME = "LEGACY.FogBeaconOnly"; public const string VERSION = "4.4.5"; public const bool TESTING = false; public const string TEST_STRING = "TESTING"; private Harmony m_Harmony; public override void Load() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown m_Harmony = new Harmony("LEGACY"); m_Harmony.PatchAll(); LegacyOverrideManagers.Init(); AssetAPI.OnAssetBundlesLoaded += Assets.Init; EventAPI.OnManagersSetup += delegate { AssetShardManager.OnStartupAssetsLoaded += Action.op_Implicit((Action)MainMenuGuiLayer.Current.PageRundownNew.SetupCustomTutorialButton); }; } } } 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_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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //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_0025: Invalid comparison between Unknown and I4 //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 eDoorStatus status = state.status; eDoorStatus val = status; if ((val - 4 <= 1 || (int)val == 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; } } } 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 Transform trans; public Vector3 sourcePos; public Vector3 targetPos; public float startTime; public float duration; public EasingFunction ease; public Action onDone; public BoolCheck checkAbort; private bool <doAbort>5__1; private float <t>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_00e2: 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_0086: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <doAbort>5__1 = false; break; case 1: <>1__state = -1; break; } if (Clock.Time < startTime + duration && !<doAbort>5__1) { <doAbort>5__1 = checkAbort != null && checkAbort(); <t>5__2 = ease(Clock.Time - startTime, 0f, 1f, duration); trans.localPosition = Vector3.Lerp(sourcePos, targetPos, <t>5__2); <>2__current = null; <>1__state = 1; return true; } trans.localPosition = targetPos; if (!<doAbort>5__1 && 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 Transform trans; public Vector3 sourceEuler; public Vector3 targetEuler; public float startTime; public float duration; public EasingFunction ease; public Action onDone; public BoolCheck checkAbort; private bool <doAbort>5__1; private float <t>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_00e2: 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_0086: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <doAbort>5__1 = false; break; case 1: <>1__state = -1; break; } if (Clock.Time < startTime + duration && !<doAbort>5__1) { <doAbort>5__1 = checkAbort != null && checkAbort(); <t>5__2 = ease(Clock.Time - startTime, 0f, 1f, duration); trans.localEulerAngles = Vector3.Lerp(sourceEuler, targetEuler, <t>5__2); <>2__current = null; <>1__state = 1; return true; } trans.localEulerAngles = targetEuler; if (!<doAbort>5__1 && 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 Transform trans; public Vector3 startScale; public Vector3 targetScale; public float startTime; public float duration; public EasingFunction ease; public Action onDone; public BoolCheck checkAbort; private bool <doAbort>5__1; private float <t>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_00e2: 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_0086: 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) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <doAbort>5__1 = false; break; case 1: <>1__state = -1; break; } if (Clock.Time < startTime + duration && !<doAbort>5__1) { <doAbort>5__1 = checkAbort != null && checkAbort(); <t>5__2 = ease(Clock.Time - startTime, 0f, 1f, duration); trans.localScale = Vector3.Lerp(startScale, targetScale, <t>5__2); <>2__current = null; <>1__state = 1; return true; } trans.localScale = targetScale; if (!<doAbort>5__1 && 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_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) 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_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) 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_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) 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 GOExtensions { public static GameObject GetChild(this GameObject go, string childName, bool substrSearch = false, bool recursiveSearch = true) { if (((Object)go).name.Equals(childName) || (substrSearch && ((Object)go).name.Contains(childName))) { return go; } for (int i = 0; i < go.transform.childCount; i++) { GameObject gameObject = ((Component)go.transform.GetChild(i)).gameObject; GameObject val = null; if (recursiveSearch) { val = gameObject.GetChild(childName, substrSearch); } else if (((Object)gameObject).name.Equals(childName) || (substrSearch && ((Object)gameObject).name.Contains(childName))) { val = gameObject; } if ((Object)(object)val != (Object)null) { return val; } } return 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) { CP_Holopath_Spline val2 = ((Il2CppObjectBase)val.m_spline).Cast<CP_Holopath_Spline>(); CP_PlayerScanner val3 = ((Il2CppObjectBase)val.PlayerScanner).Cast<CP_PlayerScanner>(); val3.ResetScanProgression(0f); val.Deactivate(); return; } CP_Cluster_Core val4 = ((Il2CppObjectBase)ICore).TryCast<CP_Cluster_Core>(); if ((Object)(object)val4 == (Object)null) { LegacyLogger.Error("ResetChild: found iChainedPuzzleCore that is neither CP_Bioscan_Core nor CP_Cluster_Core..."); return; } CP_Holopath_Spline val5 = ((Il2CppObjectBase)val4.m_spline).Cast<CP_Holopath_Spline>(); foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)val4.m_childCores) { ResetChild(item); } val4.Deactivate(); } public static void ResetChainedPuzzle(ChainedPuzzleInstance chainedPuzzleInstance) { //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_0027: Expected O, but got Unknown //IL_006d: 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_0076: 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_0086: 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_00a4: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) 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_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 return (int)player.Owner.Load<pGameState>().gameState == 10; } public static ChainedPuzzleInstance GetChainedPuzzleForCommandOnTerminal(LG_ComputerTerminal terminal, string command) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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_002b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected I4, but got Unknown //IL_00d7: 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_0184: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Invalid comparison between Unknown and I4 //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Invalid comparison between Unknown and I4 //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Invalid comparison between Unknown and I4 //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Invalid comparison between Unknown and I4 //IL_021e: Unknown result type (might be due to invalid IL or missing references) //IL_0222: Invalid comparison between Unknown and I4 //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Invalid comparison between Unknown and I4 //IL_025f: Unknown result type (might be due to invalid IL or missing references) uint num = 0u; if (terminal.SpawnNode.m_dimension.IsMainDimension) { LG_LayerType layerType = terminal.SpawnNode.LayerType; LG_LayerType val = layerType; switch ((int)val) { 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> val2 = null; List<LG_ComputerTerminal> terminalsSpawnedInZone = terminal.SpawnNode.m_zone.TerminalsSpawnedInZone; int num2 = terminalsSpawnedInZone.IndexOf(terminal); ExpeditionZoneData val3 = null; Enumerator<ExpeditionZoneData> enumerator = block.Zones.GetEnumerator(); while (enumerator.MoveNext()) { ExpeditionZoneData current = enumerator.Current; if (current.LocalIndex == terminal.SpawnNode.m_zone.LocalIndex) { val3 = current; break; } } if (val3 == null) { LegacyLogger.Error("Cannot find target zone data."); return null; } if (val3.TerminalPlacements.Count != terminalsSpawnedInZone.Count) { LegacyLogger.Error("The numbers of terminal placement and spawn, skipped for the zone terminal."); return null; } val2 = val3.TerminalPlacements[num2].UniqueCommands; if (val2.Count == 0) { return null; } List<WardenObjectiveEventData> val4 = null; TERM_Command val5 = (TERM_Command)0; Enumerator<CustomTerminalCommand> enumerator2 = val2.GetEnumerator(); string text = default(string); string text2 = default(string); while (enumerator2.MoveNext()) { CustomTerminalCommand current2 = enumerator2.Current; if (current2.Command == command) { val4 = current2.CommandEvents; if (!terminal.m_command.TryGetCommand(current2.Command, ref val5, ref text, ref text2)) { LegacyLogger.Error("Cannot get TERM_COMMAND for command {0} on the specified terminal."); } break; } } if (val4 == null || (int)val5 == 0) { return null; } if ((int)val5 != 38 && (int)val5 != 39 && (int)val5 != 40 && (int)val5 != 41 && (int)val5 != 42) { return null; } ChainedPuzzleInstance val6 = null; for (int i = 0; i < val4.Count && (val4[i].ChainPuzzle == 0 || !terminal.TryGetChainPuzzleForCommand(val5, i, ref val6) || !((Object)(object)val6 != (Object)null)); i++) { } return val6; } 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_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0031: 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_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_0034: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between I4 and Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Invalid comparison between I4 and Unknown //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected I4, but got Unknown //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Invalid comparison between I4 and Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Invalid comparison between I4 and Unknown //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Expected I4, but got Unknown //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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_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_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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0077: 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; eDimensionIndex currentDimensionIndex = 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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: 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_0068: 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_0119: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) 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; } return (terminalIndex < 0) ? null : val.TerminalsSpawnedInZone[terminalIndex]; } public static AIG_NodeCluster GetNodeFromDimensionPosition(eDimensionIndex dimensionIndex, Vector3 position) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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) 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 { static Json() { } public static T Deserialize<T>(string json) { return EOSJson.Deserialize<T>(json); } public static object Deserialize(Type type, string json) { return EOSJson.Deserialize(type, json); } public static string Serialize<T>(T value) { return EOSJson.Serialize<T>(value); } 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; } = (eWardenObjectiveEventTrigger)0; public int Type { get; set; } = 170; public eDimensionIndex DimensionIndex { get; set; } = (eDimensionIndex)0; public LG_LayerType Layer { get; set; } = (LG_LayerType)0; public eLocalZoneIndex LocalIndex { get; set; } = (eLocalZoneIndex)0; public string WorldEventObjectFilter { get; set; } = "RANDOM"; public uint EnemyID { get; set; } public int Count { get; set; } = 1; public float Delay { get; set; } = 0f; 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected I4, but got Unknown //IL_00b0: 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; LG_AreaSize val = size; switch (val - 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_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_0008: 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_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_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) GameObject val = Object.Instantiate<GameObject>(Assets.ObjectiveMarker); float num = 0.16216217f; Transform transform = val.transform; transform.localPosition += Vector3.up * num; return val; } public void EnableMarkerAt(string markerName, GameObject target, float scale) { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) if (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_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_0039: 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_007a: 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) { GameObject value; NavMarker value2; return (markerVisuals.TryGetValue(markerName, out value) && navMarkers.TryGetValue(markerName, out value2)) ? (value, value2) : (null, null); } 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() { BigPickupFogBeaconSettingManager.Current.Init(); EnemyTaggerSettingManager.Current.Init(); ((ZoneDefinitionManager<LevelSpawnedFogBeaconDefinition>)LevelSpawnedFogBeaconManager.Current).Init(); } } } namespace LEGACY.LegacyOverride.EnemyTargeting { internal class EnemyTargetingPrioritizer : MonoBehaviour { public const float UPDATE_INTERVAL = 3f; private float nextUpdateTime = float.NaN; internal EnemyAgent enemy = null; private Dam_EnemyDamageBase damage { get { EnemyAgent obj = enemy; return (obj != null) ? obj.Damage : null; } } private AgentTarget target { get { EnemyAgent obj = enemy; return (obj != null) ? ((AgentAI)obj.AI).Target : null; } } private void Update() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Invalid comparison between Unknown and I4 //IL_00ec: 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) 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() { AgentTarget val = target; Agent val2 = 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)) { continue; } val2 = (Agent)(object)current; break; } if ((Object)(object)val2 == (Object)null) { Enumerator<PlayerAgent> enumerator2 = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator2.MoveNext()) { PlayerAgent current2 = enumerator2.Current; if (!((Agent)current2).Alive || !(((Il2CppObjectBase)((Agent)current2).CourseNode.m_zone).Pointer == ((Il2CppObjectBase)((Agent)enemy).CourseNode.m_zone).Pointer)) { continue; } val2 = (Agent)(object)current2; break; } } if ((Object)(object)val2 != (Object)null) { ((AgentAI)enemy.AI).SetTarget(val2); } } private void OnDestroy() { enemy = null; } static EnemyTargetingPrioritizer() { ClassInjector.RegisterTypeInIl2Cpp<EnemyTargetingPrioritizer>(); } } } namespace LEGACY.LegacyOverride.Patches { [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 SetupBigPickupItemWithItemId { private static void SetupAsFogBeacon(LG_PickupItem __instance) { //IL_000c: 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_00ea: 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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Expected O, but got Unknown //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_023a: Expected O, but got Unknown //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01bb: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) FogRepeller_Sphere val = new GameObject("FogInstance_Beacon_Fake").AddComponent<FogRepeller_Sphere>(); val.InfiniteDuration = false; val.LifeDuration = 99999f; val.GrowDuration = 99999f; val.ShrinkDuration = 99999f; val.Range = 1f; BigPickupFogBeaconSetting setting = BigPickupFogBeaconSettingManager.Current.SettingForCurrentLevel; FogRepeller_Sphere fogRepHold = new GameObject("FogInstance_Beacon_SmallLayer").AddComponent<FogRepeller_Sphere>(); fogRepHold.InfiniteDuration = setting.RSHold.InfiniteDuration; fogRepHold.GrowDuration = setting.RSHold.GrowDuration; fogRepHold.ShrinkDuration = setting.RSHold.ShrinkDuration; fogRepHold.Range = setting.RSHold.Range; fogRepHold.Offset = Vector3.zero; FogRepeller_Sphere fogRepPlaced = new GameObject("FogInstance_Beacon_BigLayer").AddComponent<FogRepeller_Sphere>(); fogRepPlaced.InfiniteDuration = setting.RSPlaced.InfiniteDuration; fogRepPlaced.GrowDuration = setting.RSPlaced.GrowDuration; fogRepPlaced.ShrinkDuration = setting.RSPlaced.ShrinkDuration; fogRepPlaced.Range = setting.RSPlaced.Range; fogRepPlaced.Offset = Vector3.zero; CarryItemPickup_Core componentInChildren = ((Component)__instance.m_root).GetComponentInChildren<CarryItemPickup_Core>(); HeavyFogRepellerPickup val2 = ((Il2CppObjectBase)componentInChildren).Cast<HeavyFogRepellerPickup>(); iCarryItemWithGlobalState val3 = default(iCarryItemWithGlobalState); byte byteId = default(byte); if (CarryItemWithGlobalStateManager.TryCreateItemInstance((eCarryItemWithGlobalStateType)0, __instance.m_root, ref val3, ref byteId)) { pItemData_Custom customData = ((Item)val2).GetCustomData(); customData.byteId = byteId; pItemData_Custom val4 = customData; ((Item)val2).SetCustomData(val4, true); } HeavyFogRepellerGlobalState val5 = ((Il2CppObjectBase)val3).Cast<HeavyFogRepellerGlobalState>(); ((Component)fogRepHold).transform.SetParent(((Component)val5).transform, false); ((Component)fogRepPlaced).transform.SetParent(((Component)val5).transform, false); val5.m_repellerSphere = val; fogRepHold.m_sphereAllocator = new FogSphereAllocator(); fogRepPlaced.m_sphereAllocator = new FogSphereAllocator(); Interact_Pickup_PickupItem interact = ((Il2CppObjectBase)componentInChildren.m_interact).Cast<Interact_Pickup_PickupItem>(); ((Interact_Timed)interact).InteractDuration = setting.TimeToPickup; val5.CallbackOnStateChange += Action<pCarryItemWithGlobalState_State, pCarryItemWithGlobalState_State, bool>.op_Implicit((Action<pCarryItemWithGlobalState_State, pCarryItemWithGlobalState_State, bool>)delegate(pCarryItemWithGlobalState_State oldState, pCarryItemWithGlobalState_State newState, bool isRecall) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Invalid comparison between Unknown and I4 //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (isRecall) { FogRepeller_Sphere obj = fogRepHold; if (obj != null) { obj.KillRepellerInstantly(); } FogRepeller_Sphere obj2 = fogRepPlaced; if (obj2 != null) { obj2.KillRepellerInstantly(); } } else { eHeavyFogRepellerStatus val6 = (eHeavyFogRepellerStatus)newState.status; eHeavyFogRepellerStatus val7 = val6; if ((int)val7 != 1) { if ((int)val7 == 2) { FogRepeller_Sphere obj3 = fogRepHold; if (obj3 != null) { obj3.StopRepelling(); } FogRepeller_Sphere obj4 = fogRepPlaced; if (obj4 != null) { obj4.StartRepelling(); } ((Interact_Timed)interact).InteractDuration = setting.TimeToPickup; } } else { FogRepeller_Sphere obj5 = fogRepHold; if (obj5 != null) { obj5.StartRepelling(); } if (oldState.status != 0) { FogRepeller_Sphere obj6 = fogRepPlaced; if (obj6 != null) { obj6.StopRepelling(); } } ((Interact_Timed)interact).InteractDuration = setting.TimeToPlace; } } }); } [HarmonyPostfix] [HarmonyPatch(typeof(LG_PickupItem), "SetupBigPickupItemWithItemId")] private static void Post_SetupBigPickupItemWithItemId(LG_PickupItem __instance, uint itemId) { switch (itemId) { case 233u: SetupAsFogBeacon(__instance); break; case 234u: case 235u: case 236u: case 237u: EnemyTaggerSettingManager.Current.SetupAsObserver(__instance); break; } } static SetupBigPickupItemWithItemId() { } } } namespace LEGACY.LegacyOverride.FogBeacon { public class LevelSpawnedFogBeacon { public static uint LSFB_ITEM_DB_ID { get; private set; } public static bool HasFogBeaconItemDBDefinition => LSFB_ITEM_DB_ID != 0; public string WorldEventObjectFilter => def?.WorldEventObjectFilter ?? string.Empty; public LevelSpawnedFogBeaconSettings def { get; private set; } public HeavyFogRepellerGlobalState GlobalState { get; private set; } public LG_PickupItem LG_PickupItem { get; private set; } public NavMarker NavMarker { get; private set; } public Vector3 Position { get { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) LG_PickupItem lG_PickupItem = LG_PickupItem; return (lG_PickupItem != null) ? ((Component)lG_PickupItem).transform.position : Vector3.zero; } } public Color NAV_MARKER_COLOR { get; } = new Color(1f, 0.75686276f, 0.14509805f); public static LevelSpawnedFogBeacon Instantiate(eDimensionIndex dimensionIndex, LG_LayerType layer, eLocalZoneIndex localIndex, LevelSpawnedFogBeaconSettings def) { //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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) if (!HasFogBeaconItemDBDefinition) { LegacyLogger.Error("LevelSpawnedFogBeaconManager: ItemDatablock Definition of vanilla Fog Repeller Turbine is not found..."); return null; } LG_Zone val = default(LG_Zone); if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(dimensionIndex, layer, localIndex, ref val) || (Object)(object)val == (Object)null || def.AreaIndex < 0 || def.AreaIndex >= val.m_areas.Count) { LegacyLogger.Error($"LevelSpawnedFogBeacon: cannot find {(dimensionIndex, layer, localIndex)}, Area_{(ushort)(65 + def.AreaIndex)}"); return null; } AIG_CourseNode courseNode = val.m_areas[def.AreaIndex].m_courseNode; LevelSpawnedFogBeacon levelSpawnedFogBeacon = new LevelSpawnedFogBeacon(def, courseNode); levelSpawnedFogBeacon.def = def; return levelSpawnedFogBeacon; } internal void Destroy() { Object.Destroy((Object)(object)((Component)LG_PickupItem.m_root).gameObject); GlobalState = null; LG_PickupItem = null; def = null; } private LevelSpawnedFogBeacon(LevelSpawnedFogBeaconSettings def, AIG_CourseNode node) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0087: 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) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) this.def = def; GameObject val = new GameObject($"LSBF_{def.WorldEventObjectFilter}-Area_{(ushort)(65 + def.AreaIndex)}"); val.transform.SetPositionAndRotation(def.Position.ToVector3(), Quaternion.identity); LG_PickupItem = LG_PickupItem.SpawnGenericPickupItem(val.transform); LG_PickupItem.SpawnNode = node; int count = ((Il2CppArrayBase<Dictionary<byte, iCarryItemWithGlobalState>>)(object)CarryItemWithGlobalStateManager.Current.m_carryItemGlobalStatesInstancesPerType)[0].Count; LG_PickupItem.SetupAsBigPickupItem(1, LSFB_ITEM_DB_ID, false, -1); CarryItemPickup_Core componentInChildren = ((Component)LG_PickupItem.m_root).GetComponentInChildren<CarryItemPickup_Core>(); LG_PickupItem_Sync val2 = ((Il2CppObjectBase)componentInChildren.m_sync).Cast<LG_PickupItem_Sync>(); if ((Object)(object)val2 != (Object)null) { pPickupItemState state = val2.m_stateReplicator.State; ((pCourseNode)(ref state.placement.node)).Set(LG_PickupItem.SpawnNode); } Interact_Pickup_PickupItem val3 = ((Il2CppObjectBase)componentInChildren.m_interact).Cast<Interact_Pickup_PickupItem>(); ((Component)val3).gameObject.SetActive(false); iTerminalItem componentInChildren2 = ((Component)LG_PickupItem).GetComponentInChildren<iTerminalItem>(); if (componentInChildren2 != null) { LG_LevelInteractionManager.DeregisterTerminalItem(componentInChildren2); } NavMarker = GuiManager.NavMarkerLayer.PrepareGenericMarker(((Component)LG_PickupItem).gameObject); if ((Object)(object)NavMarker != (Object)null) { NavMarker.SetColor(NAV_MARKER_COLOR); NavMarker.SetStyle((eNavMarkerStyle)14); NavMarker.SetVisible(false); } iCarryItemWithGlobalState val4 = default(iCarryItemWithGlobalState); if (!CarryItemWithGlobalStateManager.TryGetItemInstance((eCarryItemWithGlobalStateType)0, (byte)count, ref val4)) { LegacyLogger.Error("LevelSpawnedFogBeaconManager: Didn't find GlobalState of '" + def.WorldEventObjectFilter + "'"); return; } GlobalState = ((Il2CppObjectBase)val4).Cast<HeavyFogRepellerGlobalState>(); FogRepeller_Sphere repellerSphere = GlobalState.m_repellerSphere; repellerSphere.GrowDuration = def.GrowDuration; repellerSphere.ShrinkDuration = def.ShrinkDuration; repellerSphere.Range = def.Range; HeavyFogRepellerGlobalState globalState = GlobalState; globalState.CallbackOnStateChange += Action<pCarryItemWithGlobalState_State, pCarryItemWithGlobalState_State, bool>.op_Implicit((Action<pCarryItemWithGlobalState_State, pCarryItemWithGlobalState_State, bool>)delegate(pCarryItemWithGlobalState_State oldState, pCarryItemWithGlobalState_State newState, bool isRecall) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_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_001e: Expected I4, but got Unknown //IL_0042: 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_0053: 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Expected O, but got Unknown eHeavyFogRepellerStatus val5 = (eHeavyFogRepellerStatus)newState.status; eHeavyFogRepellerStatus val6 = val5; eHeavyFogRepellerStatus val7 = val6; switch ((int)val7) { case 0: case 2: NavMarker.SetVisible(false); break; case 1: NavMarker.SetVisible(true); if (isRecall) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(new WardenObjectiveEventData { Type = (eWardenObjectiveEventType)222, WorldEventObjectFilter = WorldEventObjectFilter, Enabled = true, Delay = 1.1f }, (eWardenObjectiveEventTrigger)0, true, 0f); } break; } }); } private static void FindFogTurbineItemDBID() { if (!HasFogBeaconItemDBDefinition) { LSFB_ITEM_DB_ID = ((GameDataBlockBase<ItemDataBlock>)(object)GameDataBlockBase<ItemDataBlock>.GetBlock("Carry_HeavyFogRepeller"))?.persistentID ?? 0; if (LSFB_ITEM_DB_ID == 0) { LegacyLogger.Error("LevelSpawnedFogBeaconManager: ItemDatablock Definition of vanilla Fog Repeller Turbine is not found..."); } } } static LevelSpawnedFogBeacon() { LSFB_ITEM_DB_ID = 0u; FindFogTurbineItemDBID(); LevelAPI.OnBuildStart += FindFogTurbineItemDBID; } } public class LevelSpawnedFogBeaconSettings { public int AreaIndex { get; set; } = 0; public float GrowDuration { get; set; } = 10f; public float ShrinkDuration { get; set; } = 10f; public float Range { get; set; } = 11f; public string WorldEventObjectFilter { get; set; } = string.Empty; public Vec3 Position { get; set; } = new Vec3(); } public class LevelSpawnedFogBeaconDefinition : GlobalZoneIndex { public List<LevelSpawnedFogBeaconSettings> SpawnedBeaconsInZone { get; set; } = new List<LevelSpawnedFogBeaconSettings> { new LevelSpawnedFogBeaconSettings() }; } public class LevelSpawnedFogBeaconManager : ZoneDefinitionManager<LevelSpawnedFogBeaconDefinition> { private Dictionary<IntPtr, LevelSpawnedFogBeaconSettings> LSFBGlobalStatesSet = new Dictionary<IntPtr, LevelSpawnedFogBeaconSettings>(); public static LevelSpawnedFogBeaconManager Current { get; } private Dictionary<string, LevelSpawnedFogBeacon> LevelSpawnedFogBeacons { get; } = new Dictionary<string, LevelSpawnedFogBeacon>(); protected override string DEFINITION_NAME => "LevelSpawnedFogBeacon"; private void Build(LevelSpawnedFogBeaconDefinition def) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) foreach (LevelSpawnedFogBeaconSettings item in def.SpawnedBeaconsInZone) { if (item.WorldEventObjectFilter == null || item.WorldEventObjectFilter == string.Empty || LevelSpawnedFogBeacons.ContainsKey(item.WorldEventObjectFilter)) { LegacyLogger.Error("LevelSpawnedFogBeaconManager: WorldEventObjectFilter '" + item.WorldEventObjectFilter + "' is either unassigned or has already been assigned."); continue; } LevelSpawnedFogBeacon levelSpawnedFogBeacon = LevelSpawnedFogBeacon.Instantiate(((GlobalZoneIndex)def).DimensionIndex, ((GlobalZoneIndex)def).LayerType, ((GlobalZoneIndex)def).LocalIndex, item); if (levelSpawnedFogBeacon != null) { LevelSpawnedFogBeacons[item.WorldEventObjectFilter] = levelSpawnedFogBeacon; LSFBGlobalStatesSet[((Il2CppObjectBase)levelSpawnedFogBeacon.GlobalState).Pointer] = item; LegacyLogger.Debug($"LevelSpawnedFogBeaconManager: spawned '{item.WorldEventObjectFilter}' in {((GlobalZoneIndex)def).GlobalZoneIndexTuple()}, Area_{(ushort)(65 + item.AreaIndex)}"); } } } internal LevelSpawnedFogBeaconSettings GetLSFBDef(HeavyFogRepellerGlobalState h) { LevelSpawnedFogBeaconSettings value; return LSFBGlobalStatesSet.TryGetValue(((Il2CppObjectBase)h).Pointer, out value) ? value : null; } public void ToggleLSFBState(string worldEventgObjectFilter, bool enable) { //IL_0041: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) if (!LevelSpawnedFogBeacons.TryGetValue(worldEventgObjectFilter, out var value)) { LegacyLogger.Error("ToggleLSFBState: '" + worldEventgObjectFilter + "' is not defined"); } else if (SNet.IsMaster) { value.GlobalState.AttemptInteract(new pCarryItemWithGlobalState_Interaction { type = (byte)((!enable) ? 1 : 0), owner = (eCarryItemWithGlobalStateOwner)2, staticPosition = value.Position }); } } private void Clear() { foreach (LevelSpawnedFogBeacon value in LevelSpawnedFogBeacons.Values) { value.Destroy(); } LSFBGlobalStatesSet.Clear(); LevelSpawnedFogBeacons.Clear(); } private void BuildLevelSpawnedFogBeacons() { if (base.definitions.ContainsKey(RundownManager.ActiveExpedition.LevelLayoutData)) { base.definitions[RundownManager.ActiveExpedition.LevelLayoutData].Definitions.ForEach(Build); } } private LevelSpawnedFogBeaconManager() { LevelAPI.OnBuildStart += Clear; LevelAPI.OnLevelCleanup += Clear; LevelAPI.OnBuildDone += BuildLevelSpawnedFogBeacons; } static LevelSpawnedFogBeaconManager() { Current = new LevelSpawnedFogBeaconManager(); } } public class RepellerSphereSetting { public bool InfiniteDuration { get; set; } = false; public float GrowDuration { get; set; } = 10f; public float ShrinkDuration { get; set; } = 10f; public float Range { get; set; } = 11f; } public class BigPickupFogBeaconSetting { public uint MainLevelLayout { get; set; } = 0u; public float TimeToPickup { get; set; } = 1f; public float TimeToPlace { get; set; } = 1f; public RepellerSphereSetting RSHold { get; set; } = new RepellerSphereSetting(); public RepellerSphereSetting RSPlaced { get; set; } = new RepellerSphereSetting(); } internal class BigPickupFogBeaconSettingManager { private Dictionary<uint, BigPickupFogBeaconSetting> fogBeaconSettings = new Dictionary<uint, BigPickupFogBeaconSetting>(); private LiveEditListener liveEditListener; private static readonly string CONFIG_PATH; public static readonly BigPickupFogBeaconSetting DEDFAULT_SETTING; public static BigPickupFogBeaconSettingManager Current { get; private set; } internal BigPickupFogBeaconSetting SettingForCurrentLevel { get; private set; } = DEDFAULT_SETTING; private void AddOverride(BigPickupFogBeaconSetting _override) { if (_override != null) { if (fogBeaconSettings.ContainsKey(_override.MainLevelLayout)) { LegacyLogger.Warning("Replaced MainLevelLayout {0}", _override.MainLevelLayout); fogBeaconSettings[_override.MainLevelLayout] = _override; } else { fogBeaconSettings.Add(_override.MainLevelLayout, _override); } } } public void Init() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown if (!Directory.Exists(CONFIG_PATH)) { Directory.CreateDirectory(CONFIG_PATH); StreamWriter streamWriter = File.CreateText(Path.Combine(CONFIG_PATH, "Template.json")); streamWriter.WriteLine(Json.Serialize(new BigPickupFogBeaconSetting())); streamWriter.Flush(); streamWriter.Close(); return; } foreach (string item in Directory.EnumerateFiles(CONFIG_PATH, "*.json", SearchOption.AllDirectories)) { Json.Load<BigPickupFogBeaconSetting>(item, out var config); AddOverride(config); } LevelAPI.OnBuildStart += UpdateSetting; liveEditListener = LiveEdit.CreateListener(CONFIG_PATH, "*.json", true); liveEditListener.FileChanged += new LiveEditEventHandler(FileChanged); } private void FileChanged(LiveEditEventArgs e) { LegacyLogger.Warning("LiveEdit File Changed: " + e.FullPath); LiveEdit.TryReadFileContent(e.FullPath, (Action<string>)delegate(string content) { BigPickupFogBeaconSetting @override = Json.Deserialize<BigPickupFogBeaconSetting>(content); AddOverride(@override); if (GameStateManager.IsInExpedition) { UpdateSetting(); } }); } private void UpdateSetting() { uint levelLayoutData = RundownManager.ActiveExpedition.LevelLayoutData; SettingForCurrentLevel = (fogBeaconSettings.ContainsKey(levelLayoutData) ? fogBeaconSettings[levelLayoutData] : DEDFAULT_SETTING); LegacyLogger.Debug($"FogBeaconSettingManager: updated setting for level with main level layout id {levelLayoutData}"); } private BigPickupFogBeaconSettingManager() { } static BigPickupFogBeaconSettingManager() { CONFIG_PATH = Path.Combine(LegacyOverrideManagers.LEGACY_CONFIG_PATH, "FogBeaconSetting"); DEDFAULT_SETTING = new BigPickupFogBeaconSetting(); Current = new BigPickupFogBeaconSettingManager(); } } } namespace LEGACY.LegacyOverride.EnemyTagger { public enum eEnemyTaggerState { Uninitialized, Inactive, Active_Warmup, Active_Tagging } public class EnemyTaggerComponent : MonoBehaviour { private const float INACTIVE_SOUND_UPDATE_INTERVAL = 4f; internal int MaxTagPerScan = 12; internal float TagInterval = 3f; internal float TagRadius = 12f; internal float WarmupTime = 3f; private eEnemyTaggerState CurrentState = eEnemyTaggerState.Uninitialized; private CellSoundPlayer m_sound = new CellSoundPlayer(); private List<EnemyAgent> TaggableEnemies = new List<EnemyAgent>(); private float UpdateTime = 0f; internal CarryItemPickup_Core Parent { get; set; } = null; internal PlayerAgent PickedByPlayer { get; set; } = null; internal Vector3 Position => ((Object)(object)Parent == (Object)null) ? Vector3.zero : (((Object)(object)PickedByPlayer == (Object)null) ? ((Component)Parent).transform.position : ((Component)PickedByPlayer).transform.position); public void ChangeState(eEnemyTaggerState newState) { if (CurrentState == newState) { return; } switch (newState) { case eEnemyTaggerState.Uninitialized: LegacyLogger.Error("Enemy Tagger changed to state 'uninitialized'?"); return; case eEnemyTaggerState.Inactive: UpdateTime = 0f; TaggableEnemies.Clear(); m_sound.Post(EVENTS.BULKHEAD_BUTTON_CLOSE, true); break; case eEnemyTaggerState.Active_Warmup: UpdateTime = 0f; m_sound.Post(EVENTS.BUTTONGENERICDEACTIVATE, true); break; case eEnemyTaggerState.Active_Tagging: if (CurrentState != eEnemyTaggerState.Active_Warmup) { UpdateTime = 0f; } break; default: LegacyLogger.Error($"Enemy Tagger: Undefined state {CurrentState}"); return; } CurrentState = newState; } private bool UpdateTaggableEnemies() { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_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) TaggableEnemies.Clear(); bool result = false; List<EnemyAgent> reachableEnemiesInNodes = AIG_CourseGraph.GetReachableEnemiesInNodes(((Object)(object)PickedByPlayer == (Object)null) ? ((ItemInLevel)Parent).m_courseNode : ((Agent)PickedByPlayer).CourseNode, 2); Enumerator<EnemyAgent> enumerator = reachableEnemiesInNodes.GetEnumerator(); while (enumerator.MoveNext()) { EnemyAgent current = enumerator.Current; if (!((Agent)current).Alive) { continue; } Vector3 val = ((Component)current).transform.position - Position; float magnitude = ((Vector3)(ref val)).magnitude; if (!(magnitude > TagRadius)) { result = true; if (!current.IsTagged) { TaggableEnemies.Add(current); } if (TaggableEnemies.Count >= MaxTagPerScan) { break; } } } return result; } private void StartTagging() { if (!(UpdateTime >= TagInterval)) { return; } if (SNet.IsMaster) { UpdateTaggableEnemies(); foreach (EnemyAgent taggableEnemy in TaggableEnemies) { ToolSyncManager.WantToTagEnemy(taggableEnemy); } } UpdateTime = 0f; } private void StopTagging() { if (UpdateTime >= 4f) { m_sound.Post(EVENTS.BUTTONGENERICDEACTIVATE, true); UpdateTime = 0f; } } private void Warmup() { if (UpdateTime >= WarmupTime) { ChangeState(eEnemyTaggerState.Active_Tagging); UpdateTime = TagInterval; } } private void Update() { //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) if (CurrentState == eEnemyTaggerState.Uninitialized) { return; } if ((Object)(object)Parent == (Object)null) { LegacyLogger.Error("EnemyTagger: null parent"); return; } UpdateTime += Time.deltaTime; m_sound.UpdatePosition(Position); switch (CurrentState) { case eEnemyTaggerState.Active_Warmup: Warmup(); break; case eEnemyTaggerState.Active_Tagging: StartTagging(); break; case eEnemyTaggerState.Inactive: StopTagging(); break; } } private void OnDestroy() { StopTagging(); TaggableEnemies.Clear(); TaggableEnemies = null; if (m_sound != null) { m_sound.Stop(); m_sound.Recycle(); m_sound = null; } Parent = null; } static EnemyTaggerComponent() { ClassInjector.RegisterTypeInIl2Cpp<EnemyTaggerComponent>(); } } public class EnemyTaggerSetting { public uint MainLevelLayout { get; set; } = 0u; public float TimeToPickup { get; set; } = 1f; public float TimeToPlace { get; set; } = 1f; public float WarmupTime { get; set; } = 5f; public int MaxTagPerScan { get; set; } = 12; public float TagInterval { get; set; } = 3f; public float TagRadius { get; set; } = 12f; public bool TagWhenPlaced { get; set; } = true; public bool TagWhenHold { get; set; } = false; public bool UseVisual { get; set; } = false; } internal class EnemyTaggerSettingManager { public static readonly EnemyTaggerSettingManager Current; private Dictionary<uint, EnemyTaggerSetting> enemyTaggerSettingSettings = new Dictionary<uint, EnemyTaggerSetting>(); private LiveEditListener liveEditListener; private static readonly string CONFIG_PATH; private static readonly EnemyTaggerSetting DEFAULT; private List<GameObject> obsVisuals = new List<GameObject>(); internal EnemyTaggerSetting SettingForCurrentLevel { get; private set; } = DEFAULT; public IEnumerable<GameObject> OBSVisuals => obsVisuals; private void AddOverride(EnemyTaggerSetting _override) { if (_override != null) { if (enemyTaggerSettingSettings.ContainsKey(_override.MainLevelLayout)) { LegacyLogger.Warning("Replaced MainLevelLayout {0}", _override.MainLevelLayout); enemyTaggerSettingSettings[_override.MainLevelLayout] = _override; } else { enemyTaggerSettingSettings.Add(_override.MainLevelLayout, _override); } } } public void Init() { //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Expected O, but got Unknown if (!Directory.Exists(CONFIG_PATH)) { Directory.CreateDirectory(CONFIG_PATH); StreamWriter streamWriter = File.CreateText(Path.Combine(CONFIG_PATH, "Template.json")); streamWriter.WriteLine(Json.Serialize(new EnemyTaggerSetting())); streamWriter.Flush(); streamWriter.Close(); return; } foreach (string item in Directory.EnumerateFiles(CONFIG_PATH, "*.json", SearchOption.AllDirectories)) { Json.Load<EnemyTaggerSetting>(item, out var config); AddOverride(config); } LevelAPI.OnBuildStart += UpdateSetting; liveEditListener = LiveEdit.CreateListener(CONFIG_PATH, "*.json", true); liveEditListener.FileChanged += new LiveEditEventHandler(FileChanged); } private void FileChanged(LiveEditEventArgs e) { LegacyLogger.Warning("LiveEdit File Changed: " + e.FullPath); LiveEdit.TryReadFileContent(e.FullPath, (Action<string>)delegate(string content) { EnemyTaggerSetting @override = Json.Deserialize<EnemyTaggerSetting>(content); AddOverride(@override); if (GameStateManager.IsInExpedition) { UpdateSetting(); } }); } private void UpdateSetting() { uint levelLayoutData = RundownManager.ActiveExpedition.LevelLayoutData; SettingForCurrentLevel = (enemyTaggerSettingSettings.ContainsKey(levelLayoutData) ? enemyTaggerSettingSettings[levelLayoutData] : DEFAULT); LegacyLogger.Debug($"EnemyTaggerSettingManager: updated setting for level with main level layout id {levelLayoutData}"); } public void SetupAsObserver(LG_PickupItem __instance) { //IL_014d: Unknown result type (might be due to invalid IL or missing references) EnemyTaggerSetting setting = SettingForCurrentLevel; CarryItemPickup_Core core = ((Component)__instance.m_root).GetComponentInChildren<CarryItemPickup_Core>(); Interact_Pickup_PickupItem interact = ((Il2CppObjectBase)core.m_interact).Cast<Interact_Pickup_PickupItem>(); LG_PickupItem_Sync val = ((Il2CppObjectBase)core.m_sync).Cast<LG_PickupItem_Sync>(); EnemyTaggerComponent tagger = ((Component)core).gameObject.AddComponent<EnemyTaggerComponent>(); tagger.Parent = core; ((Component)tagger).gameObject.SetActive(true); ((Interact_Timed)interact).InteractDuration = setting.TimeToPickup; tagger.MaxTagPerScan = setting.MaxTagPerScan; tagger.TagInterval = setting.TagInterval; tagger.TagRadius = setting.TagRadius; tagger.WarmupTime = setting.WarmupTime; GameObject obsVisual = null; if (setting.UseVisual) { obsVisual = Object.Instantiate<GameObject>(Assets.OBSVisual, ((Component)__instance).transform); obsVisual.transform.localScale = new Vector3(setting.TagRadius, setting.TagRadius, setting.TagRadius); obsVisual.SetActive(false); obsVisuals.Add(obsVisual); } val.OnSyncStateChange += Action<ePickupItemStatus, pPickupPlacement, PlayerAgent, bool>.op_Implicit((Action<ePickupItemStatus, pPickupPlacement, PlayerAgent, bool>)delegate(ePickupItemStatus status, pPickupPlacement placement, PlayerAgent playerAgent, bool isRecall) { //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_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: 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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_007b: 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_0081: 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) if ((int)status != 0) { if ((int)status == 1) { ((Component)tagger).gameObject.SetActive(true); tagger.PickedByPlayer = playerAgent; tagger.ChangeState((!setting.TagWhenHold) ? eEnemyTaggerState.Inactive : eEnemyTaggerState.Active_Warmup); ((Interact_Timed)interact).InteractDuration = setting.TimeToPlace; if ((Object)(object)obsVisual != (Object)null && obsVisual.active) { CoroutineManager.BlinkOut(obsVisual, 0f); } } } else { tagger.PickedByPlayer = null; tagger.ChangeState((!setting.TagWhenPlaced) ? eEnemyTaggerState.Inactive : eEnemyTaggerState.Active_Warmup); ((Interact_Timed)interact).InteractDuration = setting.TimeToPickup; if ((Object)(object)obsVisual != (Object)null) { obsVisual.gameObject.transform.SetPositionAndRotation(placement.position, placement.rotation); if (isRecall) { if (((ItemInLevel)core).CanWarp) { CoroutineManager.BlinkIn(obsVisual, tagger.WarmupTime); } } else if (!obsVisual.active && setting.TagWhenPlaced) { CoroutineManager.BlinkIn(obsVisual, tagger.WarmupTime); } } } }); } private void AddOBSVisualRenderers() { foreach (GameObject oBSVisual in OBSVisuals) { Renderer componentInChildren = oBSVisual.GetComponentInChildren<Renderer>(); float @float = componentInChildren.material.GetFloat("_Intensity"); float num = -1f; } } private void Clear() { obsVisuals.Clear(); } private EnemyTaggerSettingManager() { LevelAPI.OnBuildStart += Clear; LevelAPI.OnLevelCleanup += Clear; LevelAPI.OnEnterLevel += AddOBSVisualRenderers; } static EnemyTaggerSettingManager() { CONFIG_PATH = Path.Combine(LegacyOverrideManagers.LEGACY_CONFIG_PATH, "EnemyTaggerSetting"); DEFAULT = new EnemyTaggerSetting(); Current = new EnemyTaggerSettingManager(); } } } namespace LEGACY.ExtraEvents { internal static class LegacyExtraEvents { internal enum EventType { CloseSecurityDoor_Custom = 100, SetTimerTitle = 102, AlertEnemiesInZone = 107, AlertEnemiesInArea = 108, Terminal_ShowTerminalInfoInZone = 130, Terminal_ToggleState = 131, KillEnemiesInArea = 140, KillEnemiesInZone = 141, KillEnemiesInDimension = 142, PlayGCEndSequence = 180, ChainedPuzzle_AddReqItem = 200, ChainedPuzzle_RemoveReqItem = 201, SpawnHibernate = 170, Info_ZoneHibernate = 250, Info_LevelHibernate = 251, Output_LevelHibernateSpawnEvent = 252, TP_WarpTeams = 160, TP_WarpPlayersInRange = 161, TP_WarpItemsInZone = 162, FF_ToggleFFCheck = 210, FF_AddPlayersInRangeToCheck = 211, FF_AddPlayersOutOfRangeToCheck = 212, FF_ToggleCheckOnGroup = 213, FF_Reset = 214, FF_ResetGroup = 215, FF_SetExpeditionFailedText = 216, FF_ResetExpeditionFailedText = 217, SetNavMarker = 220, ToggleDummyVisual = 221, ToggleLSFBState = 222, SaveCheckpoint = 223, SetSuccessPageCustomization = 224, ToggleCamaraShake = 225, PlayMusic = 260, StopMusic = 261, ToggleEventScanState = 270, ToggleSeamlessReload = 280 } private static bool initialized; private static void ToggleLevelSpawnedFogBeaconState(WardenObjectiveEventData e) { LevelSpawnedFogBeaconManager.Current.ToggleLSFBState(e.WorldEventObjectFilter, e.Enabled); } internal static void Init() { if (!initialized) { LegacyLogger.Log("Adding Legacy warden event definitions..."); EOSWardenEventManager.Current.AddEventDefinition(EventType.ToggleLSFBState.ToString(), 222u, (Action<WardenObjectiveEventData>)ToggleLevelSpawnedFogBeaconState); LegacyLogger.Log("Legacy warden event definitions setup completed"); initialized = true; } } } }
Plugins/NoBoosters.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using CellMenu; using HarmonyLib; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyFileVersion("1.1.0")] [assembly: AssemblyInformationalVersion("1.1.0")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("NoBoosters")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyProduct("NoBoosters")] [assembly: AssemblyTitle("NoBoosters")] [assembly: AssemblyVersion("1.1.0.0")] namespace NoBoosters; [BepInPlugin("dev.aurirex.gtfo.noboosters", "No Boosters", "1.1.0")] [BepInIncompatibility("com.mccad00.AmongDrip")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class EntryPoint : BasePlugin { public const string PLUGIN_GUID = "dev.aurirex.gtfo.noboosters"; public const string PLUGIN_NAME = "No Boosters"; public const string PLUGIN_VERSION = "1.1.0"; public const string DEVIOUSLICK_GUID = "com.mccad00.AmongDrip"; public const string SIMPLEPROGRESSION_GUID = "dev.aurirex.gtfo.simpleprogression"; private Harmony _harmony; private bool simpleProgressionLoaded; internal static ManualLogSource L; public override void Load() { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown L = ((BasePlugin)this).Log; simpleProgressionLoaded = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.Any((KeyValuePair<string, PluginInfo> kvp) => string.Equals(kvp.Key, "dev.aurirex.gtfo.simpleprogression", StringComparison.InvariantCultureIgnoreCase)); _harmony = new Harmony("dev.aurirex.gtfo.noboosters"); _harmony.PatchAll(typeof(Patches)); if (!simpleProgressionLoaded) { ((BasePlugin)this).Log.LogWarning((object)"Simple Progression is not loaded, patching like usual."); _harmony.PatchAll(typeof(PersistentInventoryManager_Patches)); } ((BasePlugin)this).Log.LogInfo((object)"Loaded and patched!"); } } internal class Patches { [HarmonyPriority(0)] [HarmonyPatch(typeof(CM_PlayerLobbyBar), "SetupFromPage")] public static class CM_PlayerLobbyBar_SetupFromPage_Patch { public static void Postfix(CM_PlayerLobbyBar __instance) { //IL_0016: 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) __instance.m_boosterImplantAlign.position = new Vector3(10000f, 0f, 0f); ((Component)__instance.m_clothesButton).transform.localPosition = new Vector3(170f, -510f, 0f); } } [HarmonyPriority(0)] [HarmonyPatch(typeof(PUI_BoosterIconActiveDisplay), "UpdateBoosterIconsActiveState")] public static class PUI_BoosterIconActiveDisplay_UpdateBoosterIconsActiveState_Patch { public static bool Prefix(PUI_BoosterIconActiveDisplay __instance) { ((Component)__instance).gameObject.SetActive(false); return false; } } [HarmonyPriority(0)] [HarmonyPatch(typeof(PUI_BoosterDetails), "SetupBoosterDetails")] public static class PUI_BoosterDetails_SetupBoosterDetails_Patch { public static void Postfix(PUI_BoosterDetails __instance) { ((Component)__instance).gameObject.SetActive(false); } } [HarmonyPriority(0)] [HarmonyPatch(typeof(PUI_BoosterDetails), "UpdateButtonActiveCheck")] public static class PUI_BoosterDetails_UpdateButtonActiveCheck_Patch { public static bool Prefix(PUI_BoosterDetails __instance) { ((Component)__instance.m_leftButton).gameObject.SetActive(false); ((Component)__instance.m_rightButton).gameObject.SetActive(false); return false; } } } internal class PersistentInventoryManager_Patches { [HarmonyPatch(typeof(GameStateManager), "DoChangeState")] public static class GameStateManager_DoChangeState_Patch { public static void Postfix(eGameStateName nextState) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown if ((int)nextState == 6) { ManualLogSource l = EntryPoint.L; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(10, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Disabling "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("PersistentInventoryManager"); } l.LogInfo(val); ((Behaviour)PersistentInventoryManager.Current).enabled = false; } } } [HarmonyPatch(typeof(PersistentInventoryManager), "OnLevelCleanup")] public static class PersistentInventoryManager_OnLevelCleanup_Patch { public static void Prefix(PersistentInventoryManager __instance) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ManualLogSource l = EntryPoint.L; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(9, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Enabling "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("PersistentInventoryManager"); } l.LogInfo(val); ((Behaviour)__instance).enabled = true; } } [HarmonyPriority(0)] [HarmonyPatch(typeof(PersistentInventoryManager), "CommitPendingTransactions")] public static class PersistentInventoryManager_CommitPendingTransactions_Patch { public static bool Prefix() { return false; } } }