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 HalcyonShrineTweaks v1.0.2
HalcyonShrineTweaks.dll
Decompiled 9 months agousing 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.2")] 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.2"; public static ConfigEntry<bool> removeShrine; public static ConfigEntry<bool> removeBoss; public static ConfigEntry<bool> changeBossEnemy; public static ConfigEntry<bool> removeScaling; public static ConfigEntry<int> lowScaling; public static ConfigEntry<int> midScaling; public static ConfigEntry<int> maxScaling; public static ConfigEntry<int> goldTakenAmt; public static ConfigEntry<float> goldTakenTickRate; public static ConfigEntry<bool> sotsBiasPickups; public void Awake() { //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Expected O, but got Unknown //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Expected O, but got Unknown //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Expected O, but got Unknown //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_0188: 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."); lowScaling = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Low Tier Gold Requirement", 75, "The amount of gold it takes for the low requirement (before difficutly scaling)"); midScaling = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Mid Tier Gold Requirement", 150, "The amount of gold it takes for the mid requirement (before difficutly scaling)"); maxScaling = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Max Tier Gold Requirement", 300, "The amount of gold it takes for the max requirement (before difficutly scaling)"); goldTakenAmt = ((BaseUnityPlugin)this).Config.Bind<int>("General", "Amount of Gold Taken Per Tick", 1, "The amount of gold that is taken every tick of the shrine (before scaling)"); goldTakenTickRate = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Gold Take Tick Rate", 5f, "How many ticks per second the halcyon shrine takes money."); sotsBiasPickups = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Rewards biased towards SOTS Items", true, "If the reward items should be more biased towards picking SOTS items or not (vanilla default is true)"); HalcyoniteShrineInteractable.Start += new hook_Start(HalcyoniteShrineInteractable_Start); HalcyoniteShrineInteractable.DrainConditionMet += new Manipulator(HalcyoniteShrineInteractable_DrainConditionMet); PickupPickerController.GenerateOptionsFromDropTablePlusForcedStorm += new hook_GenerateOptionsFromDropTablePlusForcedStorm(PickupPickerController_GenerateOptionsFromDropTablePlusForcedStorm); 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 Option[] PickupPickerController_GenerateOptionsFromDropTablePlusForcedStorm(orig_GenerateOptionsFromDropTablePlusForcedStorm orig, int numOptions, PickupDropTable dropTable, PickupDropTable stormDropTable, Xoroshiro128Plus rng) { if (sotsBiasPickups.Value) { return orig.Invoke(numOptions, dropTable, stormDropTable, rng); } return PickupPickerController.GenerateOptionsFromDropTable(numOptions, dropTable, rng); } 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_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) self.lowGoldCost = lowScaling.Value; self.midGoldCost = midScaling.Value; self.maxGoldCost = maxScaling.Value; self.tickRate = goldTakenTickRate.Value; self.goldDrainValue = goldTakenAmt.Value; 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); } } }