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 MountainShrineCounter v2.1.1
MountainShrineCounter.dll
Decompiled 21 hours agousing System; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using Microsoft.CodeAnalysis; using RoR2; using RoR2.UI; using UnityEngine; [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("MountainShrineCounter")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MountainShrineCounter")] [assembly: AssemblyTitle("MountainShrineCounter")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [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 MountainShrineCounter { [BepInPlugin("com.tuusuario.mountainshrinecounter", "MountainShrineCounter", "2.1.1")] public class Plugin : BaseUnityPlugin { public const string GUID = "com.tuusuario.mountainshrinecounter"; public const string Name = "MountainShrineCounter"; public const string Version = "2.1.1"; private void Awake() { ObjectivePanelController.collectObjectiveSources += OnCollectObjectiveSources; Stage.onStageStartGlobal += OnStageStart; Run.onRunStartGlobal += OnRunStart; } private void OnDestroy() { ObjectivePanelController.collectObjectiveSources -= OnCollectObjectiveSources; Stage.onStageStartGlobal -= OnStageStart; Run.onRunStartGlobal -= OnRunStart; } private static void OnRunStart(Run run) { ShrineData.ResetRun(); } private static void OnStageStart(Stage stage) { ShrineData.BankCurrentStage(); ShrineData.Invalidate(); } private static void OnCollectObjectiveSources(CharacterMaster master, List<ObjectiveSourceDescriptor> objectiveSourcesList) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) TeleporterInteraction instance = TeleporterInteraction.instance; if (Object.op_Implicit((Object)(object)instance)) { ShrineData.Observe(instance); ShrineData.Refresh(); ShrineData.Snapshot(); if (ShrineData.Total > 0) { objectiveSourcesList.Add(new ObjectiveSourceDescriptor { master = master, objectiveType = typeof(MountainRunObjectiveTracker), source = (Object)(object)instance }); } } } } internal static class ShrineData { private static float nextRefresh; private const float BaselineGraceSeconds = 1.5f; private static TeleporterInteraction trackedTeleporter; private static int baseline; private static float baselineLockTime; private static int bankedActive; private static int bankedTotal; private static int snapshotActive; private static int snapshotTotal; public static int Total { get; private set; } public static int Active { get { TeleporterInteraction instance = TeleporterInteraction.instance; if (!Object.op_Implicit((Object)(object)instance)) { return 0; } Observe(instance); return Math.Max(0, instance.shrineBonusStacks - baseline); } } public static int LevelActive => Active; public static int LevelTotal => Math.Max(Total, Active); public static int RunActive => bankedActive + LevelActive; public static int RunTotal => bankedTotal + LevelTotal; public static void Snapshot() { snapshotActive = LevelActive; snapshotTotal = LevelTotal; } public static void BankCurrentStage() { bankedActive += snapshotActive; bankedTotal += snapshotTotal; snapshotActive = 0; snapshotTotal = 0; } public static void ResetRun() { bankedActive = 0; bankedTotal = 0; snapshotActive = 0; snapshotTotal = 0; Invalidate(); } public static void Observe(TeleporterInteraction tp) { if ((Object)(object)tp != (Object)(object)trackedTeleporter) { trackedTeleporter = tp; baselineLockTime = Time.unscaledTime + 1.5f; baseline = tp.shrineBonusStacks; } else if (Time.unscaledTime < baselineLockTime) { baseline = tp.shrineBonusStacks; } } public static void Invalidate() { Total = 0; nextRefresh = 0f; trackedTeleporter = null; baseline = 0; } public static void Refresh() { if (!(Time.unscaledTime < nextRefresh)) { nextRefresh = Time.unscaledTime + 1f; Total = Object.FindObjectsOfType<ShrineBossBehavior>().Length; } } public static string GetShrineName() { string text = Language.GetString("SHRINE_BOSS_NAME"); if (!(text == "SHRINE_BOSS_NAME")) { return text; } return "Shrine of the Mountain"; } public static string GetRunWord() { return Language.currentLanguageName switch { "es-ES" => "Partida", "pt-BR" => "Partida", "fr" => "Partie", "it" => "Partita", _ => "Run", }; } public static string Format(int active, int total) { string text = ((active >= total) ? "cIsHealing" : "cEvent"); return "<style=" + text + ">" + active + "/" + total + "</style>"; } } public class MountainRunObjectiveTracker : ObjectiveTracker { private string lastString; public override bool shouldConsiderComplete { get { int runTotal = ShrineData.RunTotal; if (runTotal > 0) { return ShrineData.RunActive >= runTotal; } return false; } } public override string GenerateString() { lastString = BuildString(); return lastString; } public override bool IsDirty() { return lastString != BuildString(); } private static string BuildString() { return ShrineData.GetShrineName() + " · " + ShrineData.GetRunWord() + " (" + ShrineData.Format(ShrineData.RunActive, ShrineData.RunTotal) + ")"; } } }