using 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 Microsoft.CodeAnalysis; using On.RoR2; using R2API; 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("currentlyMod")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("currentlyMod")] [assembly: AssemblyTitle("currentlyMod")] [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 CurrentlyMod { [BepInPlugin("youss.CurrentlyMod.RedLegendaryStatBoost", "Red Legendary Stat Boost", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class CurrentlyModPlugin : BaseUnityPlugin { [CompilerGenerated] private static class <>O { public static StatHookEventHandler <0>__RecalculateStatsAPI_GetStatCoefficients; public static hook_RecalculateStats <1>__CharacterBody_RecalculateStats; } public const string PluginGuid = "youss.CurrentlyMod.RedLegendaryStatBoost"; public const string PluginName = "Red Legendary Stat Boost"; public const string PluginVersion = "1.0.0"; private const string ConfigSectionGeneral = "General"; private const string ConfigKeyPercentPerLegendary = "Percent bonus per legendary item"; private static ConfigEntry percentBonusPerLegendary; private void Awake() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Expected O, but got Unknown //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Expected O, but got Unknown BindConfig(); object obj = <>O.<0>__RecalculateStatsAPI_GetStatCoefficients; if (obj == null) { StatHookEventHandler val = RecalculateStatsAPI_GetStatCoefficients; <>O.<0>__RecalculateStatsAPI_GetStatCoefficients = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; object obj2 = <>O.<1>__CharacterBody_RecalculateStats; if (obj2 == null) { hook_RecalculateStats val2 = CharacterBody_RecalculateStats; <>O.<1>__CharacterBody_RecalculateStats = val2; obj2 = (object)val2; } CharacterBody.RecalculateStats += (hook_RecalculateStats)obj2; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Red Legendary Stat Boost loaded."); } private void OnDestroy() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Expected O, but got Unknown object obj = <>O.<0>__RecalculateStatsAPI_GetStatCoefficients; if (obj == null) { StatHookEventHandler val = RecalculateStatsAPI_GetStatCoefficients; <>O.<0>__RecalculateStatsAPI_GetStatCoefficients = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients -= (StatHookEventHandler)obj; object obj2 = <>O.<1>__CharacterBody_RecalculateStats; if (obj2 == null) { hook_RecalculateStats val2 = CharacterBody_RecalculateStats; <>O.<1>__CharacterBody_RecalculateStats = val2; obj2 = (object)val2; } CharacterBody.RecalculateStats -= (hook_RecalculateStats)obj2; } private void BindConfig() { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Expected O, but got Unknown percentBonusPerLegendary = ((BaseUnityPlugin)this).Config.Bind("General", "Percent bonus per legendary item", 5f, new ConfigDescription("Percent bonus applied to health, move speed, damage, attack speed, crit, regen, and armor for each non-scrap legendary item stack. Shield is intentionally not affected. Default: 5.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), new object[0])); } private static void CharacterBody_RecalculateStats(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if ((Object)(object)self == (Object)null || (Object)(object)self.inventory == (Object)null) { return; } int legendaryItemCount = GetLegendaryItemCount(self.inventory); if (legendaryItemCount > 0) { float num = (float)legendaryItemCount * Math.Max(0f, percentBonusPerLegendary.Value) / 100f; if (!(num <= 0f)) { ApplyPostRecalculateStatBoost(self, num); } } } private static void RecalculateStatsAPI_GetStatCoefficients(CharacterBody body, StatHookEventArgs args) { if ((Object)(object)body == (Object)null || (Object)(object)body.inventory == (Object)null) { return; } int legendaryItemCount = GetLegendaryItemCount(body.inventory); if (legendaryItemCount > 0) { float num = (float)legendaryItemCount * Math.Max(0f, percentBonusPerLegendary.Value) / 100f; if (!(num <= 0f)) { args.healthMultAdd += num; } } } private static int GetLegendaryItemCount(Inventory inventory) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Invalid comparison between Unknown and I4 //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Invalid comparison between Unknown and I4 //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) int num = 0; int itemCount = ItemCatalog.itemCount; for (ItemIndex val = (ItemIndex)0; (int)val < itemCount; val = (ItemIndex)(val + 1)) { ItemDef itemDef = ItemCatalog.GetItemDef(val); if (!((Object)(object)itemDef == (Object)null) && (int)itemDef.tier == 2 && !itemDef.ContainsTag((ItemTag)10)) { num += inventory.GetItemCount(val); } } return num; } private static void ApplyPostRecalculateStatBoost(CharacterBody body, float boostFraction) { body.moveSpeed += body.moveSpeed * boostFraction; body.damage += body.damage * boostFraction; body.attackSpeed += body.attackSpeed * boostFraction; body.crit += body.crit * boostFraction; body.regen += body.regen * boostFraction; body.armor += body.armor * boostFraction; } } }