using System;
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 IL.RoR2;
using Microsoft.CodeAnalysis;
using Mono.Cecil.Cil;
using MonoMod.Cil;
using On.RoR2;
using RoR2;
using UnityEngine;
using UnityEngine.AddressableAssets;
[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("HalcyonShrineTweaks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("HalcyonShrineTweaks")]
[assembly: AssemblyTitle("HalcyonShrineTweaks")]
[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.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace HalcyonShrineTweaks
{
[BepInPlugin("Jeffdev.HalcyonShrineTweaks", "HalcyonShrineTweaks", "1.0.0")]
public class HalcyonShrineTweaks : BaseUnityPlugin
{
public const string PluginGUID = "Jeffdev.HalcyonShrineTweaks";
public const string PluginAuthor = "Jeffdev";
public const string PluginName = "HalcyonShrineTweaks";
public const string PluginVersion = "1.0.0";
public static ConfigEntry<bool> removeShrine;
public static ConfigEntry<bool> removeBoss;
public static ConfigEntry<bool> changeBossEnemy;
public static ConfigEntry<bool> removeScaling;
public void Awake()
{
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Expected O, but got Unknown
//IL_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Expected O, but got Unknown
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_0097: Unknown result type (might be due to invalid IL or missing references)
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
Log.Init(((BaseUnityPlugin)this).Logger);
removeShrine = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Remove Shrine", false, "Make the Halcyon Shrine never show up in runs. (Requires Restart)");
changeBossEnemy = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Change Halcyonite Shrine Enemy", true, "Change the Halcyonite miniboss to be a gilded stone titan instead.");
removeScaling = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Nerf Halcyonite Shrine Miniboss Scaling", true, "Nerfs the Halcyonite Shrine miniboss scaling to make it less drastic.");
HalcyoniteShrineInteractable.Start += new hook_Start(HalcyoniteShrineInteractable_Start);
HalcyoniteShrineInteractable.DrainConditionMet += new Manipulator(HalcyoniteShrineInteractable_DrainConditionMet);
InteractableSpawnCard val = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC2/iscShrineHalcyonite.asset").WaitForCompletion();
InteractableSpawnCard val2 = Addressables.LoadAssetAsync<InteractableSpawnCard>((object)"RoR2/DLC2/iscShrineHalcyoniteTier1.asset").WaitForCompletion();
if (removeShrine.Value)
{
if ((Object)(object)val != (Object)null && (Object)(object)val2 != (Object)null)
{
((SpawnCard)val).directorCreditCost = 999999;
((SpawnCard)val2).directorCreditCost = 999999;
val.maxSpawnsPerStage = 0;
val2.maxSpawnsPerStage = 0;
}
else
{
Log.Error("Halcyonite Shrine InteractableSpawnCard not found.");
}
}
}
private void HalcyoniteShrineInteractable_DrainConditionMet(ILContext il)
{
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Expected O, but got Unknown
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
if (removeScaling.Value)
{
ILCursor val = new ILCursor(il);
if (val.TryGotoNext((MoveType)2, new Func<Instruction, bool>[1]
{
(Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 100f)
}))
{
int index = val.Index;
val.Index = index - 1;
val.Remove();
val.Emit(OpCodes.Ldc_R4, 200f);
Log.Info("Successfully replaced 100f with 300f.");
}
else
{
Log.Error("Failed to find ldc.r4 100!");
}
}
}
private void HalcyoniteShrineInteractable_Start(orig_Start orig, HalcyoniteShrineInteractable self)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
orig.Invoke(self);
if (changeBossEnemy.Value)
{
CharacterSpawnCard val = Addressables.LoadAssetAsync<CharacterSpawnCard>((object)"RoR2/Base/Titan/cscTitanBlackBeach.asset").WaitForCompletion();
if ((Object)(object)val == (Object)null)
{
Debug.LogError((object)"Failed to load Stone Titan CSC!");
}
else if (self.chosenDirectCard != null)
{
Debug.Log((object)"Overriding Halcyonite spawn with Stone Titan.");
self.chosenDirectCard.spawnCard = (SpawnCard)(object)val;
}
}
}
}
internal static class Log
{
private static ManualLogSource _logSource;
internal static void Init(ManualLogSource logSource)
{
_logSource = logSource;
}
internal static void Debug(object data)
{
_logSource.LogDebug(data);
}
internal static void Error(object data)
{
_logSource.LogError(data);
}
internal static void Fatal(object data)
{
_logSource.LogFatal(data);
}
internal static void Info(object data)
{
_logSource.LogInfo(data);
}
internal static void Message(object data)
{
_logSource.LogMessage(data);
}
internal static void Warning(object data)
{
_logSource.LogWarning(data);
}
}
}