using System;
using System.Collections;
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.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EnergizeInspireVisible;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Obeliskial_Essentials;
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: AssemblyCompany("com.binbin.EnergizeInspireVisible")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.1.0.0")]
[assembly: AssemblyInformationalVersion("1.1.0")]
[assembly: AssemblyProduct("EnergizeInspireVisible")]
[assembly: AssemblyTitle("com.binbin.EnergizeInspireVisible")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.1.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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
public static class EssentialsCompatibility
{
private static bool? _enabled;
public static bool Enabled
{
get
{
bool valueOrDefault = _enabled == true;
if (!_enabled.HasValue)
{
valueOrDefault = Chainloader.PluginInfos.ContainsKey("com.stiffmeds.obeliskialessentials");
_enabled = valueOrDefault;
}
return _enabled.Value;
}
}
[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)]
public static void EssentialsRegister()
{
Essentials.RegisterMod(Plugin.PluginName, "binbin", "Makes Energize and Inspire visible in the queue of auras/curses.", Plugin.PluginVersion, Plugin.ModDate, "https://github.com/binbinmods/EnergizeInspireVisible", (string[])null, "", 100, (string[])null, "", true);
Plugin.LogInfo(Plugin.PluginVersion + " has loaded with Essentials!");
}
}
namespace EnergizeInspireVisible
{
[HarmonyPatch]
public class EnergizeInspireVisiblePatches
{
[MethodImpl(MethodImplOptions.NoInlining)]
[HarmonyPostfix]
[HarmonyPatch(typeof(Globals), "CreateGameContentRoutine")]
public static void CreateGameContentRoutine(ref IEnumerator __result)
{
__result = Plugin.RunAfter(__result, CreateGameContentPostfix);
}
public static void CreateGameContentPostfix()
{
UpdateAuraCurses();
}
public static void UpdateAuraCurses()
{
try
{
Plugin.LogDebug("Starting to set IconShow for Energize, Inspire, Stress, and Fatigue", "UpdateAuraCurses");
Dictionary<string, AuraCurseData> value = Traverse.Create((object)Globals.Instance).Field("_AurasCursesSource").GetValue<Dictionary<string, AuraCurseData>>();
foreach (AuraCurseData value3 in value.Values)
{
Plugin.LogDebug("Checking " + value3.Id, "UpdateAuraCurses");
if (!((Object)(object)value3 == (Object)null) && !string.IsNullOrEmpty(value3.Id) && (Plugin.MakeAllACVisible.Value || value3.Id == "energize" || value3.Id == "inspire" || value3.Id == "stress" || value3.Id == "fatigue"))
{
Plugin.LogDebug("Setting IconShow to true for " + value3.Id, "UpdateAuraCurses");
value3.IconShow = true;
}
}
Traverse.Create((object)Globals.Instance).Field("_AurasCursesSource").SetValue((object)value);
Dictionary<string, AuraCurseData> value2 = Traverse.Create((object)Globals.Instance).Field("_AurasCurses").GetValue<Dictionary<string, AuraCurseData>>();
foreach (AuraCurseData value4 in value2.Values)
{
Plugin.LogDebug("Checking " + value4.Id, "UpdateAuraCurses");
if (!((Object)(object)value4 == (Object)null) && !string.IsNullOrEmpty(value4.Id) && (Plugin.MakeAllACVisible.Value || value4.Id == "energize" || value4.Id == "inspire" || value4.Id == "stress" || value4.Id == "fatigue"))
{
Plugin.LogDebug("Setting IconShow to true for " + value4.Id, "UpdateAuraCurses");
value4.IconShow = true;
}
}
Traverse.Create((object)Globals.Instance).Field("_AurasCurses").SetValue((object)value2);
}
catch (Exception ex)
{
Plugin.LogError("Error: " + ex.Message, "UpdateAuraCurses");
}
}
}
[BepInPlugin("com.binbin.EnergizeInspireVisible", "EnergizeInspireVisible", "1.1.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInProcess("AcrossTheObelisk.exe")]
public class Plugin : BaseUnityPlugin
{
public static string PluginName;
public static string PluginVersion;
public static string PluginGUID;
internal static int ModDate = int.Parse(DateTime.Today.ToString("yyyyMMdd"));
private readonly Harmony harmony = new Harmony("com.binbin.EnergizeInspireVisible");
internal static ManualLogSource Log;
public static string debugBase = "com.binbin.EnergizeInspireVisible ";
public static ConfigEntry<bool> EnableMod { get; set; }
public static ConfigEntry<bool> EnableDebugging { get; set; }
public static ConfigEntry<bool> MakeAllACVisible { get; set; }
private void Awake()
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_002f: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: Expected O, but got Unknown
//IL_0039: Expected O, but got Unknown
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_0066: Expected O, but got Unknown
//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_0093: Expected O, but got Unknown
//IL_0093: Expected O, but got Unknown
Log = ((BaseUnityPlugin)this).Logger;
string text = "EnergizeInspireVisible";
EnableMod = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition(text, "EnableMod"), true, new ConfigDescription("Enables the mod. Does not require a restart.", (AcceptableValueBase)null, Array.Empty<object>()));
EnableDebugging = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition(text, "EnableDebugging"), false, new ConfigDescription("Enables the debugging", (AcceptableValueBase)null, Array.Empty<object>()));
MakeAllACVisible = ((BaseUnityPlugin)this).Config.Bind<bool>(new ConfigDefinition(text, "Make all visible"), false, new ConfigDescription("Makes it such that all Auras and Curses are visible in the queue, including Doom, Block, Shield and more", (AcceptableValueBase)null, Array.Empty<object>()));
EnableMod.SettingChanged += delegate
{
EnergizeInspireVisiblePatches.UpdateAuraCurses();
};
MakeAllACVisible.SettingChanged += delegate
{
EnergizeInspireVisiblePatches.UpdateAuraCurses();
};
PluginName = "EnergizeInspireVisible";
PluginVersion = "1.1.0";
PluginGUID = "com.binbin.EnergizeInspireVisible";
if (EnableMod.Value)
{
if (EssentialsCompatibility.Enabled)
{
EssentialsCompatibility.EssentialsRegister();
}
else
{
LogInfo(PluginGUID + " " + PluginVersion + " has loaded!");
}
harmony.PatchAll();
}
}
internal static void LogDebug(string msg, [CallerMemberName] string caller = "")
{
if (EnableDebugging.Value)
{
Log.LogDebug((object)(debugBase + "- " + caller + " - " + msg));
}
}
internal static void LogInfo(string msg)
{
Log.LogInfo((object)(debugBase + msg));
}
internal static void LogError(string msg, [CallerMemberName] string caller = "")
{
Log.LogError((object)(debugBase + "- " + caller + " - " + msg));
}
public static IEnumerator RunAfter(IEnumerator original, Action action)
{
while (original.MoveNext())
{
yield return original.Current;
}
action();
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "com.binbin.EnergizeInspireVisible";
public const string PLUGIN_NAME = "EnergizeInspireVisible";
public const string PLUGIN_VERSION = "1.1.0";
}
}