Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of LCStatsTracker v1.1.3
OreoM.StatsTracker.dll
Decompiled 5 days agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Net; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Threading; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Logging; using GameNetcodeStuff; using HQoL.Network; using HarmonyLib; using Microsoft.CodeAnalysis; using Newtonsoft.Json; using StatsTracker.Patches; using StatsTracker.Util; using Unity.Netcode; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("AmazingAssets.TerrainToMesh")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: IgnoresAccessChecksTo("ClientNetworkTransform")] [assembly: IgnoresAccessChecksTo("com.olegknyazev.softmask")] [assembly: IgnoresAccessChecksTo("DissonanceVoip")] [assembly: IgnoresAccessChecksTo("DunGen")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.ASPP")] [assembly: IgnoresAccessChecksTo("DunGen.Integration.UnityNav")] [assembly: IgnoresAccessChecksTo("EasyTextEffects")] [assembly: IgnoresAccessChecksTo("Facepunch Transport for Netcode for GameObjects")] [assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")] [assembly: IgnoresAccessChecksTo("OreoM.HQoL.72")] [assembly: IgnoresAccessChecksTo("OreoM.HQoL.73")] [assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging")] [assembly: IgnoresAccessChecksTo("Unity.Animation.Rigging.DocCodeExamples")] [assembly: IgnoresAccessChecksTo("Unity.Burst")] [assembly: IgnoresAccessChecksTo("Unity.Burst.Unsafe")] [assembly: IgnoresAccessChecksTo("Unity.Collections")] [assembly: IgnoresAccessChecksTo("Unity.Collections.LowLevel.ILSupport")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem")] [assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")] [assembly: IgnoresAccessChecksTo("Unity.Jobs")] [assembly: IgnoresAccessChecksTo("Unity.Mathematics")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.Common")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.MetricTypes")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStats")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Component")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsMonitor.Implementation")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetStatsReporting")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkProfiler.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Multiplayer.Tools.NetworkSolutionInterface")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Components")] [assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.Networking.Transport")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Csg")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.KdTree")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Poly2Tri")] [assembly: IgnoresAccessChecksTo("Unity.ProBuilder.Stl")] [assembly: IgnoresAccessChecksTo("Unity.Profiling.Core")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Config.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.HighDefinition.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")] [assembly: IgnoresAccessChecksTo("Unity.Services.Authentication")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Analytics")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Components")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Configuration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Device")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Environments.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Internal")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Networking")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Registration")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Scheduler")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Telemetry")] [assembly: IgnoresAccessChecksTo("Unity.Services.Core.Threading")] [assembly: IgnoresAccessChecksTo("Unity.Services.QoS")] [assembly: IgnoresAccessChecksTo("Unity.Services.Relay")] [assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")] [assembly: IgnoresAccessChecksTo("Unity.Timeline")] [assembly: IgnoresAccessChecksTo("Unity.VisualEffectGraph.Runtime")] [assembly: IgnoresAccessChecksTo("Unity.XR.CoreUtils")] [assembly: IgnoresAccessChecksTo("Unity.XR.Management")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.ConformanceAutomation")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MetaQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.MockRuntime")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.OculusQuestSupport")] [assembly: IgnoresAccessChecksTo("Unity.XR.OpenXR.Features.RuntimeDebugger")] [assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")] [assembly: IgnoresAccessChecksTo("UnityEngine.SpatialTracking")] [assembly: IgnoresAccessChecksTo("UnityEngine.UI")] [assembly: IgnoresAccessChecksTo("UnityEngine.XR.LegacyInputHelpers")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("OreoM.StatsTracker")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.1.3.0")] [assembly: AssemblyInformationalVersion("1.1.3+917cbf30b9e22e1944e01c7598618f3a5532fa02")] [assembly: AssemblyProduct("StatsTracker")] [assembly: AssemblyTitle("OreoM.StatsTracker")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.1.3.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace StatsTracker { [BepInPlugin("OreoM.StatsTracker", "StatsTracker", "1.1.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class StatsTracker : BaseUnityPlugin { internal static bool dayHasStarted = false; internal static Stats? DayStats; internal static HttpSSE LocalServer = new HttpSSE(); internal static Dictionary<string, string> VanillaInteriorNames = new Dictionary<string, string> { { "Level1Flow", "Facility" }, { "Level2Flow", "Mansion" }, { "Level1FlowExtraLarge", "UnusedFacility" }, { "Level1Flow3Exits", "Facility" }, { "Level3Flow", "Mineshaft" } }; public static readonly Type? EggItemType = AccessTools.TypeByName("KiwiBabyItem"); public static readonly Type? KnifeItemType = AccessTools.TypeByName("KnifeItem"); public static readonly Type? ShotgunItemType = AccessTools.TypeByName("ShotgunItem"); public static readonly Type? GiftBoxItemType = AccessTools.TypeByName("GiftBoxItem"); public static readonly FieldInfo? DeactivatedField = AccessTools.Field(typeof(GrabbableObject), "deactivated"); public static StatsTracker Instance { get; private set; } = null; internal static ManualLogSource Logger { get; private set; } = null; internal static Harmony? Harmony { get; set; } private void Awake() { Logger = ((BaseUnityPlugin)this).Logger; Instance = this; Patch(); LocalServer.Start(); Logger.LogInfo((object)"OreoM.StatsTracker v1.1.3 has loaded!"); } internal static void Patch() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown if (Harmony == null) { Harmony = new Harmony("OreoM.StatsTracker"); } Logger.LogDebug((object)"Patching..."); CompanyTracker.ApplyCompanyTrackerPatches(Harmony); HazardTracker.ApplyHazardTrakcerPatches(Harmony); ItemAndEventTracker.ApplyItemAndEventTrackerPatches(Harmony); PlayerTracker.ApplyPlayerTrackerPatches(Harmony); ServerEvents.ApplyServerEventPatches(Harmony); ShipTracker.ApplyShipTrackerPatches(Harmony); SpawnTracker.ApplySpawnTrackerPatches(Harmony); if (Chainloader.PluginInfos.ContainsKey("OreoM.HQoL.72") || Chainloader.PluginInfos.ContainsKey("OreoM.HQoL.73")) { HQoLTracker.ApplyHQoLTrackerPatches(Harmony); } Logger.LogDebug((object)"Finished patching!"); } internal static void Unpatch() { Logger.LogDebug((object)"Unpatching..."); Harmony? harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } Logger.LogDebug((object)"Finished unpatching!"); } internal static string GetCurrentTimeString() { float normalizedTimeOfDay = TimeOfDay.Instance.normalizedTimeOfDay; float num = TimeOfDay.Instance.numberOfHours; bool flag = false; string text = ""; string text2 = ""; int num2 = (int)(normalizedTimeOfDay * (60f * num)) + 360; int num3 = (int)Mathf.Floor((float)(num2 / 60)); text = (flag ? "\n" : " "); text2 = text + "AM"; if (num3 >= 24) { return "12:00 " + text + " AM"; } text2 = ((num3 >= 12) ? (text + "PM") : (text + "AM")); if (num3 > 12) { num3 %= 12; } int num4 = num2 % 60; string text3 = $"{num3:00}:{num4:00}".TrimStart('0') + text2; if (!(text3 == "6:00 AM")) { return text3; } return "7:40 AM"; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "OreoM.StatsTracker"; public const string PLUGIN_NAME = "StatsTracker"; public const string PLUGIN_VERSION = "1.1.3"; } } namespace StatsTracker.Util { public class HttpSSE { private HttpListener? listener; private string? currentJson; private Thread? serverThread; private const int PORT = 2145; private readonly ManualResetEvent dayFinishedSignaler = new ManualResetEvent(initialState: false); public void Start() { listener = new HttpListener(); listener.Prefixes.Add($"http://localhost:{2145}/"); listener.Start(); serverThread = new Thread(ListenLoop) { IsBackground = true }; serverThread.Start(); StatsTracker.Logger.LogInfo((object)$"Stat server running at http://localhost:{2145}"); } public void Stop() { listener?.Stop(); serverThread?.Join(); StatsTracker.Logger.LogInfo((object)"Stat server stopped"); } public void PublishStats(string json) { currentJson = json; dayFinishedSignaler.Set(); } public void Reset() { currentJson = null; dayFinishedSignaler.Reset(); } private void ListenLoop() { while (listener.IsListening) { try { HttpListenerContext context = listener.GetContext(); ThreadPool.QueueUserWorkItem(delegate { HandleRequest(context); }); } catch (HttpListenerException) { break; } } } private void HandleRequest(HttpListenerContext context) { HttpListenerResponse response = context.Response; response.StatusCode = 200; response.ContentType = "text/event-stream"; response.Headers.Add("Cache-Control", "no-cache"); response.Headers.Add("Access-Control-Allow-Origin", "*"); dayFinishedSignaler.WaitOne(); string s = "data: " + currentJson + "\n\n"; byte[] bytes = Encoding.UTF8.GetBytes(s); response.OutputStream.Write(bytes, 0, bytes.Length); response.OutputStream.Flush(); response.Close(); Reset(); } } internal class PlayerStats { public string Name; public bool Alive; public bool Disconnected; public string TimeOfDeath; public string CauseOfDeath; public PlayerStats(string name) { Name = name; Alive = true; TimeOfDeath = ""; CauseOfDeath = ""; base..ctor(); } public void Kill(string TimeOfDeath, string CauseOfDeath) { Alive = false; this.TimeOfDeath = TimeOfDeath; this.CauseOfDeath = CauseOfDeath; } public void Disconnect() { Disconnected = true; } } internal class SpecialItemInfo { public List<int> Available = new List<int>(); public List<int> Collected = new List<int>(); public void AddToAvailable(int value) { Available.Add(value); } public void AddToCollected(int value) { Collected.Add(value); } } internal class GiftBoxInfo { public int NewScrapValue; public int GiftScrapValue; public bool Collected; public GiftBoxInfo(int newScrapValue, int GiftScrapValue) { NewScrapValue = newScrapValue; this.GiftScrapValue = GiftScrapValue; base..ctor(); } } internal class MissingItemInfo { public int Value; public string ItemType; public double[] DespawnPosition; public bool CollectedOnPreviousDay; public int ScrapInsideGiftValue; public MissingItemInfo(string Name, int Value, Vector3 DespawnPosition, bool CollectedOnPreviousDay, int ScrapInsideGiftValue = 0) { //IL_0017: 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_0037: Unknown result type (might be due to invalid IL or missing references) this.Value = Value; ItemType = Name; this.DespawnPosition = new double[3] { Math.Round(DespawnPosition.x, 1), Math.Round(DespawnPosition.y, 1), Math.Round(DespawnPosition.z, 1) }; this.CollectedOnPreviousDay = CollectedOnPreviousDay; this.ScrapInsideGiftValue = ScrapInsideGiftValue; base..ctor(); } } internal class HazardInfo { public int TurretCount; public int LandmineCount; public int SpiketrapCount; public HazardInfo(int TurretCount, int LandmineCount, int SpiketrapCount) { this.TurretCount = TurretCount; this.LandmineCount = LandmineCount; this.SpiketrapCount = SpiketrapCount; base..ctor(); } } internal class MoonInfo { public string Name; public string Weather; public MoonInfo(string Name, string Weather) { this.Name = Name; this.Weather = Weather; base..ctor(); } } internal class DungeonInfo { public int ItemCount; public string Interior; public DungeonInfo(int ItemCount, string Interior) { this.ItemCount = ItemCount; this.Interior = Interior; base..ctor(); } } internal class SpawnInfo { public string Enemy = EnemyType.enemyName; public string SpawnTime; public string TimeOfDeath; public SpawnInfo(EnemyType EnemyType, string Time) { SpawnTime = Time; TimeOfDeath = ""; base..ctor(); } } internal class Stats { public MoonInfo MoonInfo; public DungeonInfo? DungeonInfo; public HazardInfo? HazardInfo; public SpecialItemInfo BeeInfo; public SpecialItemInfo EggInfo; public SpecialItemInfo KnifeInfo; public SpecialItemInfo ShotgunInfo; public int Seed; public int Version; public int CollectedNoExtra; public int CollectedTotal; public int BottomLine; public int BottomLineTrue; public int ExtraFromOldGift; public int ValueSold; public int NewQuota; public bool AppSpawned; public bool IndoorFog; public string TakeOffTime; public string SIDType; public string InfestationType; public string MeteorShowerTime; public Dictionary<ulong, PlayerStats> Players; public List<SpawnInfo> IndoorSpawns; public List<SpawnInfo> DayTimeSpawns; public List<SpawnInfo> NightTimeSpawns; public List<GiftBoxInfo> GiftBoxesOpened; public List<MissingItemInfo> MissedItems; public Stats(int version, string moonName, string weather, PlayerControllerB[] allPlayers) { MoonInfo = new MoonInfo(moonName, weather); BeeInfo = new SpecialItemInfo(); EggInfo = new SpecialItemInfo(); KnifeInfo = new SpecialItemInfo(); ShotgunInfo = new SpecialItemInfo(); Seed = 0; Version = version; CollectedNoExtra = 0; CollectedTotal = 0; BottomLine = 0; BottomLineTrue = 0; ExtraFromOldGift = 0; ValueSold = 0; NewQuota = 0; AppSpawned = false; IndoorFog = false; TakeOffTime = ""; SIDType = ""; InfestationType = ""; MeteorShowerTime = ""; Players = new Dictionary<ulong, PlayerStats>(); IndoorSpawns = new List<SpawnInfo>(); DayTimeSpawns = new List<SpawnInfo>(); NightTimeSpawns = new List<SpawnInfo>(); GiftBoxesOpened = new List<GiftBoxInfo>(); MissedItems = new List<MissingItemInfo>(); foreach (PlayerControllerB val in allPlayers) { Players[val.playerSteamId] = new PlayerStats(val.playerUsername); } } } } namespace StatsTracker.Patches { internal class CompanyTracker { private static int itemsOnCounterCountLastFrame; public static void ApplyCompanyTrackerPatches(Harmony Harmony) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown Harmony.Patch((MethodBase)AccessTools.Method(typeof(DepositItemsDesk), "Update", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(CompanyTracker), "CheckForNewItemsOnCounter", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony.Patch((MethodBase)AccessTools.Method(typeof(StartOfRound), "ShipHasLeft", (Type[])null, (Type[])null), new HarmonyMethod(typeof(CompanyTracker), "ResetItemCountAfterTakingOffCompanyTypeMoon", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void CheckForNewItemsOnCounter(DepositItemsDesk __instance) { if (__instance.itemsOnCounter.Count > itemsOnCounterCountLastFrame) { for (int i = itemsOnCounterCountLastFrame; i < __instance.itemsOnCounter.Count; i++) { if (__instance.itemsOnCounter[i].itemProperties.isScrap) { StatsTracker.DayStats.ValueSold += __instance.itemsOnCounter[i].scrapValue; } } } itemsOnCounterCountLastFrame = __instance.itemsOnCounter.Count; } private static void ResetItemCountAfterTakingOffCompanyTypeMoon(RoundManager __instance) { if (!((Object)(object)Object.FindAnyObjectByType<DepositItemsDesk>() == (Object)null)) { itemsOnCounterCountLastFrame = 0; } } } internal class HQoLTracker { private static int totalSold; public static void ApplyHQoLTrackerPatches(Harmony Harmony) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown Harmony.Patch((MethodBase)AccessTools.Method(typeof(DepositItemsDesk), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(HQoLTracker), "RegisterOnChangeWhenLandingOnCompanyTypeMoon", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony.Patch((MethodBase)AccessTools.Method(typeof(StartOfRound), "ShipHasLeft", (Type[])null, (Type[])null), new HarmonyMethod(typeof(HQoLTracker), "DeregisterOnChangeAfterTakingOffCompanyTypeMoon", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void RegisterOnChangeWhenLandingOnCompanyTypeMoon(DepositItemsDesk __instance) { if ((Object)(object)HQoLNetwork.Instance != (Object)null) { NetworkVariable<int> totalStorageValue = HQoLNetwork.Instance.totalStorageValue; totalStorageValue.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)totalStorageValue.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnChangeFindSoldValue)); } else if ((Object)(object)HQoLNetwork.Instance != (Object)null) { NetworkVariable<int> totalStorageValue2 = HQoLNetwork.Instance.totalStorageValue; totalStorageValue2.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Combine((Delegate?)(object)totalStorageValue2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnChangeFindSoldValue)); } else { StatsTracker.Logger.LogWarning((object)"Failed to find HQoL instance, sold value will not be sync'd"); } } private static void DeregisterOnChangeAfterTakingOffCompanyTypeMoon(RoundManager __instance) { if (!((Object)(object)Object.FindAnyObjectByType<DepositItemsDesk>() == (Object)null)) { if ((Object)(object)HQoLNetwork.Instance != (Object)null) { NetworkVariable<int> totalStorageValue = HQoLNetwork.Instance.totalStorageValue; totalStorageValue.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)totalStorageValue.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnChangeFindSoldValue)); } else if ((Object)(object)HQoLNetwork.Instance != (Object)null) { NetworkVariable<int> totalStorageValue2 = HQoLNetwork.Instance.totalStorageValue; totalStorageValue2.OnValueChanged = (OnValueChangedDelegate<int>)(object)Delegate.Remove((Delegate?)(object)totalStorageValue2.OnValueChanged, (Delegate?)(object)new OnValueChangedDelegate<int>(OnChangeFindSoldValue)); } else { StatsTracker.Logger.LogWarning((object)"Failed to find HQoL instance, sold value will not be sync'd"); } StatsTracker.DayStats.ValueSold = totalSold; totalSold = 0; } } private static void OnChangeFindSoldValue(int prevValue, int currValue) { if (currValue < prevValue) { totalSold += prevValue - currValue; } } } internal class HazardTracker { public static int turretCount; public static int landmineCount; public static int spiketrapCount; public static void ApplyHazardTrakcerPatches(Harmony Harmony) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Expected O, but got Unknown //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown Harmony Harmony2 = Harmony; Harmony2.Patch((MethodBase)AccessTools.Method(typeof(RoundManager), "GenerateNewLevelClientRpc", (Type[])null, (Type[])null), new HarmonyMethod(typeof(HazardTracker), "ResetHazardTrackerWhenStartingNewDay", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony2.Patch((MethodBase)AccessTools.Method(typeof(Landmine), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(HazardTracker), "CountLandmine", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony2.Patch((MethodBase)AccessTools.Method(typeof(Turret), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(HazardTracker), "CountTurret", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Type SpikeRoofTrapType = AccessTools.TypeByName("SpikeRoofTrap"); if (SpikeRoofTrapType != null) { SpikeRoofTrapTypePath(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] void SpikeRoofTrapTypePath() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown Harmony2.Patch((MethodBase)AccessTools.Method(SpikeRoofTrapType, "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(HazardTracker), "CountSpiketrap", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private static void ResetHazardTrackerWhenStartingNewDay(RoundManager __instance) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 if ((GameNetworkManager.Instance.gameVersionNum <= 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 1) && (GameNetworkManager.Instance.gameVersionNum > 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 2)) { turretCount = (landmineCount = (spiketrapCount = 0)); } } private static void CountLandmine(Landmine __instance) { landmineCount++; } private static void CountTurret(Turret __instance) { turretCount++; } private static void CountSpiketrap(SpikeRoofTrap __instance) { spiketrapCount++; } } internal class ItemAndEventTracker { [CompilerGenerated] private sealed class <>c__DisplayClass15_0 { public GrabbableObject instance; internal bool <WaitUntilItemValueHasBeenSetAndUpdateBottomLine>b__0() { return instance.scrapValue != 0; } } [CompilerGenerated] private sealed class <>c__DisplayClass20_0 { public float startTime; public NetworkObjectReference netObjRef; public NetworkObject netObject; internal bool <WaitForGiftItemToFullySpawnBeforeTracking>b__0() { if (Time.realtimeSinceStartup - startTime < 8f) { return !((NetworkObjectReference)(ref netObjRef)).TryGet(ref netObject, (NetworkManager)null); } return false; } } [CompilerGenerated] private sealed class <>c__DisplayClass23_0 { public ShotgunItem instance; internal bool <WaitUntilShotgunValueHasBeenSetBeforeAddingToAvailable>b__0() { return ((GrabbableObject)instance).scrapValue != 0; } } [CompilerGenerated] private sealed class <WaitForGiftItemToFullySpawnBeforeTracking>d__20 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public NetworkObjectReference netObjRef; private <>c__DisplayClass20_0 <>8__1; public int indexForCollectedGift; public bool giftSpawnedThisDay; public int originalGiftValue; public int newScrapValue; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitForGiftItemToFullySpawnBeforeTracking>d__20(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass20_0(); <>8__1.netObjRef = netObjRef; <>8__1.netObject = null; <>8__1.startTime = Time.realtimeSinceStartup; <>2__current = (object)new WaitWhile((Func<bool>)(() => Time.realtimeSinceStartup - <>8__1.startTime < 8f && !((NetworkObjectReference)(ref <>8__1.netObjRef)).TryGet(ref <>8__1.netObject, (NetworkManager)null))); <>1__state = 1; return true; case 1: <>1__state = -1; if ((Object)(object)<>8__1.netObject == (Object)null) { StatsTracker.Logger.LogWarning((object)"No network object found for giftbox"); return false; } indexFromGiftBox[NetworkObjectReference.op_Implicit(<>8__1.netObject)] = indexForCollectedGift; if (giftSpawnedThisDay) { valueFromGiftSpawner[NetworkObjectReference.op_Implicit(<>8__1.netObject)] = originalGiftValue; StatsTracker.DayStats.BottomLineTrue -= originalGiftValue; } else { objectsExtraSpawnedThisDay.Remove(NetworkObjectReference.op_Implicit(<>8__1.netObject)); StatsTracker.DayStats.BottomLineTrue -= newScrapValue; StatsTracker.DayStats.ExtraFromOldGift += newScrapValue - originalGiftValue; } 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 <WaitUntilItemValueHasBeenSetAndUpdateBottomLine>d__15 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public GrabbableObject instance; private <>c__DisplayClass15_0 <>8__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitUntilItemValueHasBeenSetAndUpdateBottomLine>d__15(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass15_0(); <>8__1.instance = instance; <>2__current = (object)new WaitUntil((Func<bool>)(() => <>8__1.instance.scrapValue != 0)); <>1__state = 1; return true; case 1: <>1__state = -1; StatsTracker.DayStats.BottomLineTrue += <>8__1.instance.scrapValue; 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 <WaitUntilShotgunValueHasBeenSetBeforeAddingToAvailable>d__23 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public ShotgunItem instance; private <>c__DisplayClass23_0 <>8__1; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <WaitUntilShotgunValueHasBeenSetBeforeAddingToAvailable>d__23(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>8__1 = null; <>1__state = -2; } private bool MoveNext() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>8__1 = new <>c__DisplayClass23_0(); <>8__1.instance = instance; <>2__current = (object)new WaitUntil((Func<bool>)(() => ((GrabbableObject)<>8__1.instance).scrapValue != 0)); <>1__state = 1; return true; case 1: <>1__state = -1; StatsTracker.DayStats.ShotgunInfo.AddToAvailable(((GrabbableObject)<>8__1.instance).scrapValue); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private const int knifeValue = 35; private static readonly HashSet<NetworkObjectReference> appSpawnedThisDay = new HashSet<NetworkObjectReference>(); private static readonly HashSet<NetworkObjectReference> objectsNaturallySpawnedThisDay = new HashSet<NetworkObjectReference>(); private static readonly HashSet<NetworkObjectReference> objectsExtraSpawnedThisDay = new HashSet<NetworkObjectReference>(); private static readonly Dictionary<NetworkObjectReference, int> valueFromGiftSpawner = new Dictionary<NetworkObjectReference, int>(); private static readonly Dictionary<NetworkObjectReference, int> indexFromGiftBox = new Dictionary<NetworkObjectReference, int>(); public static void ApplyItemAndEventTrackerPatches(Harmony Harmony) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Expected O, but got Unknown //IL_01a7: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Expected O, but got Unknown //IL_01e1: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Expected O, but got Unknown //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_022a: Expected O, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Expected O, but got Unknown Harmony Harmony2 = Harmony; Harmony2.Patch((MethodBase)AccessTools.Method(typeof(RoundManager), "GenerateNewLevelClientRpc", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ItemAndEventTracker), "ResetItemAndEventTrackerWhenStartingNewDay", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo = AccessTools.Method(typeof(RoundManager), "SyncScrapValuesClientRpc", (Type[])null, (Type[])null); Harmony2.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(ItemAndEventTracker), "TrackDungeonInfo", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony2.Patch((MethodBase)methodInfo, new HarmonyMethod(typeof(ItemAndEventTracker), "TrackSID", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo RoundManagerRefreshEnemiesList = AccessTools.Method(typeof(RoundManager), "RefreshEnemiesList", (Type[])null, (Type[])null); FieldInfo fieldInfo = AccessTools.Field(typeof(RoundManager), "enemyRushIndex"); if (fieldInfo != null) { enemyRushIndexPath(); } FieldInfo fieldInfo2 = AccessTools.Field(typeof(RoundManager), "indoorFog"); if (fieldInfo2 != null) { indoorFogIntoPath(); } MethodInfo TimeOfDaySetBeginMeteorShowerClientRpcInfo = AccessTools.Method(typeof(TimeOfDay), "SetBeginMeteorShowerClientRpc", (Type[])null, (Type[])null); if (TimeOfDaySetBeginMeteorShowerClientRpcInfo != null) { TimeOfDaySetBeginMeteorShowerClientRpcInfoPath(); } Harmony2.Patch((MethodBase)AccessTools.Method(typeof(LungProp), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(ItemAndEventTracker), "CountApp", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony2.Patch((MethodBase)AccessTools.Method(typeof(NetworkBehaviour), "OnNetworkSpawn", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(ItemAndEventTracker), "TrackSpawnedItems", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony2.Patch((MethodBase)AccessTools.Method(typeof(NetworkBehaviour), "OnNetworkDespawn", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ItemAndEventTracker), "TrackMissedItems", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony2.Patch((MethodBase)AccessTools.Method(typeof(RoundManager), "DespawnPropsAtEndOfRound", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ItemAndEventTracker), "TrackCollectedItems", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); if (StatsTracker.GiftBoxItemType != null) { GiftBoxItemTypePath(); } Harmony2.Patch((MethodBase)AccessTools.Method(typeof(RedLocustBees), "SpawnHiveClientRpc", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ItemAndEventTracker), "TrackHive", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Type NutcrackerEnemyAIType = AccessTools.TypeByName("NutcrackerEnemyAI"); if (NutcrackerEnemyAIType != null) { NutcrackerEnemyAITypePath(); } Type ButlerEnemyAIType = AccessTools.TypeByName("ButlerEnemyAI"); if (ButlerEnemyAIType != null) { ButlerEnemyAITypePath(); } Type GiantKiwiAIType = AccessTools.TypeByName("GiantKiwiAI"); if (GiantKiwiAIType != null) { GiantKiwiAITypePath(); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] void ButlerEnemyAITypePath() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown Harmony2.Patch((MethodBase)AccessTools.Method(ButlerEnemyAIType, "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(ItemAndEventTracker), "TrackKnifeBeforePopping", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony2.Patch((MethodBase)AccessTools.Method(ButlerEnemyAIType, "KillEnemy", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ItemAndEventTracker), "TrackButlerPopAndRemoveFakeValue", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] void GiantKiwiAITypePath() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown Harmony2.Patch((MethodBase)AccessTools.Method(GiantKiwiAIType, "SpawnEggsClientRpc", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ItemAndEventTracker), "TrackEggs", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] void GiftBoxItemTypePath() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown Harmony2.Patch((MethodBase)AccessTools.Method(StatsTracker.GiftBoxItemType, "OpenGiftBoxClientRpc", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ItemAndEventTracker), "AddNewlySpawnedGiftItemToItemTracker", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); MethodInfo methodInfo2 = AccessTools.Method(StatsTracker.GiftBoxItemType, "InitializeAfterPositioning", (Type[])null, (Type[])null) ?? AccessTools.Method(StatsTracker.GiftBoxItemType, "Start", (Type[])null, (Type[])null); Harmony2.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(ItemAndEventTracker), "PopulateObjectInGiftValueForAllClients", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] void NutcrackerEnemyAITypePath() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Expected O, but got Unknown Harmony2.Patch((MethodBase)AccessTools.Method(NutcrackerEnemyAIType, "InitializeNutcrackerValuesClientRpc", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ItemAndEventTracker), "TrackShotgun", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] void TimeOfDaySetBeginMeteorShowerClientRpcInfoPath() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown Harmony2.Patch((MethodBase)TimeOfDaySetBeginMeteorShowerClientRpcInfo, new HarmonyMethod(typeof(ItemAndEventTracker), "TrackMeteorShower", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] void enemyRushIndexPath() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown Harmony2.Patch((MethodBase)RoundManagerRefreshEnemiesList, (HarmonyMethod)null, new HarmonyMethod(typeof(ItemAndEventTracker), "TrackInfestation", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] void indoorFogIntoPath() { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Expected O, but got Unknown Harmony2.Patch((MethodBase)RoundManagerRefreshEnemiesList, (HarmonyMethod)null, new HarmonyMethod(typeof(ItemAndEventTracker), "TrackIndoorFog", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private static void ResetItemAndEventTrackerWhenStartingNewDay(RoundManager __instance) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 if ((GameNetworkManager.Instance.gameVersionNum <= 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 1) && (GameNetworkManager.Instance.gameVersionNum > 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 2)) { appSpawnedThisDay.Clear(); objectsNaturallySpawnedThisDay.Clear(); objectsExtraSpawnedThisDay.Clear(); valueFromGiftSpawner.Clear(); indexFromGiftBox.Clear(); } } private static void TrackDungeonInfo(RoundManager __instance, NetworkObjectReference[] spawnedScrap, int[] allScrapValue) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 if ((GameNetworkManager.Instance.gameVersionNum <= 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 1) && (GameNetworkManager.Instance.gameVersionNum > 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 2)) { objectsNaturallySpawnedThisDay.UnionWith(spawnedScrap); int num = 0; foreach (int num2 in allScrapValue) { num += num2; } string value = Traverse.Create((object)__instance).Field("dungeonGenerator").Field("Generator") .Field("DungeonFlow") .Property("name", (object[])null) .GetValue<string>(); string value2; bool flag = StatsTracker.VanillaInteriorNames.TryGetValue(value, out value2); StatsTracker.DayStats.DungeonInfo = new DungeonInfo(spawnedScrap.Length + appSpawnedThisDay.Count, flag ? value2 : value); StatsTracker.DayStats.BottomLine += num; StatsTracker.DayStats.HazardInfo = new HazardInfo(HazardTracker.turretCount, HazardTracker.landmineCount, HazardTracker.spiketrapCount); } } private static void TrackSID(RoundManager __instance, NetworkObjectReference[] spawnedScrap) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if ((GameNetworkManager.Instance.gameVersionNum > 72 && (int)((NetworkBehaviour)__instance).__rpc_exec_stage != 1) || (GameNetworkManager.Instance.gameVersionNum <= 72 && (int)((NetworkBehaviour)__instance).__rpc_exec_stage != 2) || GameNetworkManager.Instance.gameVersionNum < 60) { return; } NetworkObject val = default(NetworkObject); ((NetworkObjectReference)(ref spawnedScrap[0])).TryGet(ref val, (NetworkManager)null); GrabbableObject component = ((Component)val).GetComponent<GrabbableObject>(); if ((Object)(object)component == (Object)null) { StatsTracker.Logger.LogWarning((object)"Unable to retrieve first GrabbableObject from the spawned objects"); return; } NetworkObject val3 = default(NetworkObject); for (int i = 0; i < spawnedScrap.Length; i++) { NetworkObjectReference val2 = spawnedScrap[i]; ((NetworkObjectReference)(ref val2)).TryGet(ref val3, (NetworkManager)null); GrabbableObject component2 = ((Component)val3).GetComponent<GrabbableObject>(); if ((Object)(object)component2 == (Object)null) { StatsTracker.Logger.LogWarning((object)"Unable to retrieve some GrabbableObject from the spawned objects"); return; } if (((Object)component2.itemProperties).name != ((Object)component.itemProperties).name) { return; } } StatsTracker.DayStats.SIDType = ((Component)component).gameObject.GetComponentInChildren<ScanNodeProperties>().headerText; } private static void TrackInfestation(RoundManager __instance) { if (__instance.enemyRushIndex != -1) { StatsTracker.DayStats.InfestationType = ((Object)__instance.currentLevel.Enemies[__instance.enemyRushIndex].enemyType).name; } } private static void TrackIndoorFog(RoundManager __instance) { StatsTracker.DayStats.IndoorFog = ((Component)__instance.indoorFog).gameObject.activeSelf; } private static void TrackMeteorShower(TimeOfDay __instance) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 if ((GameNetworkManager.Instance.gameVersionNum <= 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 1) && (GameNetworkManager.Instance.gameVersionNum > 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 2)) { StatsTracker.DayStats.MeteorShowerTime = StatsTracker.GetCurrentTimeString(); } } private static void CountApp(LungProp __instance) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) StatsTracker.DayStats.AppSpawned = true; appSpawnedThisDay.Add(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject)); } private static void TrackSpawnedItems(NetworkBehaviour __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0038: Unknown result type (might be due to invalid IL or missing references) if (__instance is GrabbableObject && StatsTracker.dayHasStarted) { GrabbableObject val = (GrabbableObject)__instance; if (val.itemProperties.isScrap && !(val is RagdollGrabbableObject)) { objectsExtraSpawnedThisDay.Add(NetworkObjectReference.op_Implicit(((NetworkBehaviour)val).NetworkObject)); ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(WaitUntilItemValueHasBeenSetAndUpdateBottomLine(val)); } } } [IteratorStateMachine(typeof(<WaitUntilItemValueHasBeenSetAndUpdateBottomLine>d__15))] private static IEnumerator WaitUntilItemValueHasBeenSetAndUpdateBottomLine(GrabbableObject instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitUntilItemValueHasBeenSetAndUpdateBottomLine>d__15(0) { instance = instance }; } private static void PopulateObjectInGiftValueForAllClients(object __instance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown GiftBoxItem val = (GiftBoxItem)__instance; Random random = new Random((int)((GrabbableObject)val).targetFloorPosition.x + (int)((GrabbableObject)val).targetFloorPosition.y); Random random2 = new Random((int)((GrabbableObject)val).targetFloorPosition.x + (int)((GrabbableObject)val).targetFloorPosition.y); List<int> list = new List<int>(RoundManager.Instance.currentLevel.spawnableScrap.Count); for (int i = 0; i < RoundManager.Instance.currentLevel.spawnableScrap.Count; i++) { if (RoundManager.Instance.currentLevel.spawnableScrap[i].spawnableItem.itemId == 152767) { list.Add(0); } else { list.Add(RoundManager.Instance.currentLevel.spawnableScrap[i].rarity); } } int randomWeightedIndexList = RoundManager.Instance.GetRandomWeightedIndexList(list, random); Item spawnableItem = RoundManager.Instance.currentLevel.spawnableScrap[randomWeightedIndexList].spawnableItem; val.objectInPresentValue = (int)((float)random2.Next(spawnableItem.minValue + 25, spawnableItem.maxValue + 35) * RoundManager.Instance.scrapValueMultiplier); } private static void TrackMissedItems(NetworkBehaviour __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Expected O, but got Unknown //IL_0094: 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) if (__instance is GrabbableObject && StatsTracker.dayHasStarted) { GrabbableObject val = (GrabbableObject)__instance; if (val.itemProperties.isScrap && !(val is RagdollGrabbableObject) && !((bool?)StatsTracker.DeactivatedField?.GetValue(val)).GetValueOrDefault()) { List<MissingItemInfo> missedItems = StatsTracker.DayStats.MissedItems; string name = (((Object)(object)((Component)val).gameObject.GetComponentInChildren<ScanNodeProperties>() == (Object)null) ? ((Object)val.itemProperties).name : ((Component)val).gameObject.GetComponentInChildren<ScanNodeProperties>().headerText); int scrapValue = val.scrapValue; Vector3 position = ((Component)val).transform.position; bool collectedOnPreviousDay = !objectsExtraSpawnedThisDay.Contains(NetworkObjectReference.op_Implicit(((NetworkBehaviour)val).NetworkObject)); Type? giftBoxItemType = StatsTracker.GiftBoxItemType; missedItems.Add(new MissingItemInfo(name, scrapValue, position, collectedOnPreviousDay, ((object)giftBoxItemType != null && giftBoxItemType.IsInstanceOfType(val)) ? Traverse.Create((object)val).Field("objectInPresentValue").GetValue<int>() : 0)); } } } private static void TrackCollectedItems() { //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) GrabbableObject[] array = Object.FindObjectsByType<GrabbableObject>((FindObjectsSortMode)0); GrabbableObject[] array2 = array; foreach (GrabbableObject val in array2) { if (!val.itemProperties.isScrap || ((bool?)StatsTracker.DeactivatedField?.GetValue(val)).GetValueOrDefault() || val.itemUsedUp || !val.isInShipRoom) { continue; } if (indexFromGiftBox.TryGetValue(NetworkObjectReference.op_Implicit(((NetworkBehaviour)val).NetworkObject), out var value)) { StatsTracker.DayStats.GiftBoxesOpened[value].Collected = true; } if (!objectsExtraSpawnedThisDay.Contains(NetworkObjectReference.op_Implicit(((NetworkBehaviour)val).NetworkObject))) { continue; } StatsTracker.DayStats.CollectedTotal += val.scrapValue; if (objectsNaturallySpawnedThisDay.Contains(NetworkObjectReference.op_Implicit(((NetworkBehaviour)val).NetworkObject))) { StatsTracker.DayStats.CollectedNoExtra += val.scrapValue; continue; } if (valueFromGiftSpawner.TryGetValue(NetworkObjectReference.op_Implicit(((NetworkBehaviour)val).NetworkObject), out var value2)) { StatsTracker.DayStats.CollectedNoExtra += value2; continue; } if (((Object)val.itemProperties).name == "RedLocustHive") { StatsTracker.DayStats.BeeInfo.AddToCollected(val.scrapValue); continue; } Type? eggItemType = StatsTracker.EggItemType; if ((object)eggItemType != null && eggItemType.IsInstanceOfType(val)) { StatsTracker.DayStats.EggInfo.AddToCollected(val.scrapValue); continue; } Type? shotgunItemType = StatsTracker.ShotgunItemType; if ((object)shotgunItemType != null && shotgunItemType.IsInstanceOfType(val)) { StatsTracker.DayStats.ShotgunInfo.AddToCollected(val.scrapValue); continue; } Type? knifeItemType = StatsTracker.KnifeItemType; if ((object)knifeItemType != null && knifeItemType.IsInstanceOfType(val)) { StatsTracker.DayStats.KnifeInfo.AddToCollected(val.scrapValue); } } } private static void AddNewlySpawnedGiftItemToItemTracker(object __instance, NetworkObjectReference netObjectRef) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Invalid comparison between Unknown and I4 //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) GiftBoxItem val = (GiftBoxItem)__instance; if ((GameNetworkManager.Instance.gameVersionNum <= 72 || (int)((NetworkBehaviour)val).__rpc_exec_stage == 1) && (GameNetworkManager.Instance.gameVersionNum > 72 || (int)((NetworkBehaviour)val).__rpc_exec_stage == 2) && StatsTracker.dayHasStarted) { int count = StatsTracker.DayStats.GiftBoxesOpened.Count; StatsTracker.DayStats.GiftBoxesOpened.Add(new GiftBoxInfo(val.objectInPresentValue, ((GrabbableObject)val).scrapValue)); ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(WaitForGiftItemToFullySpawnBeforeTracking(netObjectRef, count, ((GrabbableObject)val).scrapValue, val.objectInPresentValue, objectsExtraSpawnedThisDay.Contains(NetworkObjectReference.op_Implicit(((NetworkBehaviour)val).NetworkObject)))); } } [IteratorStateMachine(typeof(<WaitForGiftItemToFullySpawnBeforeTracking>d__20))] private static IEnumerator WaitForGiftItemToFullySpawnBeforeTracking(NetworkObjectReference netObjRef, int indexForCollectedGift, int originalGiftValue, int newScrapValue, bool giftSpawnedThisDay) { //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 <WaitForGiftItemToFullySpawnBeforeTracking>d__20(0) { netObjRef = netObjRef, indexForCollectedGift = indexForCollectedGift, originalGiftValue = originalGiftValue, newScrapValue = newScrapValue, giftSpawnedThisDay = giftSpawnedThisDay }; } private static void TrackHive(RedLocustBees __instance, int hiveScrapValue) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 if ((GameNetworkManager.Instance.gameVersionNum <= 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 1) && (GameNetworkManager.Instance.gameVersionNum > 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 2)) { StatsTracker.DayStats.BeeInfo.AddToAvailable(hiveScrapValue); } } private static void TrackShotgun(NutcrackerEnemyAI __instance, NetworkObjectReference gunObject) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 if ((GameNetworkManager.Instance.gameVersionNum > 72 && (int)((NetworkBehaviour)__instance).__rpc_exec_stage != 1) || (GameNetworkManager.Instance.gameVersionNum <= 72 && (int)((NetworkBehaviour)__instance).__rpc_exec_stage != 2)) { return; } NetworkObject val = null; ((NetworkObjectReference)(ref gunObject)).TryGet(ref val, (NetworkManager)null); if ((Object)(object)val == (Object)null) { StatsTracker.Logger.LogWarning((object)"Gun in GrabGun function did not contain NetworkObject."); return; } ShotgunItem component = ((Component)val).GetComponent<ShotgunItem>(); if ((Object)(object)component == (Object)null) { StatsTracker.Logger.LogWarning((object)"Gun in GrabGun function did not contain ShotgunItem component."); } else { ((MonoBehaviour)StartOfRound.Instance).StartCoroutine(WaitUntilShotgunValueHasBeenSetBeforeAddingToAvailable(component)); } } [IteratorStateMachine(typeof(<WaitUntilShotgunValueHasBeenSetBeforeAddingToAvailable>d__23))] private static IEnumerator WaitUntilShotgunValueHasBeenSetBeforeAddingToAvailable(ShotgunItem instance) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <WaitUntilShotgunValueHasBeenSetBeforeAddingToAvailable>d__23(0) { instance = instance }; } private static void TrackKnifeBeforePopping(ButlerEnemyAI __instance) { StatsTracker.DayStats.BottomLineTrue += 35; StatsTracker.DayStats.KnifeInfo.AddToAvailable(35); } private static void TrackButlerPopAndRemoveFakeValue(ButlerEnemyAI __instance) { StatsTracker.DayStats.BottomLineTrue -= 35; } private static void TrackEggs(GiantKiwiAI __instance, int[] eggScrapValues) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 if ((GameNetworkManager.Instance.gameVersionNum <= 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 1) && (GameNetworkManager.Instance.gameVersionNum > 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 2)) { foreach (int value in eggScrapValues) { StatsTracker.DayStats.EggInfo.AddToAvailable(value); } } } } internal class PlayerTracker { public static void ApplyPlayerTrackerPatches(Harmony Harmony) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown Harmony.Patch((MethodBase)AccessTools.Method(typeof(PlayerControllerB), "KillPlayerClientRpc", (Type[])null, (Type[])null), new HarmonyMethod(typeof(PlayerTracker), "TrackDeath", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony.Patch((MethodBase)AccessTools.Method(typeof(StartOfRound), "OnPlayerDC", (Type[])null, (Type[])null), new HarmonyMethod(typeof(PlayerTracker), "TrackDisconnect", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void TrackDeath(PlayerControllerB __instance, int causeOfDeath) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_004a: 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_002c: Invalid comparison between Unknown and I4 if ((GameNetworkManager.Instance.gameVersionNum <= 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 1) && (GameNetworkManager.Instance.gameVersionNum > 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 2)) { PlayerStats playerStats = StatsTracker.DayStats.Players[__instance.playerSteamId]; string currentTimeString = StatsTracker.GetCurrentTimeString(); CauseOfDeath val = (CauseOfDeath)causeOfDeath; playerStats.Kill(currentTimeString, ((object)(CauseOfDeath)(ref val)).ToString()); } } private static void TrackDisconnect(StartOfRound __instance, int playerObjectNumber) { StatsTracker.DayStats.Players[__instance.allPlayerScripts[playerObjectNumber].playerSteamId].Disconnect(); } } internal class ServerEvents { [CompilerGenerated] private sealed class <>c__DisplayClass4_0 { public int prevQuota; internal bool <PublishDayStatsAfterQuotaRoll>b__0() { return TimeOfDay.Instance.profitQuota != prevQuota; } } [CompilerGenerated] private sealed class <PublishDayStatsAfterQuotaRoll>d__4 : IEnumerator<object>, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public int prevQuota; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <PublishDayStatsAfterQuotaRoll>d__4(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitUntil((Func<bool>)new <>c__DisplayClass4_0 { prevQuota = prevQuota }.<PublishDayStatsAfterQuotaRoll>b__0); <>1__state = 1; return true; case 1: <>1__state = -1; StatsTracker.DayStats.NewQuota = TimeOfDay.Instance.profitQuota; StatsTracker.LocalServer.PublishStats(JsonConvert.SerializeObject((object)StatsTracker.DayStats)); 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(); } } public static void ApplyServerEventPatches(Harmony Harmony) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown Harmony.Patch((MethodBase)AccessTools.Method(typeof(StartOfRound), "ResetPlayersLoadedValueClientRpc", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ServerEvents), "StartTrackingNewday", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony.Patch((MethodBase)AccessTools.Method(typeof(RoundManager), "FinishGeneratingNewLevelClientRpc", (Type[])null, (Type[])null), new HarmonyMethod(typeof(ServerEvents), "TrackNewSeed", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony.Patch((MethodBase)AccessTools.Method(typeof(StartOfRound), "PassTimeToNextDay", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(ServerEvents), "PublishDayStats", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void StartTrackingNewday(StartOfRound __instance) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 if ((GameNetworkManager.Instance.gameVersionNum <= 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 1) && (GameNetworkManager.Instance.gameVersionNum > 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 2)) { StatsTracker.DayStats = new Stats(GameNetworkManager.Instance.gameVersionNum, __instance.currentLevel.PlanetName, ((int)__instance.currentLevel.currentWeather == -1) ? "Mild" : ((object)(LevelWeatherType)(ref __instance.currentLevel.currentWeather)).ToString(), new ArraySegment<PlayerControllerB>(__instance.allPlayerScripts, 0, __instance.connectedPlayersAmount + 1).ToArray()); StatsTracker.dayHasStarted = true; TimeOfDay.Instance.normalizedTimeOfDay = 0f; } } private static void TrackNewSeed(RoundManager __instance) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 if ((GameNetworkManager.Instance.gameVersionNum <= 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 1) && (GameNetworkManager.Instance.gameVersionNum > 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 2)) { StatsTracker.DayStats.Seed = StartOfRound.Instance.randomMapSeed; } } private static void PublishDayStats(StartOfRound __instance) { if (TimeOfDay.Instance.profitQuota - TimeOfDay.Instance.quotaFulfilled <= 0) { ((MonoBehaviour)__instance).StartCoroutine(PublishDayStatsAfterQuotaRoll(TimeOfDay.Instance.profitQuota)); } else { StatsTracker.LocalServer.PublishStats(JsonConvert.SerializeObject((object)StatsTracker.DayStats)); } StatsTracker.dayHasStarted = false; } [IteratorStateMachine(typeof(<PublishDayStatsAfterQuotaRoll>d__4))] private static IEnumerator PublishDayStatsAfterQuotaRoll(int prevQuota) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <PublishDayStatsAfterQuotaRoll>d__4(0) { prevQuota = prevQuota }; } } internal class ShipTracker { public static void ApplyShipTrackerPatches(Harmony Harmony) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown Harmony.Patch((MethodBase)AccessTools.Method(typeof(StartOfRound), "ShipLeave", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(ShipTracker), "RegisterTakeOffTime", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void RegisterTakeOffTime(StartOfRound __instance) { StatsTracker.DayStats.TakeOffTime = StatsTracker.GetCurrentTimeString(); } } internal class SpawnTracker { private static readonly Dictionary<NetworkObjectReference, int> EnemyToSpawnInfoIndex = new Dictionary<NetworkObjectReference, int>(); public static void ApplySpawnTrackerPatches(Harmony Harmony) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Expected O, but got Unknown Harmony.Patch((MethodBase)AccessTools.Method(typeof(RoundManager), "GenerateNewLevelClientRpc", (Type[])null, (Type[])null), new HarmonyMethod(typeof(SpawnTracker), "ResetSpawnTrackerWhenStartingNewDay", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony.Patch((MethodBase)AccessTools.Method(typeof(EnemyAI), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(SpawnTracker), "TrackSpawn", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); Harmony.Patch((MethodBase)AccessTools.Method(typeof(EnemyAI), "KillEnemy", (Type[])null, (Type[])null), new HarmonyMethod(typeof(SpawnTracker), "TrackDeath", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } private static void ResetSpawnTrackerWhenStartingNewDay(RoundManager __instance) { //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Invalid comparison between Unknown and I4 //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 if ((GameNetworkManager.Instance.gameVersionNum <= 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 1) && (GameNetworkManager.Instance.gameVersionNum > 72 || (int)((NetworkBehaviour)__instance).__rpc_exec_stage == 2)) { EnemyToSpawnInfoIndex.Clear(); } } private static void TrackSpawn(EnemyAI __instance) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) if (__instance.enemyType.isDaytimeEnemy) { EnemyToSpawnInfoIndex[NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject)] = StatsTracker.DayStats.DayTimeSpawns.Count; StatsTracker.DayStats.DayTimeSpawns.Add(new SpawnInfo(__instance.enemyType, StatsTracker.GetCurrentTimeString())); } else if (__instance.enemyType.isOutsideEnemy) { EnemyToSpawnInfoIndex[NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject)] = StatsTracker.DayStats.NightTimeSpawns.Count; StatsTracker.DayStats.NightTimeSpawns.Add(new SpawnInfo(__instance.enemyType, StatsTracker.GetCurrentTimeString())); } else { EnemyToSpawnInfoIndex[NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject)] = StatsTracker.DayStats.IndoorSpawns.Count; StatsTracker.DayStats.IndoorSpawns.Add(new SpawnInfo(__instance.enemyType, StatsTracker.GetCurrentTimeString())); } } private static void TrackDeath(EnemyAI __instance) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) EnemyToSpawnInfoIndex.TryGetValue(NetworkObjectReference.op_Implicit(((NetworkBehaviour)__instance).NetworkObject), out var value); try { if (__instance.enemyType.isDaytimeEnemy) { StatsTracker.DayStats.DayTimeSpawns[value].TimeOfDeath = StatsTracker.GetCurrentTimeString(); } else if (__instance.enemyType.isOutsideEnemy) { StatsTracker.DayStats.NightTimeSpawns[value].TimeOfDeath = StatsTracker.GetCurrentTimeString(); } else { StatsTracker.DayStats.IndoorSpawns[value].TimeOfDeath = StatsTracker.GetCurrentTimeString(); } } catch (Exception ex) { StatsTracker.Logger.LogError((object)("Error when registering enemy death: " + ex.Message + "\n$" + ex.StackTrace)); } } } } namespace System.Runtime.CompilerServices { [AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)] internal sealed class IgnoresAccessChecksToAttribute : Attribute { public IgnoresAccessChecksToAttribute(string assemblyName) { } } }