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 On.RoR2; using R2API.Utils; using RoR2; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.0", FrameworkDisplayName = ".NET Standard 2.0")] [assembly: AssemblyCompany("ShrineClamper")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ShrineClamper")] [assembly: AssemblyTitle("ShrineClamper")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace ShrineClamper.Utils { public static class ListHandlers { public static List ItemDefList { get; } } } namespace MountainConfig { [BepInDependency("com.bepis.r2api", "3.0.7")] [BepInDependency(/*Could not decode attribute arguments.*/)] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.thebugreport.mountainConfig", "Mountain Config", "1.0.0")] [R2APISubmoduleDependency(new string[] { "ResourcesAPI", "LanguageAPI" })] public class Main : BaseUnityPlugin { public const string ModGUID = "com.thebugreport.mountainConfig"; public const string ModName = "Mountain Config"; public const string ModVersion = "1.0.0"; private int shrineStacks; public void Awake() { ShrineConfigs.Init(((BaseUnityPlugin)this).Config); Hooks(); } public void Hooks() { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Expected O, but got Unknown ((BaseUnityPlugin)this).Logger.LogInfo((object)"Initializing hooks..."); TeleporterInteraction.AddShrineStack += (hook_AddShrineStack)delegate(orig_AddShrineStack orig, TeleporterInteraction self) { shrineStacks++; ((BaseUnityPlugin)this).Logger.LogInfo((object)$"[ShrineClamper] Shrine activated. Total shrine stacks: {shrineStacks}"); orig.Invoke(self); }; BossGroup.DropRewards += (hook_DropRewards)delegate(orig_DropRewards orig, BossGroup self) { Run instance = Run.instance; int num = ((instance == null) ? 1 : instance.participatingPlayerCount); int num2 = ((!ShrineConfigs.OverrideBaseCount.Value) ? num : ((!ShrineConfigs.UsePlayerCountScaling.Value) ? (ShrineConfigs.FixedOrMultiplierBase.Value + ShrineConfigs.PlayerCountOffset.Value) : (num * ShrineConfigs.FixedOrMultiplierBase.Value + ShrineConfigs.PlayerCountOffset.Value))); int num3 = 0; num3 = ((!ShrineConfigs.OverrideShrines.Value) ? (shrineStacks * num) : ((!ShrineConfigs.UsePlayerCountScalingShrine.Value) ? (shrineStacks * ShrineConfigs.FixedOrMultiplierShrine.Value + ShrineConfigs.ShrineCountOffset.Value) : (shrineStacks * ShrineConfigs.FixedOrMultiplierShrine.Value * num + ShrineConfigs.ShrineCountOffset.Value))); int bonusRewardCount = Mathf.Max(-num, num2 - num + num3); self.scaleRewardsByPlayerCount = false; self.bonusRewardCount = bonusRewardCount; orig.Invoke(self); shrineStacks = 0; }; Stage.Start += (hook_Start)delegate(orig_Start orig, Stage self) { ((BaseUnityPlugin)this).Logger.LogInfo((object)"[ShrineClamper] Stage started — resetting shrineStacks to 0."); shrineStacks = 0; orig.Invoke(self); }; } } public static class ShrineConfigs { public static ConfigEntry OverrideBaseCount { get; set; } public static ConfigEntry UsePlayerCountScaling { get; set; } public static ConfigEntry FixedOrMultiplierBase { get; set; } public static ConfigEntry PlayerCountOffset { get; set; } public static ConfigEntry OverrideShrines { get; set; } public static ConfigEntry UsePlayerCountScalingShrine { get; set; } public static ConfigEntry FixedOrMultiplierShrine { get; set; } public static ConfigEntry ShrineCountOffset { get; set; } public static void Init(ConfigFile config) { OverrideBaseCount = config.Bind("Base Rewards", "Override Base Rewards", false, "Enable this to override the base number of items dropped by the teleporter before any Shrine of the Mountain bonuses are applied."); UsePlayerCountScaling = config.Bind("Base Rewards", "Use Player Scaling", true, "When enabled, the base item drops will scale with the number of players (e.g., 1 item per player). Disable to use fixed amounts set below."); FixedOrMultiplierBase = config.Bind("Base Rewards", "Multiplier", 1, "If player count scaling is off, this sets the exact number of base items dropped. If scaling is on, this acts as a multiplier (e.g., 2 = 2 items per player)."); PlayerCountOffset = config.Bind("Base Rewards", "Item Reward Offset", 0, "This value is added to the final base item count after all other calculations. Can be positive or negative."); OverrideShrines = config.Bind("Shrine Rewards", "Override Shrine Rewards", false, "Enable this to override how Shrine of the Mountain affects teleporter item drops."); UsePlayerCountScalingShrine = config.Bind("Shrine Rewards", "Use Player Scaling", true, "When enabled, shrine bonuses will scale with player count. Disable to use fixed amounts set below."); FixedOrMultiplierShrine = config.Bind("Shrine Rewards", "Multiplier", 1, "If player count scaling is off, this sets how many items each shrine adds. If scaling is on, this acts as a per-player multiplier for shrine rewards."); ShrineCountOffset = config.Bind("Shrine Rewards", "Shrine Reward Offset", 0, "This value is added to the final base item count after all other calculations per shrine. Can be positive or negative."); } } }