Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of The Mountain in Question v1.0.0
MountainShrineItem.dll
Decompiled a year agousing System; using System.Diagnostics; using System.IO; 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 Microsoft.CodeAnalysis; using R2API; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [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("MountainShrineItem")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+cc447bc729f86c80e92045723c0082acfe022988")] [assembly: AssemblyProduct("MountainShrineItem")] [assembly: AssemblyTitle("MountainShrineItem")] [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 MountainShrineItem { public class MountainShrineItem { public static ItemDef itemDef; public static int bonusItems = ConfigManager.bonusItems.Value; public static float bossCredits = ConfigManager.difficultyPercent.Value * 6f; public static float difficultyMultiplier = ConfigManager.difficultyPercent.Value / 100f; public static bool multiplyShrines = ConfigManager.multiplyShrines.Value; internal static void Init() { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown Log.Info("Initializing Mons Crisium Item"); itemDef = ScriptableObject.CreateInstance<ItemDef>(); ((Object)itemDef).name = "MOUNTAINSHRINEITEM"; itemDef.nameToken = "ITEM_MOUNTAINSHRINEITEM_NAME"; itemDef.pickupToken = "ITEM_MOUNTAINSHRINEITEM_PICKUP"; itemDef.descriptionToken = "ITEM_MOUNTAINSHRINEITEM_DESC"; itemDef.loreToken = "ITEM_MOUNTAINSHRINEITEM_LORE"; itemDef.AutoPopulateTokens(); ((ResourceAvailability)(ref ItemTierCatalog.availability)).CallWhenAvailable((Action)delegate { if (Object.op_Implicit((Object)(object)itemDef)) { itemDef.tier = (ItemTier)3; } }); ItemDef obj = itemDef; ItemTag[] array = new ItemTag[5]; RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/); obj.tags = (ItemTag[])(object)array; itemDef.pickupIconSprite = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/ShrineBoss/texShrineBossSymbol.png").WaitForCompletion(); itemDef.pickupModelPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/Base/ShrineBoss/ShrineBoss.prefab").WaitForCompletion(); ModelPanelParameters val = itemDef.pickupModelPrefab.AddComponent<ModelPanelParameters>(); val.minDistance = 5f; val.maxDistance = 10f; itemDef.canRemove = true; itemDef.hidden = false; ItemDisplayRuleDict val2 = new ItemDisplayRuleDict((ItemDisplayRule[])null); ItemAPI.Add(new CustomItem(itemDef, val2)); Hooks(); Debug.Log((object)"Mons Crisium Initialized"); } private static void Hooks() { TeleporterInteraction.onTeleporterBeginChargingGlobal += TeleporterInteraction_onTeleporterBeginChargingGlobal; } public static void TeleporterInteraction_onTeleporterBeginChargingGlobal(TeleporterInteraction self) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) int itemCountForTeam = Util.GetItemCountForTeam((TeamIndex)1, itemDef.itemIndex, true, true); if (NetworkServer.active && Object.op_Implicit((Object)(object)self.bossDirector) && Object.op_Implicit((Object)(object)self.bossGroup) && itemCountForTeam > 0) { float num = bossCredits * (float)itemCountForTeam; if (multiplyShrines) { num *= (float)(self.shrineBonusStacks + 1); } Log.Debug("Added Credits: " + num); CombatDirector bossDirector = self.bossDirector; bossDirector.monsterCredit += (float)(int)(num * Mathf.Pow(Run.instance.compensatedDifficultyCoefficient, 0.5f)); int num2 = itemCountForTeam * bonusItems * Run.instance.participatingPlayerCount; if (multiplyShrines) { num2 *= self.shrineBonusStacks + 1; } Log.Debug("Items Added: " + num2); BossGroup bossGroup = self.bossGroup; bossGroup.bonusRewardCount += num2; } } } 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); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Braquen.The_Mountain_in_Question", "The_Mountain_in_Question", "0.0.1")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class MountainItemPlugin : BaseUnityPlugin { public const string PluginGUID = "Braquen.The_Mountain_in_Question"; public const string PluginAuthor = "Braquen"; public const string PluginName = "The_Mountain_in_Question"; public const string PluginVersion = "0.0.1"; public static PluginInfo pluginInfo; public static AssetBundle AssetBundle; public void Awake() { Log.Init(((BaseUnityPlugin)this).Logger); pluginInfo = ((BaseUnityPlugin)this).Info; ConfigManager.Init(Paths.ConfigPath); if (ConfigManager.isEnabled.Value) { MountainShrineItem.Init(); } } private void Update() { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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: Unknown result type (might be due to invalid IL or missing references) if (Input.GetKeyDown((KeyCode)283)) { Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed F2. Spawning our custom item at coordinates {transform.position}"); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(MountainShrineItem.itemDef.itemIndex), transform.position, transform.forward * 20f); } } } public class ConfigManager { public static ConfigEntry<bool> isEnabled; public static ConfigEntry<bool> multiplyShrines; public static ConfigEntry<int> bonusItems; public static ConfigEntry<float> difficultyPercent; public static void Init(string configPath) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Expected O, but got Unknown //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Expected O, but got Unknown //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Expected O, but got Unknown //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown ConfigFile val = new ConfigFile(Path.Combine(configPath, "braquen-TheMountaininQuestion.cfg"), true); isEnabled = val.Bind<bool>("MOUNTAINSHRINEITEM", "Enable", true, "Enables the item to appear in runs."); multiplyShrines = val.Bind<bool>("MOUNTAINSHRINEITEM", "Multiply Shrines", false, "When enabled, the item will multiply with shrines instead of add on top of them."); bonusItems = val.Bind<int>("MOUNTAINSHRINEITEM", "Bonus Item Count", 1, "Number of extra boss items per stack."); difficultyPercent = val.Bind<float>("MOUNTAINSHRINEITEM", "Difficulty scaling", 100f, "Percent extra credits gained by the Director per stack."); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(isEnabled)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(multiplyShrines)); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(bonusItems, new IntSliderConfig { min = 1, max = 100 })); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(difficultyPercent, new StepSliderConfig { min = 0f, max = 10000f, increment = 0.1f })); } } }