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.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("ObjectTrackerMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+ba192c8c017e44b28ce8987753f779d39e05be1a")]
[assembly: AssemblyProduct("ObjectTrackerMod")]
[assembly: AssemblyTitle("ObjectTrackerMod")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[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]
[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]
[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 ObjectTrackerMod
{
[BepInPlugin("com.github.antigravity.objecttrackermod", "Object Tracker Mod", "2.1.1")]
public class Plugin : BaseUnityPlugin
{
public class TrackedItem
{
public string Name { get; set; }
public int Total { get; set; }
public int Collected { get; set; }
public TrackedItem(string name)
{
Name = name;
Total = 0;
Collected = 0;
}
public void Reset()
{
Total = 0;
Collected = 0;
}
}
public static ManualLogSource? Log;
private Harmony? _harmony;
public static ConfigEntry<bool>? ShowUI;
public static ConfigEntry<KeyCode>? ToggleKey;
public static ConfigEntry<float>? WindowPositionX;
public static ConfigEntry<float>? WindowPositionY;
private Rect _windowRect = new Rect(25f, 180f, 176f, 264f);
private const int WindowID = 987654;
private Texture2D? _bgTexture;
private Texture2D? _cardBgTexture;
private GUIStyle? _windowStyle;
private GUIStyle? _cardStyle;
private GUIStyle? _headerStyle;
private GUIStyle? _labelStyle;
private GUIStyle? _valueStyle;
public static readonly HashSet<int> PushedObjectIds = new HashSet<int>();
public static readonly HashSet<int> RemovedObjectIds = new HashSet<int>();
public static TrackedItem BuffShrines = new TrackedItem("Buff Shrines");
public static TrackedItem WolfStatues = new TrackedItem("Wolf Shrines");
public static TrackedItem RabbitStatues = new TrackedItem("Rabbit Shrines");
public static TrackedItem BearStatues = new TrackedItem("Bear Shrines");
public static TrackedItem FoxStatues = new TrackedItem("Fox Shrines");
public static TrackedItem XpBags = new TrackedItem("XP Bags");
public static TrackedItem Chests = new TrackedItem("Chests");
public static TrackedItem CursedBells = new TrackedItem("Cursed Bells");
public static TrackedItem Lairs = new TrackedItem("Lairs");
private void Awake()
{
//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0100: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
Log.LogInfo((object)"Sineus Arena Object Tracker Mod initializing...");
try
{
ShowUI = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "ShowUI", true, "Show or hide the Object Tracker UI overlay.");
ToggleKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "ToggleKey", (KeyCode)288, "Key to toggle the Object Tracker UI visibility.");
WindowPositionX = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "WindowPositionX", 25f, "X position of the window.");
WindowPositionY = ((BaseUnityPlugin)this).Config.Bind<float>("UI", "WindowPositionY", 180f, "Y position of the window.");
((Rect)(ref _windowRect)).x = WindowPositionX.Value;
((Rect)(ref _windowRect)).y = WindowPositionY.Value;
((Rect)(ref _windowRect)).width = 176f;
((Rect)(ref _windowRect)).height = 264f;
_harmony = new Harmony("com.github.antigravity.objecttrackermod");
_harmony.PatchAll();
SceneManager.sceneLoaded += OnSceneLoaded;
Log.LogInfo((object)"Object Tracker Mod v2.1.1 loaded successfully!");
}
catch (Exception ex)
{
Log.LogError((object)("Failed to initialize Object Tracker Mod: " + ex));
}
}
private void OnSceneLoaded(Scene scene, LoadSceneMode mode)
{
ManualLogSource? log = Log;
if (log != null)
{
log.LogInfo((object)("[ObjectTracker] Scene loaded: " + ((Scene)(ref scene)).name + ". Resetting counters for new run."));
}
ResetAllTrackers();
}
public static void ResetAllTrackers()
{
ManualLogSource? log = Log;
if (log != null)
{
log.LogInfo((object)"[ObjectTracker] Resetting all object tracker counters.");
}
BuffShrines.Reset();
WolfStatues.Reset();
RabbitStatues.Reset();
BearStatues.Reset();
FoxStatues.Reset();
XpBags.Reset();
Chests.Reset();
CursedBells.Reset();
Lairs.Reset();
PushedObjectIds.Clear();
RemovedObjectIds.Clear();
}
private void Update()
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
if (ToggleKey != null && Input.GetKeyDown(ToggleKey.Value) && ShowUI != null)
{
ShowUI.Value = !ShowUI.Value;
}
}
private void InitStyles()
{
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Expected O, but got Unknown
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Expected O, but got Unknown
//IL_00ad: Expected O, but got Unknown
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00f7: Expected O, but got Unknown
//IL_00f8: 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_010e: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Expected O, but got Unknown
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0122: Unknown result type (might be due to invalid IL or missing references)
//IL_012c: Expected O, but got Unknown
//IL_0131: Expected O, but got Unknown
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_0141: Unknown result type (might be due to invalid IL or missing references)
//IL_0149: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0173: Unknown result type (might be due to invalid IL or missing references)
//IL_0182: Expected O, but got Unknown
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
//IL_0192: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01b4: Expected O, but got Unknown
if (_windowStyle == null)
{
_bgTexture = MakeTex(2, 2, new Color(0.055f, 0.07f, 0.094f, 0.9f));
_cardBgTexture = MakeTex(2, 2, new Color(0.12f, 0.15f, 0.2f, 0.55f));
GUIStyle val = new GUIStyle(GUI.skin.window);
val.normal.background = _bgTexture;
val.onNormal.background = _bgTexture;
val.border = new RectOffset(2, 2, 2, 2);
val.padding = new RectOffset(6, 6, 4, 12);
_windowStyle = val;
GUIStyle val2 = new GUIStyle(GUI.skin.label)
{
alignment = (TextAnchor)4,
fontSize = 12,
fontStyle = (FontStyle)1
};
val2.normal.textColor = new Color(0.95f, 0.75f, 0.3f);
_headerStyle = val2;
GUIStyle val3 = new GUIStyle();
val3.normal.background = _cardBgTexture;
val3.padding = new RectOffset(4, 4, 1, 1);
val3.margin = new RectOffset(0, 0, 1, 1);
_cardStyle = val3;
GUIStyle val4 = new GUIStyle(GUI.skin.label)
{
fontSize = 12,
fontStyle = (FontStyle)0,
alignment = (TextAnchor)3,
wordWrap = false
};
val4.normal.textColor = new Color(0.85f, 0.9f, 0.95f);
_labelStyle = val4;
_valueStyle = new GUIStyle(GUI.skin.label)
{
fontSize = 12,
fontStyle = (FontStyle)1,
alignment = (TextAnchor)5,
wordWrap = false
};
}
}
private Texture2D MakeTex(int width, int height, Color col)
{
//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_0021: 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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
Color[] array = (Color[])(object)new Color[width * height];
for (int i = 0; i < array.Length; i++)
{
array[i] = col;
}
Texture2D val = new Texture2D(width, height);
val.SetPixels(array);
val.Apply();
return val;
}
private void OnGUI()
{
//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_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Expected O, but got Unknown
//IL_006a: 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)
if (ShowUI == null || !ShowUI.Value)
{
return;
}
Scene activeScene = SceneManager.GetActiveScene();
string name = ((Scene)(ref activeScene)).name;
if (name.IndexOf("Lobby", StringComparison.OrdinalIgnoreCase) < 0 && name.IndexOf("Menu", StringComparison.OrdinalIgnoreCase) < 0)
{
InitStyles();
_windowRect = GUI.Window(987654, _windowRect, new WindowFunction(DrawWindow), "", _windowStyle);
if (((Rect)(ref _windowRect)).x != WindowPositionX?.Value)
{
WindowPositionX.Value = ((Rect)(ref _windowRect)).x;
}
if (((Rect)(ref _windowRect)).y != WindowPositionY?.Value)
{
WindowPositionY.Value = ((Rect)(ref _windowRect)).y;
}
}
}
private void DrawWindow(int windowID)
{
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
GUILayout.Label("OBJECT TRACKER", _headerStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(16f) });
GUILayout.EndHorizontal();
GUILayout.Space(2f);
DrawTrackerRow(BuffShrines);
DrawTrackerRow(WolfStatues);
DrawTrackerRow(RabbitStatues);
DrawTrackerRow(BearStatues);
DrawTrackerRow(FoxStatues);
DrawTrackerRow(XpBags);
DrawTrackerRow(Chests);
DrawTrackerRow(CursedBells);
DrawTrackerRow(Lairs);
GUILayout.EndVertical();
GUI.DragWindow(new Rect(0f, 0f, 1000f, 20f));
}
private void DrawTrackerRow(TrackedItem item)
{
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
GUILayout.BeginHorizontal(_cardStyle, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(19f) });
GUILayout.Label(item.Name, _labelStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
{
GUILayout.Width(90f),
GUILayout.Height(17f)
});
bool flag = item.Total > 0 && item.Collected >= item.Total;
_valueStyle.normal.textColor = (flag ? new Color(0.35f, 0.95f, 0.45f) : ((item.Collected > 0) ? new Color(0.35f, 0.85f, 1f) : new Color(0.95f, 0.8f, 0.35f)));
GUILayout.Label($"{item.Collected} / {item.Total}", _valueStyle, (GUILayoutOption[])(object)new GUILayoutOption[2]
{
GUILayout.Width(62f),
GUILayout.Height(17f)
});
GUILayout.EndHorizontal();
}
}
[HarmonyPatch(typeof(WolfShrine), "PushToMinimap")]
public static class WolfShrine_Push_Patch
{
[HarmonyPostfix]
public static void Postfix(WolfShrine __instance)
{
if ((Object)(object)__instance != (Object)null && Plugin.PushedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.WolfStatues.Total++;
}
}
}
[HarmonyPatch(typeof(WolfShrine), "RemoveIcon")]
public static class WolfShrine_Remove_Patch
{
[HarmonyPostfix]
public static void Postfix(WolfShrine __instance)
{
if ((Object)(object)__instance != (Object)null && Plugin.RemovedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.WolfStatues.Collected++;
}
}
}
[HarmonyPatch(typeof(BearShrine), "PushToMinimap")]
public static class BearShrine_Push_Patch
{
[HarmonyPostfix]
public static void Postfix(BearShrine __instance)
{
if ((Object)(object)__instance != (Object)null && Plugin.PushedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.BearStatues.Total++;
}
}
}
[HarmonyPatch(typeof(BearShrine), "RemoveIcon")]
public static class BearShrine_Remove_Patch
{
[HarmonyPostfix]
public static void Postfix(BearShrine __instance)
{
if ((Object)(object)__instance != (Object)null && Plugin.RemovedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.BearStatues.Collected++;
}
}
}
[HarmonyPatch(typeof(RabbitShrine), "PushToMinimap")]
public static class RabbitShrine_Push_Patch
{
[HarmonyPostfix]
public static void Postfix(RabbitShrine __instance)
{
if ((Object)(object)__instance != (Object)null && Plugin.PushedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.RabbitStatues.Total++;
}
}
}
[HarmonyPatch(typeof(RabbitShrine), "RemoveIcon")]
public static class RabbitShrine_Remove_Patch
{
[HarmonyPostfix]
public static void Postfix(RabbitShrine __instance)
{
if ((Object)(object)__instance != (Object)null && Plugin.RemovedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.RabbitStatues.Collected++;
}
}
}
[HarmonyPatch(typeof(GreedShrine), "PushToMinimap")]
public static class GreedShrine_Push_Patch
{
[HarmonyPostfix]
public static void Postfix(GreedShrine __instance)
{
if ((Object)(object)__instance != (Object)null && Plugin.PushedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.FoxStatues.Total++;
}
}
}
[HarmonyPatch(typeof(GreedShrine), "RemoveIcon")]
public static class GreedShrine_Remove_Patch
{
[HarmonyPostfix]
public static void Postfix(GreedShrine __instance)
{
if ((Object)(object)__instance != (Object)null && Plugin.RemovedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.FoxStatues.Collected++;
}
}
}
[HarmonyPatch(typeof(BuffShrine), "PushToMinimap")]
public static class BuffShrine_Push_Patch
{
[HarmonyPostfix]
public static void Postfix(BuffShrine __instance)
{
if ((Object)(object)__instance != (Object)null && Plugin.PushedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.BuffShrines.Total++;
}
}
}
[HarmonyPatch(typeof(BuffShrine), "RemoveIcon")]
public static class BuffShrine_Remove_Patch
{
[HarmonyPostfix]
public static void Postfix(BuffShrine __instance)
{
if ((Object)(object)__instance != (Object)null && Plugin.RemovedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.BuffShrines.Collected++;
}
}
}
[HarmonyPatch(typeof(AnkhoBag), "PushToMinimap")]
public static class AnkhoBag_Push_Patch
{
[HarmonyPostfix]
public static void Postfix(AnkhoBag __instance)
{
if ((Object)(object)__instance != (Object)null && Plugin.PushedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.XpBags.Total++;
}
}
}
[HarmonyPatch(typeof(AnkhoBag), "RemoveIcon")]
public static class AnkhoBag_Remove_Patch
{
[HarmonyPostfix]
public static void Postfix(AnkhoBag __instance)
{
if ((Object)(object)__instance != (Object)null && Plugin.RemovedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.XpBags.Collected++;
}
}
}
[HarmonyPatch(typeof(BuffChest), "PushToMinimap")]
public static class BuffChest_Push_Patch
{
[HarmonyPostfix]
public static void Postfix(BuffChest __instance)
{
if ((Object)(object)__instance != (Object)null && Plugin.PushedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.Chests.Total++;
}
}
}
[HarmonyPatch(typeof(BuffChest), "RemoveIcon")]
public static class BuffChest_Remove_Patch
{
[HarmonyPostfix]
public static void Postfix(BuffChest __instance)
{
if ((Object)(object)__instance != (Object)null && Plugin.RemovedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.Chests.Collected++;
}
}
}
[HarmonyPatch(typeof(CursedBell), "PushToMinimap")]
public static class CursedBell_Push_Patch
{
[HarmonyPostfix]
public static void Postfix(CursedBell __instance)
{
if ((Object)(object)__instance != (Object)null && Plugin.PushedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.CursedBells.Total++;
}
}
}
[HarmonyPatch(typeof(CursedBell), "RemoveIcon")]
public static class CursedBell_Remove_Patch
{
[HarmonyPostfix]
public static void Postfix(CursedBell __instance)
{
if ((Object)(object)__instance != (Object)null && Plugin.RemovedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.CursedBells.Collected++;
}
}
}
[HarmonyPatch(typeof(InteractableLairSpawner), "PushToMinimap")]
public static class InteractableLairSpawner_Push_Patch
{
[HarmonyPostfix]
public static void Postfix(InteractableLairSpawner __instance)
{
if ((Object)(object)__instance != (Object)null && !__instance.IsFinalBossLair && Plugin.PushedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.Lairs.Total++;
}
}
}
[HarmonyPatch(typeof(InteractableLairSpawner), "RemoveIcon")]
public static class InteractableLairSpawner_Remove_Patch
{
[HarmonyPostfix]
public static void Postfix(InteractableLairSpawner __instance)
{
if ((Object)(object)__instance != (Object)null && !__instance.IsFinalBossLair && Plugin.RemovedObjectIds.Add(((Object)__instance).GetInstanceID()))
{
Plugin.Lairs.Collected++;
}
}
}
[HarmonyPatch(typeof(InteractableObjectsGenerator), "RegenerateObjects")]
public static class InteractableObjectsGenerator_RegenerateObjects_Patch
{
[HarmonyPrefix]
[HarmonyPostfix]
public static void ResetTrackers()
{
Plugin.ResetAllTrackers();
}
}
[HarmonyPatch(typeof(InteractableObjectsGenerator), "DestroyAllSceneBuffChests")]
public static class InteractableObjectsGenerator_DestroyChests_Patch
{
[HarmonyPrefix]
public static void Prefix()
{
Plugin.Chests.Reset();
Plugin.PushedObjectIds.Clear();
Plugin.RemovedObjectIds.Clear();
}
}
[HarmonyPatch(typeof(GameStageManager), "GoToNextStage")]
public static class GameStageManager_GoToNextStage_Patch
{
[HarmonyPrefix]
[HarmonyPostfix]
public static void ResetTrackers()
{
Plugin.ResetAllTrackers();
}
}
}