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 Benthic Rebloomed v1.0.1
BenthicRework.dll
Decompiled a month ago#define DEBUG using System; using System.Collections.Generic; 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.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using IL.RoR2; using Microsoft.CodeAnalysis; using Mono.Cecil.Cil; using MonoMod.Cil; using R2API; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using UnityEngine; using UnityEngine.AddressableAssets; [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("BenthicRework")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+8fa68371a75c86a84b633335ba1fe556d4f9ed65")] [assembly: AssemblyProduct("BenthicRework")] [assembly: AssemblyTitle("BenthicRework")] [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 BenthicRework { [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("Braquen.Benthic_Rebloomed", "Benthic_Rebloomed", "1.0.0")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] public class BenthicRework : BaseUnityPlugin { public const string PluginGUID = "Braquen.Benthic_Rebloomed"; public const string PluginAuthor = "Braquen"; public const string PluginName = "Benthic_Rebloomed"; public const string PluginVersion = "1.0.0"; public static PluginInfo pluginInfo; public static AssetBundle AssetBundle; public static ConfigEntry<int> StacksUpgraded; public static ConfigEntry<int> ItemsAdded; public static ConfigEntry<bool> UpgradeLunars; public static ConfigEntry<bool> UpgradeSelf; public void Awake() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Expected O, but got Unknown //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Expected O, but got Unknown //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_00e1: Expected O, but got Unknown //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Expected O, but got Unknown //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Expected O, but got Unknown Log.Init(((BaseUnityPlugin)this).Logger); pluginInfo = ((BaseUnityPlugin)this).Info; ConfigFile val = new ConfigFile(Path.Combine(Paths.ConfigPath, "braquen-BenthicRebloomed.cfg"), true); StacksUpgraded = val.Bind<int>("Benthic Stats", "Stacks Upgraded", 3, "Number of stacks each bloom upgrades on stage advance. Setting 0 restores original benthic bloom functionality."); ItemsAdded = val.Bind<int>("Benthic Stats", "Items Granted", 2, "Number of items added to a stack when upgraded. Setting 0 restores original benthic bloom functionality."); UpgradeLunars = val.Bind<bool>("Allowed Upgrades", "Allow Lunar Upgrades", false, "When enabled, bloom can grant more stacks of lunar items on stage advance."); UpgradeSelf = val.Bind<bool>("Allowed Upgrades", "Allow Self Upgrade", false, "When enabled, bloom can grant more stacks of itself on stage advance. Completely unbalanced."); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(StacksUpgraded, new IntSliderConfig { min = 0, max = 100 })); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(ItemsAdded, new IntSliderConfig { min = 1, max = 100 })); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(UpgradeLunars)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(UpgradeSelf)); ModSettingsManager.SetModDescription("Braq's Big Beautiful Benthic Bloom Betterer"); Sprite val2 = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/DLC1/CloverVoid/texCloverVoidIcon.png").WaitForCompletion(); if ((Object)(object)val2 != (Object)null) { ModSettingsManager.SetModIcon(val2); } UpdateText(); CharacterMaster.TryCloverVoidUpgrades += new Manipulator(CharacterMaster_TryCloverVoidUpgrades); } private void CharacterMaster_TryCloverVoidUpgrades(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); Log.Debug("Inserting alternate Benthic Bloom functionality"); try { val.GotoNext((MoveType)2, new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 2), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld<CharacterMaster>(x, "cloverVoidRng") }); val.Index += 1; val.Emit(OpCodes.Ldarg_0); val.Emit(OpCodes.Ldloc_2); val.EmitDelegate<Func<int, CharacterMaster, List<ItemIndex>, int>>((Func<int, CharacterMaster, List<ItemIndex>, int>)AlternateBenthic); } catch (Exception e) { ErrorHookFailed("Add alternate Benthic Functionality", e); } } private static int AlternateBenthic(int itemCount, CharacterMaster characterMaster, List<ItemIndex> itemsCollected) { //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: 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) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Invalid comparison between Unknown and I4 //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Invalid comparison between Unknown and I4 //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) int value = StacksUpgraded.Value; int value2 = ItemsAdded.Value; if (value == 0 || value2 == 0) { return itemCount; } bool value3 = UpgradeSelf.Value; bool value4 = UpgradeLunars.Value; int count = itemsCollected.Count; int num = itemCount * value; bool[] array = new bool[count]; int num2 = 0; int num3 = 0; while (num2 < num) { if (num3 >= count) { if (num2 == 0) { break; } num3 = 0; continue; } ItemIndex val = itemsCollected[num3]; ItemTier[] array2 = (ItemTier[])(object)new ItemTier[2] { (ItemTier)3, (ItemTier)5 }; if ((val == Items.CloverVoid.itemIndex && !value3) || ((int)ItemCatalog.GetItemDef(val).tier == 3 && !value4) || (int)ItemCatalog.GetItemDef(val).tier == 5) { num3++; continue; } array[num3] = true; characterMaster.inventory.GiveItemPermanent(val, value2); num2++; num3++; } for (int i = 0; i < count; i++) { if (array[i]) { CharacterMasterNotificationQueue.PushItemNotification(characterMaster, itemsCollected[i]); } } if (num2 > 0 && Object.op_Implicit((Object)(object)characterMaster.bodyInstanceObject)) { Util.PlaySound("Play_item_proc_extraLife", characterMaster.bodyInstanceObject); } return 0; } internal static void ErrorHookFailed(string name, Exception e) { Log.Error(name + " hook failed: " + e.Message); } private void UpdateText() { if (ItemsAdded.Value != 0 && StacksUpgraded.Value != 0) { string token = "ITEM_CLOVERVOID_DESC"; string newtext = "<style=cIsUtility>Adds " + ItemsAdded.Value + " </style> items to <style=cIsUtility>" + StacksUpgraded.Value + "</style> <style=cStack>(+" + StacksUpgraded.Value + " per stack)</style> item stacks at the <style=cIsUtility>start of each stage</style>. <style=cIsVoid>Corrupts all 57 Leaf Clovers</style>."; string token2 = "ITEM_CLOVERVOID_PICKUP"; string newtext2 = "Upgrades your item stacks at the start of each stage."; ReplaceString(token, newtext); ReplaceString(token2, newtext2); } } private void ReplaceString(string token, string newtext) { LanguageAPI.Add(token, newtext); } } internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } [Conditional("DEBUG")] 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); } } } namespace BenthicRework.compat { public static class QualityModCompatibility { private static bool? _enabled; public static bool enabled { get { if (!_enabled.HasValue) { _enabled = Chainloader.PluginInfos.ContainsKey("com.Gorakh.ItemQualities"); } return _enabled.Value; } } public static bool BenthicQualityEffectHandler(CharacterMaster master, ItemTransformation itemTransformation, List<ItemIndex> upgradableItems) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) if (enabled) { _BenthicQualityEffectHandler(master, itemTransformation, upgradableItems); } return enabled; } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void _BenthicQualityEffectHandler(CharacterMaster master, ItemTransformation itemTransformation, List<ItemIndex> upgradableItems) { } } }