Some mods may be broken due to the recent Alloyed Collective update.
Decompiled source of Mega Tempest v1.1.5
MegaTempest.dll
Decompiled 11 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.Bootstrap; 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; [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("MegaTempest")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("MegaTempest")] [assembly: AssemblyTitle("MegaTempest")] [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 MegaTempest { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("MegaTempest", "MegaTempest", "1.1.5")] internal class DifficultyExample : BaseUnityPlugin { private const string modName = "MegaTempest"; private const string Author = "idolfan"; private const string modGuid = "MegaTempest"; private const string Version = "1.1.5"; public static string desc; public static DifficultyDef megaTempestDef; public static AssetBundle assetBundle; private DifficultyIndex myIndex; public static ConfigEntry<float> difficultyScaling { get; set; } public static ConfigEntry<float> movementSpeedBonus { get; set; } public static ConfigEntry<float> attackSpeedBonus { get; set; } public static ConfigEntry<float> armorPerLevel { get; set; } public static ConfigEntry<bool> decreaseEnemyDamage { get; set; } public static ConfigEntry<float> reductionBeginning { get; set; } public static ConfigEntry<float> reductionMiddle { get; set; } public static ConfigEntry<bool> debug { get; set; } public static bool rooInstalled => Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions"); private void Awake() { //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Expected O, but got Unknown //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Expected O, but got Unknown Run.onRunSetRuleBookGlobal += removeLevelCap; difficultyScaling = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Difficulty Scaling", 8f, "The difficulty scaling. Monsoon is 3, Tempest is 6, default is 8"); movementSpeedBonus = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Movement Speed", 0.35f, "The movement speed bonus given to monsters. Default is 0.35"); attackSpeedBonus = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Attack Speed", 0.25f, "The attack speed bonus given to monsters. Default is 0.25"); armorPerLevel = ((BaseUnityPlugin)this).Config.Bind<float>("General", "Armor per Level", 1f, "The armor per level given to monsters. Default is 1"); decreaseEnemyDamage = ((BaseUnityPlugin)this).Config.Bind<bool>("Experimental", "Decrease Enemy Damage", false, "Whether the changes to enemy baseDamage should be applied or not.\nThis will recude the amount of baseDamage enemies gain per level, the higher their level gets."); reductionBeginning = ((BaseUnityPlugin)this).Config.Bind<float>("Experimental", "Beginn reduction at level", 10f, "DO NOT CHANGE CARELESSLY:\nDefines when the damage drop of for enemies should start.\nRepresents x in the formula:\n(level-x)/(level+y)"); reductionMiddle = ((BaseUnityPlugin)this).Config.Bind<float>("Experimental", "50% reduction at level", 250f, "DO NOT CHANGE CARELESSLY:\nDetermines at which level reduction is approximately 50%.\nRepresents y in the formula:\n(level-x)/(level+y)"); debug = ((BaseUnityPlugin)this).Config.Bind<bool>("Debug", "Debug", false, "Will print debug messages into the console. (For development purposes)"); assetBundle = AssetBundle.LoadFromFile(Assembly.GetExecutingAssembly().Location.Replace("MegaTempest.dll", "assets1")); DifficultyDef val = new DifficultyDef(difficultyScaling.Value, "MEGA_TEMPEST_NAME", "", "MEGA_TEMPEST_DESC", new Color(0.5f, 0.1f, 0.2f), "nr", true); val.foundIconSprite = true; val.iconSprite = assetBundle.LoadAsset<Sprite>("assets/importantfolder/icon.png"); myIndex = DifficultyAPI.AddDifficulty(val); megaTempestDef = val; LanguageTokens(); if (rooInstalled) { initRiskOfOptions(val); } RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(RecalculateStatsAPI_GetStatCoefficients); if (debug.Value) { Console.WriteLine("Mega Tempest awake completed."); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private void initRiskOfOptions(DifficultyDef def) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Expected O, but got Unknown //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Expected O, but got Unknown //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: 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_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Expected O, but got Unknown //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Expected O, but got Unknown //IL_0131: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Expected O, but got Unknown //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Expected O, but got Unknown //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Expected O, but got Unknown //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Expected O, but got Unknown ModSettingsManager.SetModIcon(def.iconSprite, "MegaTempest", "MegaTempest"); ModSettingsManager.SetModDescription("Edit the settings for the MegaTempest difficulty. Be aware: Changes made will not be displayed in the difficulty description inside a lobby. They will however still be applied.", "MegaTempest", "MegaTempest"); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(difficultyScaling, new StepSliderConfig { increment = 0.1f, min = 0f, max = 100f }), "MegaTempest", "MegaTempest"); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(movementSpeedBonus, new StepSliderConfig { increment = 0.01f, min = 0f, max = 10f }), "MegaTempest", "MegaTempest"); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(attackSpeedBonus, new StepSliderConfig { increment = 0.01f, min = 0f, max = 10f }), "MegaTempest", "MegaTempest"); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(armorPerLevel, new StepSliderConfig { increment = 0.1f, min = 0f, max = 30f }), "MegaTempest", "MegaTempest"); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(reductionBeginning, new StepSliderConfig { increment = 1f, min = 1f, max = 500f }), "MegaTempest", "MegaTempest"); ModSettingsManager.AddOption((BaseOption)new StepSliderOption(reductionMiddle, new StepSliderConfig { increment = 1f, min = 1f, max = 1500f }), "MegaTempest", "MegaTempest"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(decreaseEnemyDamage), "MegaTempest", "MegaTempest"); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(debug), "MegaTempest", "MegaTempest"); difficultyScaling.SettingChanged += delegate { Reflection.SetFieldValue<float>((object)megaTempestDef, "scalingValue", difficultyScaling.Value); }; } private void RecalculateStatsAPI_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Invalid comparison between Unknown and I4 DifficultyIndex selectedDifficulty = Run.instance.selectedDifficulty; if (selectedDifficulty != myIndex || !Object.op_Implicit((Object)(object)sender) || !Object.op_Implicit((Object)(object)sender.teamComponent) || !(((Object)((Component)sender).gameObject).name != "BrotherBody(Clone)") || (int)sender.teamComponent.teamIndex != 2) { return; } args.moveSpeedMultAdd += movementSpeedBonus.Value; args.attackSpeedMultAdd += attackSpeedBonus.Value; args.levelArmorAdd += armorPerLevel.Value; if (decreaseEnemyDamage.Value) { float num = Math.Max(0f, (sender.level - reductionBeginning.Value) / (sender.level + reductionMiddle.Value)); float damage = sender.damage; args.levelDamageAdd -= sender.levelDamage * num; if (debug.Value) { Console.WriteLine(((Object)sender).name + "(" + sender.level + ") " + sender.baseDamage + " + " + sender.levelDamage + " * " + (sender.level - 1f) + "L = " + (sender.baseDamage + sender.levelDamage * (sender.level - 1f)) + " (" + damage + ") -> " + sender.damage + " (" + num + ")"); } } } private void removeLevelCap(Run run, RuleBook rulebook) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) if (run.selectedDifficulty == myIndex) { Run.ambientLevelCap = int.MaxValue; } } private void LanguageTokens() { LanguageAPI.Add("MEGA_TEMPEST_NAME", "Mega Tempest"); desc = "Prepare for hell. <style=cStack>\n\n>Difficulty scaling: <style=cIsHealth>+" + (difficultyScaling.Value * 50f - 100f) + "%</style>\n>Enemy Movement speed: <style=cIsHealth>+" + movementSpeedBonus.Value * 100f + "%</style>\n>Enemy Attack speed: <style=cIsHealth>+" + attackSpeedBonus.Value * 100f + "%</style>\n>Enemy Armor per level: <style=cIsHealth>+" + armorPerLevel.Value + "</style>\n><style=cIsHealth>Removes enemy level cap</style>"; if (decreaseEnemyDamage.Value) { desc += "\n>EXPERIMENTAL: <style=cIsHealing>Enemy Damage is lowered on higher levels</style>"; } desc += "</style>"; LanguageAPI.Add("MEGA_TEMPEST_DESC", desc); } } } namespace ExamplePlugin { 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); } } }