using System; using System.Collections; 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 Microsoft.CodeAnalysis; using On.RoR2; using PokeItems.Buffs; using PokeItems.Items; using PokeItems.Managers; using R2API; using R2API.Utils; using RiskOfOptions; using RiskOfOptions.OptionConfigs; using RiskOfOptions.Options; using RoR2; using RoR2.ExpansionManagement; 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("PokeItems")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+c3e1ae21f4ce00abdefd43fded99e83dd3805c53")] [assembly: AssemblyProduct("PokeItems")] [assembly: AssemblyTitle("PokeItems")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [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 PokeItems { internal static class Log { private static ManualLogSource _logSource; internal static void Init(ManualLogSource logSource) { _logSource = logSource; } private static string Format(object data, string file, int line) { string fileName = Path.GetFileName(file); return $"[{fileName}:{line}] {data}"; } internal static void Debug(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogDebug((object)Format(data, file, line)); } internal static void Error(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogError((object)Format(data, file, line)); } internal static void Fatal(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogFatal((object)Format(data, file, line)); } internal static void Info(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogInfo((object)Format(data, file, line)); } internal static void Message(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogMessage((object)Format(data, file, line)); } internal static void Warning(object data, [CallerFilePath] string file = "", [CallerLineNumber] int line = 0) { _logSource.LogWarning((object)Format(data, file, line)); } } internal class MathUtility { public static float GetLinearStacking(float value, float count, float procCoefficient = 1f) { return value * count * procCoefficient; } public static float GetLinearWithExtraStacking(float value, float extraValue, float count, float procCoefficient = 1f) { if (count <= 1f) { return GetLinearStacking(value, count, procCoefficient); } return (value + extraValue * (count - 1f)) * procCoefficient; } public static float GetExponentialPercentReductionStacking(float percent, float count) { return Mathf.Pow(1f - percent / 100f, count); } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("DTPGStudios.PokeItems", "PokeItems", "0.3.3")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public class PokeItems : BaseUnityPlugin { public const string PluginGUID = "DTPGStudios.PokeItems"; public const string PluginAuthor = "DTPGStudios"; public const string PluginName = "PokeItems"; public const string PluginVersion = "0.3.3"; public static ExpansionDef sotvDLC; public static ExpansionDef sotsDLC; private static bool isUnfinishedEnabled; public static PluginInfo PInfo { get; private set; } public static ConfigFile PConfig { get; private set; } public void Awake() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) PInfo = ((BaseUnityPlugin)this).Info; PConfig = ((BaseUnityPlugin)this).Config; sotvDLC = Addressables.LoadAssetAsync((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion(); sotsDLC = Addressables.LoadAssetAsync((object)"RoR2/DLC2/Common/DLC2.asset").WaitForCompletion(); Log.Init(((BaseUnityPlugin)this).Logger); ConfigManager.Init(); AssetManager.Init(); RiskOfOptionsManager.Init(); Leftovers.Init(); FlameOrb.Init(); AirBalloonBroken.Init(); AirBalloon.Init(); ExpShare.Init(); AmuletCoin.Init(); HeavyDutyBoots.Init(); ChoiceBuffs.Init(); ChoiceManager.Init(); ChoiceBand.Init(); ChoiceSpecs.Init(); ChoiceScarf.Init(); isUnfinishedEnabled = ConfigManager.UnfinishedItemsEnabled.Value; if (isUnfinishedEnabled) { } Log.Message("PokeItems mod is ready!", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 87); } private void Update() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_00e2: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016f: 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_0180: Unknown result type (might be due to invalid IL or missing references) //IL_01c0: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Unknown result type (might be due to invalid IL or missing references) //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0376: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Unknown result type (might be due to invalid IL or missing references) //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0393: Unknown result type (might be due to invalid IL or missing references) //IL_03d3: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_03fc: Unknown result type (might be due to invalid IL or missing references) //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_0414: Unknown result type (might be due to invalid IL or missing references) //IL_0454: Unknown result type (might be due to invalid IL or missing references) //IL_0478: Unknown result type (might be due to invalid IL or missing references) //IL_047d: Unknown result type (might be due to invalid IL or missing references) //IL_0484: Unknown result type (might be due to invalid IL or missing references) //IL_048b: Unknown result type (might be due to invalid IL or missing references) //IL_0495: Unknown result type (might be due to invalid IL or missing references) if (!ConfigManager.SpawnModeEnabled.Value) { return; } if (Input.GetKeyDown((KeyCode)283)) { Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed key. Spawning custom item at coordinates {transform.position}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 107); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(AirBalloon.itemDef.itemIndex), transform.position, transform.forward * 30f); } if (Input.GetKeyDown((KeyCode)284)) { Transform transform2 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed key. Spawning custom item at coordinates {transform2.position}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 119); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(FlameOrb.itemDef.itemIndex), transform2.position, transform2.forward * 30f); } if (Input.GetKeyDown((KeyCode)285)) { Transform transform3 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed key. Spawning custom item at coordinates {transform3.position}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 131); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(Leftovers.itemDef.itemIndex), transform3.position, transform3.forward * 30f); } if (Input.GetKeyDown((KeyCode)286)) { Transform transform4 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed key. Spawning custom item at coordinates {transform4.position}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 143); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(ExpShare.itemDef.itemIndex), transform4.position, transform4.forward * 30f); } if (Input.GetKeyDown((KeyCode)287)) { Transform transform5 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed key. Spawning custom item at coordinates {transform5.position}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 155); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(AmuletCoin.itemDef.itemIndex), transform5.position, transform5.forward * 30f); } if (Input.GetKeyDown((KeyCode)288)) { Transform transform6 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed key. Spawning custom item at coordinates {transform6.position}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 167); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(HeavyDutyBoots.itemDef.itemIndex), transform6.position, transform6.forward * 30f); } if (isUnfinishedEnabled) { if (Input.GetKeyDown((KeyCode)289)) { Transform transform7 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed key. Spawning custom item at coordinates {transform7.position}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 182); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(ChoiceBand.itemDef.itemIndex), transform7.position, transform7.forward * 30f); } if (Input.GetKeyDown((KeyCode)290)) { Transform transform8 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed key. Spawning custom item at coordinates {transform8.position}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 194); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(ChoiceSpecs.itemDef.itemIndex), transform8.position, transform8.forward * 30f); } if (Input.GetKeyDown((KeyCode)291)) { Transform transform9 = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Player pressed key. Spawning custom item at coordinates {transform9.position}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 206); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(ChoiceScarf.itemDef.itemIndex), transform9.position, transform9.forward * 30f); } } } } } namespace PokeItems.Managers { public static class AssetManager { public static AssetBundle bundle; public const string bundleName = "pokeassets"; public static string AssetBundlePath => Path.Combine(Path.GetDirectoryName(PokeItems.PInfo.Location), "pokeassets"); public static void Init() { bundle = AssetBundle.LoadFromFile(AssetBundlePath); } } internal static class ChoiceManager { [CompilerGenerated] private static class <>O { public static hook_OnExecute <0>__SkillUsed; public static hook_RunRecharge <1>__ModifyCooldown; public static hook_Start <2>__StageStart; public static hook_OnBodyStart <3>__BodyStart; } public static float cooldownPenaltyPerStack = 20f; public static float cooldownPenaltyPercentLimit = 1f; private static readonly Dictionary chosenSkills = new Dictionary(); public static void Init() { //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 //IL_0053: 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_005e: Expected O, but got Unknown //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown object obj = <>O.<0>__SkillUsed; if (obj == null) { hook_OnExecute val = SkillUsed; <>O.<0>__SkillUsed = val; obj = (object)val; } GenericSkill.OnExecute += (hook_OnExecute)obj; object obj2 = <>O.<1>__ModifyCooldown; if (obj2 == null) { hook_RunRecharge val2 = ModifyCooldown; <>O.<1>__ModifyCooldown = val2; obj2 = (object)val2; } GenericSkill.RunRecharge += (hook_RunRecharge)obj2; object obj3 = <>O.<2>__StageStart; if (obj3 == null) { hook_Start val3 = StageStart; <>O.<2>__StageStart = val3; obj3 = (object)val3; } Stage.Start += (hook_Start)obj3; object obj4 = <>O.<3>__BodyStart; if (obj4 == null) { hook_OnBodyStart val4 = BodyStart; <>O.<3>__BodyStart = val4; obj4 = (object)val4; } CharacterMaster.OnBodyStart += (hook_OnBodyStart)obj4; } private static void SkillUsed(orig_OnExecute orig, GenericSkill self) { orig.Invoke(self); CharacterBody characterBody = self.characterBody; if (!((Object)(object)characterBody == (Object)null) && !((Object)(object)characterBody.inventory == (Object)null) && GetTotalChoiceStacks(characterBody) > 0 && !ChoiceBuffs.HasChoiceLock(characterBody)) { if ((Object)(object)characterBody.skillLocator.primary == (Object)(object)self) { characterBody.AddBuff(ChoiceBuffs.ChoicePrimaryLock); } else if ((Object)(object)characterBody.skillLocator.secondary == (Object)(object)self) { characterBody.AddBuff(ChoiceBuffs.ChoiceSecondaryLock); } else if ((Object)(object)characterBody.skillLocator.utility == (Object)(object)self) { characterBody.AddBuff(ChoiceBuffs.ChoiceUtilityLock); } else if ((Object)(object)characterBody.skillLocator.special == (Object)(object)self) { characterBody.AddBuff(ChoiceBuffs.ChoiceSpecialLock); } } } private static void ModifyCooldown(orig_RunRecharge orig, GenericSkill self, float rechargeTime) { if (rechargeTime <= 0f) { orig.Invoke(self, rechargeTime); return; } CharacterBody characterBody = self.characterBody; if ((Object)(object)characterBody == (Object)null || (Object)(object)characterBody.inventory == (Object)null) { orig.Invoke(self, rechargeTime); return; } int totalChoiceStacks = GetTotalChoiceStacks(characterBody); if (!ChoiceBuffs.HasChoiceLock(characterBody) || IsChosenSkill(characterBody, self)) { orig.Invoke(self, rechargeTime); return; } float floatValue = ConfigManager.GetFloatValue(ConfigManager.ChoiceItems_CooldownPenaltyPerStack, cooldownPenaltyPerStack); float exponentialPercentReductionStacking = MathUtility.GetExponentialPercentReductionStacking(floatValue, Math.Max(1, totalChoiceStacks)); exponentialPercentReductionStacking = Mathf.Max(exponentialPercentReductionStacking, cooldownPenaltyPercentLimit / 100f); float num = rechargeTime * exponentialPercentReductionStacking; orig.Invoke(self, num); } private static IEnumerator StageStart(orig_Start orig, Stage self) { yield return orig.Invoke(self); foreach (CharacterMaster master in CharacterMaster.readOnlyInstancesList) { CharacterBody body = master.GetBody(); if ((Object)(object)body != (Object)null) { ChoiceBuffs.RemoveAllChoiceLocks(body); } } } private static void BodyStart(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body) { orig.Invoke(self, body); if ((Object)(object)body != (Object)null) { ChoiceBuffs.RemoveAllChoiceLocks(body); } } private static bool IsChosenSkill(CharacterBody body, GenericSkill skill) { if ((Object)(object)body.skillLocator.primary == (Object)(object)skill) { return body.HasBuff(ChoiceBuffs.ChoicePrimaryLock); } if ((Object)(object)body.skillLocator.secondary == (Object)(object)skill) { return body.HasBuff(ChoiceBuffs.ChoiceSecondaryLock); } if ((Object)(object)body.skillLocator.utility == (Object)(object)skill) { return body.HasBuff(ChoiceBuffs.ChoiceUtilityLock); } if ((Object)(object)body.skillLocator.special == (Object)(object)skill) { return body.HasBuff(ChoiceBuffs.ChoiceSpecialLock); } return false; } public static int GetTotalChoiceStacks(CharacterBody body) { Inventory inventory = body.inventory; if ((Object)(object)inventory == (Object)null) { return 0; } return inventory.GetItemCountEffective(ChoiceBand.itemDef) + inventory.GetItemCountEffective(ChoiceSpecs.itemDef) + inventory.GetItemCountEffective(ChoiceScarf.itemDef); } } internal class ConfigManager { public static ConfigEntry CustomValuesEnabled; public static ConfigEntry SpawnModeEnabled; public static ConfigEntry UnfinishedItemsEnabled; public static ConfigEntry Leftovers_RegenBonusPerStack; public static ConfigEntry Leftovers_RegenBonusPerExtraStack; public static ConfigEntry FlameOrb_ProcPercentPerStack; public static ConfigEntry FlameOrb_DebuffDuration; public static ConfigEntry AirBalloon_FallSpeedLimit; public static ConfigEntry AirBalloon_FallPercentReductionPerExtraStack; public static ConfigEntry AirBalloon_HpThresholdPercent; public static ConfigEntry ExpShare_ExpPercentBonusPerStack; public static ConfigEntry ExpShare_ExpPercentBonusPerExtraStack; public static ConfigEntry ExpShare_ExpRateBonus; public static ConfigEntry AmuletCoin_GoldMulPercentPerStack; public static ConfigEntry HeavyDutyBoots_ArmorBonusPerStack; public static ConfigEntry HeavyDutyBoots_ArmorBonusPerExtraStack; public static ConfigEntry ChoiceItems_CooldownPenaltyPerStack; public static ConfigEntry ChoiceBand_DamageBonus; public static ConfigEntry ChoiceBand_DamageBonusPerExtraStack; public static ConfigEntry ChoiceSpecs_DamageBonus; public static ConfigEntry ChoiceSpecs_DamageBonusPerExtraStack; public static ConfigEntry ChoiceScarf_MovementBonus; public static ConfigEntry ChoiceScarf_MovementBonusPerExtraStack; public static void Init() { ConfigFile pConfig = PokeItems.PConfig; CustomValuesEnabled = pConfig.Bind("! Important !", "Use Custom Values", false, "Whether items utilise user-inputted/custom values instead of the preferred values [TURN THIS ON IF YOU WANT TO CUSTOMIZE VALUES]."); SpawnModeEnabled = pConfig.Bind("! Important !", "Spawn Mode", false, "Enable Spawn Mode to allow spawning custom items via F-keys."); UnfinishedItemsEnabled = pConfig.Bind("! Important !", "Enable Unfinished Items", false, "Allow early-access items that are either unfinished or currently being developed. NOTE: You will need to restart your game."); Leftovers_RegenBonusPerStack = pConfig.Bind("Leftovers", "Initial Regeneration Bonus", Leftovers.regenBonusPerStack, "Health regeneration applied from initial stack."); Leftovers_RegenBonusPerExtraStack = pConfig.Bind("Leftovers", "Regeneration Bonus Per Extra Stack", Leftovers.regenBonusPerExtraStack, "Health regeneration applied per extra stack."); FlameOrb_ProcPercentPerStack = pConfig.Bind("Flame Orb", "Burn Chance Percent Per Stack", FlameOrb.procPercentPerStack, "Chance to inflict burn per stack."); FlameOrb_DebuffDuration = pConfig.Bind("Flame Orb", "Burn Duration", FlameOrb.debuffDuration, "How long the burn debuff lasts."); AirBalloon_FallSpeedLimit = pConfig.Bind("Air Balloon", "Fall Speed Limit", AirBalloon.fallSpeedLimit, "Limit applied to falling speed (m/s)."); AirBalloon_FallPercentReductionPerExtraStack = pConfig.Bind("Air Balloon", "Fall Percent Reduction Per Extra Stack", AirBalloon.fallPercentReductionPerExtraStack, "Reduction percent over falling speed limit exponentially applied."); AirBalloon_HpThresholdPercent = pConfig.Bind("Air Balloon", "HP Threshold Percent", AirBalloon.hpThresholdPercent, "How low the HP can deplete before the balloon pops."); ExpShare_ExpPercentBonusPerStack = pConfig.Bind("EXP Share", "Initial EXP Percent Bonus", ExpShare.expPercentBonusPerStack, "Extra percent of EXP is applied from initial stack."); ExpShare_ExpPercentBonusPerExtraStack = pConfig.Bind("EXP Share", "EXP Percent Bonus Per Extra Stack", ExpShare.expPercentBonusPerExtraStack, "Extra percent of EXP is applied per extra stack."); ExpShare_ExpRateBonus = pConfig.Bind("EXP Share", "Required EXP Percent Rate", ExpShare.expRateBonus, "Percent amount of required EXP gained per minute."); AmuletCoin_GoldMulPercentPerStack = pConfig.Bind("Amulet Coin", "Gold Percent Bonus", AmuletCoin.goldMulPercentPerStack, "Extra percent of gold is applied per stack."); HeavyDutyBoots_ArmorBonusPerStack = pConfig.Bind("Heavy-Duty Boots", "Initial Armor Bonus", HeavyDutyBoots.armorBonusPerStack, "Extra percent of EXP is applied from initial stack."); HeavyDutyBoots_ArmorBonusPerExtraStack = pConfig.Bind("Heavy-Duty Boots", "Armor Bonus Per Extra Stack", HeavyDutyBoots.armorBonusPerExtraStack, "How long the burn debuff lasts."); ChoiceItems_CooldownPenaltyPerStack = pConfig.Bind("Choice Items", "Cooldown Penalty Per Stack", ChoiceManager.cooldownPenaltyPerStack, "How slow the non-preferred skill cooldown recharges."); ChoiceBand_DamageBonus = pConfig.Bind("Choice Band", "Initial Damage Bonus", ChoiceBand.damageBonus, "Initial damage bonus percent for Primary and Secondary skills."); ChoiceBand_DamageBonusPerExtraStack = pConfig.Bind("Choice Band", "Damage Bonus Per Extra Stack", ChoiceBand.damageBonusPerExtraStack, "Damage bonus percent for Primary and Secondary skills per extra stack."); ChoiceSpecs_DamageBonus = pConfig.Bind("Choice Specs", "Initial Damage Bonus", ChoiceSpecs.damageBonus, "Initial damage bonus percent for Utility and Special skills."); ChoiceSpecs_DamageBonusPerExtraStack = pConfig.Bind("Choice Specs", "Damage Bonus Per Extra Stack", ChoiceSpecs.damageBonusPerExtraStack, "Damage bonus percent for Utility and Special skills per extra stack."); ChoiceScarf_MovementBonus = pConfig.Bind("Choice Scarf", "Initial Movement Bonus", ChoiceScarf.movementBonus, "Initial movement bonus percent."); ChoiceScarf_MovementBonusPerExtraStack = pConfig.Bind("Choice Scarf", "Movement Bonus Per Extra Stack", ChoiceScarf.movementBonusPerExtraStack, "Movement bonus percent per extra stack."); } public static float GetFloatValue(ConfigEntry config, float defaultValue) { if (CustomValuesEnabled.Value) { return config.Value; } return defaultValue; } } internal class ItemManager { public static ItemDef itemDef; public static readonly Dictionary tokenMap = new Dictionary(); public unsafe static ItemDef CreateItemDef(string name, ItemTier tier, bool canRemove, bool hidden, ItemTag[] tags, params object[] itemTokens) { //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e0: Invalid comparison between Unknown and I4 //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Invalid comparison between Unknown and I4 //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Invalid comparison between Unknown and I4 //IL_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Invalid comparison between Unknown and I4 //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Expected O, but got Unknown //IL_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021d: Invalid comparison between Unknown and I4 //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Expected O, but got Unknown //IL_02aa: Unknown result type (might be due to invalid IL or missing references) itemDef = ScriptableObject.CreateInstance(); ((Object)itemDef).name = name; itemDef.nameToken = "Item_" + ((Object)itemDef).name + "_Name"; itemDef.pickupToken = "Item_" + ((Object)itemDef).name + "_Pickup"; itemDef.descriptionToken = "Item_" + ((Object)itemDef).name + "_Desc"; itemDef.loreToken = "Item_" + ((Object)itemDef).name + "_Lore"; tokenMap[itemDef.descriptionToken] = itemTokens; GameObject val = AssetManager.bundle.LoadAsset(name + ".prefab"); if ((Object)(object)val == (Object)null) { if ((int)tier != 5) { Log.Warning("Missing prefab file for item " + ((Object)itemDef).name + ". Substituting default...", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\ItemManager.cs", 32); } val = Addressables.LoadAssetAsync((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion(); } Sprite val2 = AssetManager.bundle.LoadAsset(name + ".png"); if ((Object)(object)val2 == (Object)null) { Log.Warning("Missing sprite file for item " + ((Object)itemDef).name + ". Substituting default...", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\ItemManager.cs", 41); val2 = (itemDef.pickupIconSprite = Addressables.LoadAssetAsync((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion()); } ModelPanelParameters val3 = val.AddComponent(); val3.focusPointTransform = val.transform; val3.cameraPositionTransform = val.transform; val3.maxDistance = 10f; val3.minDistance = 5f; itemDef.pickupIconSprite = val2; itemDef.pickupModelPrefab = val; itemDef.deprecatedTier = tier; if ((int)itemDef.tier == 9 || (int)itemDef.tier == 6 || (int)itemDef.tier == 7 || (int)itemDef.tier == 8) { itemDef.requiredExpansion = PokeItems.sotvDLC; } itemDef.canRemove = canRemove; itemDef.hidden = hidden; itemDef.tags = tags; ItemDisplayRuleDict val4 = new ItemDisplayRuleDict((ItemDisplayRule[])null); Language.onCurrentLanguageChanged += FormatDescription; ItemAPI.Add(new CustomItem(itemDef, val4)); string text = ""; for (int i = 0; i < tags.Length; i++) { text = text + ((object)tags[i]/*cast due to .constrained prefix*/).ToString() + ", "; } Log.Info("Item created: " + name + "; Tier: " + ((object)(*(ItemTier*)(&tier))/*cast due to .constrained prefix*/).ToString() + "; Tags: " + text.Trim(), "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\ItemManager.cs", 88); return itemDef; } private static void FormatDescription() { foreach (KeyValuePair item in tokenMap) { string stringFormatted = Language.GetStringFormatted(item.Key, item.Value); LanguageAPI.AddOverlay(item.Key, stringFormatted); } } } internal static class RiskOfOptionsManager { private const string RiskOfOptionsGUID = "com.rune580.riskofoptions"; private const string IconName = "ModIcon"; private static bool initialized; public static void Init() { if (!initialized) { initialized = true; if (Chainloader.PluginInfos.ContainsKey("com.rune580.riskofoptions")) { InitializeRiskOfOptions(); } } } [MethodImpl(MethodImplOptions.NoInlining)] private static void InitializeRiskOfOptions() { try { Sprite modIcon = AssetManager.bundle.LoadAsset("ModIcon.png"); ModSettingsManager.SetModIcon(modIcon); RegisterOptions(); Log.Info("Risk of Options detected. Added PokeItems configuration to mod menu.", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\RiskOfOptionsManager.cs", 48); } catch (Exception ex) { Log.Error("Failed to initialize Risk of Options integration:\n" + ex, "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\RiskOfOptionsManager.cs", 52); } } private static void RegisterOptions() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Expected O, but got Unknown //IL_0061: 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) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Expected O, but got Unknown //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Expected O, but got Unknown //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Expected O, but got Unknown //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Expected O, but got Unknown //IL_00e2: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Expected O, but got Unknown //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Expected O, but got Unknown //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Expected O, but got Unknown //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Expected O, but got Unknown //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Expected O, but got Unknown //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01ae: Expected O, but got Unknown //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Expected O, but got Unknown //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_01d9: Expected O, but got Unknown //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Expected O, but got Unknown //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01e9: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Expected O, but got Unknown //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Expected O, but got Unknown //IL_020f: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Expected O, but got Unknown //IL_022a: Unknown result type (might be due to invalid IL or missing references) //IL_0234: Expected O, but got Unknown //IL_023a: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //IL_025a: Expected O, but got Unknown //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Expected O, but got Unknown //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_0285: Expected O, but got Unknown //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Expected O, but got Unknown //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02b0: Expected O, but got Unknown //IL_02ab: Unknown result type (might be due to invalid IL or missing references) //IL_02b5: Expected O, but got Unknown //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_02db: Expected O, but got Unknown //IL_02d6: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Expected O, but got Unknown //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_02eb: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_0306: Expected O, but got Unknown //IL_0301: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Expected O, but got Unknown //IL_0311: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0331: Expected O, but got Unknown //IL_032c: Unknown result type (might be due to invalid IL or missing references) //IL_0336: Expected O, but got Unknown //IL_033c: Unknown result type (might be due to invalid IL or missing references) //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_034c: Unknown result type (might be due to invalid IL or missing references) //IL_035c: Expected O, but got Unknown //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Expected O, but got Unknown //IL_0367: Unknown result type (might be due to invalid IL or missing references) //IL_036c: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_0387: Expected O, but got Unknown //IL_0382: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Expected O, but got Unknown ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ConfigManager.CustomValuesEnabled)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ConfigManager.SpawnModeEnabled)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ConfigManager.UnfinishedItemsEnabled)); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.Leftovers_RegenBonusPerStack, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.Leftovers_RegenBonusPerExtraStack, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.FlameOrb_ProcPercentPerStack, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.FlameOrb_DebuffDuration, new SliderConfig { min = 0f, max = 30f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.AirBalloon_FallSpeedLimit, new SliderConfig { min = 0f, max = 200f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.AirBalloon_FallPercentReductionPerExtraStack, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.AirBalloon_HpThresholdPercent, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ExpShare_ExpPercentBonusPerStack, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ExpShare_ExpPercentBonusPerExtraStack, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ExpShare_ExpRateBonus, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.AmuletCoin_GoldMulPercentPerStack, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.HeavyDutyBoots_ArmorBonusPerStack, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.HeavyDutyBoots_ArmorBonusPerExtraStack, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ChoiceItems_CooldownPenaltyPerStack, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ChoiceBand_DamageBonus, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ChoiceBand_DamageBonusPerExtraStack, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ChoiceSpecs_DamageBonus, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ChoiceSpecs_DamageBonusPerExtraStack, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ChoiceScarf_MovementBonus, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ChoiceScarf_MovementBonusPerExtraStack, new SliderConfig { min = 0f, max = 1000f })); } } } namespace PokeItems.Items { internal class AirBalloon { [CompilerGenerated] private static class <>O { public static hook_TakeDamage <0>__AirBalloonDamagedHook; public static hook_FixedUpdate <1>__AirBalloonHook; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)0; public static float fallSpeedLimit = 50f; public static float fallPercentReductionPerExtraStack = 10f; public static float hpThresholdPercent = 35f; public static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("AirBalloon", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)3, (ItemTag)31 }, fallSpeedLimit, fallPercentReductionPerExtraStack, hpThresholdPercent); object obj = <>O.<0>__AirBalloonDamagedHook; if (obj == null) { hook_TakeDamage val = AirBalloonDamagedHook; <>O.<0>__AirBalloonDamagedHook = val; obj = (object)val; } HealthComponent.TakeDamage += (hook_TakeDamage)obj; object obj2 = <>O.<1>__AirBalloonHook; if (obj2 == null) { hook_FixedUpdate val2 = AirBalloonHook; <>O.<1>__AirBalloonHook = val2; obj2 = (object)val2; } CharacterMotor.FixedUpdate += (hook_FixedUpdate)obj2; } private static void AirBalloonDamagedHook(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { orig.Invoke(self, damageInfo); CharacterBody body = self.body; if ((Object)(object)body == (Object)null || (Object)(object)body.inventory == (Object)null || (Object)(object)body.healthComponent == (Object)null) { return; } int itemCountEffective = body.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.AirBalloon_HpThresholdPercent, hpThresholdPercent); float num = self.combinedHealth / self.fullCombinedHealth; if (num <= floatValue / 100f) { PopAllBalloons(body.inventory); } } } private static void PopAllBalloons(Inventory inventory) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) int itemCountEffective = inventory.GetItemCountEffective(itemDef); if (itemCountEffective <= 0) { return; } inventory.RemoveItem(itemDef, itemCountEffective); inventory.GiveItem(AirBalloonBroken.itemDef, itemCountEffective); CharacterMaster component = ((Component)inventory).GetComponent(); if (Object.op_Implicit((Object)(object)component)) { CharacterBody body = component.GetBody(); if (Object.op_Implicit((Object)(object)body) && body.isPlayerControlled) { CharacterMasterNotificationQueue.PushItemTransformNotification(component, itemDef.itemIndex, AirBalloonBroken.itemDef.itemIndex, (TransformationType)0); } } } private static void AirBalloonHook(orig_FixedUpdate orig, CharacterMotor self) { //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: 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) orig.Invoke(self); CharacterBody body = self.body; if ((Object)(object)body == (Object)null || (Object)(object)body.inventory == (Object)null) { return; } int itemCountEffective = body.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0 && self.velocity.y < 0f) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.AirBalloon_FallSpeedLimit, fallSpeedLimit); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.AirBalloon_FallPercentReductionPerExtraStack, fallPercentReductionPerExtraStack); float exponentialPercentReductionStacking = MathUtility.GetExponentialPercentReductionStacking(floatValue2, itemCountEffective - 1); float num = (0f - floatValue) * exponentialPercentReductionStacking; if (self.velocity.y < num) { Vector3 velocity = self.velocity; velocity.y = num; self.velocity = velocity; } } } } internal class AirBalloonBroken { public static ItemDef itemDef; private static ItemTier tier = (ItemTier)5; public static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) itemDef = ItemManager.CreateItemDef("AirBalloonBroken", tier, false, false, Array.Empty()); } } internal class AmuletCoin { [CompilerGenerated] private static class <>O { public static hook_OnKilledServer <0>__AmuletCoinHook; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)2; public static float goldMulPercentPerStack = 100f; public static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("AmuletCoin", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)3, (ItemTag)31 }, goldMulPercentPerStack); object obj = <>O.<0>__AmuletCoinHook; if (obj == null) { hook_OnKilledServer val = AmuletCoinHook; <>O.<0>__AmuletCoinHook = val; obj = (object)val; } DeathRewards.OnKilledServer += (hook_OnKilledServer)obj; } private static void AmuletCoinHook(orig_OnKilledServer orig, DeathRewards self, DamageReport damageReport) { CharacterBody attackerBody = damageReport.attackerBody; if ((Object)(object)attackerBody != (Object)null && (Object)(object)attackerBody.inventory != (Object)null) { int itemCountEffective = attackerBody.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.AmuletCoin_GoldMulPercentPerStack, goldMulPercentPerStack); float num = 1f + MathUtility.GetLinearStacking(floatValue, itemCountEffective) / 100f; self.goldReward = (uint)Mathf.RoundToInt((float)self.goldReward * num); } } orig.Invoke(self, damageReport); } } internal class ChoiceBand { [CompilerGenerated] private static class <>O { public static hook_TakeDamage <0>__ChoiceBandDamageHook; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)3; public static float damageBonus = 100f; public static float damageBonusPerExtraStack = 50f; public static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("ChoiceBand", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)1, (ItemTag)31 }, damageBonus, damageBonusPerExtraStack, ChoiceManager.cooldownPenaltyPerStack); object obj = <>O.<0>__ChoiceBandDamageHook; if (obj == null) { hook_TakeDamage val = ChoiceBandDamageHook; <>O.<0>__ChoiceBandDamageHook = val; obj = (object)val; } HealthComponent.TakeDamage += (hook_TakeDamage)obj; } private static void ChoiceBandDamageHook(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Invalid comparison between Unknown and I4 //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Invalid comparison between Unknown and I4 if ((Object)(object)damageInfo.attacker == (Object)null) { orig.Invoke(self, damageInfo); return; } CharacterBody component = damageInfo.attacker.GetComponent(); if ((Object)(object)component == (Object)null || (Object)(object)component.inventory == (Object)null) { orig.Invoke(self, damageInfo); return; } int itemCountEffective = component.inventory.GetItemCountEffective(itemDef); if (itemCountEffective <= 0) { orig.Invoke(self, damageInfo); return; } DamageSource damageSource = damageInfo.damageType.damageSource; bool flag = (damageSource & 1) > 0; bool flag2 = (damageSource & 2) > 0; if (!flag && !flag2) { orig.Invoke(self, damageInfo); return; } float floatValue = ConfigManager.GetFloatValue(ConfigManager.ChoiceBand_DamageBonus, damageBonus); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.ChoiceBand_DamageBonusPerExtraStack, damageBonusPerExtraStack); float linearWithExtraStacking = MathUtility.GetLinearWithExtraStacking(floatValue, floatValue2, itemCountEffective); float num = 1f + linearWithExtraStacking / 100f; damageInfo.damage *= num; orig.Invoke(self, damageInfo); } } internal class ChoiceScarf { [CompilerGenerated] private static class <>O { public static StatHookEventHandler <0>__ChoiceScarfMovementHook; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)3; public static float movementBonus = 30f; public static float movementBonusPerExtraStack = 20f; public static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("ChoiceScarf", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)3, (ItemTag)31 }, movementBonus, movementBonusPerExtraStack, ChoiceManager.cooldownPenaltyPerStack); object obj = <>O.<0>__ChoiceScarfMovementHook; if (obj == null) { StatHookEventHandler val = ChoiceScarfMovementHook; <>O.<0>__ChoiceScarfMovementHook = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; } private static void ChoiceScarfMovementHook(CharacterBody body, StatHookEventArgs args) { if (!((Object)(object)body == (Object)null) && Object.op_Implicit((Object)(object)body.inventory)) { int itemCountEffective = body.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.ChoiceScarf_MovementBonus, movementBonus); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.ChoiceScarf_MovementBonusPerExtraStack, movementBonusPerExtraStack); float linearWithExtraStacking = MathUtility.GetLinearWithExtraStacking(floatValue, floatValue2, itemCountEffective); args.moveSpeedMultAdd += linearWithExtraStacking / 100f; } } } } internal class ChoiceSpecs { [CompilerGenerated] private static class <>O { public static hook_TakeDamage <0>__ChoiceSpecsDamageHook; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)3; public static float damageBonus = 100f; public static float damageBonusPerExtraStack = 50f; public static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("ChoiceSpecs", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)1, (ItemTag)31 }, damageBonus, damageBonusPerExtraStack, ChoiceManager.cooldownPenaltyPerStack); object obj = <>O.<0>__ChoiceSpecsDamageHook; if (obj == null) { hook_TakeDamage val = ChoiceSpecsDamageHook; <>O.<0>__ChoiceSpecsDamageHook = val; obj = (object)val; } HealthComponent.TakeDamage += (hook_TakeDamage)obj; } private static void ChoiceSpecsDamageHook(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Invalid comparison between Unknown and I4 //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Invalid comparison between Unknown and I4 if ((Object)(object)damageInfo.attacker == (Object)null) { orig.Invoke(self, damageInfo); return; } CharacterBody component = damageInfo.attacker.GetComponent(); if ((Object)(object)component == (Object)null || (Object)(object)component.inventory == (Object)null) { orig.Invoke(self, damageInfo); return; } int itemCountEffective = component.inventory.GetItemCountEffective(itemDef); if (itemCountEffective <= 0) { orig.Invoke(self, damageInfo); return; } DamageSource damageSource = damageInfo.damageType.damageSource; bool flag = (damageSource & 4) > 0; bool flag2 = (damageSource & 8) > 0; if (!flag && !flag2) { orig.Invoke(self, damageInfo); return; } float floatValue = ConfigManager.GetFloatValue(ConfigManager.ChoiceSpecs_DamageBonus, damageBonus); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.ChoiceSpecs_DamageBonusPerExtraStack, damageBonusPerExtraStack); float linearWithExtraStacking = MathUtility.GetLinearWithExtraStacking(floatValue, floatValue2, itemCountEffective); float num = 1f + linearWithExtraStacking / 100f; damageInfo.damage *= num; orig.Invoke(self, damageInfo); } } internal class ExpShare { [CompilerGenerated] private static class <>O { public static hook_AwardExperience <0>__ExpShareHook; public static hook_FixedUpdate <1>__ExpShareRateHook; public static hook_OnDestroy <2>__DictionaryDestroy; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)2; public static float expPercentBonusPerStack = 200f; public static float expPercentBonusPerExtraStack = 100f; public static float expRateBonus = 30f; private static readonly Dictionary timersDict = new Dictionary(); private static readonly Dictionary prevRunTimesDict = new Dictionary(); private static bool isPassiveEXP = false; public static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_00a5: 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_00b0: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("ExpShare", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)3, (ItemTag)31 }, expPercentBonusPerStack, expPercentBonusPerExtraStack, expRateBonus); object obj = <>O.<0>__ExpShareHook; if (obj == null) { hook_AwardExperience val = ExpShareHook; <>O.<0>__ExpShareHook = val; obj = (object)val; } ExperienceManager.AwardExperience += (hook_AwardExperience)obj; object obj2 = <>O.<1>__ExpShareRateHook; if (obj2 == null) { hook_FixedUpdate val2 = ExpShareRateHook; <>O.<1>__ExpShareRateHook = val2; obj2 = (object)val2; } CharacterBody.FixedUpdate += (hook_FixedUpdate)obj2; object obj3 = <>O.<2>__DictionaryDestroy; if (obj3 == null) { hook_OnDestroy val3 = DictionaryDestroy; <>O.<2>__DictionaryDestroy = val3; obj3 = (object)val3; } CharacterMaster.OnDestroy += (hook_OnDestroy)obj3; } private static void ExpShareHook(orig_AwardExperience orig, ExperienceManager self, Vector3 origin, CharacterBody body, ulong experience) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)body != (Object)null && (Object)(object)body.inventory != (Object)null && !isPassiveEXP) { int itemCountEffective = body.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.ExpShare_ExpPercentBonusPerStack, expPercentBonusPerStack); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.ExpShare_ExpPercentBonusPerExtraStack, expPercentBonusPerExtraStack); float num = 1f + MathUtility.GetLinearWithExtraStacking(floatValue, floatValue2, itemCountEffective) / 100f; experience = (ulong)((float)experience * num); } } orig.Invoke(self, origin, body, experience); } private static void ExpShareRateHook(orig_FixedUpdate orig, CharacterBody self) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Invalid comparison between Unknown and I4 orig.Invoke(self); if (!NetworkServer.active || (Object)(object)self == (Object)null || (Object)(object)self.inventory == (Object)null || (Object)(object)self.master == (Object)null) { return; } int itemCountEffective = self.inventory.GetItemCountEffective(itemDef); bool flag = itemCountEffective > 0; Run instance = Run.instance; if ((Object)(object)instance == (Object)null) { return; } SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene(); bool flag2 = (Object)(object)sceneDefForCurrentScene != (Object)null && (int)sceneDefForCurrentScene.sceneType == 1; CharacterMaster master = self.master; float fixedTime = instance.fixedTime; if (!prevRunTimesDict.ContainsKey(master) || !flag2 || !flag) { ResetTimer(master, fixedTime); return; } float num = prevRunTimesDict[master]; float num2 = fixedTime - num; prevRunTimesDict[master] = fixedTime; if (!(num2 <= 0f)) { timersDict[master] += num2; if (timersDict[master] >= 1f) { timersDict[master] -= 1f; GainPassiveEXP(self, itemCountEffective); } } } private static void GainPassiveEXP(CharacterBody body, int itemCount) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.ExpShare_ExpRateBonus, expRateBonus); uint num = (uint)Mathf.FloorToInt(body.level); ulong experienceForLevel = TeamManager.GetExperienceForLevel(num); ulong experienceForLevel2 = TeamManager.GetExperienceForLevel(num + 1); ulong num2 = experienceForLevel2 - experienceForLevel; ulong num3 = (ulong)((float)num2 * (floatValue / 100f / 60f)); if (num3 == 0) { num3 = 1uL; } isPassiveEXP = true; ExperienceManager.instance.AwardExperience(body.corePosition, body, num3); isPassiveEXP = false; } } private static void ResetTimer(CharacterMaster master, float currTime) { prevRunTimesDict[master] = currTime; timersDict[master] = 0f; } private static void DictionaryDestroy(orig_OnDestroy orig, CharacterMaster self) { timersDict.Remove(self); prevRunTimesDict.Remove(self); orig.Invoke(self); } } internal class FlameOrb { [CompilerGenerated] private static class <>O { public static hook_OnHitEnemy <0>__FlameOrbHook; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)0; public static float procPercentPerStack = 7f; public static float debuffDuration = 4f; public static float damageMul = 1f; public static void Init() { //IL_0006: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("FlameOrb", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)1, (ItemTag)31 }, procPercentPerStack, debuffDuration); object obj = <>O.<0>__FlameOrbHook; if (obj == null) { hook_OnHitEnemy val = FlameOrbHook; <>O.<0>__FlameOrbHook = val; obj = (object)val; } GlobalEventManager.OnHitEnemy += (hook_OnHitEnemy)obj; } private static void FlameOrbHook(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, damageInfo, victim); if ((Object)(object)damageInfo.attacker == (Object)null || (Object)(object)victim == (Object)null) { return; } CharacterBody component = damageInfo.attacker.GetComponent(); CharacterBody component2 = victim.GetComponent(); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null || (Object)(object)component.inventory == (Object)null) { return; } int itemCountEffective = component.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.FlameOrb_ProcPercentPerStack, procPercentPerStack); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.FlameOrb_DebuffDuration, debuffDuration); float linearStacking = MathUtility.GetLinearStacking(floatValue, itemCountEffective, damageInfo.procCoefficient); if (Util.CheckRoll(linearStacking, component.master)) { InflictDotInfo val = new InflictDotInfo { victimObject = victim, attackerObject = damageInfo.attacker, dotIndex = (DotIndex)1, duration = floatValue2, damageMultiplier = damageMul }; StrengthenBurnUtils.CheckDotForUpgrade(component.inventory, ref val); DotController.InflictDot(ref val); } } } } internal class HeavyDutyBoots { [CompilerGenerated] private static class <>O { public static StatHookEventHandler <0>__HeavyDutyBootsHook; public static hook_FixedUpdate <1>__HeavyDutyBootsGroundedHook; public static hook_OnDestroy <2>__DictionaryDestroy; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)1; public static float armorBonusPerStack = 20f; public static float armorBonusPerExtraStack = 10f; private static readonly Dictionary isGroundedDict = new Dictionary(); public static void Init() { //IL_0006: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("HeavyDutyBoots", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)3, (ItemTag)31 }, armorBonusPerStack, armorBonusPerExtraStack); object obj = <>O.<0>__HeavyDutyBootsHook; if (obj == null) { StatHookEventHandler val = HeavyDutyBootsHook; <>O.<0>__HeavyDutyBootsHook = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; object obj2 = <>O.<1>__HeavyDutyBootsGroundedHook; if (obj2 == null) { hook_FixedUpdate val2 = HeavyDutyBootsGroundedHook; <>O.<1>__HeavyDutyBootsGroundedHook = val2; obj2 = (object)val2; } CharacterMotor.FixedUpdate += (hook_FixedUpdate)obj2; object obj3 = <>O.<2>__DictionaryDestroy; if (obj3 == null) { hook_OnDestroy val3 = DictionaryDestroy; <>O.<2>__DictionaryDestroy = val3; obj3 = (object)val3; } CharacterBody.OnDestroy += (hook_OnDestroy)obj3; } private static void HeavyDutyBootsHook(CharacterBody body, StatHookEventArgs args) { if ((Object)(object)body == (Object)null || (Object)(object)body.inventory == (Object)null) { return; } int itemCountEffective = body.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { CharacterMotor characterMotor = body.characterMotor; if ((Object)(object)characterMotor == (Object)null || characterMotor.isGrounded) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.HeavyDutyBoots_ArmorBonusPerStack, armorBonusPerStack); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.HeavyDutyBoots_ArmorBonusPerExtraStack, armorBonusPerExtraStack); args.armorAdd += MathUtility.GetLinearWithExtraStacking(floatValue, floatValue2, itemCountEffective); } } } private static void HeavyDutyBootsGroundedHook(orig_FixedUpdate orig, CharacterMotor self) { orig.Invoke(self); CharacterBody body = self.body; if ((Object)(object)body == (Object)null || (Object)(object)body.inventory == (Object)null) { return; } int itemCountEffective = body.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { bool isGrounded = self.isGrounded; if (!isGroundedDict.TryGetValue(body, out var value)) { isGroundedDict[body] = isGrounded; } else if (value != isGrounded) { isGroundedDict[body] = isGrounded; body.MarkAllStatsDirty(); } } } private static void DictionaryDestroy(orig_OnDestroy orig, CharacterBody self) { isGroundedDict.Remove(self); orig.Invoke(self); } } internal class Leftovers { [CompilerGenerated] private static class <>O { public static StatHookEventHandler <0>__LeftoversHook; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)1; public static float regenBonusPerStack = 4f; public static float regenBonusPerExtraStack = 2f; public static void Init() { //IL_0006: 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_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("Leftovers", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)2, (ItemTag)31 }, regenBonusPerStack, regenBonusPerExtraStack); object obj = <>O.<0>__LeftoversHook; if (obj == null) { StatHookEventHandler val = LeftoversHook; <>O.<0>__LeftoversHook = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; } private static void LeftoversHook(CharacterBody body, StatHookEventArgs args) { if (!((Object)(object)body == (Object)null) && Object.op_Implicit((Object)(object)body.inventory)) { int itemCountEffective = body.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.Leftovers_RegenBonusPerStack, regenBonusPerStack); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.Leftovers_RegenBonusPerExtraStack, regenBonusPerExtraStack); args.baseRegenAdd += MathUtility.GetLinearWithExtraStacking(floatValue, floatValue2, itemCountEffective); } } } } } namespace PokeItems.Buffs { internal static class ChoiceBuffs { public static readonly Dictionary tokenMap = new Dictionary(); public static BuffDef ChoicePrimaryLock; public static BuffDef ChoiceSecondaryLock; public static BuffDef ChoiceUtilityLock; public static BuffDef ChoiceSpecialLock; public static BuffDef[] ChoiceLocks; public static void Init() { ChoicePrimaryLock = CreateChoiceLock("PrimaryLock", TryGetSprite("PrimaryLock")); ChoiceSecondaryLock = CreateChoiceLock("SecondaryLock", TryGetSprite("SecondaryLock")); ChoiceUtilityLock = CreateChoiceLock("UtilityLock", TryGetSprite("UtilityLock")); ChoiceSpecialLock = CreateChoiceLock("SpecialLock", TryGetSprite("SpecialLock")); ChoiceLocks = (BuffDef[])(object)new BuffDef[4] { ChoicePrimaryLock, ChoiceSecondaryLock, ChoiceUtilityLock, ChoiceSpecialLock }; } private static Sprite TryGetSprite(string spriteName) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) Sprite val = AssetManager.bundle.LoadAsset(spriteName + ".png"); if ((Object)(object)val == (Object)null) { Log.Warning("Missing debuff sprite file for choice items. Substituting default...", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Buffs\\ChoiceBuffs.cs", 56); val = Addressables.LoadAssetAsync((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion(); } return val; } private static BuffDef CreateChoiceLock(string name, Sprite icon) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) BuffDef val = ScriptableObject.CreateInstance(); ((Object)val).name = name; val.iconSprite = icon; val.buffColor = Color.white; val.canStack = false; val.isDebuff = true; val.isHidden = false; ContentAddition.AddBuffDef(val); return val; } public static void RemoveAllChoiceLocks(CharacterBody body) { BuffDef[] choiceLocks = ChoiceLocks; foreach (BuffDef val in choiceLocks) { if (body.HasBuff(val)) { body.RemoveBuff(val); } } } public static bool HasChoiceLock(CharacterBody body) { return body.HasBuff(ChoicePrimaryLock) || body.HasBuff(ChoiceSecondaryLock) || body.HasBuff(ChoiceUtilityLock) || body.HasBuff(ChoiceSpecialLock); } } }