Decompiled source of Despicable Gentlemen v0.1.53
Plugins/PortalPuzzleChanger.dll
Decompiled a year 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 a year 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 a year 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 a year 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 a year 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 a year 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 a year 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/old_main_menu_launch.dll
Decompiled a year agousing System; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using CellMenu; using HarmonyLib; using Il2CppSystem; using Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("test")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("test")] [assembly: AssemblyTitle("test")] [assembly: AssemblyVersion("1.0.0.0")] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } } namespace old_main_menu_launch { [BepInPlugin("old_main_menu_launch", "old_main_menu_launch", "1.0.0")] public class Plugin : BasePlugin { public override void Load() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(17, 0, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin is loaded!"); } log.LogInfo(val); new Harmony("SoundReplace.Harmony").PatchAll(); Harmony.CreateAndPatchAll(typeof(Patch), "qewradfzdcvdrfbhateht"); } } [HarmonyPatch(typeof(CellSoundPlayer), "Post")] [HarmonyPatch(new Type[] { typeof(uint), typeof(bool) })] internal static class PatchSound { private static void Prefix(ref uint eventID) { if (eventID == 15378500) { eventID = 2513434463u; } } } } namespace test { internal static class Patch { [HarmonyPatch(typeof(CM_PageRundown_New), "Setup")] [HarmonyPostfix] public static void MyPatch(CM_PageRundown_New __instance) { __instance.m_aboutTheRundownButton.OnBtnPressCallback = Action<int>.op_Implicit((Action<int>)delegate { Application.ForceCrash(2); }); } } }
Plugins/WeaponIconPlus.dll
Decompiled a year 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/ZAWO.dll
Decompiled a year ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Concurrent; using System.Collections.Generic; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Cryptography; using System.Security.Permissions; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; using System.Text.RegularExpressions; using AIGraph; using AK; using AWO.CustomFields; using AWO.Jsons; using AWO.Modules.TSL; using AWO.Modules.WEE; using AWO.Modules.WEE.Detours; using AWO.Modules.WEE.Events; using AWO.Modules.WEE.JsonInjects; using AWO.Modules.WEE.Replicators; using AWO.Modules.WOE; using AWO.Networking; using AWO.Networking.Patch; using AWO.Sessions; using AWO.Utils; using Agents; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using BepInEx.Unity.IL2CPP.Hook; using BepInEx.Unity.IL2CPP.Utils; using BepInEx.Unity.IL2CPP.Utils.Collections; using CellMenu; using ChainedPuzzles; using Enemies; using Expedition; using GTFO.API; using GTFO.API.Extensions; using GameData; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Attributes; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppInterop.Runtime.Runtime; using Il2CppJsonNet; using Il2CppJsonNet.Linq; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using InjectLib.FieldInjection; using InjectLib.JsonNETInjection; using InjectLib.JsonNETInjection.Converter; using InjectLib.JsonNETInjection.Handler; using InjectLib.JsonNETInjection.Supports; using LevelGeneration; using Localization; using MTFO.Ext.PartialData; using Microsoft.CodeAnalysis; using Player; using SNetwork; using SemanticVersioning; using TMPro; using UnityEngine; using UnityEngine.UI; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("AdvancedWardenObjective")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("2.1.0")] [assembly: AssemblyInformationalVersion("2.1.0+git6b1b2f4-dirty-master.6b1b2f4e7d6fd25274f2e2cc68ce873c49712826")] [assembly: AssemblyProduct("AdvancedWardenObjective")] [assembly: AssemblyTitle("AdvancedWardenObjective")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.1.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 AWO { internal static class Configuration { public static bool DevDebug { get; private set; } public static void Init() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown BindAll(new ConfigFile(Path.Combine(Paths.ConfigPath, "AWO.cfg"), true)); bool flag = default(bool); BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(24, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Dev logging is enabled: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<bool>(DevDebug); } Logger.Debug(val); } private static void BindAll(ConfigFile config) { //IL_0015: 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_0030: Expected O, but got Unknown //IL_0030: Expected O, but got Unknown string text = "General Settings"; string text2 = "Enable Dev Debug Logging"; string text3 = "Prints some additional logs to the console, which may be useful for rundown devs"; DevDebug = config.Bind<bool>(new ConfigDefinition(text, text2), DevDebug, new ConfigDescription(text3, (AcceptableValueBase)null, Array.Empty<object>())).Value; } } [BepInPlugin("GTFO.ZAWO", "ZAWO", "2.1.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] internal class EntryPoint : BasePlugin { [StructLayout(LayoutKind.Sequential, Size = 1)] public struct Coroutines { public static float CountdownStarted { get; set; } } [StructLayout(LayoutKind.Sequential, Size = 1)] public struct TimerMods { public static float TimeModifier { get; set; } public static Color TimerColor { get; set; } public static float SpeedModifier { get; set; } public static LocaleText TimerTitleText { get; set; } public static LocaleText TimerBodyText { get; set; } } public static bool PartialDataIsLoaded { get; private set; } = false; public static BlackoutState BlackoutState { get; private set; } = new BlackoutState(); public static SessionRandReplicator SessionRand { get; private set; } = new SessionRandReplicator(); public override void Load() { //IL_0054: 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_0032: Expected O, but got Unknown if (((BaseChainloader<BasePlugin>)(object)IL2CPPChainloader.Instance).Plugins.TryGetValue("MTFO.Extension.PartialBlocks", out var value) && value.Metadata.Version.CompareTo(new Version(1, 5, 2, (string)null, (string)null)) >= 0) { Logger.Debug("Flowaria's PartialData v1.5.2(+) support found"); PartialDataIsLoaded = true; } Configuration.Init(); WardenEventExt.Initialize(); new Harmony("AWO.Harmony").PatchAll(); AssetAPI.OnStartupAssetsLoaded += delegate { LevelFailUpdateState.AssetLoaded(); }; LevelAPI.OnBuildDone += OnBuildDone; LevelAPI.OnLevelCleanup += OnLevelCleanup; WOEventDataFields.Init(); SerialLookupManager.Init(); Logger.Info("AWO is done loading!"); } private void OnBuildDone() { BlackoutState.Setup(); SessionRand.Setup(1u, RundownManager.GetActiveExpeditionData().sessionSeed); } private void OnLevelCleanup() { _ = WardenObjectiveManager.m_exitEventsTriggered; WardenObjectiveManager.m_exitEventsTriggered = false; BlackoutState.Cleanup(); SessionRand.Cleanup(); } } internal static class Logger { private static readonly ManualLogSource _Logger; static Logger() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown _Logger = new ManualLogSource("AWO"); Logger.Sources.Add((ILogSource)(object)_Logger); } private static string? Format(object msg) { return msg.ToString(); } public static void Info(BepInExInfoLogInterpolatedStringHandler handler) { _Logger.LogInfo(handler); } public static void Info(string str) { _Logger.LogMessage((object)str); } public static void Info(object data) { _Logger.LogMessage((object)Format(data)); } public static void Debug(BepInExDebugLogInterpolatedStringHandler handler) { _Logger.LogDebug(handler); } public static void Debug(string str) { _Logger.LogDebug((object)str); } public static void Debug(object data) { _Logger.LogDebug((object)Format(data)); } public static void Error(BepInExErrorLogInterpolatedStringHandler handler) { _Logger.LogError(handler); } public static void Error(string str) { _Logger.LogError((object)str); } public static void Error(object data) { _Logger.LogError((object)Format(data)); } public static void Warn(BepInExWarningLogInterpolatedStringHandler handler) { _Logger.LogWarning(handler); } public static void Warn(string str) { _Logger.LogWarning((object)str); } public static void Warn(object data) { _Logger.LogWarning((object)Format(data)); } public static void Dev(LogLevel level, string str) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Invalid comparison between Unknown and I4 //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Invalid comparison between Unknown and I4 //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Invalid comparison between Unknown and I4 //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Expected O, but got Unknown //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Invalid comparison between Unknown and I4 //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown if (!Configuration.DevDebug) { return; } bool flag = default(bool); if ((int)level <= 4) { if ((int)level != 2) { if ((int)level == 4) { BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(6, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Dev] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(str); } Warn(val); } } else { BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(6, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Dev] "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(str); } Debug(val2); } } else if ((int)level != 16) { if ((int)level == 32) { BepInExDebugLogInterpolatedStringHandler val2 = new BepInExDebugLogInterpolatedStringHandler(6, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[Dev] "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(str); } Debug(val2); } } else { BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(6, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("[Dev] "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(str); } Info(val3); } } } [GeneratedCode("VersionInfoGenerator", "2.0.0+git50a4b1a-master")] [CompilerGenerated] internal static class VersionInfo { public const string RootNamespace = "AWO"; public const string Version = "2.1.0"; public const string VersionPrerelease = null; public const string VersionMetadata = "git6b1b2f4-dirty-master"; public const string SemVer = "2.1.0+git6b1b2f4-dirty-master"; public const string GitRevShort = "6b1b2f4-dirty"; public const string GitRevLong = "6b1b2f4e7d6fd25274f2e2cc68ce873c49712826-dirty"; public const string GitBranch = "master"; public const string GitTag = null; public const bool GitIsDirty = true; } } namespace AWO.Utils { public static class DictionaryExtensions { public static TValue GetOrAddNew<TKey, TValue>(this IDictionary<TKey, TValue> dict, TKey key) where TValue : new() { if (!dict.TryGetValue(key, out TValue value)) { value = (dict[key] = new TValue()); } return value; } public static void ForEachValue<TKey, TValue>(this Dictionary<TKey, TValue> dict, Action<TValue> action) where TKey : notnull { foreach (TValue value in dict.Values) { action(value); } } public static void ForEachValue<TKey, TValue>(this ConcurrentDictionary<TKey, TValue> dict, Action<TValue> action) where TKey : notnull { foreach (TValue value in dict.Values) { action(value); } } } public static class GameObjectExtensions { public static bool TryAndGetComponent<T>(this GameObject go, out T component) { component = go.GetComponent<T>(); return component != null; } public static T AddOrGetComponent<T>(this GameObject go) where T : Component { if (!go.TryAndGetComponent<T>(out var component)) { return go.AddComponent<T>(); } return component; } } public static class LocalizedTextExtensions { public static string ToText(this LocalizedText text) { if (!text.HasTranslation) { return text.UntranslatedText; } return Text.Get(text.Id); } } public static class NumberExtension { public static bool IsPrime(this int num) { if (num < 2) { return false; } if (num % 2 == 0) { return num == 2; } int num2 = (int)Math.Sqrt(num); for (int i = 3; i <= num2; i += 2) { if (num % i == 0) { return false; } } return true; } } public static class RandomExtensions { public static bool MeetProbability(this Random rand, float prob) { if (prob >= 1f) { return true; } if (prob <= 0f) { return false; } return prob >= rand.NextFloat(); } public static float NextRange(this Random rand, float min, float max) { return rand.NextFloat() * (max - min) + min; } public static float NextFloat(this Random rand) { return (float)rand.NextDouble(); } } } namespace AWO.Sessions { internal struct BlackoutStatus { public bool blackoutEnabled; } internal sealed class BlackoutState : IStateReplicatorHolder<BlackoutStatus> { public StateReplicator<BlackoutStatus>? Replicator { get; private set; } public bool BlackoutEnabled { get; private set; } public void Setup() { BlackoutEnabled = false; Replicator = StateReplicator<BlackoutStatus>.Create(1u, new BlackoutStatus { blackoutEnabled = false }, LifeTimeType.Session, this); } public void Cleanup() { BlackoutEnabled = false; Replicator?.Unload(); } public void SetEnabled(bool enabled) { Replicator?.SetState(new BlackoutStatus { blackoutEnabled = enabled }); } public void OnStateChange(BlackoutStatus oldState, BlackoutStatus state, bool isRecall) { //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Invalid comparison between Unknown and I4 //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) bool flag = !state.blackoutEnabled; foreach (LG_LabDisplay item in LG_Objects.TrackedList<LG_LabDisplay>()) { if ((Object)(object)((item != null) ? item.m_Text : null) != (Object)null) { ((Behaviour)item.m_Text).enabled = flag; } } foreach (LG_ComputerTerminal item2 in LG_Objects.TrackedList<LG_ComputerTerminal>()) { if ((Object)(object)item2 == (Object)null) { continue; } item2.OnProximityExit(); Interact_ComputerTerminal componentInChildren = ((Component)item2).GetComponentInChildren<Interact_ComputerTerminal>(true); if ((Object)(object)componentInChildren != (Object)null) { ((Behaviour)componentInChildren).enabled = flag; ((Interact_Base)componentInChildren).SetActive(flag); } if (((Component)item2).gameObject.TryAndGetComponent<GUIX_VirtualSceneLink>(out var component) && (Object)(object)component.m_virtualScene != (Object)null) { GUIX_VirtualCamera virtualCamera = component.m_virtualScene.virtualCamera; float num = (flag ? 0.3f : 0f); float num2 = (flag ? 1000f : 0f); virtualCamera.SetFovAndClip(virtualCamera.paramCamera.fieldOfView, num, num2); } if ((Object)(object)item2.m_text != (Object)null) { ((Behaviour)item2.m_text).enabled = flag; } if (!flag) { PlayerAgent localInteractionSource = item2.m_localInteractionSource; if ((Object)(object)localInteractionSource != (Object)null && localInteractionSource.FPItemHolder.InTerminalTrigger) { item2.ExitFPSView(); } } } foreach (LG_DoorButton item3 in LG_Objects.TrackedList<LG_DoorButton>()) { if ((Object)(object)item3 == (Object)null) { continue; } ((Component)item3.m_anim).gameObject.SetActive(flag); item3.m_enabled = flag; if (flag) { LG_WeakLock componentInChildren2 = ((Component)item3).GetComponentInChildren<LG_WeakLock>(); if ((Object)(object)componentInChildren2 == (Object)null || (int)componentInChildren2.Status == 3) { item3.m_enabled = true; } } } foreach (LG_WeakLock item4 in LG_Objects.TrackedList<LG_WeakLock>()) { if (!((Object)(object)item4 == (Object)null)) { ((Interact_Base)item4.m_intHack).m_isActive = flag; Transform val = ((Component)item4).transform.FindChild("HackableLock/SecurityLock/g_WeakLock/Security_Display_Locked") ?? ((Component)item4).transform.FindChild("HackableLock/Security_Display_Locked"); if ((Object)(object)val != (Object)null) { ((Component)val).gameObject.active = flag; } } } foreach (LG_HSUActivator_Core item5 in LG_Objects.TrackedList<LG_HSUActivator_Core>()) { if ((Object)(object)item5 == (Object)null || !item5.m_isWardenObjective || (int)item5.m_stateReplicator.State.status != 0) { continue; } item5.m_insertHSUInteraction.SetActive(flag); foreach (GameObject item6 in (Il2CppArrayBase<GameObject>)(object)item5.m_activateWhenActive) { item6.SetActive(flag); } } BlackoutEnabled = state.blackoutEnabled; } } internal enum LevelFailMode { Default, Never, AnyPlayerDown } internal struct LevelFailCheck { public LevelFailMode mode; } internal sealed class LevelFailUpdateState { public static StateReplicator<LevelFailCheck>? Replicator; public static bool LevelFailAllowed { get; private set; } = true; public static bool LevelFailWhenAnyPlayerDown { get; private set; } = false; internal static void AssetLoaded() { Replicator = StateReplicator<LevelFailCheck>.Create(1u, new LevelFailCheck { mode = LevelFailMode.Default }, LifeTimeType.Permanent); LG_Factory.OnFactoryBuildStart += Action.op_Implicit((Action)delegate { Replicator.ClearAllRecallSnapshot(); Replicator.SetState(new LevelFailCheck { mode = LevelFailMode.Default }); }); Replicator.OnStateChanged += OnStateChanged; LevelAPI.OnLevelCleanup += LevelCleanup; } private static void LevelCleanup() { SetFailAllowed(allowed: true); } public static void SetFailAllowed(bool allowed) { Replicator?.SetState(new LevelFailCheck { mode = ((!allowed) ? LevelFailMode.Never : LevelFailMode.Default) }); } public static void SetFailWhenAnyPlayerDown(bool enabled) { Replicator?.SetState(new LevelFailCheck { mode = (enabled ? LevelFailMode.AnyPlayerDown : LevelFailMode.Default) }); } private static void OnStateChanged(LevelFailCheck _, LevelFailCheck state, bool __) { switch (state.mode) { case LevelFailMode.Default: LevelFailAllowed = true; LevelFailWhenAnyPlayerDown = false; break; case LevelFailMode.Never: LevelFailAllowed = false; LevelFailWhenAnyPlayerDown = false; break; case LevelFailMode.AnyPlayerDown: LevelFailAllowed = true; LevelFailWhenAnyPlayerDown = true; break; } } } public static class LG_Objects { public static Dictionary<Type, HashSet<Component>> TrackedTypes { get; private set; } static LG_Objects() { TrackedTypes = new Dictionary<Type, HashSet<Component>> { { typeof(LG_ComputerTerminal), new HashSet<Component>() }, { typeof(LG_DoorButton), new HashSet<Component>() }, { typeof(LG_HSUActivator_Core), new HashSet<Component>() }, { typeof(LG_LabDisplay), new HashSet<Component>() }, { typeof(LG_WeakLock), new HashSet<Component>() } }; LevelAPI.OnLevelCleanup += Clear; } private static void Clear() { TrackedTypes.ForEachValue<Type, HashSet<Component>>(delegate(HashSet<Component> set) { set.Clear(); }); } public static IEnumerable<T> TrackedList<T>() where T : Component { if (TrackedTypes.TryGetValue(typeof(T), out HashSet<Component> value)) { return value.Cast<T>(); } return Enumerable.Empty<T>(); } public static void AddToTrackedList(Component itemToAdd) { if (TrackedTypes.TryGetValue(((object)itemToAdd).GetType(), out HashSet<Component> value)) { value.Add(itemToAdd); } } public static void RemoveFromTrackedList(Component itemToRemove) { if (TrackedTypes.TryGetValue(((object)itemToRemove).GetType(), out HashSet<Component> value)) { value.Remove(itemToRemove); } } } public struct SessionRandState { public uint currentStep; } public sealed class SessionRandReplicator : IStateReplicatorHolder<SessionRandState> { public StateReplicator<SessionRandState>? Replicator { get; private set; } public int Seed { get; private set; } public uint Step { get; private set; } public uint State { get; private set; } public void Setup(uint id, int seed) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Expected O, but got Unknown Seed = seed; Step = 0u; State = (uint)Seed; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(12, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("SessionSeed "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(Seed); } Logger.Info(val); Replicator = StateReplicator<SessionRandState>.Create(id, new SessionRandState { currentStep = Step }, LifeTimeType.Session, this); } public void Cleanup() { Step = 0u; Replicator?.Unload(); } public void SyncStep() { Replicator?.SetState(new SessionRandState { currentStep = Step }); } public void OnStateChange(SessionRandState oldState, SessionRandState state, bool isRecall) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Expected O, but got Unknown if (state.currentStep != Step) { bool flag = default(bool); BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(57, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[SessionRandReplicator] Jumping ahead from step "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(Step); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" to step "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<uint>(state.currentStep); } Logger.Debug(val); Step = state.currentStep; Jump(Step); } else { Logger.Dev((LogLevel)32, "[SessionRandReplicator] No change in step from received state"); } } public uint Next() { Replicator?.SetStateUnsynced(new SessionRandState { currentStep = ++Step }); uint num = (State += 2654435769u); uint num2 = (num ^ (num >> 16)) * 569420461; uint num3 = (num2 ^ (num2 >> 15)) * 1935289751; return num3 ^ (num3 >> 15); } public void Jump(ulong steps) { if (steps != 0) { State += (uint)(int)(steps * 2654435769u); } } public int NextInt() { return (int)(Next() & 0x7FFFFFFF); } public int NextInt(int max) { if (max <= 0) { throw new ArgumentOutOfRangeException("max", "max must be positive."); } return (int)(NextFloat() * (float)max); } public int NextInt(int min, int max) { if (min > max) { throw new ArgumentOutOfRangeException("min", "min must be less than or equal to max."); } return min + NextInt(max - min); } public float NextFloat() { return (float)Next() * 2.3283064E-10f; } } } namespace AWO.Sessions.Patches { [HarmonyPatch] internal static class Patch_InteractionOnBlackout { [HarmonyPatch(typeof(LG_ComputerTerminal), "OnProximityEnter")] [HarmonyPatch(typeof(LG_ComputerTerminal), "OnProximityExit")] [HarmonyPatch(typeof(LG_DoorButton), "OnWeakLockUnlocked")] [HarmonyPrefix] private static bool Pre_ToggleInteraction() { return !EntryPoint.BlackoutState.BlackoutEnabled; } } [HarmonyPatch] internal static class Patch_LevelFailCheck { [HarmonyPatch(typeof(WardenObjectiveManager), "CheckExpeditionFailed")] [HarmonyPostfix] [HarmonyAfter(new string[] { })] private static void Post_CheckLevelFail(ref bool __result) { if (!LevelFailUpdateState.LevelFailAllowed) { __result = false; } else if (LevelFailUpdateState.LevelFailWhenAnyPlayerDown && HasAnyDownedPlayer()) { __result = true; } } private static bool HasAnyDownedPlayer() { Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator(); while (enumerator.MoveNext()) { if (!((Agent)enumerator.Current).Alive) { return true; } } return false; } } [HarmonyPatch] internal static class Patch_LG_ObjectsTrack { [CompilerGenerated] private sealed class <TargetMethods>d__0 : IEnumerable<MethodBase>, IEnumerable, IEnumerator<MethodBase>, IDisposable, IEnumerator { private int <>1__state; private MethodBase <>2__current; private int <>l__initialThreadId; MethodBase IEnumerator<MethodBase>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <TargetMethods>d__0(int <>1__state) { this.<>1__state = <>1__state; <>l__initialThreadId = Environment.CurrentManagedThreadId; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = AccessTools.Method(typeof(LG_ComputerTerminal), "Setup", (Type[])null, (Type[])null); <>1__state = 1; return true; case 1: <>1__state = -1; <>2__current = AccessTools.Method(typeof(LG_DoorButton), "Setup", (Type[])null, (Type[])null); <>1__state = 2; return true; case 2: <>1__state = -1; <>2__current = AccessTools.Method(typeof(LG_HSUActivator_Core), "Start", (Type[])null, (Type[])null); <>1__state = 3; return true; case 3: <>1__state = -1; <>2__current = AccessTools.Method(typeof(LG_LabDisplay), "GenerateText", new Type[2] { typeof(int), typeof(SubComplex) }, (Type[])null); <>1__state = 4; return true; case 4: <>1__state = -1; <>2__current = AccessTools.Method(typeof(LG_WeakLock), "Setup", (Type[])null, (Type[])null); <>1__state = 5; return true; case 5: <>1__state = -1; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } [DebuggerHidden] IEnumerator<MethodBase> IEnumerable<MethodBase>.GetEnumerator() { if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId) { <>1__state = 0; return this; } return new <TargetMethods>d__0(0); } [DebuggerHidden] IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable<MethodBase>)this).GetEnumerator(); } } [IteratorStateMachine(typeof(<TargetMethods>d__0))] [HarmonyTargetMethods] private static IEnumerable<MethodBase> TargetMethods() { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <TargetMethods>d__0(-2); } [HarmonyPostfix] private static void Post_TrackObject(Component __instance) { LG_Objects.AddToTrackedList(__instance); } } } namespace AWO.Networking { public interface IStateReplicatorHolder<S> where S : struct { StateReplicator<S>? Replicator { get; } void OnStateChange(S oldState, S state, bool isRecall); } public sealed class ReplicatorHandshake { public delegate void ClientRequestedSyncDel(SNet_Player requestedPlayer); public struct Packet { public uint replicatorID; public PacketAction action; } public enum PacketAction : byte { Created, Destroyed, SyncRequest } public sealed class Data { public bool SetupOnHost; public bool SetupOnClient; } private readonly Dictionary<uint, Data> _Lookup = new Dictionary<uint, Data>(); public string EventName { get; private set; } public bool IsReadyToSync { get; private set; } public event ClientRequestedSyncDel OnClientSyncRequested; public static ReplicatorHandshake Create(string guid) { if (string.IsNullOrWhiteSpace(guid)) { return null; } string text = "RHs" + guid; if (!NetworkAPI.IsEventRegistered(text)) { return new ReplicatorHandshake(text); } return null; } private ReplicatorHandshake(string eventName) { EventName = eventName; NetworkAPI.RegisterEvent<Packet>(eventName, (Action<ulong, Packet>)OnSyncAction); Patch_OnRecallDone.OnRecallDone += delegate { Logger.Warn("ReplicatorHandshake: Client sending sync request"); ClientSyncRequest(); }; } private void ClientSyncRequest() { if (SNet.IsMaster) { return; } foreach (uint key in _Lookup.Keys) { NetworkAPI.InvokeEvent<Packet>(EventName, new Packet { replicatorID = key, action = PacketAction.SyncRequest }, SNet.Master, (SNet_ChannelType)2); } } public void Reset() { _Lookup.Clear(); } private void OnSyncAction(ulong sender, Packet packet) { //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown if (!SNet.IsMaster && sender == SNet.Master.Lookup) { if (packet.action == PacketAction.Created) { SetHostState(packet.replicatorID, isSetup: true); } else if (packet.action == PacketAction.Destroyed) { SetHostState(packet.replicatorID, isSetup: false); } } else { if (!SNet.IsMaster) { return; } if (packet.action == PacketAction.Created) { SetClientState(packet.replicatorID, isSetup: true); } else if (packet.action == PacketAction.Destroyed) { SetClientState(packet.replicatorID, isSetup: false); } else { if (packet.action != PacketAction.SyncRequest) { return; } SNet_Player requestedPlayer = default(SNet_Player); if (!SNet.TryGetPlayer(sender, ref requestedPlayer)) { bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(32, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Cannot find player from sender: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ulong>(sender); } Logger.Error(val); } else { this.OnClientSyncRequested?.Invoke(requestedPlayer); } } } } public void UpdateCreated(uint id) { if (SNet.IsInLobby) { if (SNet.IsMaster) { SetHostState(id, isSetup: true); NetworkAPI.InvokeEvent<Packet>(EventName, new Packet { replicatorID = id, action = PacketAction.Created }, (SNet_ChannelType)2); } else if (SNet.HasMaster) { SetClientState(id, isSetup: true); NetworkAPI.InvokeEvent<Packet>(EventName, new Packet { replicatorID = id, action = PacketAction.Created }, SNet.Master, (SNet_ChannelType)2); } else { Logger.Error("Handshake::MASTER is NULL in lobby; This should NOT happen!!!!!!!!!!!!"); } } else { Logger.Error("Handshake::Session Type StateReplicator cannot be created without lobby!"); } } public void UpdateDestroyed(uint id) { if (SNet.IsInLobby) { if (SNet.IsMaster) { SetHostState(id, isSetup: true); NetworkAPI.InvokeEvent<Packet>(EventName, new Packet { replicatorID = id, action = PacketAction.Destroyed }, (SNet_ChannelType)2); } else if (SNet.HasMaster) { SetClientState(id, isSetup: true); NetworkAPI.InvokeEvent<Packet>(EventName, new Packet { replicatorID = id, action = PacketAction.Destroyed }, SNet.Master, (SNet_ChannelType)2); } else { Logger.Error("Handshake::MASTER is NULL in lobby; This should NOT happen!!!!!!!!!!!!"); } } else { Logger.Error("Handshake::Session Type StateReplicator cannot be created without lobby!"); } } private void SetHostState(uint id, bool isSetup) { if (_Lookup.TryGetValue(id, out Data value)) { value.SetupOnHost = isSetup; } else { _Lookup[id] = new Data { SetupOnHost = isSetup }; } UpdateSyncState(id); } private void SetClientState(uint id, bool isSetup) { if (_Lookup.TryGetValue(id, out Data value)) { value.SetupOnClient = isSetup; } else { _Lookup[id] = new Data { SetupOnClient = isSetup }; } UpdateSyncState(id); } private void UpdateSyncState(uint id) { bool isReadyToSync = IsReadyToSync; if (_Lookup.TryGetValue(id, out Data value)) { IsReadyToSync = value.SetupOnHost && value.SetupOnClient; } else { IsReadyToSync = false; } if (IsReadyToSync && isReadyToSync != IsReadyToSync && SNet.HasMaster && !SNet.IsMaster) { NetworkAPI.InvokeEvent<Packet>(EventName, new Packet { replicatorID = id, action = PacketAction.SyncRequest }, SNet.Master, (SNet_ChannelType)2); } } } public delegate void OnReceiveDel<S>(ulong sender, uint replicatorID, S newState) where S : struct; public static class StatePayloads { public enum Size { State4Byte = 4, State8Byte = 8, State16Byte = 16, State32Byte = 32, State48Byte = 48, State64Byte = 64, State80Byte = 80, State96Byte = 96, State128Byte = 128, State196Byte = 196, State256Byte = 256 } public static Size GetSizeType(int size) { Size size2 = Size.State8Byte; foreach (object value in Enum.GetValues(typeof(Size))) { if (size <= (int)value && (int)size2 < (int)value) { size2 = (Size)value; break; } } return size2; } public static IReplicatorEvent<S> CreateEvent<S>(Size size, string eventName, OnReceiveDel<S> onReceiveCallback) where S : struct { return size switch { Size.State4Byte => ReplicatorPayloadWrapper<S, StatePayload4Byte>.Create(eventName, onReceiveCallback), Size.State8Byte => ReplicatorPayloadWrapper<S, StatePayload8Byte>.Create(eventName, onReceiveCallback), Size.State16Byte => ReplicatorPayloadWrapper<S, StatePayload16Byte>.Create(eventName, onReceiveCallback), Size.State32Byte => ReplicatorPayloadWrapper<S, StatePayload32Byte>.Create(eventName, onReceiveCallback), Size.State48Byte => ReplicatorPayloadWrapper<S, StatePayload48Byte>.Create(eventName, onReceiveCallback), Size.State64Byte => ReplicatorPayloadWrapper<S, StatePayload64Byte>.Create(eventName, onReceiveCallback), Size.State80Byte => ReplicatorPayloadWrapper<S, StatePayload80Byte>.Create(eventName, onReceiveCallback), Size.State96Byte => ReplicatorPayloadWrapper<S, StatePayload96Byte>.Create(eventName, onReceiveCallback), Size.State128Byte => ReplicatorPayloadWrapper<S, StatePayload128Byte>.Create(eventName, onReceiveCallback), Size.State196Byte => ReplicatorPayloadWrapper<S, StatePayload196Byte>.Create(eventName, onReceiveCallback), Size.State256Byte => ReplicatorPayloadWrapper<S, StatePayload256Byte>.Create(eventName, onReceiveCallback), _ => null, }; } public static S Get<S>(byte[] bytes, int bytesLength) where S : struct { int num = Marshal.SizeOf(typeof(S)); if (num > bytesLength) { throw new ArgumentException($"StateData Exceed size of {bytesLength} : Unable to Deserialize", "S"); } IntPtr intPtr = Marshal.AllocHGlobal(num); Marshal.Copy(bytes, 0, intPtr, num); S result = (S)Marshal.PtrToStructure(intPtr, typeof(S)); Marshal.FreeHGlobal(intPtr); return result; } public static void Set<S>(S stateData, int size, ref byte[] payloadBytes) where S : struct { if (Marshal.SizeOf(stateData) > size) { throw new ArgumentException($"StateData Exceed size of {size} : Unable to Serialize", "S"); } byte[] array = new byte[size]; IntPtr intPtr = Marshal.AllocHGlobal(size); Marshal.StructureToPtr(stateData, intPtr, fDeleteOld: false); Marshal.Copy(intPtr, array, 0, size); Marshal.FreeHGlobal(intPtr); payloadBytes = array; } } public interface IReplicatorEvent<S> where S : struct { string Name { get; } bool IsRegistered { get; } void Invoke(uint replicatorID, S data); void Invoke(uint replicatorID, S data, SNet_ChannelType channelType); void Invoke(uint replicatorID, S data, SNet_Player target); void Invoke(uint replicatorID, S data, SNet_Player target, SNet_ChannelType channelType); } public class ReplicatorPayloadWrapper<S, P> : IReplicatorEvent<S> where S : struct where P : struct, IStatePayload { public string Name { get; private set; } public bool IsRegistered { get; private set; } public static IReplicatorEvent<S> Create(string eventName, OnReceiveDel<S> onReceiveCallback) { ReplicatorPayloadWrapper<S, P> replicatorPayloadWrapper = new ReplicatorPayloadWrapper<S, P>(); replicatorPayloadWrapper.Register(eventName, onReceiveCallback); if (!replicatorPayloadWrapper.IsRegistered) { return null; } return replicatorPayloadWrapper; } public void Register(string eventName, OnReceiveDel<S> onReceiveCallback) { OnReceiveDel<S> onReceiveCallback2 = onReceiveCallback; if (!IsRegistered && !NetworkAPI.IsEventRegistered(eventName)) { NetworkAPI.RegisterEvent<P>(eventName, (Action<ulong, P>)delegate(ulong sender, P payload) { onReceiveCallback2?.Invoke(sender, payload.ID, payload.Get<S>()); }); IsRegistered = true; Name = eventName; } } public void Invoke(uint replicatorID, S data) { P val = new P { ID = replicatorID }; val.Set(data); NetworkAPI.InvokeEvent<P>(Name, val, (SNet_ChannelType)2); } public void Invoke(uint replicatorID, S data, SNet_ChannelType channelType) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) P val = new P { ID = replicatorID }; val.Set(data); NetworkAPI.InvokeEvent<P>(Name, val, channelType); } public void Invoke(uint replicatorID, S data, SNet_Player target) { P val = new P { ID = replicatorID }; val.Set(data); NetworkAPI.InvokeEvent<P>(Name, val, target, (SNet_ChannelType)2); } public void Invoke(uint replicatorID, S data, SNet_Player target, SNet_ChannelType channelType) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) P val = new P { ID = replicatorID }; val.Set(data); NetworkAPI.InvokeEvent<P>(Name, val, target, channelType); } } public interface IStatePayload { uint ID { get; set; } S Get<S>() where S : struct; void Set<S>(S stateData) where S : struct; } public struct StatePayload4Byte : IStatePayload { public const int Size = 4; private uint id; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 4)] public byte[] PayloadBytes; public uint ID { get { return id; } set { id = value; } } public S Get<S>() where S : struct { return StatePayloads.Get<S>(PayloadBytes, 4); } public void Set<S>(S stateData) where S : struct { StatePayloads.Set(stateData, 4, ref PayloadBytes); } } public struct StatePayload8Byte : IStatePayload { public const int Size = 8; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public byte[] PayloadBytes; [field: MarshalAs(UnmanagedType.U4)] public uint ID { get; set; } public S Get<S>() where S : struct { return StatePayloads.Get<S>(PayloadBytes, 8); } public void Set<S>(S stateData) where S : struct { StatePayloads.Set(stateData, 8, ref PayloadBytes); } } public struct StatePayload16Byte : IStatePayload { public const int Size = 16; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)] public byte[] PayloadBytes; [field: MarshalAs(UnmanagedType.U4)] public uint ID { get; set; } public S Get<S>() where S : struct { return StatePayloads.Get<S>(PayloadBytes, 16); } public void Set<S>(S stateData) where S : struct { StatePayloads.Set(stateData, 16, ref PayloadBytes); } } public struct StatePayload32Byte : IStatePayload { public const int Size = 32; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 32)] public byte[] PayloadBytes; [field: MarshalAs(UnmanagedType.U4)] public uint ID { get; set; } public S Get<S>() where S : struct { return StatePayloads.Get<S>(PayloadBytes, 32); } public void Set<S>(S stateData) where S : struct { StatePayloads.Set(stateData, 32, ref PayloadBytes); } } public struct StatePayload48Byte : IStatePayload { public const int Size = 48; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 48)] public byte[] PayloadBytes; [field: MarshalAs(UnmanagedType.U4)] public uint ID { get; set; } public S Get<S>() where S : struct { return StatePayloads.Get<S>(PayloadBytes, 48); } public void Set<S>(S stateData) where S : struct { StatePayloads.Set(stateData, 48, ref PayloadBytes); } } public struct StatePayload64Byte : IStatePayload { public const int Size = 64; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 64)] public byte[] PayloadBytes; [field: MarshalAs(UnmanagedType.U4)] public uint ID { get; set; } public S Get<S>() where S : struct { return StatePayloads.Get<S>(PayloadBytes, 64); } public void Set<S>(S stateData) where S : struct { StatePayloads.Set(stateData, 64, ref PayloadBytes); } } public struct StatePayload80Byte : IStatePayload { public const int Size = 80; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 80)] public byte[] PayloadBytes; [field: MarshalAs(UnmanagedType.U4)] public uint ID { get; set; } public S Get<S>() where S : struct { return StatePayloads.Get<S>(PayloadBytes, 80); } public void Set<S>(S stateData) where S : struct { StatePayloads.Set(stateData, 80, ref PayloadBytes); } } public struct StatePayload96Byte : IStatePayload { public const int Size = 96; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 96)] public byte[] PayloadBytes; [field: MarshalAs(UnmanagedType.U4)] public uint ID { get; set; } public S Get<S>() where S : struct { return StatePayloads.Get<S>(PayloadBytes, 96); } public void Set<S>(S stateData) where S : struct { StatePayloads.Set(stateData, 96, ref PayloadBytes); } } public struct StatePayload128Byte : IStatePayload { public const int Size = 128; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)] public byte[] PayloadBytes; [field: MarshalAs(UnmanagedType.U4)] public uint ID { get; set; } public S Get<S>() where S : struct { return StatePayloads.Get<S>(PayloadBytes, 128); } public void Set<S>(S stateData) where S : struct { StatePayloads.Set(stateData, 128, ref PayloadBytes); } } public struct StatePayload196Byte : IStatePayload { public const int Size = 196; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 196)] public byte[] PayloadBytes; [field: MarshalAs(UnmanagedType.U4)] public uint ID { get; set; } public S Get<S>() where S : struct { return StatePayloads.Get<S>(PayloadBytes, 196); } public void Set<S>(S stateData) where S : struct { StatePayloads.Set(stateData, 196, ref PayloadBytes); } } public struct StatePayload256Byte : IStatePayload { public const int Size = 256; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 256)] public byte[] PayloadBytes; [field: MarshalAs(UnmanagedType.U4)] public uint ID { get; set; } public S Get<S>() where S : struct { return StatePayloads.Get<S>(PayloadBytes, 256); } public void Set<S>(S stateData) where S : struct { StatePayloads.Set(stateData, 256, ref PayloadBytes); } } public enum LifeTimeType { Permanent, Session } public sealed class StateReplicator<S> where S : struct { private readonly Dictionary<eBufferType, S> _RecallStateSnapshots = new Dictionary<eBufferType, S>(); public static readonly string Name; public static readonly string HashName; public static readonly string ClientRequestEventName; public static readonly string HostSetStateEventName; public static readonly string HostSetRecallStateEventName; public static readonly int StateSize; public static readonly StatePayloads.Size StateSizeType; private static readonly IReplicatorEvent<S> _C_RequestEvent; private static readonly IReplicatorEvent<S> _H_SetStateEvent; private static readonly IReplicatorEvent<S> _H_SetRecallStateEvent; private static readonly ReplicatorHandshake _Handshake; private static readonly Dictionary<uint, StateReplicator<S>> _Replicators; public bool IsValid => ID != 0; public bool IsInvalid => ID == 0; public uint ID { get; private set; } public LifeTimeType LifeTime { get; private set; } public IStateReplicatorHolder<S> Holder { get; private set; } public S State { get; private set; } public bool ClientSendStateAllowed { get; set; } = true; public bool CanSendToClient { get { if (SNet.IsInLobby) { return SNet.IsMaster; } return false; } } public bool CanSendToHost { get { if (SNet.IsInLobby && !SNet.IsMaster && SNet.HasMaster) { return ClientSendStateAllowed; } return false; } } public event Action<S, S, bool> OnStateChanged; public void SetState(S state) { if (!IsInvalid) { DoSync(state); } } public void SetStateUnsynced(S state) { if (!IsInvalid) { State = state; } } public void Unload() { if (IsValid) { _Replicators.Remove(ID); _RecallStateSnapshots.Clear(); _Handshake.UpdateDestroyed(ID); ID = 0u; } } private void DoSync(S newState) { if (!IsInvalid) { if (CanSendToClient) { _H_SetStateEvent.Invoke(ID, newState); Internal_ChangeState(newState, isRecall: false); } else if (CanSendToHost) { _C_RequestEvent.Invoke(ID, newState, SNet.Master); } } } private void Internal_ChangeState(S state, bool isRecall) { if (!IsInvalid) { S state2 = State; State = state; this.OnStateChanged?.Invoke(state2, state, isRecall); Holder?.OnStateChange(state2, state, isRecall); } } private void SendDropInState(SNet_Player target) { if (!IsInvalid) { if ((Object)(object)target == (Object)null) { Logger.Error("SendDropInState::Target was null??"); } else { _H_SetRecallStateEvent.Invoke(ID, State, target); } } } public void ClearAllRecallSnapshot() { if (!IsInvalid) { _RecallStateSnapshots.Clear(); } } private void SaveSnapshot(eBufferType type) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) if (!IsInvalid) { _RecallStateSnapshots[type] = State; } } private void RestoreSnapshot(eBufferType type) { //IL_0017: 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_0046: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (IsInvalid || !CanSendToClient) { return; } if (_RecallStateSnapshots.TryGetValue(type, out var value)) { _H_SetRecallStateEvent.Invoke(ID, value); Internal_ChangeState(value, isRecall: true); return; } bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(29, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("RestoreSnapshot"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("::There was no snapshot for "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<eBufferType>(type); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("?"); } Logger.Error(val); } static StateReplicator() { _Replicators = new Dictionary<uint, StateReplicator<S>>(); Name = typeof(S).Name; StateSize = Marshal.SizeOf(typeof(S)); StateSizeType = StatePayloads.GetSizeType(StateSize); using MD5 mD = MD5.Create(); HashName = Convert.ToBase64String(mD.ComputeHash(Encoding.UTF8.GetBytes(typeof(S).FullName))); ClientRequestEventName = "SRs" + Name + "-" + HashName; HostSetStateEventName = "SRr" + Name + "-" + HashName; HostSetRecallStateEventName = "SRre" + Name + "-" + HashName; _C_RequestEvent = StatePayloads.CreateEvent<S>(StateSizeType, ClientRequestEventName, ClientRequestEventCallback); _H_SetStateEvent = StatePayloads.CreateEvent<S>(StateSizeType, HostSetStateEventName, HostSetStateEventCallback); _H_SetRecallStateEvent = StatePayloads.CreateEvent<S>(StateSizeType, HostSetRecallStateEventName, HostSetRecallStateEventCallback); _Handshake = ReplicatorHandshake.Create(Name + "-" + HashName); _Handshake.OnClientSyncRequested += ClientSyncRequested; Patch_SNet_Capture.OnBufferCapture += BufferStored; Patch_SNet_Capture.OnBufferRecalled += BufferRecalled; LevelAPI.OnLevelCleanup += LevelCleanedUp; } private static void ClientSyncRequested(SNet_Player requestedPlayer) { foreach (StateReplicator<S> value in _Replicators.Values) { if (value.IsValid) { value.SendDropInState(requestedPlayer); } } } private static void BufferStored(eBufferType type) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) foreach (StateReplicator<S> value in _Replicators.Values) { if (value.IsValid) { value.SaveSnapshot(type); } } } private static void BufferRecalled(eBufferType type) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) foreach (StateReplicator<S> value in _Replicators.Values) { if (value.IsValid) { value.RestoreSnapshot(type); } } } private static void LevelCleanedUp() { UnloadSessionReplicator(); } private StateReplicator() { } public static StateReplicator<S> Create(uint replicatorID, S startState, LifeTimeType lifeTime, IStateReplicatorHolder<S> holder = null) { //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown if (replicatorID == 0) { Logger.Error("Replicator ID 0 is reserved for empty!"); return null; } if (_Replicators.ContainsKey(replicatorID)) { Logger.Error("Replicator ID has already assigned!"); return null; } StateReplicator<S> stateReplicator = new StateReplicator<S> { ID = replicatorID, LifeTime = lifeTime, Holder = holder, State = startState }; switch (lifeTime) { case LifeTimeType.Permanent: Logger.Debug("LifeTime is Permanent :: Handshaking is disabled!"); break; case LifeTimeType.Session: _Handshake.UpdateCreated(replicatorID); break; default: { bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(22, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("LifeTime is invalid!: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<LifeTimeType>(lifeTime); } Logger.Error(val); return null; } } _Replicators[replicatorID] = stateReplicator; return stateReplicator; } public static void UnloadSessionReplicator() { List<uint> list = new List<uint>(); foreach (StateReplicator<S> value in _Replicators.Values) { if (value.LifeTime == LifeTimeType.Session) { list.Add(value.ID); value.Unload(); } } foreach (uint item in list) { _Replicators.Remove(item); } _Handshake.Reset(); } private static void ClientRequestEventCallback(ulong sender, uint replicatorID, S newState) { if (SNet.IsMaster && _Replicators.TryGetValue(replicatorID, out StateReplicator<S> value)) { value.SetState(newState); } } private static void HostSetStateEventCallback(ulong sender, uint replicatorID, S newState) { if (SNet.HasMaster && SNet.Master.Lookup == sender && _Replicators.TryGetValue(replicatorID, out StateReplicator<S> value)) { value.Internal_ChangeState(newState, isRecall: false); } } private static void HostSetRecallStateEventCallback(ulong sender, uint replicatorID, S newState) { if (SNet.HasMaster && SNet.Master.Lookup == sender && _Replicators.TryGetValue(replicatorID, out StateReplicator<S> value)) { value.Internal_ChangeState(newState, isRecall: true); } } } } namespace AWO.Networking.Patch { [HarmonyPatch(typeof(SNet_Capture))] internal static class Patch_OnRecallDone { public static event Action? OnRecallDone; [HarmonyPostfix] [HarmonyPatch(typeof(SNet_SyncManager), "OnRecallDone")] private static void Post_OnRecallDone() { Patch_OnRecallDone.OnRecallDone?.Invoke(); } } [HarmonyPatch(typeof(SNet_Capture))] internal static class Patch_SNet_Capture { public static event Action<eBufferType>? OnBufferCapture; public static event Action<eBufferType>? OnBufferRecalled; [HarmonyPatch("TriggerCapture")] [HarmonyPrefix] [HarmonyWrapSafe] private static void Pre_TriggerCapture(SNet_Capture __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_0011: Unknown result type (might be due to invalid IL or missing references) eBufferType primedBufferType = __instance.PrimedBufferType; Patch_SNet_Capture.OnBufferCapture?.Invoke(primedBufferType); } [HarmonyPatch("RecallBuffer")] [HarmonyPostfix] [HarmonyWrapSafe] private static void Post_RecallBuffer(SNet_Capture __instance, eBufferType bufferType) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) if (!__instance.IsRecalling) { Patch_SNet_Capture.OnBufferRecalled?.Invoke(bufferType); } } } } namespace AWO.Modules.WOE { [Obsolete] public static class WardenObjectiveExt { private static readonly Dictionary<eWardenObjectiveType, Type> _DTOTypes; private static readonly List<WOE_ContextBase> _ActiveContexts; static WardenObjectiveExt() { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown _DTOTypes = new Dictionary<eWardenObjectiveType, Type>(); _ActiveContexts = new List<WOE_ContextBase>(); bool flag = default(bool); foreach (Type item in from x in typeof(WOE_ContextBase).Assembly.GetTypes() where !x.IsAbstract where x.IsAssignableTo(typeof(WOE_ContextBase)) select x) { WOE_ContextBase wOE_ContextBase = (WOE_ContextBase)Activator.CreateInstance(item); if (_DTOTypes.TryGetValue(wOE_ContextBase.TargetType, out Type _)) { Logger.Error("Duplicate TargetType Detected!"); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(14, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("With '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(item.Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' and '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(wOE_ContextBase.GetType().Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'"); } Logger.Error(val); } else if (!wOE_ContextBase.DataType.IsAssignableTo(typeof(WOE_DataBase))) { BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(41, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(item.Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" does not have valid "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("DataType"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" (not derived from "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("WOE_DataBase"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")"); } Logger.Error(val); } else { _DTOTypes[wOE_ContextBase.TargetType] = item; } } WOEvents.OnSetup += ObjectiveSetup; LevelAPI.OnLevelCleanup += LevelCleanup; } internal static void Initialize() { } private static void ObjectiveSetup(LG_LayerType layer, int chainIndex) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0067: 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) WardenObjectiveDataBlock val = default(WardenObjectiveDataBlock); Type value; if (!WardenObjectiveManager.TryGetWardenObjectiveDataForLayer(layer, chainIndex, ref val)) { bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(44, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<LG_LayerType>(layer); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" Layer (CI: "); ((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(chainIndex); ((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(") does not have ObjectiveData!!!"); } Logger.Error(val2); } else if (_DTOTypes.TryGetValue(val.Type, out value)) { WOE_ContextBase wOE_ContextBase = (WOE_ContextBase)Activator.CreateInstance(value); wOE_ContextBase.Setup(layer, chainIndex); _ActiveContexts.Add(wOE_ContextBase); } } private static void LevelCleanup() { foreach (WOE_ContextBase activeContext in _ActiveContexts) { activeContext.OnLevelCleanup(); } _ActiveContexts.Clear(); } } public delegate void SetupObjectiveDel(LG_LayerType layer, int chainIndex); [Obsolete] internal static class WOEvents { public static event SetupObjectiveDel? OnSetup; internal static void Invoke_OnSetup(LG_LayerType layer, int chainIndex) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) WOEvents.OnSetup?.Invoke(layer, chainIndex); } } [Obsolete] internal abstract class WOE_ContextBase { public abstract eWardenObjectiveType TargetType { get; } public abstract Type DataType { get; } protected WOE_DataBase? Data { get; private set; } protected LG_LayerType Layer { get; private set; } protected int ChainIndex { get; private set; } public void Setup(LG_LayerType layer, int chainIndex) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) Layer = layer; ChainIndex = chainIndex; } public virtual void OnSetup() { } public virtual void OnBuildDone() { } public virtual void OnBuildDoneLate() { } public virtual void OnLevelCleanup() { } } [Obsolete] internal abstract class WOE_DataBase { public uint ObjectiveID { get; set; } public WardenObjectiveDataBlock? GameData { get; set; } } } namespace AWO.Modules.WOE.Objectives.Uplinks { [Obsolete] internal sealed class WOE_UplinkContext : WOE_ContextBase { public override eWardenObjectiveType TargetType => (eWardenObjectiveType)8; public override Type DataType => typeof(WOE_UplinkData); } [Obsolete] internal sealed class WOE_UplinkData : WOE_DataBase { public UplinkCodeBehaviour[] CodeBehaviours { get; set; } = Array.Empty<UplinkCodeBehaviour>(); } internal sealed class UplinkCodeBehaviour { public bool ShowCodesOnTerminal { get; set; } public bool ShowCodesOnHUD { get; set; } = true; public bool ShowCodeToOtherTerminal { get; set; } = true; public TerminalZoneSelectionData TerminalZone { get; set; } = new TerminalZoneSelectionData(); public TerminalOutput[] StartOutputs { get; set; } = Array.Empty<TerminalOutput>(); public TerminalOutput[] EndOutputs { get; set; } = Array.Empty<TerminalOutput>(); public WardenObjectiveEventData[] EventsOnStart { get; set; } = Array.Empty<WardenObjectiveEventData>(); public WardenObjectiveEventData[] EventsOnEnd { get; set; } = Array.Empty<WardenObjectiveEventData>(); } } namespace AWO.Modules.WOE.Objectives.ReactorStartups { [Obsolete] internal sealed class WOE_ReactorStartupContext : WOE_ContextBase { public override eWardenObjectiveType TargetType => (eWardenObjectiveType)1; public override Type DataType => typeof(WOE_ReactorStartupData); } internal enum ReactorWavePuzzleType { Default, CustomLock, UseCommand_OnMainTerminal, UseCommand_InZone, PowerGenerator_InZone } [Obsolete] internal sealed class WOE_ReactorStartupData : WOE_DataBase { public bool RemoveMainStartupCommand { get; set; } public bool RemoveMainVerifyCommand { get; set; } public ScriptedWaveData[] WaveDatas { get; set; } = Array.Empty<ScriptedWaveData>(); public ReactorWavePuzzleData[] WavePuzzles { get; set; } = Array.Empty<ReactorWavePuzzleData>(); } internal enum SettingWarpMode { Clamped, Repeat, PingPong } internal sealed class ScriptedWaveData { public float[] IntroDuration { get; set; } = Array.Empty<float>(); public SettingWarpMode IntroDurationWarpMode { get; set; } public float[] WaveDuration { get; set; } = Array.Empty<float>(); public SettingWarpMode WaveDurationWarpMode { get; set; } public string[][] WaveInstructions { get; set; } = Array.Empty<string[]>(); public SettingWarpMode WaveInstructionsWarpMode { get; set; } } internal sealed class ReactorWavePuzzleData { public ReactorWavePuzzleType Type { get; set; } public bool ShowBeacon { get; set; } public string BeaconText { get; set; } = "Auxiliary Terminal"; public Color BeaconColor { get; set; } = Color.magenta; public string Command { get; set; } = "REACTOR_CONTINUE"; public string CommandDescription { get; set; } = "CONTINUE REACTOR STARTUP PROCESS"; public bool ForceJumpWaveWhenSolved { get; set; } = true; } } namespace AWO.Modules.WOE.Objectives.GenClusters { [Obsolete] internal sealed class WOE_GenClusterContext : WOE_ContextBase { public override eWardenObjectiveType TargetType => (eWardenObjectiveType)9; public override Type DataType => typeof(int); } } namespace AWO.Modules.WOE.JsonInjects { [Obsolete] internal class ObjectiveDataHandler : Il2CppJsonReferenceTypeHandler<WardenObjectiveDataBlock> { public override void OnRead(in Object result, in JToken jToken) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_000d: 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 JToken val = default(JToken); if ((int)jToken.Type == 1 && ((JObject)jToken).TryGetValue("woeEnabled", ref val) && (int)val.Type == 9 && (bool)val) { ((Il2CppObjectBase)result).Cast<WardenObjectiveDataBlock>(); } } } } namespace AWO.Modules.WEE { internal static class VanillaEventOvr { [CompilerGenerated] private sealed class <Handle>d__2 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public WardenObjectiveEventData e; public float currentDuration; public eWardenObjectiveEventType type; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Handle>d__2(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0087: 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) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Invalid comparison between Unknown and I4 //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Invalid comparison between Unknown and I4 switch (<>1__state) { default: return false; case 0: { <>1__state = -1; float num = Mathf.Max(e.Delay - currentDuration, 0f); if (num > 0f) { <>2__current = (object)new WaitForSeconds(num); <>1__state = 1; return true; } break; } case 1: <>1__state = -1; break; } if (WorldEventManager.GetCondition(e.Condition.ConditionIndex) != e.Condition.IsTrue) { return false; } WardenObjectiveManager.DisplayWardenIntel(e.Layer, e.WardenIntel); if (e.DialogueID != 0) { PlayerDialogManager.WantToStartDialog(e.DialogueID, -1, false, false); } eWardenObjectiveEventType val = type; if ((int)val != 5) { if ((int)val == 16) { CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(SpawnEnemyOnPoint(e)), (Action)null); } } else { PlaySound(e); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <SpawnEnemyOnPoint>d__5 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public WardenObjectiveEventData e; private int <count>5__2; private Vector3 <pos>5__3; private AIG_CourseNode <courseNode>5__4; private AgentMode <mode>5__5; private WaitForSeconds <spawnInterval>5__6; private int <i>5__7; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <SpawnEnemyOnPoint>d__5(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <courseNode>5__4 = null; <spawnInterval>5__6 = null; <>1__state = -2; } private bool MoveNext() { //IL_014d: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: { <>1__state = -1; if (e.SoundID != 0) { WardenObjectiveManager.Current.m_sound.Post(e.SoundID, true); string text = ((Object)e.SoundSubtitle).ToString(); if (!string.IsNullOrWhiteSpace(text)) { GuiManager.PlayerLayer.ShowMultiLineSubtitle(text); } } if (!SNet.IsMaster) { return false; } <count>5__2 = ((e.Count < 2) ? 1 : e.Count); LG_WorldEventObject val = default(LG_WorldEventObject); <pos>5__3 = (WorldEventUtils.TryGetRandomWorldEventObjectFromFilter(e.WorldEventObjectFilter, (uint)Builder.SessionSeedRandom.Seed, ref val) ? ((Component)val).gameObject.transform.position : e.Position); if (!Dimension.TryGetCourseNodeFromPos(<pos>5__3, ref <courseNode>5__4)) { Logger.Error("[SpawnEnemyOnPoint] Failed to find valid CourseNode from Position!"); return false; } AgentMode val2 = (e.Enabled ? ((AgentMode)1) : ((e.EnemyID != 20) ? ((AgentMode)4) : ((AgentMode)3))); <mode>5__5 = val2; <spawnInterval>5__6 = new WaitForSeconds(2f / (float)<count>5__2); <i>5__7 = 0; break; } case 1: <>1__state = -1; <i>5__7++; break; } if (<i>5__7 < <count>5__2) { EnemyAgent.SpawnEnemy(e.EnemyID, <pos>5__3, <courseNode>5__4, <mode>5__5); <>2__current = <spawnInterval>5__6; <>1__state = 1; return true; } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal static bool HasOverride(eWardenObjectiveEventType type, WardenObjectiveEventData e) { //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_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 bool flag = e.Position != Vector3.zero; if ((int)type != 5) { if ((int)type == 16) { return flag || e.Count > 0; } return false; } return flag; } internal static void HandleEvent(eWardenObjectiveEventType type, WardenObjectiveEventData e, float currentDuration) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(Handle(type, e, currentDuration)), (Action)null); } [IteratorStateMachine(typeof(<Handle>d__2))] private static IEnumerator Handle(eWardenObjectiveEventType type, WardenObjectiveEventData e, float currentDuration) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Handle>d__2(0) { type = type, e = e, currentDuration = currentDuration }; } private static void PlaySound(WardenObjectiveEventData e) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Expected O, but got Unknown //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (e.SoundID != 0) { CellSoundPlayer val = new CellSoundPlayer(); val.Post(e.SoundID, e.Position, 1u, EventCallback.op_Implicit((Action<Object, AkCallbackType, AkCallbackInfo>)SoundDoneCallback), (Object)(object)val); string text = ((Object)e.SoundSubtitle).ToString(); if (!string.IsNullOrWhiteSpace(text)) { GuiManager.PlayerLayer.ShowMultiLineSubtitle(text); } } } private static void SoundDoneCallback(Object in_cookie, AkCallbackType in_type, AkCallbackInfo callbackInfo) { CellSoundPlayer obj = ((Il2CppObjectBase)in_cookie).Cast<CellSoundPlayer>(); if (obj != null) { obj.Recycle(); } } [IteratorStateMachine(typeof(<SpawnEnemyOnPoint>d__5))] private static IEnumerator SpawnEnemyOnPoint(WardenObjectiveEventData e) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <SpawnEnemyOnPoint>d__5(0) { e = e }; } } internal static class WardenEventExt { [CompilerGenerated] private sealed class <Handle>d__4 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public WEE_EventData e; public float currentDuration; public WEE_Type type; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <Handle>d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Expected O, but got Unknown //IL_0087: 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_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01fa: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: { <>1__state = -1; float num = Mathf.Max(e.Delay - currentDuration, 0f); if (num > 0f) { <>2__current = (object)new WaitForSeconds(num); <>1__state = 1; return true; } break; } case 1: <>1__state = -1; break; } if (WorldEventManager.GetCondition(e.Condition.ConditionIndex) != e.Condition.IsTrue) { return false; } WardenObjectiveManager.DisplayWardenIntel(e.Layer, (LocalizedText)e.WardenIntel); if (e.Type != WEE_Type.ForcePlayPlayerDialogue) { if (e.DialogueID != 0) { PlayerDialogManager.WantToStartDialog(e.DialogueID, -1, false, false); } if (e.SoundID != 0) { WardenObjectiveManager.Current.m_sound.Post(e.SoundID, true); string text = e.SoundSubtitle; if (!string.IsNullOrWhiteSpace(text) && e.Type != WEE_Type.PlaySubtitles) { GuiManager.PlayerLayer.ShowMultiLineSubtitle(text); } } } if (e.SubObjective.DoUpdate && e.Type != WEE_Type.MultiProgression) { WardenObjectiveManager.UpdateSyncCustomSubObjective((LocalizedText)e.SubObjective.CustomSubObjectiveHeader, (LocalizedText)e.SubObjective.CustomSubObjective); } if (e.Fog.DoUpdate) { EnvironmentStateManager.AttemptStartFogTransition(e.Fog.FogSetting, e.Fog.FogTransitionDuration, e.DimensionIndex); } if (_EventsToTrigger.TryGetValue(type, out BaseEvent value)) { value.Trigger(e); } else { bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(26, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<WEE_Type>(type); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" does not exist in lookup!"); } Logger.Error(val); } return false; } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } internal static readonly Dictionary<WEE_Type, BaseEvent> _EventsToTrigger; static WardenEventExt() { //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown _EventsToTrigger = new Dictionary<WEE_Type, BaseEvent>(); bool flag = default(bool); foreach (Type item in from x in typeof(BaseEvent).Assembly.GetTypes() where !x.IsAbstract where x.IsAssignableTo(typeof(BaseEvent)) select x) { BaseEvent baseEvent = (BaseEvent)Activator.CreateInstance(item); if (_EventsToTrigger.TryGetValue(baseEvent.EventType, out BaseEvent value)) { Logger.Error("Duplicate EventType detected!"); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(14, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("With '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(value.Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("' and '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(baseEvent.Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'"); } Logger.Error(val); } else { baseEvent.Setup(); _EventsToTrigger[baseEvent.EventType] = baseEvent; } } } internal static void Initialize() { ClassInjector.RegisterTypeInIl2Cpp<ScanPositionReplicator>(); ClassInjector.RegisterTypeInIl2Cpp<ZoneLightReplicator>(); JsonInjector.SetConverter<eWardenObjectiveEventType>((Il2CppJsonUnmanagedTypeConverter<eWardenObjectiveEventType>)new EventTypeConverter()); JsonInjector.AddHandler<WardenObjectiveEventData>((Il2CppJsonReferenceTypeHandler<WardenObjectiveEventData>)(object)new EventDataHandler()); JsonInjector.AddHandler<WorldEventFromSourceData>((Il2CppJsonReferenceTypeHandler<WorldEventFromSourceData>)(object)new TriggerDataHandler()); WEE_EnumInjector.Inject(); Detour_ExecuteEvent.Patch(); } internal static void HandleEvent(WEE_Type type, WardenObjectiveEventData e, float currentDuration) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown WEE_EventData wEEData = e.GetWEEData(); if (wEEData != null) { CoroutineManager.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(Handle(type, wEEData, currentDuration)), (Action)null); return; } bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(72, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("WardenEvent Type is Extension ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<WEE_Type>(type); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("), but it's not registered to dataholder!"); } Logger.Error(val); } [IteratorStateMachine(typeof(<Handle>d__4))] private static IEnumerator Handle(WEE_Type type, WEE_EventData e, float currentDuration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <Handle>d__4(0) { type = type, e = e, currentDuration = currentDuration }; } } internal static class WEE_EnumInjector { public const int ExtendedIndex = 10000; private static readonly Dictionary<string, object> _EventTypes; private static int _CurrentIndex; static WEE_EnumInjector() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Expected O, but got Unknown _EventTypes = new Dictionary<string, object>(); _CurrentIndex = 0; WEE_Type[] values = Enum.GetValues<WEE_Type>(); bool flag = default(bool); for (int i = 0; i < values.Length; i++) { WEE_Type wEE_Type = values[i]; string text = wEE_Type.ToString(); AddEvent(text); BepInExDebugLogInterpolatedStringHandler val = new BepInExDebugLogInterpolatedStringHandler(22, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Injecting EWOEvent: '"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("'"); } Logger.Debug(val); } } private static void AddEvent(string name) { _EventTypes[name] = _CurrentIndex + 10000; _CurrentIndex++; } internal static void Inject() { EnumInjector.InjectEnumValues<eWardenObjectiveEventType>(_EventTypes); } } public sealed class WEE_EventData { public WEE_Type Type { get; set; } public WorldEventConditionPair Condition { get; set; } = new WorldEventConditionPair { ConditionIndex = -1, IsTrue = false }; public eWardenObjectiveEventTrigger Trigger { get; set; } public uint ChainPuzzle { get; set; } public bool UseStaticBioscanPoints { get; set; } public LG_LayerType Layer { get; set; } public eDimensionIndex DimensionIndex { get; set; } public eLocalZoneIndex LocalIndex { get; set; } public Vector3 Position { get; set; } = Vector3.zero; public float Delay { get; set; } public float Duration { get; set; } public LocaleText WardenIntel { get; set; } = LocaleText.Empty; public uint SoundID { get; set; } public LocaleText SoundSubtitle { get; set; } = LocaleText.Empty; public uint DialogueID { get; set; } public int Count { get; set; } public bool Enabled { get; set; } = true; public bool SpecialBool { get; set; } public int SpecialNumber { get; set; } = -1; public LocaleText SpecialText { get; set; } = LocaleText.Empty; public string WorldEventObjectFilter { get { return SpecialText; } set { SpecialText = new LocaleText(value); } } public WEE_SubObjectiveData SubObjective { get; set; } = new WEE_SubObjectiveData(); public WEE_UpdateFogData Fog { get; set; } = new WEE_UpdateFogData(); public bool CleanUpEnemiesBehind { get; set; } = true; public WEE_ReactorEventData Reactor { get; set; } = new WEE_ReactorEventData(); public WEE_CountdownData Countdown { get; set; } = new WEE_CountdownData(); public WEE_ZoneLightData SetZoneLight { get; set; } = new WEE_ZoneLightData(); public WEE_CleanupEnemiesData CleanupEnemies { get; set; } = new WEE_CleanupEnemiesData(); public WEE_SpawnHibernateData SpawnHibernates { get; set; } = new WEE_SpawnHibernateData(); public WEE_SpawnScoutData SpawnScouts { get; set; } = new WEE_SpawnScoutData(); public WEE_AddTerminalCommand AddTerminalCommand { get; set; } = new WEE_AddTerminalCommand(); public WEE_HideTerminalCommand HideTerminalCommand { get; set; } = new WEE_HideTerminalCommand(); public WEE_UnhideTerminalCommand UnhideTerminalCommand { get; set; } = new WEE_UnhideTerminalCommand(); public WEE_NestedEvent NestedEvent { get; set; } = new WEE_NestedEvent(); public WEE_StartEventLoop StartEventLoop { get; set; } = new WEE_StartEventLoop(); public WEE_StartEventLoop EventLoop { get { return StartEventLoop; } set { StartEventLoop = value; } } public WEE_TeleportPlayer TeleportPlayer { get; set; } = new WEE_TeleportPlayer(); public WEE_InfectPlayer InfectPlayer { get; set; } = new WEE_InfectPlayer(); public WEE_DamagePlayer DamagePlayer { get; set; } = new WEE_DamagePlayer(); public WEE_RevivePlayer RevivePlayer { get; set; } = new WEE_RevivePlayer(); public WEE_AdjustTimer AdjustTimer { get; set; } = new WEE_AdjustTimer(); public WEE_CountupData Countup { get; set; } = new WEE_CountupData(); public WEE_NavMarkerData NavMarker { get; set; } = new WEE_NavMarkerData(); public WEE_ShakeScreen CameraShake { get; set; } = new WEE_ShakeScreen(); public WEE_StartPortalMachine Portal { get; set; } = new WEE_StartPortalMachine(); public WEE_SetSuccessScreen SuccessScreen { get; set; } = new WEE_SetSuccessScreen(); public List<WEE_SubObjectiveData> MultiProgression { get; set; } = new List<WEE_SubObjectiveData>(); public WEE_PlayWaveDistantRoar WaveRoarSound { get; set; } = new WEE_PlayWaveDistantRoar(); public WEE_CustomHudText CustomHudText { get; set; } = new WEE_CustomHudText(); public WEE_SpecialHudTimer SpecialHudTimer { get; set; } = new WEE_SpecialHudTimer(); public WEE_ForcePlayerDialogue PlayerDialogue { get; set; } = new WEE_ForcePlayerDialogue(); public WEE_SetTerminalLog SetTerminalLog { get; set; } = new WEE_SetTerminalLog(); public List<WEE_SetPocketItem> ObjectiveItems { get; set; } = new List<WEE_SetPocketItem>(); } public sealed class WEE_SubObjectiveData { public bool DoUpdate { get; set; } public LocaleText CustomSubObjectiveHeader { get; set; } = LocaleText.Empty; public LocaleText CustomSubObjective { get; set; } = LocaleText.Empty; public uint Index { get; set; } public int Priority { get; set; } = 1; public LG_LayerType Layer { get; set; } public bool IsLayerIndependent { get; set; } = true; public LocaleText OverrideTag { get; set; } = LocaleText.Empty; } public sealed class WEE_UpdateFogData { public bool DoUpdate { get; set; } public uint FogSetting { get; set; } public float FogTransitionDuration { get; set; } } public sealed class WEE_ReactorEventData { public enum WaveState { Intro, Wave, Verify } public WaveState State { get; set; } public int Wave { get; set; } = 1; public float Progress { get; set; } } public sealed class WEE_CountdownData { public float Duration { get; set; } public bool CanShowHours { get; set; } = true; public LocaleText TimerText { get; set; } = LocaleText.Empty; public LocaleText TitleText { get { return TimerText; } set { TimerText = value; } } public Color TimerColor { get; set; } = Color.red; public List<EventsOnTimerProgress> EventsOnProgress { get; set; } = new List<EventsOnTimerProgress>(); public List<WardenObjectiveEventData> EventsOnDone { get; set; } = new List<WardenObjectiveEventData>(); } public sealed class WEE_CleanupEnemiesData { public enum CleanUpType { Kill, Despawn } public CleanUpType Type { get; set; } = CleanUpType.Despawn; public int AreaIndex { get; set; } = -1; public bool IncludeHibernate { get; set; } = true; public bool IncludeAggressive { get; set; } = true; public bool IncludeScout { get; set; } = true; public uint[] ExcludeEnemyID { get; set; } = Array.Empty<uint>(); public uint[] IncludeOnlyID { get; set; } = Array.Empty<uint>(); public void DoClear(AIG_CourseNode node) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0054: Expected I4, but got Unknown //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) if (!SNet.IsMaster || node == null || node.m_enemiesInNode == null) { return; } foreach (EnemyAgent item in node.m_enemiesInNode.ToArray()) { AgentMode mode = ((AgentAI)item.AI).Mode; if ((mode - 1) switch { 0 => IncludeAggressive, 2 => IncludeScout, 3 => IncludeHibernate, _ => true, } && !ExcludeEnemyID.Contains(item.EnemyDataID) && (IncludeOnlyID.Length == 0 || IncludeOnlyID.Contains(item.EnemyDataID))) { switch (Type) { case CleanUpType.Despawn: ((Agent)item).m_replicator.Despawn(); break; case CleanUpType.Kill: item.Damage.IsImortal = false; item.Damage.BulletDamage(((Dam_SyncedDamageBase)item.Damage).DamageMax, (Agent)null, default(Vector3), default(Vector3), default(Vector3), false, 0, 1f, 1f, 0u); break; } } } } } public sealed class WEE_ZoneLightData { public enum ModifierType : byte { RevertToOriginal, SetZoneLightData } public ModifierType Type { get; set; } public uint LightDataID { get; set; } public float TransitionDuration { get; set; } = 0.5f; public int Seed { get; set; } public bool UseRandomSeed => Seed == 0; } public sealed class WEE_SpawnHibernateData { public int AreaIndex { get; set; } = -1; public uint EnemyID { get; set; } public int Count { get; set; } = 1; public Vector3 Position { get; set; } = Vector3.zero; public Vector3 Rotation { get; set; } = Vector3.zero; } public sealed class WEE_SpawnScoutData { public int AreaIndex { get; set; } = -1; public eEnemyGroupType GroupType { get; set; } public eEnemyRoleDifficulty Difficulty { get; set; } public int Count { get; set; } = 1; } public sealed class WEE_AddTerminalCommand { public int TerminalIndex { get; set; } public int CommandNumber { get; set; } = 6; public string Command { get; set; } = string.Empty; public LocaleText CommandDesc { get; set; } = LocaleText.Empty; public bool AutoIndentCommandDesc { get; set; } public List<TerminalOutput> PostCommandOutputs { get; set; } = new List<TerminalOutput>(); public List<WardenObjectiveEventData> CommandEvents { get; set; } = new List<WardenObjectiveEventData>(); public bool ProgressWaitBeforeEvents { get; set; } public TERM_CommandRule SpecialCommandRule { get; set; } } public sealed class WEE_HideTerminalCommand { public int TerminalIndex { get; set; } public TERM_Command CommandEnum { get; set; } public int CommandNumber { get; set; } public bool DeleteCommand { get; set; } } public sealed class WEE_UnhideTerminalCommand { public int TerminalIndex { get; set; } public TERM_Command CommandEnum { get; set; } public int CommandNumber { get; set; } } public sealed class WEE_NestedEvent { public enum NestedMode : byte { ActivateAll, RandomAny, RandomWeighted } public struct EventsOnRandomWeight { public string DebugName { get; set; } public float Weight { get; set; } public int RepeatCount { get; set; } public bool IsInfinite { get; set; } public List<WardenObjectiveEventData> Events { get; set; } } public NestedMode Type { get; set; } public int MaxRandomEvents { get; set; } = -1; public bool AllowRepeatsInRandom { get; set; } public List<WardenObjectiveEventData> EventsToActivate { get; set; } = new List<WardenObjectiveEventData>(); public List<EventsOnRandomWeight> WheelOfEvents { get; set; } = new List<EventsOnRandomWeight>(); } public sealed class WEE_StartEventLoop { public int LoopIndex { get; set; } public float LoopDelay { get; set; } = 1f; public int LoopCount { get; set; } = -1; public List<WardenObjectiveEventData> EventsToActivate { get; set; } = new List<WardenObjectiveEventData>(); } public enum PlayerIndex : byte { P0, P1, P2, P3 } public sealed class WEE_TeleportPlayer { public HashSet<PlayerIndex> PlayerFilter { get; set; } = new HashSet<PlayerIndex>(); public bool PlayWarpAnimation { get; set; } = true; public bool FlashTeleport { get; set; } public bool WarpSentries { get; set; } = true; public bool WarpBigPickups { get; set; } = true; public bool SendBPUsToHost { get; set; } public Vector3 Player0Position { get; set; } = Vector3.zero; public int P0LookDir { get; set; } public Vector3 Player1Position { get; set; } = Vector3.zero; public int P1LookDir { get; set; } public Vector3 Player2Position { get; set; } = Vector3.zero; public int P2LookDir { get; set; } public Vector3 Player3Position { get; set; } = Vector3.zero; public int P3LookDir { get; set; } } public sealed class WEE_InfectPlayer { public HashSet<PlayerIndex> PlayerFilter { get; set; } = new HashSet<PlayerIndex> { PlayerIndex.P0, PlayerIndex.P1, PlayerIndex.P2, PlayerIndex.P3 }; public float InfectionAmount { get; set; } public bool InfectOverTime { get; set; } public float Interval { get; set; } = 1f; public bool UseZone { get; set; } } public sealed class WEE_DamagePlayer { public HashSet<PlayerIndex> PlayerFilter { get; set; } = new HashSet<PlayerIndex> { PlayerIndex.P0, PlayerIndex.P1, PlayerIndex.P2, PlayerIndex.P3 }; public float DamageAmount { get; set; } public bool DamageOverTime { get; set; } public float Interval { get; set; } = 1f; public bool UseZone { get; set; } } public sealed class WEE_RevivePlayer { public HashSet<PlayerIndex> PlayerFilter { get; set; } = new HashSet<PlayerIndex> { PlayerIndex.P0, PlayerIndex.P1, PlayerIndex.P2, PlayerIndex.P3 }; } public sealed class WEE_AdjustTimer { public float Duration { get; set; } public float Speed { get; set; } public bool UpdateTitleText { get; set; } public LocaleText TitleText { get; set; } = LocaleText.Empty; public bool UpdateText { get; set; } public bool UpdateBodyText { get { return UpdateText; } set { UpdateText = value; } } public LocaleText CustomText { get; set; } = LocaleText.Empty; public LocaleText BodyText { get { return CustomText; } set { CustomText = value; } } public bool UpdateColor { get; set; } public Color TimerColor { get; set; } = Color.red; } public sealed class WEE_CountupData { public float Duration { get; set; } public float StartValue { get; set; } public float Speed { get; set; } = 1f; public LocaleText TimerText { get; set; } = LocaleText.Empty; public LocaleText TitleText { get { return TimerText; } set { TimerText = value; } } public LocaleText CustomText { get; set; } = LocaleText.Empty; public LocaleText BodyText { get { return CustomText; } set { CustomText = value; } } public Color TimerColor { get; set; } = Color.red; public int DecimalPoints { get; set; } public List<EventsOnTimerProgress> EventsOnProgress { get; set; } = new List<EventsOnTimerProgress>(); public List<WardenObjectiveEventData> EventsOnDone { get; set; } = new List<WardenObjectiveEventData>(); } public struct EventsOnTimerProgress { public float Progress { get; set; } public List<WardenObjectiveEventData> Events { get; set; } } public sealed class WEE_NavMarkerData { public NavMarkerOption Style { get; set; } = (NavMarkerOption)10; public LocaleText Title { get; set; } = LocaleText.Empty; public Color Color { get; set; } = new Color(0.701f, 0.435f, 0.964f, 1f); public bool UsePin { get; set; } = true; } public sealed class WEE_ShakeScreen { public float Radius { get; set; } public float Duration { get; set; } public float Amplitude { get; set; } public float Frequency { get; set; } public bool Directional { get; set; } = true; } public sealed class WEE_StartPortalMachine { public eDimensionIndex TargetDimension { get; set; } = (eDimensionIndex)1; public float TeleportDelay { get; set; } = 5f; public bool PreventPortalWarpTeamEvent { get; set; } } public sealed class WEE_SetSuccessScreen { public enum ScreenType : byte { SetSuccessScreen, FlashFakeScreen } public ScreenType Type { get; set; } public WinScreen CustomSuccessScreen { get; set; } = WinScreen.Empty; public eCM_MenuPage FakeEndScreen { get; set; } = (eCM_MenuPage)17; } public sealed class WEE_PlayWaveDistantRoar { public enum WaveRoarSound : byte { Striker, Shooter, Birther, Shadow, Tank, Flyer, Immortal, Bullrush, Pouncer, Striker_Berserk, Shooter_Spread } public enum WaveRoarSize : byte { Small, Medium, Big } public WaveRoarSound RoarSound { get; set; } public WaveRoarSize RoarSize { get; set; } public bool IsOutside { get; set; } } public sealed class WEE_CustomHudText { public LocaleText Title { get; set; } = LocaleText.Empty; public LocaleText TitleText { get { return Title; } set { Title = value; } } public LocaleText Body { get; set; } = LocaleText.Empty; public LocaleText BodyText { get { return Body; } set { Body = value; } } } public sealed class WEE_SpecialHudTimer { public float Duration { get; set; } public LocaleText Message { get; set; } = LocaleText.Empty; public ePUIMessageStyle Style { get; set; } public int Priority { get; set; } = -2; public bool ShowTimeInProgressBar { get; set; } = true; public List<EventsOnTimerProgress> EventsOnProgress { get; set; } = new List<EventsOnTimerProgress>(); public List<WardenObjectiveEventData> EventsOnDone { get; set; } = new List<WardenObjectiveEventData>(); } public sealed class WEE_ForcePlayerDialogue { public enum DialogueType : byte { Closest, Specific, Random } public enum PlayerIntensityState : byte { Exploration, Stealth, Encounter, Combat } public DialogueType Type { get; set; } public PlayerIndex CharacterID { get; set; } public PlayerIntensityState IntensityState { get; set; } } public sealed class WEE_SetTerminalLog { public enum LogEventType : byte { Add, Remove } public int TerminalIndex { get; set; } public LogEventType Type { get; set; } public string FileName { get; set; } = string.Empty; public LocaleText FileContent { get; set; } = LocaleText.Empty; public Language FileContentOriginalLanguage { get; set; } = (Language)1; public uint AttachedAudioFile { get; set; } public int AttachedAudioByteSize { get; set; } public uint PlayerDialogToTriggerAfterAudio { get; set; } public List<WardenObjectiveEventData> EventsOnFileRead { get; set; } = new List<WardenObjectiveEventData>(); } public sealed class WEE_SetPocketItem { public enum PlayerTagType : byte { Custom, Specific, Random, Closest } public int Index { get; set; } public int Count { get; set; } = 1; public bool IsOnTop { get; set; } public LocaleText ItemName { get; set; } = LocaleText.Empty; public PlayerTagType TagType { get; set; } public PlayerIndex PlayerIndex { get; set; } public string CustomTag { get; set; } = string.Empty; [