using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
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(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("Omniscye")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ChaosStatTracker")]
[assembly: AssemblyTitle("ChaosStatTracker")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.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 OmniChaosTracker
{
[HarmonyPatch(typeof(ChatManager), "Update")]
public static class Patch_ChaosOverlayInit
{
private static GameObject overlayHolder;
private static void Postfix()
{
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Expected O, but got Unknown
if ((Object)(object)overlayHolder == (Object)null)
{
overlayHolder = new GameObject("ChaosStatsOverlay", new Type[1] { typeof(ChaosStatsDrawer) });
Object.DontDestroyOnLoad((Object)(object)overlayHolder);
}
}
}
[HarmonyPatch(typeof(LevelGenerator), "Generate")]
public static class Patch_ResetStats
{
private static void Prefix()
{
ChaosStatsDrawer.ResetStats();
}
}
[HarmonyPatch(typeof(PlayerHealth), "Death")]
public static class Patch_TrackDeaths
{
private static void Postfix()
{
ChaosStatsDrawer.RecordDeath("YOU");
}
}
[HarmonyPatch(typeof(ValuableObject), "DiscoverRPC")]
public static class Patch_TrackLootDiscovery
{
private static void Prefix()
{
ChaosStatsDrawer.RecordLoot("YOU");
}
}
[HarmonyPatch(typeof(PhysGrabObjectImpactDetector), "BreakRPC")]
public static class Patch_TrackValueLoss
{
private static void Prefix(float valueLost)
{
ChaosStatsDrawer.RecordValueLoss("YOU", valueLost);
}
}
public class ChaosStatsDrawer : MonoBehaviour
{
private static Dictionary<string, int> deaths = new Dictionary<string, int>();
private static Dictionary<string, int> loots = new Dictionary<string, int>();
private static Dictionary<string, float> valueLost = new Dictionary<string, float>();
private static float levelTimer;
private static bool showOverlay = true;
public static void RecordDeath(string name)
{
if (!deaths.ContainsKey(name))
{
deaths[name] = 0;
}
deaths[name]++;
}
public static void RecordLoot(string name)
{
if (!loots.ContainsKey(name))
{
loots[name] = 0;
}
loots[name]++;
}
public static void RecordValueLoss(string name, float amount)
{
if (!valueLost.ContainsKey(name))
{
valueLost[name] = 0f;
}
valueLost[name] += amount;
}
public static void ResetStats()
{
deaths.Clear();
loots.Clear();
valueLost.Clear();
levelTimer = 0f;
}
private void Update()
{
levelTimer += Time.deltaTime;
if (Input.GetKeyDown((KeyCode)277))
{
showOverlay = !showOverlay;
}
}
private void OnGUI()
{
//IL_0012: 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_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
if (showOverlay)
{
GUI.color = Color.black;
GUI.Box(new Rect(8f, 8f, 320f, 160f), GUIContent.none);
GUI.color = Color.white;
GUILayout.BeginArea(new Rect(10f, 10f, 300f, 1000f));
GUILayout.Label("<b><size=16>\ud83d\udd25 CHAOS STATS \ud83d\udd25</size></b>", Array.Empty<GUILayoutOption>());
GUILayout.Label($"⏱\ufe0f Time: {levelTimer:F1}s", Array.Empty<GUILayoutOption>());
GUILayout.Label(string.Format("\ud83d\udc80 Deaths: {0}", deaths.GetValueOrDefault("YOU", 0)), Array.Empty<GUILayoutOption>());
GUILayout.Label(string.Format("\ud83d\udce6 Loot Found: {0}", loots.GetValueOrDefault("YOU", 0)), Array.Empty<GUILayoutOption>());
GUILayout.Label(string.Format("\ud83d\udcb8 Value Lost: ${0}", Mathf.RoundToInt(valueLost.GetValueOrDefault("YOU", 0f))), Array.Empty<GUILayoutOption>());
GUILayout.EndArea();
}
}
}
}
namespace ChaosStatTracker
{
[BepInPlugin("Omniscye.ChaosStatTracker", "ChaosStatTracker", "1.0")]
public class ChaosStatTracker : BaseUnityPlugin
{
internal static ChaosStatTracker Instance { get; private set; }
internal static ManualLogSource Logger => Instance._logger;
private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger;
internal Harmony? Harmony { get; set; }
private void Awake()
{
Instance = this;
((Component)this).gameObject.transform.parent = null;
((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
Patch();
Logger.LogInfo((object)$"{((BaseUnityPlugin)this).Info.Metadata.GUID} v{((BaseUnityPlugin)this).Info.Metadata.Version} has loaded!");
}
internal void Patch()
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Expected O, but got Unknown
//IL_0026: Expected O, but got Unknown
if (Harmony == null)
{
Harmony val = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID);
Harmony val2 = val;
Harmony = val;
}
Harmony.PatchAll();
}
internal void Unpatch()
{
Harmony? harmony = Harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
}
private void Update()
{
}
}
}