Decompiled source of INTEGER v0.0.3
Plugins/PortalPuzzleChanger.dll
Decompiled 5 days 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/AllVanity.dll
Decompiled 5 days agousing System.Collections; 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.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Utils; using DropServer.VanityItems; using GameData; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes.Arrays; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: AssemblyFileVersion("1.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("AllVanity")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyProduct("AllVanity")] [assembly: AssemblyTitle("AllVanity")] [assembly: AssemblyVersion("1.0.0.0")] namespace AllVanity; [BepInPlugin("dev.aurirex.gtfo.allvanity", "All Vanity", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInIncompatibility("com.mccad00.AmongDrip")] public class EntryPoint : BasePlugin { public const string GUID = "dev.aurirex.gtfo.allvanity"; public const string NAME = "All Vanity"; public const string VERSION = "1.0.0"; public const string DEVIOUSLICK_GUID = "com.mccad00.AmongDrip"; public const string NOBOOSTERS_GUID = "dev.aurirex.gtfo.noboosters"; private Harmony _harmonyInstance; internal static ManualLogSource L; internal static bool noboostersLoaded; public override void Load() { //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Expected O, but got Unknown L = ((BasePlugin)this).Log; noboostersLoaded = ((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.Any((KeyValuePair<string, PluginInfo> kvp) => kvp.Key == "dev.aurirex.gtfo.noboosters"); ((BasePlugin)this).Log.LogInfo((object)"Applying Patches ..."); _harmonyInstance = new Harmony("dev.aurirex.gtfo.allvanity"); _harmonyInstance.PatchAll(Assembly.GetExecutingAssembly()); } } internal class Patches { [HarmonyPriority(500)] [HarmonyPatch(typeof(PersistentInventoryManager), "CommitPendingTransactions")] internal static class PersistentInventoryManager_CommitPendingTransactions_Patch { private static bool _dirtyFlag; public static bool Prefix(PersistentInventoryManager __instance) { if (EntryPoint.noboostersLoaded) { if (PersistentInventoryManager.m_dirty) { Unlock.SetupVanityInventory(); PersistentInventoryManager.m_dirty = false; return false; } return true; } if (PersistentInventoryManager.m_dirty || __instance.m_vanityItemPendingTransactions.IsDirty()) { _dirtyFlag = true; return true; } if (_dirtyFlag) { MonoBehaviourExtensions.StartCoroutine((MonoBehaviour)(object)__instance, Unlock.DelayedSetupVanity()); _dirtyFlag = false; } return true; } } } public class Unlock { public static IEnumerator DelayedSetupVanity() { EntryPoint.L.LogDebug((object)"Delayed Setup ..."); yield return (object)new WaitForSeconds(0.5f); SetupVanityInventory(); } public static void SetupVanityInventory() { EntryPoint.L.LogWarning((object)"Setting up Vanity Item Inventory!"); PersistentInventoryManager.Current.m_vanityItemsInventory.UpdateItems(CreateVanityPlayerData()); } internal static VanityItemPlayerData CreateVanityPlayerData() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown VanityItemPlayerData val = new VanityItemPlayerData(ClassInjector.DerivedConstructorPointer<VanityItemPlayerData>()); Il2CppArrayBase<VanityItemsTemplateDataBlock> allBlocks = GameDataBlockBase<VanityItemsTemplateDataBlock>.GetAllBlocks(); Il2CppReferenceArray<VanityItem> val2 = new Il2CppReferenceArray<VanityItem>((long)allBlocks.Count); int num = 0; foreach (VanityItemsTemplateDataBlock item in allBlocks) { VanityItem val3 = new VanityItem(ClassInjector.DerivedConstructorPointer<VanityItem>()) { Flags = (InventoryItemFlags)3, ItemId = ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)item).persistentID }; ((Il2CppArrayBase<VanityItem>)(object)val2)[num] = val3; num++; } val.Items = val2; return val; } }
Plugins/NoBoosters.dll
Decompiled 5 days agousing 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 UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [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("Release")] [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")] 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"; private Harmony _harmony; internal static ManualLogSource L; public override void Load() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown L = ((BasePlugin)this).Log; _harmony = new Harmony("dev.aurirex.gtfo.noboosters"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); ((BasePlugin)this).Log.LogInfo((object)"Loaded and patched!"); } } internal class Patches { [HarmonyPatch(typeof(GameStateManager), "DoChangeState")] public static class GameStateManager_DoChangeState_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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0014: 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_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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; } } [HarmonyPatch(typeof(CM_PlayerLobbyBar), "SetupFromPage")] public static class CM_PlayerLobbyBar_SetupFromPage_Patch { public static void Postfix(CM_PlayerLobbyBar __instance) { //IL_0015: 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) __instance.m_boosterImplantAlign.position = new Vector3(10000f, 0f, 0f); ((Component)__instance.m_clothesButton).transform.localPosition = new Vector3(170f, -510f, 0f); } } [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; } } [HarmonyPatch(typeof(PUI_BoosterDetails), "SetupBoosterDetails")] public static class PUI_BoosterDetails_SetupBoosterDetails_Patch { public static void Postfix(PUI_BoosterDetails __instance) { ((Component)__instance).gameObject.SetActive(false); } } [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; } } }
Plugins/SimpleProgression.dll
Decompiled 5 days 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 BoosterImplants; using Clonesoft.Json; using DropServer; using DropServer.BoosterImplants; using DropServer.VanityItems; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Threading.Tasks; using SimpleProgression.Impl; using SimpleProgression.Interfaces; using SimpleProgression.Progression; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: AssemblyFileVersion("0.0.1")] [assembly: AssemblyInformationalVersion("0.0.1")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("SimpleProgression")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyProduct("SimpleProgression")] [assembly: AssemblyTitle("SimpleProgression")] [assembly: AssemblyVersion("0.0.1.0")] namespace SimpleProgression { public class LocalProgressionManager { private string _loadedRundownKey; public static LocalProgressionManager Instance { get; private set; } public static string SavePath { get; private set; } public ExpeditionSession CurrentActiveSession { get; private set; } public ILogger Logger { get; set; } public LocalRundownProgression CurrentLoadedLocalProgressionData { get; private set; } = null; public bool HasLocalRundownProgressionLoaded => CurrentLoadedLocalProgressionData != null; public static event Action<ExpeditionCompletionData> OnExpeditionCompleted; public LocalProgressionManager() { if (Instance != null) { throw new InvalidOperationException("One instance already exists!"); } SavePath = Path.Combine(Paths.BepInExRootPath, "LocalProgression/"); Directory.CreateDirectory(SavePath); Instance = this; } public LocalRundownProgression GetOrCreateLocalProgression(string rundownKeyToLoad) { if (string.IsNullOrEmpty(rundownKeyToLoad)) { throw new ArgumentException("rundownKeyToLoad"); } if (!HasLocalRundownProgressionLoaded) { CurrentLoadedLocalProgressionData = LoadFromProgressionFile(rundownKeyToLoad); return CurrentLoadedLocalProgressionData; } if (rundownKeyToLoad == _loadedRundownKey) { return CurrentLoadedLocalProgressionData; } Logger.Debug($"{"GetOrCreateLocalProgression"}() {"rundownKeyToLoad"} changed. ({_loadedRundownKey} -> {rundownKeyToLoad})"); SaveToProgressionFile(CurrentLoadedLocalProgressionData); CurrentLoadedLocalProgressionData = LoadFromProgressionFile(rundownKeyToLoad); return CurrentLoadedLocalProgressionData; } public void Init() { Logger.Msg(ConsoleColor.Magenta, "New Progression Manager has inited!"); } public void StartNewExpeditionSession(string rundownId, string expeditionId, string sessionId) { CurrentActiveSession = ExpeditionSession.InitNewSession(rundownId, expeditionId, sessionId, Logger); } public void OnLevelEntered() { CurrentActiveSession?.OnLevelEntered(); } public 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); } } public void SaveAtCheckpoint() { CurrentActiveSession?.OnCheckpointSave(); } public void ReloadFromCheckpoint() { CurrentActiveSession?.OnCheckpointReset(); } public void ArtifactCountUpdated(int count) { if (CurrentActiveSession != null) { CurrentActiveSession.ArtifactsCollected = count; Logger.Info($"current Artifact count: {count}"); } } public void EndCurrentExpeditionSession(bool success) { CurrentActiveSession?.OnExpeditionCompleted(success); GetOrCreateLocalProgression(CurrentActiveSession.RundownId); ExpeditionCompletionData completionData; bool flag = CurrentLoadedLocalProgressionData.AddSessionResults(CurrentActiveSession, out completionData); CurrentActiveSession = null; SaveToProgressionFile(CurrentLoadedLocalProgressionData); if (flag) { Logger.Notice($"Expedition time: {completionData.RawSessionData.EndTime - completionData.RawSessionData.StartTime}"); LocalProgressionManager.OnExpeditionCompleted?.Invoke(completionData); } } public void SaveToProgressionFile(LocalRundownProgression data) { SaveToProgressionFile(data, _loadedRundownKey, out var path); Instance.Logger.Msg(ConsoleColor.DarkRed, "Saved progression file to disk at: " + path); } public 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); } public static string GetLocalProgressionFilePath(string rundownKey) { char[] invalidFileNameChars = Path.GetInvalidFileNameChars(); foreach (char oldChar in invalidFileNameChars) { rundownKey = rundownKey.Replace(oldChar, '_'); } return Path.Combine(SavePath, rundownKey + ".json"); } public LocalRundownProgression LoadFromProgressionFile(string rundownKey) { string path; bool isNew; LocalRundownProgression localRundownProgression = LoadFromProgressionFile(rundownKey, out path, out isNew); _loadedRundownKey = rundownKey; if (isNew) { Instance.Logger.Msg(ConsoleColor.Green, "Created progression file at: " + path); SaveToProgressionFile(localRundownProgression, _loadedRundownKey, 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; } public 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 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); } } [BepInPlugin("dev.aurirex.gtfo.simpleprogression", "Simple Progression", "0.0.1")] public class Plugin : BasePlugin { public const string GUID = "dev.aurirex.gtfo.simpleprogression"; public const string NAME = "Simple Progression"; public const string VERSION = "0.0.1"; internal static Logger L; private static Harmony _harmony; 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 //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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[2] { typeof(IDropServerGameSession), typeof(IDisposable) })); val2.set_LogSuccess(true); ClassInjector.RegisterTypeInIl2Cpp<LocalGameSession>(val2); val2 = new RegisterTypeOptions(); val2.set_Interfaces(Il2CppInterfaceCollection.op_Implicit(new Type[1] { typeof(IDropServerClientAPI) })); val2.set_LogSuccess(true); ClassInjector.RegisterTypeInIl2Cpp<LocalDropServerAPI>(val2); new LocalProgressionManager().Logger = L; _harmony = new Harmony("dev.aurirex.gtfo.simpleprogression"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); } } 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) { 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 value in Expeditions.Values) { if (value != orAdd && value != null && !(value.ArtifactHeat >= 1f)) { float val3 = value.ArtifactHeat + (float)session.ArtifactsCollected * 0.5f / 100f; value.ArtifactHeat = Math.Min(1f, val3); } } } if (!uint.TryParse(session.RundownId.Replace("Local_", string.Empty), out var result)) { _logger?.Error($"[{"LocalRundownProgression"}.{"AddSessionResults"}] Could not parse rundown id from \"{session.RundownId}\"!"); result = 0u; } completionData = new ExpeditionCompletionData { RundownId = result, 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.Progression { public struct ExpeditionCompletionData { public bool Success => RawSessionData.ExpeditionSurvived; public string RundownIdString => RawSessionData.RundownId; public uint RundownId { get; internal set; } public string ExpeditionId => RawSessionData.ExpeditionId; public string SessionId => RawSessionData.SessionId; public int ArtifactsCollected => RawSessionData.ArtifactsCollected; public 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; } = null; public ExpeditionSessionData CurrentData { get; private set; } = null; public bool HasCheckpointBeenUsed { get; private set; } = false; public bool ExpeditionSurvived { get; private set; } = false; public DateTimeOffset DropTime { get; private set; } public DateTimeOffset StartTime { get; private set; } public DateTimeOffset EndTime { get; private set; } public string RundownId { get; private set; } = string.Empty; public string ExpeditionId { get; private set; } = string.Empty; public string SessionId { get; private set; } = string.Empty; public int ArtifactsCollected { get; internal set; } = 0; public bool PrisonerEfficiencyCompleted => CurrentData.LayerStates.Count() == 3 && CurrentData.LayerStates.All((KeyValuePair<Layers, LayerState> x) => x.Value == LayerState.Completed); private ExpeditionSession(string rundownId, string expeditionId, string sessionId, ILogger logger) { RundownId = rundownId; ExpeditionId = expeditionId; SessionId = sessionId; _logger = logger; DropTime = DateTimeOffset.UtcNow; CurrentData = new ExpeditionSessionData(logger); SetLayer(Layers.Main, LayerState.Entered); } internal static ExpeditionSession InitNewSession(string rundownId, string expeditionId, string sessionId, ILogger logger) { ExpeditionSession result = new ExpeditionSession(rundownId, expeditionId, sessionId, logger); logger.Info($"[{"ExpeditionSession"}] New expedition session started! (R:{rundownId}, 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:{RundownId}, 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 } } 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.RareCount + __instance.UncommonCount); } } [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; } } } 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_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: RundownProgressionAsync"); 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_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: 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); return Task.FromResult<NewSessionResult>(new NewSessionResult { SessionBlob = "Chat, is this real?! " + request.SessionId }); } public Task<LayerProgressionResult> LayerProgressionAsync(LayerProgressionRequest request) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected O, but got Unknown Plugin.L.Warning("LocalDropServerAPI: LayerProgressionAsync"); LocalProgressionManager.Instance.IncreaseLayerProgression(request.Layer, request.LayerProgressionState); return Task.FromResult<LayerProgressionResult>(new LayerProgressionResult { SessionBlob = ((SessionRequestBase)request).SessionBlob }); } public Task<EndSessionResult> EndSessionAsync(EndSessionRequest request) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown Plugin.L.Warning("LocalDropServerAPI: EndSessionAsync"); LocalProgressionManager.Instance.EndCurrentExpeditionSession(request.Success); 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0027: Expected O, but got Unknown Plugin.L.Warning("LocalDropServerAPI: GetBoosterImplantPlayerDataAsync"); return Task.FromResult<GetBoosterImplantPlayerDataResult>(new GetBoosterImplantPlayerDataResult { Data = new BoosterImplantPlayerData() }); } 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0027: Expected O, but got Unknown Plugin.L.Warning("LocalDropServerAPI: UpdateBoosterImplantPlayerDataAsync"); return Task.FromResult<UpdateBoosterImplantPlayerDataResult>(new UpdateBoosterImplantPlayerDataResult { Data = new BoosterImplantPlayerData() }); } public Task<ConsumeBoostersResult> ConsumeBoostersAsync(ConsumeBoostersRequest 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_0028: Expected O, but got Unknown Plugin.L.Warning("LocalDropServerAPI: ConsumeBoostersAsync"); 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //IL_0033: Expected O, but got Unknown Plugin.L.Warning("LocalDropServerAPI: GetInventoryPlayerDataAsync"); return Task.FromResult<GetInventoryPlayerDataResult>(new GetInventoryPlayerDataResult { Boosters = new BoosterImplantPlayerData(), VanityItems = new VanityItemPlayerData() }); } 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_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0027: Expected O, but got Unknown Plugin.L.Warning("LocalDropServerAPI: UpdateVanityItemPlayerDataAsync"); return Task.FromResult<UpdateVanityItemPlayerDataResult>(new UpdateVanityItemPlayerDataResult { Data = new VanityItemPlayerData() }); } 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 }); } } public class LocalGameSession : Object { public bool IsCompleted { get; set; } public LocalGameSession(IntPtr ptr) : base(ptr) { ClassInjector.DerivedConstructorBody((Il2CppObjectBase)(object)this); } public static LocalGameSession NewGameSession(string sessionGUID, string activeRundownKey, string expeditionKey, uint[] uints) { return new LocalGameSession(ClassInjector.DerivedConstructorPointer<LocalGameSession>()); } public void ReportLayerProgression(ExpeditionLayers layer, LayerProgressionState progressionState) { //IL_002b: 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) Plugin.L.Warning($"{"ReportLayerProgression"}: {layer}, {progressionState}"); } public void ConsumeBoosters() { Plugin.L.Warning("ConsumeBoosters"); } public void ReportSessionResult(bool success, PerBoosterCategoryInt boosterCurrency) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) Plugin.L.Warning($"{"ReportSessionResult"}: {success}, {boosterCurrency}"); } public void EndSession() { Plugin.L.Warning("EndSession"); } public void CancelSession() { Plugin.L.Warning("CancelSession"); } public Task WaitAsync() { throw new NotImplementedException(); } public void Dispose() { } } }
Plugins/ExpeditionSectorIconOverride.dll
Decompiled 5 days 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/Doughnut.dll
Decompiled 5 days 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 Player; using SimpleProgression.Interop; using SimpleProgression.Models.Progression; 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("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 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_0204: Unknown result type (might be due to invalid IL or missing references) //IL_020b: Expected O, but got Unknown //IL_024d: Unknown result type (might be due to invalid IL or missing references) //IL_0254: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0165: Expected O, but got Unknown //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Expected O, but got Unknown //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Expected O, but got Unknown if (_loaded) { return; } string directoryName = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); _glucoseStoragePath = Path.Combine(directoryName, "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); donutPrefab2 = Object.Instantiate<GameObject>(donutPrefab); Material val = ((Il2CppObjectBase)LoadAsset(_donutBundle, "assets/doughnut/doughnutmat2.mat")).Cast<Material>(); ReplaceMatShader(val); donutPrefab2.GetComponentInChildren<Renderer>().sharedMaterial = val; DontDestroyAndSetHideFlags((Object)(object)donutPrefab2); donutPrefab3 = Object.Instantiate<GameObject>(donutPrefab); Material val2 = ((Il2CppObjectBase)LoadAsset(_donutBundle, "assets/doughnut/doughnutmat3.mat")).Cast<Material>(); ReplaceMatShader(val2); donutPrefab3.GetComponentInChildren<Renderer>().sharedMaterial = val2; DontDestroyAndSetHideFlags((Object)(object)donutPrefab3); 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", directoryName); 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 { private static Material _material; 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); } 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) => kvp.Key == "dev.aurirex.gtfo.simpleprogression"); _harmony = new Harmony("dev.aurirex.gtfo.doughnut"); _harmony.PatchAll(Assembly.GetExecutingAssembly()); if (IsSProgInstalled) { ProgressionInterop.Register(); } } 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(); } } } namespace Doughnut.UI { internal class UIManager { 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); } } private static IEnumerator DelayedToggle() { yield return (object)new WaitForSeconds(4f); CoroutineManager.BlinkIn(_go, 0f); _routine = null; } 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 { private static VanityItemsTemplateDataBlock[] _allBlocks; internal static IEnumerable<VanityItemsTemplateDataBlock> AttemptUnlockFunc(ExpeditionCompletionData? _) { if (_allBlocks == null) { _allBlocks = ((IEnumerable<VanityItemsTemplateDataBlock>)GameDataBlockBase<VanityItemsTemplateDataBlock>.GetAllBlocks()).ToArray(); } List<VanityItemsTemplateDataBlock> list = new List<VanityItemsTemplateDataBlock>(); foreach (GlucoseUnlockCriterias.Criteria criteria in AssetLoader.unlockCriteriasData.UnlockCriterias) { if (criteria.IsMet(AssetLoader.glucoseStorage)) { VanityItemsTemplateDataBlock val = ((IEnumerable<VanityItemsTemplateDataBlock>)_allBlocks).FirstOrDefault((Func<VanityItemsTemplateDataBlock, bool>)((VanityItemsTemplateDataBlock block) => ((GameDataBlockBase<VanityItemsTemplateDataBlock>)(object)block).name == criteria.UnlockKey)); if (val != null) { list.Add(val); } } } return list; } } [MethodImpl(MethodImplOptions.NoInlining)] public static void Register() { LocalVanityUnlocker.RegisterUnlockMethod((Func<ExpeditionCompletionData?, IEnumerable<VanityItemsTemplateDataBlock>>)Impl.AttemptUnlockFunc); } } } 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 class 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>(); } }
Plugins/RundownTitleFix.dll
Decompiled 5 days 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 5 days 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/LEGACY.dll
Decompiled 5 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.Immutable; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; using AIGraph; using AK; using Agents; using AssetShards; using BepInEx; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Utils.Collections; using BoosterImplants; using CellMenu; using ChainedPuzzles; using EOSExt.Reactor.Managers; using Enemies; using ExtraObjectiveSetup; using ExtraObjectiveSetup.BaseClasses; using ExtraObjectiveSetup.ExtendedWardenEvents; using ExtraObjectiveSetup.Instances; using ExtraObjectiveSetup.Utils; using FloLib.Infos; using FloLib.Networks.Replications; using GTFO.API; using GTFO.API.Utilities; using GameData; using Gear; using HarmonyLib; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using LEGACY.ExtraEvents; using LEGACY.LegacyOverride; using LEGACY.LegacyOverride.DummyVisual; using LEGACY.LegacyOverride.DummyVisual.VisualGOAnimation; using LEGACY.LegacyOverride.DummyVisual.VisualGOAnimation.AnimationConfig; using LEGACY.LegacyOverride.DummyVisual.VisualSequenceType; using LEGACY.LegacyOverride.ElevatorCargo; using LEGACY.LegacyOverride.EnemyTagger; using LEGACY.LegacyOverride.EventScan; using LEGACY.LegacyOverride.ExpeditionIntelNotification; using LEGACY.LegacyOverride.ExpeditionSuccessPage; using LEGACY.LegacyOverride.FogBeacon; using LEGACY.LegacyOverride.ForceFail; using LEGACY.LegacyOverride.Music; using LEGACY.LegacyOverride.ResourceStations; using LEGACY.Utils; using LEGACY.VanillaFix; using LevelGeneration; using Localization; using MTFO.API; using Microsoft.CodeAnalysis; using Player; using SNetwork; using ScanPosOverride.JSON; using ScanPosOverride.Managers; using StateMachines; using TMPro; using ThermalSights; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("LEGACY")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+6516d149c5b3ab9c71a75700061b6ed33372a1ea")] [assembly: AssemblyProduct("LEGACY")] [assembly: AssemblyTitle("LEGACY")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [HarmonyPatch(typeof(PUI_Watermark), "UpdateWatermark")] internal static class Patch_WatermarkUpdateWatermark { private static void Postfix(PUI_Watermark __instance) { string value = "4.6.1+gitf831086-dirty-main".Remove("x.x.x".Length); ((TMP_Text)__instance.m_watermarkText).SetText($"<color=red>MODDED</color> <color=orange>{value}</color>\n<color=#00ae9d>LEGACY</color> <color=orange>{"4.3.3"}</color>", true); } } namespace LEGACY { internal static class Assets { public static GameObject CircleSensor { get; private set; } public static GameObject MovableSensor { get; private set; } public static GameObject OBSVisual { get; private set; } public static GameObject ObjectiveMarker { get; private set; } public static GameObject EventScan { get; private set; } internal static GameObject DummyScan { get; private set; } internal static GameObject DummySensor { get; private set; } internal static GameObject AmmoStation { get; private set; } internal static GameObject MediStation { get; private set; } internal static GameObject ToolStation { get; private set; } public static void Init() { CircleSensor = AssetAPI.GetLoadedAsset<GameObject>("Assets/SecuritySensor/CircleSensor.prefab"); MovableSensor = AssetAPI.GetLoadedAsset<GameObject>("Assets/SecuritySensor/MovableSensor.prefab"); OBSVisual = AssetAPI.GetLoadedAsset<GameObject>("Assets/SecuritySensor/OBSVisual.prefab"); ObjectiveMarker = AssetAPI.GetLoadedAsset<GameObject>("Assets/SecuritySensor/ObjectiveMarker.prefab"); EventScan = AssetAPI.GetLoadedAsset<GameObject>("Assets/EventObjects/EventScan.prefab"); DummyScan = AssetAPI.GetLoadedAsset<GameObject>("Assets/DummyVisual/DummyScan.prefab"); DummySensor = AssetAPI.GetLoadedAsset<GameObject>("Assets/DummyVisual/DummySensor.prefab"); AmmoStation = AssetAPI.GetLoadedAsset<GameObject>("Assets/Misc/AmmoStation.prefab"); MediStation = AssetAPI.GetLoadedAsset<GameObject>("Assets/Misc/MediStation.prefab"); ToolStation = AssetAPI.GetLoadedAsset<GameObject>("Assets/Misc/ToolStation.prefab"); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInIncompatibility("GTFO.AWO")] [BepInPlugin("Inas.LEGACY", "LEGACY", "4.3.3")] public class EntryPoint : BasePlugin { public const string AUTHOR = "Inas"; public const string RUNDOWN_NAME = "LEGACY"; public const string VERSION = "4.3.3"; public const bool TESTING = false; public const string TEST_STRING = "TESTING"; private Harmony m_Harmony; public override void Load() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown m_Harmony = new Harmony("LEGACY"); m_Harmony.PatchAll(); LegacyOverrideManagers.Init(); LegacyExtraEvents.Init(); LEGACY.VanillaFix.Debugger.Current.Init(); AssetAPI.OnAssetBundlesLoaded += Assets.Init; EventAPI.OnManagersSetup += delegate { AssetShardManager.OnStartupAssetsLoaded += Action.op_Implicit((Action)MainMenuGuiLayer.Current.PageRundownNew.SetupCustomTutorialButton); }; } } } namespace LEGACY.Reactor { [HarmonyPatch] internal class Patch_ReactorShutdown { [HarmonyPostfix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")] private static void Post_OnStateChange(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between Unknown and I4 //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Expected I4, but got Unknown //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || oldState.status == newState.status) { return; } WardenObjectiveDataBlock val = null; if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref val) || val == null) { LegacyLogger.Error("Patch_ReactorShutdown: "); LegacyLogger.Error("Failed to get warden objective"); } else if ((int)val.Type == 2 && !val.OnActivateOnSolveItem) { eWardenObjectiveEventTrigger val2 = (eWardenObjectiveEventTrigger)0; eReactorStatus status = newState.status; switch (status - 7) { default: return; case 0: val2 = (eWardenObjectiveEventTrigger)1; break; case 1: val2 = (eWardenObjectiveEventTrigger)2; break; case 2: val2 = (eWardenObjectiveEventTrigger)3; break; } _ = __instance.SpawnNode.LayerType; WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(val.EventsOnActivate, val2, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); } } [HarmonyPrefix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnBuildDone")] private static void Pre_OnBuildDone_ChainedPuzzleMidObjectiveFix(LG_WardenObjective_Reactor __instance) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) WardenObjectiveDataBlock val = null; if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref val) || val == null) { LegacyLogger.Error("Patch_ReactorShutdown: Failed to get warden objective"); } else if (val.ChainedPuzzleMidObjective != 0) { __instance.m_chainedPuzzleAlignMidObjective = __instance.m_chainedPuzzleAlign; } } [HarmonyPrefix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "Update")] private static bool Pre_Update(LG_WardenObjective_Reactor __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 if ((int)__instance.m_currentState.status != 7) { return true; } if (!__instance.m_currentWaveData.HasVerificationTerminal) { return true; } __instance.SetGUIMessage(true, Text.Format(3000u, (Object[])(object)new Object[1] { Object.op_Implicit("<color=orange>" + __instance.m_currentWaveData.VerificationTerminalSerial + "</color>") }), (ePUIMessageStyle)3, false, "", ""); return false; } } [HarmonyPatch] internal class Patch_ReactorStartup_ExtraEventsExecution { [HarmonyPostfix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")] private static void Post_ExecuteOnNoneEventsOnDefenseStart(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 if (oldState.status != newState.status && (int)newState.status == 3) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)0, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); } } [HarmonyPostfix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnBuildDone")] private static void Post_OnBuildDone(LG_WardenObjective_Reactor __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Invalid comparison between Unknown and I4 WardenObjectiveDataBlock db = default(WardenObjectiveDataBlock); if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref db) || db == null) { LegacyLogger.Error("Patch_ReactorStartup_ExtraEventsExecution: "); LegacyLogger.Error("Failed to get warden objective"); } else if ((int)db.Type == 1 && !db.OnActivateOnSolveItem) { ChainedPuzzleInstance chainedPuzzleToStartSequence = __instance.m_chainedPuzzleToStartSequence; chainedPuzzleToStartSequence.OnPuzzleSolved += Action.op_Implicit((Action)delegate { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(db.EventsOnActivate, (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); }); } } } [HarmonyPatch] internal class Patch_ReactorStartup_OverwriteGUIBehaviour { private static HashSet<uint> ForceDisableLevels; [HarmonyPrefix] [HarmonyPatch(typeof(LG_WardenObjective_Reactor), "OnStateChange")] private static bool Pre_HideReactorMessageForInfiniteWave(LG_WardenObjective_Reactor __instance, pReactorState oldState, pReactorState newState) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected I4, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_02a6: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) if (oldState.status == newState.status) { return true; } if ((int)newState.status != 2 && (int)newState.status != 3 && (int)newState.status != 4) { return true; } if (ForceDisable()) { if (oldState.stateCount != newState.stateCount) { __instance.OnStateCountUpdate(newState.stateCount); } if (oldState.stateProgress != newState.stateProgress) { __instance.OnStateProgressUpdate(newState.stateProgress); } __instance.ReadyForVerification = false; eReactorStatus status = newState.status; switch (status - 2) { case 0: { WardenObjectiveDataBlock val = null; if (!WardenObjectiveManager.Current.TryGetActiveWardenObjectiveData(__instance.SpawnNode.LayerType, ref val) || val == null) { LegacyLogger.Error("Patch_ReactorStartup_OverwriteGUIBehaviour: "); LegacyLogger.Error("Failed to get warden objective datablock"); break; } __instance.m_lightCollection.SetMode(val.LightsOnDuringIntro); __instance.m_lightCollection.ResetUpdateValues(true); __instance.lcReset = true; __instance.m_lightsBlinking = false; __instance.m_spawnEnemies = false; __instance.m_progressUpdateEnabled = true; __instance.m_alarmCountdownPlayed = false; __instance.m_currentDuration = ((!newState.verifyFailed) ? __instance.m_currentWaveData.Warmup : __instance.m_currentWaveData.WarmupFail); WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)1, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); if (__instance.m_currentWaveCount == 1) { Debug.LogError(Object.op_Implicit("Reactor IDLE START")); __instance.m_sound.Post(EVENTS.REACTOR_POWER_LEVEL_1_LOOP, true); __instance.m_sound.SetRTPCValue(GAME_PARAMETERS.REACTOR_POWER, 0f); } else { Debug.LogError(Object.op_Implicit("Reactor REACTOR_POWER_DOWN")); __instance.m_sound.Post(EVENTS.REACTOR_POWER_LEVEL_2_TO_1_TRANSITION, true); __instance.m_sound.SetRTPCValue(GAME_PARAMETERS.REACTOR_POWER, 0f); } break; } case 1: __instance.m_lightCollection.ResetUpdateValues(true); __instance.lcReset = true; __instance.m_spawnEnemies = true; __instance.m_currentEnemyWaveIndex = 0; __instance.m_alarmCountdownPlayed = false; __instance.m_progressUpdateEnabled = true; __instance.m_currentDuration = __instance.m_currentWaveData.Wave; __instance.m_sound.Post(EVENTS.REACTOR_POWER_LEVEL_1_TO_3_TRANSITION, true); break; case 2: __instance.m_lightCollection.ResetUpdateValues(false); __instance.lcReset = true; __instance.m_spawnEnemies = false; __instance.m_progressUpdateEnabled = true; __instance.ReadyForVerification = true; Debug.Log(Object.op_Implicit("Wait for verify! newState.verifyFailed? " + newState.verifyFailed)); __instance.m_currentDuration = ((!newState.verifyFailed) ? __instance.m_currentWaveData.Verify : __instance.m_currentWaveData.VerifyFail); WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.m_currentWaveData.Events, (eWardenObjectiveEventTrigger)2, false, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); break; } __instance.m_currentState = newState; return false; } return true; } private static bool ForceDisable() { return ForceDisableLevels.Contains(RundownManager.ActiveExpedition.LevelLayoutData); } static Patch_ReactorStartup_OverwriteGUIBehaviour() { ForceDisableLevels = new HashSet<uint>(); LevelLayoutDataBlock block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock("Legacy_L3E2_L1"); if (block != null) { ForceDisableLevels.Add(((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).persistentID); } block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock("Legacy_L1E1_L1"); if (block != null) { ForceDisableLevels.Add(((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).persistentID); } } } } namespace LEGACY.HardcodedBehaviours { [HarmonyPatch] internal class Patch_PickupItem_Hardcoded { [HarmonyPrefix] [HarmonyPatch(typeof(LG_Distribute_PickupItemsPerZone), "Build")] private static void Pre_LG_Distribute_PickupItemsPerZone(LG_Distribute_PickupItemsPerZone __instance) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between Unknown and I4 //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Invalid comparison between Unknown and I4 //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 LevelLayoutDataBlock block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock("LAYOUT_O4_1_L1"); if (block == null || RundownManager.ActiveExpedition.LevelLayoutData != ((GameDataBlockBase<LevelLayoutDataBlock>)(object)block).persistentID) { return; } eLocalZoneIndex localIndex = __instance.m_zone.LocalIndex; if ((int)localIndex != 1) { if ((int)localIndex == 5) { __instance.m_zonePlacementWeights.Start = 0f; __instance.m_zonePlacementWeights.Middle = 0f; __instance.m_zonePlacementWeights.End = 100000f; } } else if ((int)__instance.m_pickupType == 1) { __instance.m_zonePlacementWeights.Start = 100000f; __instance.m_zonePlacementWeights.Middle = 0f; __instance.m_zonePlacementWeights.End = 0f; } } } } namespace LEGACY.VanillaFix { [HarmonyPatch] internal class Patch_FixScoutFreeze { [HarmonyPrefix] [HarmonyPatch(typeof(ES_ScoutScream), "CommonUpdate")] private static bool Prefix_Debug(ES_ScoutScream __instance) { if (((AgentAI)((ES_Base)__instance).m_ai).Target == null) { return false; } return true; } } [HarmonyPatch] internal class Patch_LG_SecurityDoor_Fix_EventsOnUnlockDoor_Powergenerator { [HarmonyPrefix] [HarmonyPatch(typeof(LG_SecurityDoor), "OnSyncDoorStatusChange")] private static void Pre_OnSyncDoorStatusChange(LG_SecurityDoor __instance, pDoorState state, bool isRecall) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Invalid comparison between Unknown and I4 //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 eDoorStatus status = state.status; if ((status - 4 <= 1 || (int)status == 9) && (int)__instance.m_lastState.status == 6 && !isRecall) { WardenObjectiveManager.CheckAndExecuteEventsOnTrigger(__instance.LinkedToZoneData.EventsOnUnlockDoor, (eWardenObjectiveEventTrigger)0, true, 0f, (Il2CppStructArray<eWardenObjectiveEventType>)null); } } } [HarmonyPatch] internal class Patch_LockSecurityDoor_FixCustomText { [HarmonyPostfix] [HarmonyPatch(typeof(LG_SecurityDoor_Locks), "Setup", new Type[] { typeof(LG_SecurityDoor) })] private static void Post_LG_SecurityDoor_Locks_Setup(LG_SecurityDoor door, LG_SecurityDoor_Locks __instance) { LocalizedText customText = door.LinkedToZoneData.ProgressionPuzzleToEnter.CustomText; __instance.m_lockedWithNoKeyInteractionText = customText; } } [HarmonyPatch] internal class Debugger { public static Debugger Current { get; private set; } = new Debugger(); public bool DEBUGGING { get; private set; } private Debugger() { } internal void Init() { _ = DEBUGGING; } private void f1(int k, out string v) { if (k < 2) { v = "2"; } v = null; } private void f2(int k, ref string v) { if (k < 2) { v = "2"; } } } } namespace LEGACY.Utils { public delegate float EasingFunction(float t, float b, float c, float d); public delegate bool BoolCheck(); internal static class CoroutineEase { 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) bool doAbort = false; while (Clock.Time < startTime + duration && !doAbort) { doAbort = checkAbort?.Invoke() ?? false; float num = ease(Clock.Time - startTime, 0f, 1f, duration); trans.localScale = Vector3.Lerp(startScale, targetScale, num); yield return null; } trans.localScale = targetScale; if (!doAbort) { onDone?.Invoke(); } } 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) bool doAbort = false; while (Clock.Time < startTime + duration && !doAbort) { doAbort = checkAbort?.Invoke() ?? false; float num = ease(Clock.Time - startTime, 0f, 1f, duration); trans.localPosition = Vector3.Lerp(sourcePos, targetPos, num); yield return null; } trans.localPosition = targetPos; if (!doAbort) { onDone?.Invoke(); } } 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) bool doAbort = false; while (Clock.Time < startTime + duration && !doAbort) { doAbort = checkAbort?.Invoke() ?? false; float num = ease(Clock.Time - startTime, 0f, 1f, duration); trans.localEulerAngles = Vector3.Lerp(sourceEuler, targetEuler, num); yield return null; } trans.localEulerAngles = targetEuler; if (!doAbort) { onDone?.Invoke(); } } internal static Coroutine EaseLocalScale(Transform trans, Vector3 startScale, Vector3 targetScale, float duration, EasingFunction ease = null, Action onDone = null, BoolCheck checkAbort = null) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) EasingFunction ease2 = ease ?? new EasingFunction(Easing.EaseOutExpo); return CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoEaseLocalScale(trans, startScale, targetScale, Clock.Time, duration, ease2, onDone, checkAbort)), (Action)null); } internal static Coroutine EaseLocalPos(Transform trans, Vector3 sourcePos, Vector3 targetPos, float duration, EasingFunction ease = null, Action onDone = null, BoolCheck checkAbort = null) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) EasingFunction ease2 = ease ?? new EasingFunction(Easing.EaseOutExpo); return CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoEaseLocalPos(trans, sourcePos, targetPos, Clock.Time, duration, ease2, onDone, checkAbort)), (Action)null); } internal static Coroutine EaseLocalRot(Transform trans, Vector3 sourceEuler, Vector3 targetEuler, float duration, EasingFunction ease = null, Action onDone = null, BoolCheck checkAbort = null) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) EasingFunction ease2 = ease ?? new EasingFunction(Easing.EaseOutExpo); return CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(DoEaseLocalRot(trans, sourceEuler, targetEuler, Clock.Time, duration, ease2, onDone, checkAbort)), (Action)null); } } public static class Helper { private static void ResetChild(iChainedPuzzleCore ICore) { CP_Bioscan_Core val = ((Il2CppObjectBase)ICore).TryCast<CP_Bioscan_Core>(); if ((Object)(object)val != (Object)null) { ((Il2CppObjectBase)val.m_spline).Cast<CP_Holopath_Spline>(); ((Il2CppObjectBase)val.PlayerScanner).Cast<CP_PlayerScanner>().ResetScanProgression(0f); val.Deactivate(); return; } CP_Cluster_Core val2 = ((Il2CppObjectBase)ICore).TryCast<CP_Cluster_Core>(); if ((Object)(object)val2 == (Object)null) { LegacyLogger.Error("ResetChild: found iChainedPuzzleCore that is neither CP_Bioscan_Core nor CP_Cluster_Core..."); return; } ((Il2CppObjectBase)val2.m_spline).Cast<CP_Holopath_Spline>(); foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)val2.m_childCores) { ResetChild(item); } val2.Deactivate(); } public static void ResetChainedPuzzle(ChainedPuzzleInstance chainedPuzzleInstance) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) if (chainedPuzzleInstance.Data.DisableSurvivalWaveOnComplete) { chainedPuzzleInstance.m_sound = new CellSoundPlayer(chainedPuzzleInstance.m_parent.position); } foreach (iChainedPuzzleCore item in (Il2CppArrayBase<iChainedPuzzleCore>)(object)chainedPuzzleInstance.m_chainedPuzzleCores) { ResetChild(item); } if (SNet.IsMaster) { pChainedPuzzleState state = chainedPuzzleInstance.m_stateReplicator.State; pChainedPuzzleState val = default(pChainedPuzzleState); val.status = (eChainedPuzzleStatus)0; val.currentSurvivalWave_EventID = state.currentSurvivalWave_EventID; val.isSolved = false; val.isActive = false; pChainedPuzzleState val2 = val; chainedPuzzleInstance.m_stateReplicator.InteractWithState(val2, new pChainedPuzzleInteraction { type = (eChainedPuzzleInteraction)2 }); } } public static List<T> ToManagedList<T>(this List<T> il2cppList) { List<T> list = new List<T>(); Enumerator<T> enumerator = il2cppList.GetEnumerator(); while (enumerator.MoveNext()) { T current = enumerator.Current; list.Add(current); } return list; } public static bool TryGetComponent<T>(this GameObject obj, out T comp) { comp = obj.GetComponent<T>(); return comp != null; } public static bool IsPlayerInLevel(PlayerAgent player) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Invalid comparison between Unknown and I4 return (int)player.Owner.Load<pGameState>().gameState == 10; } public static ChainedPuzzleInstance GetChainedPuzzleForCommandOnTerminal(LG_ComputerTerminal terminal, string command) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected I4, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Invalid comparison between Unknown and I4 //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Invalid comparison between Unknown and I4 //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Invalid comparison between Unknown and I4 //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Invalid comparison between Unknown and I4 //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Invalid comparison between Unknown and I4 uint num = 0u; if (terminal.SpawnNode.m_dimension.IsMainDimension) { LG_LayerType layerType = terminal.SpawnNode.LayerType; switch ((int)layerType) { case 0: num = RundownManager.ActiveExpedition.LevelLayoutData; break; case 1: num = RundownManager.ActiveExpedition.SecondaryLayout; break; case 2: num = RundownManager.ActiveExpedition.ThirdLayout; break; default: LegacyLogger.Error("Unimplemented layer type."); return null; } } else { num = terminal.SpawnNode.m_dimension.DimensionData.LevelLayoutData; } LevelLayoutDataBlock block = GameDataBlockBase<LevelLayoutDataBlock>.GetBlock(num); List<CustomTerminalCommand> val = null; List<LG_ComputerTerminal> terminalsSpawnedInZone = terminal.SpawnNode.m_zone.TerminalsSpawnedInZone; int num2 = terminalsSpawnedInZone.IndexOf(terminal); ExpeditionZoneData val2 = null; Enumerator<ExpeditionZoneData> enumerator = block.Zones.GetEnumerator(); while (enumerator.MoveNext()) { ExpeditionZoneData current = enumerator.Current; if (current.LocalIndex == terminal.SpawnNode.m_zone.LocalIndex) { val2 = current; break; } } if (val2 == null) { LegacyLogger.Error("Cannot find target zone data."); return null; } if (val2.TerminalPlacements.Count != terminalsSpawnedInZone.Count) { LegacyLogger.Error("The numbers of terminal placement and spawn, skipped for the zone terminal."); return null; } val = val2.TerminalPlacements[num2].UniqueCommands; if (val.Count == 0) { return null; } List<WardenObjectiveEventData> val3 = null; TERM_Command val4 = (TERM_Command)0; Enumerator<CustomTerminalCommand> enumerator2 = val.GetEnumerator(); string text = default(string); string text2 = default(string); while (enumerator2.MoveNext()) { CustomTerminalCommand current2 = enumerator2.Current; if (current2.Command == command) { val3 = current2.CommandEvents; if (!terminal.m_command.TryGetCommand(current2.Command, ref val4, ref text, ref text2)) { LegacyLogger.Error("Cannot get TERM_COMMAND for command {0} on the specified terminal."); } break; } } if (val3 == null || (int)val4 == 0) { return null; } if ((int)val4 != 38 && (int)val4 != 39 && (int)val4 != 40 && (int)val4 != 41 && (int)val4 != 42) { return null; } ChainedPuzzleInstance val5 = null; for (int i = 0; i < val3.Count && (val3[i].ChainPuzzle == 0 || !terminal.TryGetChainPuzzleForCommand(val4, i, ref val5) || !((Object)(object)val5 != (Object)null)); i++) { } return val5; } public static bool TryGetZoneEntranceSecDoor(LG_Zone zone, out LG_SecurityDoor door) { if ((Object)(object)zone == (Object)null) { door = null; return false; } if ((Object)(object)zone.m_sourceGate == (Object)null) { door = null; return false; } if (zone.m_sourceGate.SpawnedDoor == null) { door = null; return false; } door = ((Il2CppObjectBase)zone.m_sourceGate.SpawnedDoor).TryCast<LG_SecurityDoor>(); return (Object)(object)door != (Object)null; } internal static bool isSecDoorToZoneOpened(LG_Zone zone14) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 LG_SecurityDoor door = null; if (!TryGetZoneEntranceSecDoor(zone14, out door) || (Object)(object)door == (Object)null) { return false; } return (int)door.m_sync.GetCurrentSyncState().status == 10; } public static List<T> cast<T>(List<T> list) { List<T> list2 = new List<T>(); Enumerator<T> enumerator = list.GetEnumerator(); while (enumerator.MoveNext()) { T current = enumerator.Current; list2.Add(current); } return list2; } private static eDimensionIndex GetCurrentDimensionIndex() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (PlayerManager.PlayerAgentsInLevel.Count <= 0) { throw new Exception("? You don't have any player agent in level? How could that happen?"); } return ((Agent)PlayerManager.PlayerAgentsInLevel[0]).DimensionIndex; } public static void GetMinLayerAndLocalIndex(out LG_LayerType MinLayer, out eLocalZoneIndex MinLocalIndex) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between I4 and Unknown //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Invalid comparison between I4 and Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Expected I4, but got Unknown //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Expected I4, but got Unknown MinLayer = (LG_LayerType)2; MinLocalIndex = (eLocalZoneIndex)20; Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (IsPlayerInLevel(current)) { if ((int)MinLayer > (int)current.m_courseNode.LayerType) { MinLayer = (LG_LayerType)(int)current.m_courseNode.LayerType; MinLocalIndex = (eLocalZoneIndex)20; } if ((int)MinLocalIndex >= (int)current.m_courseNode.m_zone.LocalIndex) { MinLocalIndex = (eLocalZoneIndex)(int)current.m_courseNode.m_zone.LocalIndex; } } } } public static void GetMaxLayerAndLocalIndex(out LG_LayerType MaxLayer, out eLocalZoneIndex MaxLocalIndex) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Invalid comparison between I4 and Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Invalid comparison between I4 and Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected I4, but got Unknown //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Expected I4, but got Unknown MaxLayer = (LG_LayerType)0; MaxLocalIndex = (eLocalZoneIndex)0; Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (IsPlayerInLevel(current)) { if ((int)MaxLayer < (int)current.m_courseNode.LayerType) { MaxLayer = (LG_LayerType)(int)current.m_courseNode.LayerType; MaxLocalIndex = (eLocalZoneIndex)0; } if ((int)MaxLocalIndex < (int)current.m_courseNode.m_zone.LocalIndex) { MaxLocalIndex = (eLocalZoneIndex)(int)current.m_courseNode.m_zone.LocalIndex; } } } } public static int GetMinAreaIndex(LG_Zone zone) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)zone == (Object)null) { return -1; } LG_LayerType type = zone.m_layer.m_type; eLocalZoneIndex localIndex = zone.LocalIndex; GetCurrentDimensionIndex(); int num = zone.m_areas.Count; Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (current.m_courseNode.LayerType != type || current.m_courseNode.m_zone.LocalIndex != localIndex) { continue; } int i = 0; for (List<LG_Area> areas = zone.m_areas; i < areas.Count; i++) { if (((Object)((Component)areas[i]).gameObject).GetInstanceID() == ((Object)((Component)current.m_courseNode.m_area).gameObject).GetInstanceID()) { if (num > i) { num = i; } break; } } } return num; } public static LG_ComputerTerminal FindTerminal(eDimensionIndex dimensionIndex, LG_LayerType layerType, eLocalZoneIndex localIndex, int terminalIndex) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) LG_Zone val = null; if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(dimensionIndex, layerType, localIndex, ref val) || (Object)(object)val == (Object)null) { LegacyLogger.Error($"FindTerminal: Didn't find LG_Zone {dimensionIndex}, {layerType}, {localIndex}"); return null; } if (val.TerminalsSpawnedInZone == null || terminalIndex >= val.TerminalsSpawnedInZone.Count) { LegacyLogger.Error($"FindTerminal: Invalid terminal index {terminalIndex} - {((val.TerminalsSpawnedInZone != null) ? val.TerminalsSpawnedInZone.Count : 0)} terminals are spawned in {dimensionIndex}, {layerType}, {localIndex}"); return null; } if (terminalIndex >= 0) { return val.TerminalsSpawnedInZone[terminalIndex]; } return null; } public static AIG_NodeCluster GetNodeFromDimensionPosition(eDimensionIndex dimensionIndex, Vector3 position) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) AIG_GeomorphNodeVolume val = default(AIG_GeomorphNodeVolume); AIG_VoxelNodePillar val2 = default(AIG_VoxelNodePillar); AIG_INode val3 = default(AIG_INode); AIG_NodeCluster result = default(AIG_NodeCluster); if (!AIG_GeomorphNodeVolume.TryGetGeomorphVolume(0, dimensionIndex, position, ref val) || !((AIG_NodeVolume)val).m_voxelNodeVolume.TryGetPillar(position, ref val2) || !val2.TryGetVoxelNode(position.y, ref val3) || !AIG_NodeCluster.TryGetNodeCluster(val3.ClusterID, ref result)) { LegacyLogger.Error("TryWarpTo : Position is not valid, try again inside an area."); return null; } return result; } } internal static class Json { private static readonly JsonSerializerOptions _setting; static Json() { _setting = new JsonSerializerOptions { ReadCommentHandling = JsonCommentHandling.Skip, IncludeFields = false, PropertyNameCaseInsensitive = true, WriteIndented = true, IgnoreReadOnlyProperties = true }; _setting.Converters.Add(new JsonStringEnumConverter()); _setting.Converters.Add(MTFOPartialDataUtil.PersistentIDConverter); _setting.Converters.Add(MTFOPartialDataUtil.LocalizedTextConverter); } public static T Deserialize<T>(string json) { return JsonSerializer.Deserialize<T>(json, _setting); } public static object Deserialize(Type type, string json) { return JsonSerializer.Deserialize(json, type, _setting); } public static string Serialize<T>(T value) { return JsonSerializer.Serialize(value, _setting); } public static void Load<T>(string filePath, out T config) where T : new() { config = Deserialize<T>(File.ReadAllText(filePath)); } } internal static class LegacyLogger { private static ManualLogSource logger = Logger.CreateLogSource("LEGACYCore"); public static void Log(string format, params object[] args) { Log(string.Format(format, args)); } public static void Log(string str) { if (logger != null) { logger.Log((LogLevel)8, (object)str); } } public static void Warning(string format, params object[] args) { Warning(string.Format(format, args)); } public static void Warning(string str) { if (logger != null) { logger.Log((LogLevel)4, (object)str); } } public static void Error(string format, params object[] args) { Error(string.Format(format, args)); } public static void Error(string str) { if (logger != null) { logger.Log((LogLevel)2, (object)str); } } public static void Debug(string format, params object[] args) { Debug(string.Format(format, args)); } public static void Debug(string str) { if (logger != null) { logger.Log((LogLevel)32, (object)str); } } } public class SpawnHibernateEnemiesEvent { public eWardenObjectiveEventTrigger Trigger { get; set; } public int Type { get; set; } = 170; public eDimensionIndex DimensionIndex { get; set; } public LG_LayerType Layer { get; set; } public eLocalZoneIndex LocalIndex { get; set; } public string WorldEventObjectFilter { get; set; } = "RANDOM"; public uint EnemyID { get; set; } public int Count { get; set; } = 1; public float Delay { get; set; } public float Duration { get; set; } = 2f; } public class WeightedAreaSelector { private static readonly Dictionary<LG_Zone, WeightedAreaSelector> dict; private WeightedRandomBag<LG_Area> weightedRandomBag; public static WeightedAreaSelector Get(LG_Zone zone) { //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected I4, but got Unknown //IL_009c: Unknown result type (might be due to invalid IL or missing references) if (!dict.ContainsKey(zone)) { WeightedAreaSelector weightedAreaSelector = new WeightedAreaSelector(); Enumerator<LG_Area> enumerator = zone.m_areas.GetEnumerator(); while (enumerator.MoveNext()) { LG_Area current = enumerator.Current; float num = 0f; LG_AreaSize size = current.m_size; switch (size - 1) { case 4: num = 7f; break; case 0: num = 20f; break; case 1: num = 30f; break; case 2: num = 35f; break; case 3: num = 45f; break; default: LegacyLogger.Error($"Unhandled LG_AreaSize: {current.m_size}. Won't build."); return null; } weightedAreaSelector.AddEntry(current, num); } dict.Add(zone, weightedAreaSelector); } return dict[zone]; } public static WeightedAreaSelector Get(eDimensionIndex eDimensionIndex, LG_LayerType layerType, eLocalZoneIndex localIndex) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) LG_Zone val = default(LG_Zone); if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(eDimensionIndex, layerType, localIndex, ref val) || !Object.op_Implicit((Object)(object)val)) { return null; } return Get(val); } private WeightedAreaSelector() { weightedRandomBag = new WeightedRandomBag<LG_Area>(); } private void AddEntry(LG_Area area, float weight) { weightedRandomBag.AddEntry(area, weight); } public LG_Area GetRandom() { return weightedRandomBag.GetRandom(); } private static void OnBuildDone() { } private static void Clear() { dict.Clear(); } static WeightedAreaSelector() { dict = new Dictionary<LG_Zone, WeightedAreaSelector>(); LevelAPI.OnLevelCleanup += dict.Clear; } } public class WeightedRandomBag<T> { private struct Entry { public double accumulatedWeight; public T item; } private List<Entry> entries = new List<Entry>(); private double accumulatedWeight; private Random rand = new Random(); public void AddEntry(T item, double weight) { if (weight <= 0.0) { LegacyLogger.Error("AddEntry: no non-positive weight pls."); return; } accumulatedWeight += weight; entries.Add(new Entry { item = item, accumulatedWeight = accumulatedWeight }); } public T GetRandom() { double num = rand.NextDouble() * accumulatedWeight; foreach (Entry entry in entries) { if (entry.accumulatedWeight >= num) { return entry.item; } } return default(T); } } } namespace LEGACY.LegacyOverride { internal class NavMarkerManager { private Dictionary<string, GameObject> markerVisuals = new Dictionary<string, GameObject>(); private Dictionary<string, NavMarker> navMarkers = new Dictionary<string, NavMarker>(); private List<GameObject> arbitraryNavMarkers = new List<GameObject>(); public static NavMarkerManager Current { get; private set; } = new NavMarkerManager(); private GameObject InstantiateMarkerVisual() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) GameObject obj = Object.Instantiate<GameObject>(Assets.ObjectiveMarker); float num = 0.16216217f; Transform transform = obj.transform; transform.localPosition += Vector3.up * num; return obj; } public void EnableMarkerAt(string markerName, GameObject target, float scale) { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) if (navMarkers.ContainsKey(markerName)) { navMarkers[markerName].SetVisible(true); } else { NavMarker val = GuiManager.NavMarkerLayer.PrepareGenericMarker(target); if ((Object)(object)val != (Object)null) { val.SetColor(new Color(0.855f, 0.482f, 0.976f)); val.SetStyle((eNavMarkerStyle)14); val.SetVisible(true); navMarkers[markerName] = val; } else { LegacyLogger.Error("EnableMarkerAt: got null nav marker"); } } GameObject val2 = null; if (markerVisuals.ContainsKey(markerName)) { val2 = markerVisuals[markerName]; } else { val2 = InstantiateMarkerVisual(); val2.transform.localScale = new Vector3(scale, scale, scale); val2.transform.SetPositionAndRotation(target.transform.position, Quaternion.identity); markerVisuals[markerName] = val2; } CoroutineManager.BlinkIn(val2, 0f); LegacyLogger.Debug("EnableMarker: marker " + markerName + " enabled"); } public void EnableArbitraryMarkerAt(string markerName, Vector3 Position) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Expected O, but got Unknown //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) if (navMarkers.ContainsKey(markerName)) { navMarkers[markerName].SetVisible(true); } else { GameObject val = new GameObject(markerName); val.transform.SetPositionAndRotation(Position, Quaternion.identity); arbitraryNavMarkers.Add(val); NavMarker val2 = GuiManager.NavMarkerLayer.PrepareGenericMarker(val); if ((Object)(object)val2 != (Object)null) { val2.SetColor(new Color(0.855f, 0.482f, 0.976f)); val2.SetStyle((eNavMarkerStyle)14); val2.SetVisible(true); navMarkers[markerName] = val2; } else { LegacyLogger.Error("EnableMarkerAt: got null nav marker"); } } LegacyLogger.Debug("EnableMarker: marker " + markerName + " enabled"); } internal (GameObject markerVisual, NavMarker navMakrer) GetMarkerVisuals(string markerName) { if (!markerVisuals.TryGetValue(markerName, out var value) || !navMarkers.TryGetValue(markerName, out var value2)) { return (null, null); } return (value, value2); } public void DisableMakrer(string markerName) { if (navMarkers.ContainsKey(markerName)) { navMarkers[markerName].SetVisible(false); } if (markerVisuals.ContainsKey(markerName)) { GameObject val = markerVisuals[markerName]; if (val.active) { CoroutineManager.BlinkOut(val, 0f); } LegacyLogger.Debug("DisableMakrer: marker " + markerName + " disabled"); } } public void Clear() { foreach (GameObject value in markerVisuals.Values) { Object.Destroy((Object)(object)value); } arbitraryNavMarkers.ForEach((Action<GameObject>)Object.Destroy); markerVisuals.Clear(); navMarkers.Clear(); arbitraryNavMarkers.Clear(); } private NavMarkerManager() { LevelAPI.OnBuildStart += Clear; LevelAPI.OnLevelCleanup += Clear; } } internal static class LegacyOverrideManagers { internal static readonly string LEGACY_CONFIG_PATH = Path.Combine(MTFOPathAPI.CustomPath, "LegacyOverride"); internal static void Init() { ElevatorCargoOverrideManager.Current.Init(); BigPickupFogBeaconSettingManager.Current.Init(); EnemyTaggerSettingManager.Current.Init(); ForceFailManager.Current.Init(); ((GenericExpeditionDefinitionManager<ExpeditionIntel>)ExpeditionIntelNotifier.Current).Init(); ((GenericExpeditionDefinitionManager<EventScanDefinition>)EventScanManager.Current).Init(); ((GenericExpeditionDefinitionManager<VisualGroupDefinition>)VisualManager.Current).Init(); ((GenericExpeditionDefinitionManager<MusicOverride>)MusicStateOverrider.Current).Init(); ((ZoneDefinitionManager<LevelSpawnedFogBeaconDefinition>)LevelSpawnedFogBeaconManager.Current).Init(); ((GenericExpeditionDefinitionManager<SuccessPageCustomization>)SuccessPageCustomizationManager.Current).Init(); ((GenericExpeditionDefinitionManager<ResourceStationDefinition>)ResourceStationManager.Current).Init(); } } } namespace LEGACY.LegacyOverride.ResourceStations { public sealed class ToolStation : ResourceStation { public override string ItemKey => $"Tool_Station_{base.SerialNumber}"; protected override void SetupInteraction() { base.SetupInteraction(); TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.InteractionPrompt.ToolStation"); Interact.InteractionMessage = ((block == null) ? "TOOL STATION" : Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID)); } protected override void Replenish(PlayerAgent player) { PlayerAmmoStorage ammoStorage = PlayerBackpackManager.GetBackpack(player.Owner).AmmoStorage; float num = Math.Max(0f, Math.Min(def.SupplyUplimit.Tool - ammoStorage.ClassAmmo.RelInPack, def.SupplyEfficiency.Tool)); player.GiveAmmoRel((PlayerAgent)null, 0f, 0f, num); player.Sound.Post(EVENTS.AMMOPACK_APPLY, true); } public static ToolStation Instantiate(ResourceStationDefinition def) { if (def.StationType != StationType.TOOL) { LegacyLogger.Error($"Trying to instantiate MediStation with def with 'StationType': {def.StationType}!"); return null; } GameObject gO = Object.Instantiate<GameObject>(Assets.ToolStation); return new ToolStation(def, gO); } private ToolStation(ResourceStationDefinition def, GameObject GO) : base(def, GO) { } static ToolStation() { } } public sealed class MediStation : ResourceStation { public const float VANILLA_MAX_HEALTH = 25f; public override string ItemKey => $"Health_Station_{base.SerialNumber}"; protected override void SetupInteraction() { base.SetupInteraction(); TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.InteractionPrompt.MediStation"); Interact.InteractionMessage = ((block == null) ? "HEALTH STATION" : Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID)); } protected override void Replenish(PlayerAgent player) { float health = ((Dam_SyncedDamageBase)player.Damage).Health; float num = def.SupplyUplimit.Medi * 25f; if (!(health >= num)) { player.GiveHealth((PlayerAgent)null, Math.Min(def.SupplyEfficiency.Medi, (num - health) / 25f)); player.Sound.Post(EVENTS.MEDPACK_APPLY, true); } } public static MediStation Instantiate(ResourceStationDefinition def) { if (def.StationType != 0) { LegacyLogger.Error($"Trying to instantiate MediStation with def with 'StationType': {def.StationType}!"); return null; } GameObject gO = Object.Instantiate<GameObject>(Assets.MediStation); return new MediStation(def, gO); } private MediStation(ResourceStationDefinition def, GameObject GO) : base(def, GO) { } static MediStation() { } } public abstract class ResourceStation { public const int UNLIMITED_USE_TIME = int.MaxValue; private Coroutine m_blinkMarkerCoroutine; public virtual GameObject GameObject { get; protected set; } public GameObject InteractGO { get { GameObject gameObject = GameObject; return ((gameObject != null) ? ((Component)gameObject.transform.GetChild(3)).gameObject : null) ?? null; } } public GameObject StationMarkerGO { get { GameObject gameObject = GameObject; return ((gameObject != null) ? ((Component)gameObject.transform.GetChild(2)).gameObject : null) ?? null; } } public virtual Interact_Timed Interact { get; protected set; } public virtual ResourceStationDefinition def { get; protected set; } public RSTimer Timer { get; protected set; } public StateReplicator<RSStateStruct> StateReplicator { get; protected set; } public RSStateStruct State => StateReplicator?.State ?? new RSStateStruct(); public LG_GenericTerminalItem TerminalItem { get; protected set; } public AIG_CourseNode SpawnNode { get { return TerminalItem.SpawnNode; } set { TerminalItem.SpawnNode = value; } } protected int SerialNumber { get; private set; } public virtual string ItemKey => $"Resource_Station_{SerialNumber}"; public bool Enabled => State.Enabled; protected virtual bool InCooldown { get { if (State.RemainingUseTime <= 0) { return State.CurrentCooldownTime > 0f; } return false; } } public virtual bool HasUnlimitedUseTime => def.AllowedUseTimePerCooldown == int.MaxValue; public virtual void Destroy() { if (m_blinkMarkerCoroutine != null) { CoroutineManager.StopCoroutine(m_blinkMarkerCoroutine); m_blinkMarkerCoroutine = null; } Object.Destroy((Object)(object)GameObject); StateReplicator?.Unload(); Interact = null; def = null; StateReplicator = null; } protected virtual bool CanInteract() { if (Enabled) { return !InCooldown; } return false; } protected abstract void Replenish(PlayerAgent player); protected virtual void SetInteractionText() { //IL_0013: Unknown result type (might be due to invalid IL or missing references) string text = Text.Format(827u, (Object[])(object)new Object[1] { Object.op_Implicit(InputMapper.GetBindingName(((Interact_Base)Interact).InputAction)) }); TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.OnAdditionalInteractionText.ResourceStation"); string text2 = ((block == null) ? "TO REPLENISH" : Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID)); string text3 = (HasUnlimitedUseTime ? string.Empty : $"({State.RemainingUseTime}/{def.AllowedUseTimePerCooldown})"); GuiManager.InteractionLayer.SetInteractPrompt(Interact.InteractionMessage, text + text2 + text3, (ePUIMessageStyle)0); } protected virtual void OnTriggerInteraction(PlayerAgent player) { RSStateStruct state = State; int num = (HasUnlimitedUseTime ? int.MaxValue : Math.Max(state.RemainingUseTime - 1, 0)); int num2 = player.Owner.PlayerSlotIndex(); if (num2 < 0 || num2 >= ((Il2CppArrayBase<SNet_Slot>)(object)SNet.Slots.PlayerSlots).Count) { LegacyLogger.Error($"ResourceStation_OnTriggerInteraction: player {player.PlayerName} has invalid slot index: {num2}"); } else { StateReplicator?.SetState(new RSStateStruct { LastInteractedPlayer = num2, RemainingUseTime = num, CurrentCooldownTime = ((num == 0) ? def.CooldownTime : 0f), Enabled = true }); } } protected virtual void OnInteractionSelected(PlayerAgent agent, bool selected) { if (selected) { SetInteractionText(); } } protected virtual void SetupInteraction() { Interact.InteractDuration = def.InteractDuration; Interact_Timed interact = Interact; interact.ExternalPlayerCanInteract += Func<PlayerAgent, bool>.op_Implicit((Func<PlayerAgent, bool>)((PlayerAgent _) => CanInteract())); Interact_Timed interact2 = Interact; interact2.OnInteractionSelected += Action<PlayerAgent, bool>.op_Implicit((Action<PlayerAgent, bool>)OnInteractionSelected); Interact_Timed interact3 = Interact; interact3.OnInteractionTriggered += Action<PlayerAgent>.op_Implicit((Action<PlayerAgent>)OnTriggerInteraction); } protected virtual void SetupTerminalItem() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) LG_Zone val = default(LG_Zone); if (!Builder.CurrentFloor.TryGetZoneByLocalIndex(((GlobalZoneIndex)def).DimensionIndex, ((GlobalZoneIndex)def).LayerType, ((GlobalZoneIndex)def).LocalIndex, ref val) || (Object)(object)val == (Object)null) { LegacyLogger.Error("ResourceStation: Cannot find spawn node!"); return; } if (def.AreaIndex < 0 || def.AreaIndex >= val.m_areas.Count) { LegacyLogger.Error("ResourceStation: Cannot find spawn node - Area index is invalid!"); return; } TerminalItem.Setup(ItemKey, val.m_areas[def.AreaIndex].m_courseNode); if (SpawnNode != null) { TerminalItem.FloorItemLocation = SpawnNode.m_zone.NavInfo.GetFormattedText((LG_NavInfoFormat)7); } TerminalItem.FloorItemStatus = (eFloorInventoryObjectStatus)0; } protected virtual void OnStateChanged(RSStateStruct oldState, RSStateStruct newState, bool isRecall) { if (isRecall) { return; } int lastInteractedPlayer = newState.LastInteractedPlayer; if (lastInteractedPlayer < 0 || lastInteractedPlayer >= ((Il2CppArrayBase<SNet_Slot>)(object)SNet.Slots.PlayerSlots).Count) { return; } if (((Interact_Base)Interact).IsSelected) { SetInteractionText(); } if (!SNet.IsMaster) { return; } LegacyLogger.Warning($"ResourceStation OnStateChanged: replenish for player {lastInteractedPlayer}, remaining use time: {newState.RemainingUseTime}"); if (oldState.RemainingUseTime > 0) { SNet_Player playerInSlot = SNet.Slots.GetPlayerInSlot(lastInteractedPlayer); if ((Object)(object)playerInSlot != (Object)null) { Replenish(((Il2CppObjectBase)playerInSlot.m_playerAgent).Cast<PlayerAgent>()); } else { LegacyLogger.Error($"playerSlot_{lastInteractedPlayer} has no player agent!"); } } if (newState.RemainingUseTime == 0) { LegacyLogger.Warning("ResourceStation OnStateChanged: cooldown timer starts!"); OnCoolDownStart(); } } protected virtual void OnCoolDownStart() { Timer.StartTimer(def.CooldownTime); if (m_blinkMarkerCoroutine == null) { m_blinkMarkerCoroutine = CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(BlinkMarker()), (Action)null); } } protected virtual void OnCoolDownTimerProgress(float progress) { } protected virtual void OnCoolDownEnd() { LegacyLogger.Warning("ResourceStation OnCoolDownEnd"); if (m_blinkMarkerCoroutine != null) { CoroutineManager.StopCoroutine(m_blinkMarkerCoroutine); m_blinkMarkerCoroutine = null; StationMarkerGO.SetActive(true); } if (SNet.IsMaster) { LegacyLogger.Warning("ResourceStation OnCoolDownEnd: master reset state!"); StateReplicator.SetState(new RSStateStruct { LastInteractedPlayer = -1, RemainingUseTime = def.AllowedUseTimePerCooldown, CurrentCooldownTime = 0f, Enabled = true }); } } protected virtual void SetupReplicator() { if (StateReplicator == null) { uint num = EOSNetworking.AllotReplicatorID(); if (num == 0) { LegacyLogger.Error("ResourceStation: replicatorID depleted, cannot setup replicator!"); return; } StateReplicator = StateReplicator<RSStateStruct>.Create(num, new RSStateStruct { RemainingUseTime = def.AllowedUseTimePerCooldown, CurrentCooldownTime = -1f, Enabled = true }, (LifeTimeType)1, (IStateReplicatorHolder<RSStateStruct>)null); StateReplicator.OnStateChanged += OnStateChanged; } } protected virtual void SetupRSTimer() { if ((Object)(object)Timer == (Object)null) { Timer = RSTimer.Instantiate(OnCoolDownTimerProgress, OnCoolDownEnd); } } private IEnumerator BlinkMarker() { while (true) { StationMarkerGO.SetActive(!StationMarkerGO.active); yield return (object)new WaitForSeconds(0.5f); } } protected ResourceStation(ResourceStationDefinition def, GameObject GO) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) this.def = def; GameObject = GO; GameObject.transform.SetPositionAndRotation(def.Position.ToVector3(), def.Rotation.ToQuaternion()); Interact = InteractGO.GetComponent<Interact_Timed>(); SerialNumber = SerialGenerator.GetUniqueSerialNo(); if ((Object)(object)Interact == (Object)null) { LegacyLogger.Error("ResourceStation: Interact Comp not found!"); } else { SetupInteraction(); } TerminalItem = GO.GetComponent<LG_GenericTerminalItem>(); if ((Object)(object)TerminalItem == (Object)null) { LegacyLogger.Error("ResourceStation: TerminalItem not found!"); } else { SetupTerminalItem(); } SetupReplicator(); SetupRSTimer(); } static ResourceStation() { } } public sealed class AmmoStation : ResourceStation { public override string ItemKey => $"Ammunition_Station_{base.SerialNumber}"; protected override void SetupInteraction() { base.SetupInteraction(); TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("InGame.InteractionPrompt.AmmoStation"); Interact.InteractionMessage = ((block == null) ? "AMMUNITION STATION" : Text.Get(((GameDataBlockBase<TextDataBlock>)(object)block).persistentID)); } public static AmmoStation Instantiate(ResourceStationDefinition def) { if (def.StationType != StationType.AMMO) { LegacyLogger.Error($"Trying to instantiate AmmoStation with def with 'StationType': {def.StationType}!"); return null; } GameObject gO = Object.Instantiate<GameObject>(Assets.AmmoStation); return new AmmoStation(def, gO); } protected override void Replenish(PlayerAgent player) { PlayerAmmoStorage ammoStorage = PlayerBackpackManager.GetBackpack(player.Owner).AmmoStorage; float num = Math.Max(0f, Math.Min(def.SupplyUplimit.AmmoStandard - ammoStorage.StandardAmmo.RelInPack, def.SupplyEfficiency.AmmoStandard)); float num2 = Math.Max(0f, Math.Min(def.SupplyUplimit.AmmoSpecial - ammoStorage.SpecialAmmo.RelInPack, def.SupplyEfficiency.AmmoSpecial)); player.GiveAmmoRel((PlayerAgent)null, num, num2, 0f); player.Sound.Post(EVENTS.AMMOPACK_APPLY, true); } private AmmoStation(ResourceStationDefinition def, GameObject GO) : base(def, GO) { } static AmmoStation() { } } public enum StationType { MEDI, AMMO, TOOL } public class SupplyUplimit { public float Medi { get; set; } = 0.6f; public float AmmoStandard { get; set; } = 1f; public float AmmoSpecial { get; set; } = 1f; public float Tool { get; set; } } public class SupplyEfficiency { public float Medi { get; set; } = 0.2f; public float AmmoStandard { get; set; } = 0.15f; public float AmmoSpecial { get; set; } = 0.15f; public float Tool { get; set; } } public class ResourceStationDefinition : GlobalZoneIndex { public int AreaIndex { get; set; } public string WorldEventObjectFilter { get; set; } = string.Empty; public StationType StationType { get; set; } = StationType.AMMO; public Vec3 Position { get; set; } = new Vec3(); public Vec3 Rotation { get; set; } = new Vec3(); public float InteractDuration { get; set; } = 2.5f; public SupplyEfficiency SupplyEfficiency { get; set; } = new SupplyEfficiency(); public SupplyUplimit SupplyUplimit { get; set; } = new SupplyUplimit(); public int AllowedUseTimePerCooldown { get; set; } = int.MaxValue; public float CooldownTime { get; set; } = 3f; } public class ResourceStationManager : GenericExpeditionDefinitionManager<ResourceStationDefinition> { public static ResourceStationManager Current { get; private set; } protected override string DEFINITION_NAME => "ResourceStation"; private Dictionary<string, ResourceStation> Stations { get; } = new Dictionary<string, ResourceStation>(); private void Build(ResourceStationDefinition def) { if (Stations.ContainsKey(def.WorldEventObjectFilter)) { LegacyLogger.Error("ResourceStationManager: WorldEventObjectFilter '" + def.WorldEventObjectFilter + "' is already used"); return; } ResourceStation resourceStation = null; switch (def.StationType) { case StationType.MEDI: resourceStation = MediStation.Instantiate(def); break; case StationType.AMMO: resourceStation = AmmoStation.Instantiate(def); break; case StationType.TOOL: resourceStation = ToolStation.Instantiate(def); break; default: LegacyLogger.Error($"ResourceStation {def.StationType} is unimplemented"); return; } if (resourceStation != null) { Stations[def.WorldEventObjectFilter] = resourceStation; LegacyLogger.Debug("ResourceStation '" + def.WorldEventObjectFilter + "' instantiated"); } } private void BuildStations() { if (base.definitions.TryGetValue(base.CurrentMainLevelLayout, out var value)) { value.Definitions.ForEach(Build); } } private void Clear() { foreach (ResourceStation value in Stations.Values) { value.Destroy(); } Stations.Clear(); } private ResourceStationManager() { LevelAPI.OnBuildStart += delegate { Clear(); }; LevelAPI.OnLevelCleanup += Clear; LevelAPI.OnBuildDone += BuildStations; } static ResourceStationManager() { Current = new ResourceStationManager(); } } public struct RSStateStruct { public int LastInteractedPlayer; public int RemainingUseTime; public float CurrentCooldownTime; public bool Enabled; public RSStateStruct() { LastInteractedPlayer = 0; RemainingUseTime = 0; CurrentCooldownTime = 0f; Enabled = false; } } public class RSTimer : MonoBehaviour { private float startTime; private float endTime; private bool hasOnGoingTimer; private Action<float> OnProgress; private Action OnTimerEnd; public float RemainingTime { get { if (!hasOnGoingTimer) { return 0f; } return Math.Max(endTime - Clock.Time, 0f); } } private static List<GameObject> TimerGOs { get; } private void Update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 if ((int)GameStateManager.CurrentStateName == 10 && hasOnGoingTimer) { float time = Clock.Time; if (OnProgress != null) { OnProgress((time - startTime) / (endTime - startTime)); } if (!(time < endTime)) { endTime = 0f; hasOnGoingTimer = false; OnTimerEnd?.Invoke(); } } } public void StartTimer(float time) { if (time <= 0f) { LegacyLogger.Error("StartTimer: time is not positive!"); return; } if (hasOnGoingTimer) { LegacyLogger.Error("StartTimer: this timer is yet ended!"); return; } startTime = Clock.Time; endTime = startTime + time; hasOnGoingTimer = true; } private void OnDestroy() { endTime = 0f; hasOnGoingTimer = false; OnTimerEnd = null; } public static RSTimer Instantiate(Action<float> onProgress, Action actionOnEnd) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Expected O, but got Unknown GameObject val = new GameObject(); RSTimer rSTimer = val.AddComponent<RSTimer>(); rSTimer.OnProgress = onProgress; rSTimer.OnTimerEnd = actionOnEnd; TimerGOs.Add(val); return rSTimer; } public static void DestroyAll() { TimerGOs.ForEach((Action<GameObject>)Object.Destroy); TimerGOs.Clear(); } private RSTimer() { } static RSTimer() { TimerGOs = new List<GameObject>(); ClassInjector.RegisterTypeInIl2Cpp<RSTimer>(); LevelAPI.OnBuildStart += DestroyAll; LevelAPI.OnLevelCleanup += DestroyAll; } } } namespace LEGACY.LegacyOverride.EnemyTargeting { internal class EnemyTargetingPrioritizer : MonoBehaviour { public const float UPDATE_INTERVAL = 3f; private float nextUpdateTime = float.NaN; internal EnemyAgent enemy; private Dam_EnemyDamageBase damage { get { EnemyAgent obj = enemy; if (obj == null) { return null; } return obj.Damage; } } private AgentTarget target { get { EnemyAgent obj = enemy; if (obj == null) { return null; } return ((AgentAI)obj.AI).Target; } } private void Update() { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Invalid comparison between Unknown and I4 //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Invalid comparison between Unknown and I4 //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if ((int)GameStateManager.CurrentStateName != 10 || !SNet.IsMaster) { return; } if (float.IsNaN(nextUpdateTime)) { nextUpdateTime = Clock.Time + 3f; } else if (!(Clock.Time < nextUpdateTime) && !((Object)(object)enemy == (Object)null)) { nextUpdateTime = Clock.Time + 3f; if ((int)((AgentAI)enemy.AI).Mode == 1 && target != null && !(((Il2CppObjectBase)target.m_agent.CourseNode).Pointer == ((Il2CppObjectBase)((Agent)enemy).CourseNode).Pointer) && PlayerManager.PlayerAgentsInLevel.Count > 1 && ((Agent)PlayerManager.PlayerAgentsInLevel[0]).CourseNode.m_dimension.DimensionIndex == ((Agent)enemy).CourseNode.m_dimension.DimensionIndex) { TryPrioritizeCloserTarget(); } } } internal void TryPrioritizeCloserTarget() { _ = target; Agent val = null; Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current = enumerator.Current; if (((Agent)current).Alive && ((Il2CppObjectBase)((Agent)current).CourseNode).Pointer == ((Il2CppObjectBase)((Agent)enemy).CourseNode).Pointer) { val = (Agent)(object)current; break; } } if ((Object)(object)val == (Object)null) { enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { PlayerAgent current2 = enumerator.Current; if (((Agent)current2).Alive && ((Il2CppObjectBase)((Agent)current2).CourseNode.m_zone).Pointer == ((Il2CppObjectBase)((Agent)enemy).CourseNode.m_zone).Pointer) { val = (Agent)(object)current2; break; } } } if ((Object)(object)val != (Object)null) { ((AgentAI)enemy.AI).SetTarget(val); } } private void OnDestroy() { enemy = null; } static EnemyTargetingPrioritizer() { ClassInjector.RegisterTypeInIl2Cpp<EnemyTargetingPrioritizer>(); } } } namespace LEGACY.LegacyOverride.Patches { [HarmonyPatch] internal static class ExpeditionSuccessPage { [HarmonyPostfix] [HarmonyPatch(typeof(CM_PageExpeditionSuccess), "OnEnable")] private static void Post_CM_PageExpeditionSuccess_OnEnable(CM_PageExpeditionSuccess __instance) { if (!((Object)(object)__instance == (Object)null)) { SuccessPageCustomization currentCustomization = SuccessPageCustomizationManager.Current.CurrentCustomization; if (currentCustomization != null) { ((TMP_Text)__instance.m_header).SetText(LocalizedText.op_Implicit(currentCustomization.PageHeader), true); __instance.m_overrideSuccessMusic = currentCustomization.OverrideSuccessMusic; LegacyLogger.Warning("Post_CM_PageExpeditionSuccess_OnEnable: " + ((Object)currentCustomization.PageHeader).ToString()); } } } } [HarmonyPatch] internal static class LevelSpawnFogBeacon_BugFix { [HarmonyPostfix] [HarmonyPatch(typeof(HeavyFogRepellerGlobalState), "AttemptInteract")] private static void Post_HeavyFogRepellerGlobalState_AttemptInteract(HeavyFogRepellerGlobalState __instance) { LevelSpawnedFogBeaconSettings lSFBDef = LevelSpawnedFogBeaconManager.Current.GetLSFBDef(__instance); if (lSFBDef != null) { __instance.m_repellerSphere.Range = lSFBDef.Range; } } } [HarmonyPatch] internal class PrioritizeEnemyTargeting { private static bool s_patch = true; [HarmonyPostfix] [HarmonyPatch(typeof(EnemyCourseNavigation), "UpdateTracking")] private static void UpdateTracking(EnemyCourseNavigation __instance) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Invalid comparison between Unknown and I4 if (!s_patch) { return; } int count = PlayerManager.PlayerAgentsInLevel.Count; if (!SNet.IsMaster || count <= 1) { return; } EnemyAgent owner = __instance.m_owner; if ((int)((StateMachine<ES_Base>)(object)owner.Locomotion).m_currentState.m_stateEnum == 14 || ((Il2CppObjectBase)__instance.m_targetRef.m_agent.CourseNode).Pointer == ((Il2CppObjectBase)((Agent)owner).CourseNode).Pointer) { return; } PlayerAgent val = null; int num = Random.RandomRangeInt(0, count); for (int i = 0; i < count; i++) { PlayerAgent val2 = PlayerManager.PlayerAgentsInLevel[num]; if (((Agent)val2).Alive && ((Il2CppObjectBase)((Agent)val2).CourseNode).Pointer == ((Il2CppObjectBase)((Agent)owner).CourseNode).Pointer) { val = val2; break; } num = (num + 1) % count; } if ((Object)(object)val != (Object)null) { s_patch = false; ((AgentAI)owner.AI).SetTarget((Agent)(object)val); s_patch = true; } } } [HarmonyPatch] internal class RundownSelectionCustomization { private static uint r1TitleID; private static uint r2TitleID; [HarmonyPostfix] [HarmonyPatch(typeof(CM_PageRundown_New), "Setup")] private static void Post_CM_PageRundown_New(CM_PageRundown_New __instance) { //IL_003f: 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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00da: 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_00eb: Unknown result type (might be due to invalid IL or missing references) GameSetupDataBlock block = GameDataBlockBase<GameSetupDataBlock>.GetBlock(1u); if (block.RundownIdsToLoad.Count > 1 && block.RundownIdsToLoad.Count == 2) { ((Il2CppArrayBase<Vector3>)(object)__instance.m_rundownSelectionPositions)[0] = new Vector3(-320f, 75f, 0f); ((Il2CppArrayBase<Vector3>)(object)__instance.m_rundownSelectionPositions)[1] = new Vector3(320f, 0f, 0f); Vector3 zero = Vector3.zero; for (int i = block.RundownIdsToLoad.Count; i < ((Il2CppArrayBase<Vector3>)(object)__instance.m_rundownSelectionPositions).Count; i++) { zero = ((Il2CppArrayBase<Vector3>)(object)__instance.m_rundownSelectionPositions)[i]; ((Il2CppArrayBase<Vector3>)(object)__instance.m_rundownSelectionPositions)[i] = new Vector3(zero.x, -10000f, zero.z); } zero = __instance.m_textRundownHeaderTop.transform.position; __instance.m_textRundownHeaderTop.transform.position = new Vector3(zero.x, -350f, zero.z); } } private static void SetSelectionScale(CM_PageRundown_New p) { //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) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) GameSetupDataBlock block = GameDataBlockBase<GameSetupDataBlock>.GetBlock(1u); if (block.RundownIdsToLoad.Count > 1 && block.RundownIdsToLoad.Count == 2) { CM_RundownSelection obj = p.m_rundownSelections[0]; CM_RundownSelection val = p.m_rundownSelections[1]; ((Component)obj).transform.localScale = new Vector3(2f, 2f, 2f) * 1.625f; ((Component)val).transform.localScale = new Vector3(1.25f, 1.25f, 1.25f) * 1.5f; Transform transform = obj.m_rundownText.transform; Quaternion localRotation = (val.m_rundownText.transform.localRotation = Quaternion.AngleAxis(45f, Vector3.right)); transform.localRotation = localRotation; obj.m_rundownText.transform.localPosition = Vector3.up * 60f + Vector3.right * 20f; val.m_rundownText.transform.localPosition = Vector3.up * 85f + Vector3.left * 25f; Transform transform2 = ((Component)obj).transform; localRotation = (((Component)val).transform.localRotation = Quaternion.AngleAxis(-45f, Vector3.right)); transform2.localRotation = localRotation; ((TMP_Text)obj.m_rundownText).text = ((r1TitleID != 0) ? Text.Get(r1TitleID) : "<size=50%><color=#00ae9d>[ LEGACY ]</color></size>"); ((TMP_Text)val.m_rundownText).text = ((r2TitleID != 0) ? Text.Get(r2TitleID) : "<size=80%><color=#009ad6>[ L-OMNI ]</color></size>"); DestroyAltText(obj); DestroyAltText(val); } static void DestroyAltText(CM_RundownSelection s) { if ((Object)(object)s.m_altText != (Object)null) { Object.Destroy((Object)(object)((Component)s.m_altText).gameObject); s.m_altText = null; } } } [HarmonyPostfix] [HarmonyPatch(typeof(CM_PageRundown_New), "UpdateRundownSelectionButton")] private static void Post_UpdateRundownSelectionButton(CM_PageRundown_New __instance) { InitTitle(); SetSelectionScale(__instance); } private static void InitTitle() { if (r1TitleID == 0) { TextDataBlock block = GameDataBlockBase<TextDataBlock>.GetBlock("LEGACY_Title"); if (block != null) { r1TitleID = ((GameDataBlockBase<TextDataBlock>)(object)block).persistentID; } block = GameDataBlockBase<TextDataBlock>.GetBlock("LEGACY-Omni_Title"); if (block != null) { r2TitleID = ((GameDataBlockBase<TextDataBlock>)(object)block).persistentID; } } } private static IEnumerator reverseReveal(CM_PageRundown_New p, bool hosting, Transform guixSurfaceTransform) { float arrowScale = p.m_tierSpacing * 5f * p.m_tierSpaceToArrowScale; if (hosting) { CoroutineManager.BlinkIn(p.m_buttonConnect, 0f, (Transform)null); yield return (object)new WaitForSeconds(0.1f); yield return (object)new WaitForSeconds(0.24f); ((RectTransformComp)p.m_buttonConnect).SetVisible(false); } CM_PageBase.PostSound(EVENTS.MENU_SURFACE_LEVEL_MOVE_UP, ""); yield return CoroutineEase.EaseLocalPos(guixSurfaceTransform, Vector3.zero, new Vector3(0f, 650f, 0f), 0.5f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); yield return (object)new WaitForSeconds(0.1f); CM_PageBase.PostSound(EVENTS.MENU_SURFACE_LEVEL_SHRINK, ""); CoroutineEase.EaseLocalScale(p.m_textRundownHeader.transform, Vector3.one, new Vector3(0.6f, 0.6f, 0.6f), 0.2f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); yield return CoroutineEase.EaseLocalScale(guixSurfaceTransform, Vector3.one, new Vector3(0.2f, 0.2f, 0.2f), 0.2f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); yield return (object)new WaitForSeconds(0.1f); CoroutineEase.EaseLocalPos(p.m_textRundownHeader.transform, p.m_textRundownHeader.transform.localPosition, p.m_rundownHeaderPos, 0.2f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); CoroutineManager.BlinkIn(p.m_rundownIntelButton, 0f, (Transform)null); yield return (object)new WaitForSeconds(0.2f); CM_PageBase.PostSound(EVENTS.MENU_SURFACE_LEVEL_TURN, ""); yield return CoroutineEase.EaseLocalRot(guixSurfaceTransform, Vector3.zero, new Vector3(70f, 0f, 0f), 0.3f, (EasingFunction)Easing.LinearTween, (Action)null, (BoolCheck)null); p.m_verticalArrow.SetActive(true); yield return (object)new WaitForSeconds(0.5f); CoroutineManager.BlinkIn(((Component)p.m_tierMarkerSectorSummary).gameObject, 0f); CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_5, ""); yield return (object)new WaitForSeconds(0.5f); CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_SPINE_START, ""); CoroutineEase.EaseLocalScale(p.m_verticalArrow.transform, new Vector3(1f, 0f, 1f), new Vector3(1f, arrowScale, 1f), 4.3f, (EasingFunction)Easing.LinearTween, (Action)delegate { CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_SPINE_STOP, ""); }, (BoolCheck)null); float tierMarkerDelay = 0.6f; yield return (object)new WaitForSeconds(0.2f); CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_3, ""); ((Component)p.m_guix_Tier3).gameObject.SetActive(true); for (int i = 0; i < p.m_expIconsTier3.Count; i++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier3[i]).gameObject, (float)i * 0.1f); } if (p.m_expIconsTier3.Count > 0) { p.m_tierMarker3.SetVisible(true, tierMarkerDelay); } yield return (object)new WaitForSeconds(1f); CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_5, ""); ((Component)p.m_guix_Tier5).gameObject.SetActive(true); for (int j = 0; j < p.m_expIconsTier5.Count; j++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier5[j]).gameObject, (float)j * 0.1f); } if (p.m_expIconsTier5.Count > 0) { p.m_tierMarker5.SetVisible(true, tierMarkerDelay); } yield return (object)new WaitForSeconds(1f); CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_4, ""); ((Component)p.m_guix_Tier4).gameObject.SetActive(true); for (int k = 0; k < p.m_expIconsTier4.Count; k++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier4[k]).gameObject, (float)k * 0.1f); } if (p.m_expIconsTier4.Count > 0) { p.m_tierMarker4.SetVisible(true, tierMarkerDelay); } yield return (object)new WaitForSeconds(1f); CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_2, ""); ((Component)p.m_guix_Tier2).gameObject.SetActive(true); for (int l = 0; l < p.m_expIconsTier2.Count; l++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier2[l]).gameObject, (float)l * 0.1f); } if (p.m_expIconsTier2.Count > 0) { p.m_tierMarker2.SetVisible(true, tierMarkerDelay); } yield return (object)new WaitForSeconds(1f); CM_PageBase.PostSound(EVENTS.MENU_RUNDOWN_DISC_APPEAR_1, ""); ((Component)p.m_guix_Tier1).gameObject.SetActive(true); for (int m = 0; m < p.m_expIconsTier1.Count; m++) { CoroutineManager.BlinkIn(((Component)p.m_expIconsTier1[m]).gameObject, (float)m * 0.1f); } if (p.m_expIconsTier1.Count > 0) { p.m_tierMarker1.SetVisible(true, tierMarkerDelay); } yield return (object)new WaitForSeconds(1f); ((Component)p.m_joinOnServerIdText).gameObject.SetActive(true); CoroutineManager.BlinkIn(p.m_aboutTheRundownButton, 0f, (Transform)null); CoroutineManager.BlinkIn(p.m_discordButton, 0.1f, (Transform)null); if (SNet.IsMaster || !SNet.IsInLobby) { CoroutineManager.BlinkIn(p.m_matchmakeAllButton, 0.2f, (Transform)null); } p.m_selectionIsRevealed = true; p.CheckClipboard(); } } [HarmonyPatch] internal class DisableExpeditionFailPageArtifactDisplay { private class CustomExpeditionFailedSequence { private CM_PageExpeditionFail page; public CustomExpeditionFailedSequence(CM_PageExpeditionFail page) { this.page = page; } public IEnumerator CustomFailedSequence() { yield return (object)new WaitForSeconds(0.5f); ((Component)page.m_bgCortex_text).gameObject.SetActive(false); page.m_bgCortex_textBoxSmall.SetActive(false); page.m_bgCortex_textBoxLarge.SetActive(false); ((Component)page.m_returnToLobby_text).gameObject.SetActive(false); CM_PageBase.PostSound(EVENTS.PLAY_01_FIRST_TEXT_APPEAR, ""); yield return CoroutineManager.BlinkIn(page.m_bgCortex_logo, 0f); yield return (object)new WaitForSeconds(0.3f); CM_PageBase.PostSound(EVENTS.PLAY_01_FIRST_TEXT_APPEAR, ""); yield return CoroutineManager.BlinkIn(page.m_bgCortex_text, 0f, (Transform)null); yield return (object)new WaitForSeconds(0.4f); CoroutineManager.BlinkIn(page.m_bgCortex_textBoxSmall, 0f); CoroutineManager.BlinkIn(page.m_bgCortex_textBoxLarge, 0.15f); yield return (object)new WaitForSeconds(0.5f); yield return CoroutineManager.BlinkOut(page.m_bgCortex_textBoxLarge, 0f); yield return CoroutineManager.BlinkOut(page.m_bgCortex_textBoxSmall, 0f); ((Component)page.m_bgCortex_text).gameObject.SetActive(false); yield return CoroutineManager.BlinkOut(page.m_bgCortex_logo, 0f); yield return (object)new WaitForSeconds(1f); CM_PageBase.PostSound(EVENTS.PLAY_06_MAIN_MENU_LAUNCH, ""); ((Component)page.m_bgScare).gameObject.SetActive(true); page.m_bgScare.Play(); yield return (object)new WaitForSeconds(0.5f); ((Component)page.m_bgScare).gameObject.SetActive(false); yield return CoroutineManager.BlinkIn(((Component)page.m_missionFailed_text).gameObject, 0f); yield return (object)new WaitForSeconds(0.2f); yield return CoroutineManager.BlinkIn(((Component)page.m_returnToLobby_text).gameObject, 0f); } } [HarmonyPrefix] [HarmonyPatch(typeof(CM_PageExpeditionFail), "OnEnable")] private static bool Pre_CM_PageExpeditionFail(CM_PageExpeditionFail __instance) { if (((CM_PageBase)__instance).m_isSetup) { CellSound.StopAll(); CellSound.AllSoundsStoppedThisSession = true; CM_PageBase.PostSound(EVENTS.MUSIC_EXPEDITION_FAILED, ""); ((RectTransformComp)__instance.m_ArtifactInventoryDisplay).Setup(); __instance.m_ArtifactInventoryDisplay.SetArtifactValuesFromInventory(BoosterImplantManager.ArtifactInventory); ((Component)__instance.m_missionFailed_text).gameObject.SetActive(false); ((Component)__instance.m_artifactInfo_text).gameObject.SetActive(false); __instance.m_btnRestartCheckpoint.SetText(Text.Get(916u)); if (SNet.IsMaster) { __instance.m_btnRestartCheckpoint.SetButtonEnabled(true); __instance.m_btnGoToLobby.SetButtonEnabled(true); __instance.m_btnGoToLobby.SetText(Text.Get(917u)); } else { __instance.m_btnRestartCheckpoint.SetButtonEnabled(false); __instance.m_btnGoToLobby.SetButtonEnabled(false); __instance.m_btnGoToLobby.SetText(Text.Get(918u)); } ((Component)__instance.m_btnGoToLobby).gameObject.SetActive(false); ((Component)__instance.m_btnRestartCheckpoint).gameObject.SetActive(false); __instance.m_lobbyButtonVisible = false; __instance.m_showLobbybuttonTimer = Clock.Time + 3f; ((RectTransformComp)__instance.m_ArtifactInventoryDisplay).SetVisible(false); ((CM_PageBase)__instance).StartPageTransitionRoutine(CollectionExtensions.WrapToIl2Cpp(new CustomExpeditionFailedSequence(__instance).CustomFailedSequence())); } return false; } } [HarmonyPatch] internal class SetupBigPickupItemWithItemId { private static void SetupAsFogBeacon(LG_PickupItem __instance) { //IL_000b: 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_00e0: 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_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_020f: Expected O, but got Unknown //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Expected O, but got Unknown //IL_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: 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, re
Plugins/old_main_menu_launch.dll
Decompiled 5 days 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); }); } } }