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 PokeItems v0.4.3
plugins/PokeItems.dll
Decompiled a week ago
The result has been truncated due to the large size, download it to view full contents!
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 LookingGlass.ItemStatsNameSpace; using Microsoft.CodeAnalysis; using On.RoR2; 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+634bac9421dfae0376aeed14c7611965f2d77d1a")] [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.4.3")] [NetworkCompatibility(/*Could not decode attribute arguments.*/)] [BepInDependency(/*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.4.3"; public static ExpansionDef sotvDLC; public static ExpansionDef sotsDLC; public static PluginInfo PInfo { get; private set; } public static ConfigFile PConfig { get; private set; } public static bool isUnfinishedEnabled { 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<ExpansionDef>((object)"RoR2/DLC1/Common/DLC1.asset").WaitForCompletion(); sotsDLC = Addressables.LoadAssetAsync<ExpansionDef>((object)"RoR2/DLC2/Common/DLC2.asset").WaitForCompletion(); Log.Init(((BaseUnityPlugin)this).Logger); ConfigManager.Init(); AssetManager.Init(); RiskOfOptionsManager.Init(); Leftovers.Init(); FlameOrb.Init(); AirBalloon.Init(); ExpShare.Init(); AmuletCoin.Init(); HeavyDutyBoots.Init(); ChoiceManager.Init(); ChoiceBand.Init(); ChoiceSpecs.Init(); ChoiceScarf.Init(); WeaknessPolicy.Init(); QuickClaw.Init(); BerryJuice.Init(); isUnfinishedEnabled = ConfigManager.UnfinishedItemsEnabled.Value; if (isUnfinishedEnabled) { LifeOrb.Init(); } LookingGlassManager.Init(); Log.Message("PokeItems mod is ready!", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\PokeItems.cs", 89); } public void Update() { SpawnMode.Update(); } } internal class SpawnMode { public static int pageNo = 0; private static int maxPages = 2; public static void Update() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: 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_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) if (!ConfigManager.SpawnModeEnabled.Value) { return; } if (Input.GetKeyDown((KeyCode)282)) { changePage(); } if (pageNo == 0) { if (Input.GetKeyDown((KeyCode)283)) { spawnItem(AirBalloon.itemDef.itemIndex, isUnfinished: false); } if (Input.GetKeyDown((KeyCode)284)) { spawnItem(FlameOrb.itemDef.itemIndex, isUnfinished: false); } if (Input.GetKeyDown((KeyCode)285)) { spawnItem(Leftovers.itemDef.itemIndex, isUnfinished: false); } if (Input.GetKeyDown((KeyCode)286)) { spawnItem(ExpShare.itemDef.itemIndex, isUnfinished: false); } if (Input.GetKeyDown((KeyCode)287)) { spawnItem(AmuletCoin.itemDef.itemIndex, isUnfinished: false); } if (Input.GetKeyDown((KeyCode)288)) { spawnItem(HeavyDutyBoots.itemDef.itemIndex, isUnfinished: false); } if (Input.GetKeyDown((KeyCode)289)) { spawnItem(ChoiceBand.itemDef.itemIndex, isUnfinished: false); } if (Input.GetKeyDown((KeyCode)290)) { spawnItem(ChoiceSpecs.itemDef.itemIndex, isUnfinished: false); } if (Input.GetKeyDown((KeyCode)291)) { spawnItem(ChoiceScarf.itemDef.itemIndex, isUnfinished: false); } } else if (pageNo == 1) { if (Input.GetKeyDown((KeyCode)283)) { spawnItem(WeaknessPolicy.itemDef.itemIndex, isUnfinished: false); } if (Input.GetKeyDown((KeyCode)284)) { spawnItem(QuickClaw.itemDef.itemIndex, isUnfinished: false); } if (Input.GetKeyDown((KeyCode)285)) { spawnItem(BerryJuice.itemDef.itemIndex, isUnfinished: false); } if (Input.GetKeyDown((KeyCode)286)) { spawnItem(LifeOrb.itemDef.itemIndex, isUnfinished: true); } } } private static void spawnItem(ItemIndex itemDex, bool isUnfinished) { //IL_0032: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: 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_0065: Unknown result type (might be due to invalid IL or missing references) if (!isUnfinished || PokeItems.isUnfinishedEnabled) { Transform transform = PlayerCharacterMasterController.instances[0].master.GetBodyObject().transform; Log.Info($"Spawning custom item at coordinates {transform.position}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\SpawnMode.cs", 94); PickupDropletController.CreatePickupDroplet(PickupCatalog.FindPickupIndex(itemDex), transform.position, transform.forward * 30f); } } private static void changePage() { if (++pageNo >= maxPages) { pageNo -= maxPages; } Log.Info($"Changed to page {pageNo + 1}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\SpawnMode.cs", 105); Chat.AddMessage($"<color=#FFAAFF>[PokeItems] Spawn Mode: Changed to page {pageNo + 1}.</color>"); } } } 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 class BuffManager { public static BuffDef buffDef; public static BuffDef CreateBuffDef(string name, Color color, bool canStack, bool isDebuff, bool isHidden) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) buffDef = ScriptableObject.CreateInstance<BuffDef>(); ((Object)buffDef).name = name; buffDef.iconSprite = TryGetSprite(name); buffDef.buffColor = color; buffDef.canStack = canStack; buffDef.isDebuff = isDebuff; buffDef.isHidden = isHidden; ContentAddition.AddBuffDef(buffDef); Log.Info("Buff created: " + name + "; CanStack: " + canStack + "; isDebuff: " + isDebuff + "; isHidden: " + isHidden, "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\BuffManager.cs", 33); return buffDef; } private static Sprite TryGetSprite(string spriteName) { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) Sprite val = AssetManager.bundle.LoadAsset<Sprite>(spriteName + ".png"); if ((Object)(object)val == (Object)null) { Log.Warning("Missing debuff sprite file for" + ((Object)buffDef).name + ". Substituting default...", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\BuffManager.cs", 46); val = Addressables.LoadAssetAsync<Sprite>((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion(); } return val; } } internal static class ChoiceManager { [CompilerGenerated] private static class <>O { public static hook_OnExecute <0>__ChoiceSkillHook; public static hook_RunRecharge_float <1>__ChoiceCooldownHook; public static hook_Start <2>__ChoiceStageStartHook; public static hook_OnBodyStart <3>__ChoiceBodyStartHook; } public static BuffDef choicePrimaryLock; public static BuffDef choiceSecondaryLock; public static BuffDef choiceUtilityLock; public static BuffDef choiceSpecialLock; public static BuffDef[] choiceLocks; public static float cooldownPenaltyPerStack = 20f; public static float cooldownPenaltyPercentLimit = 1f; public static void Init() { //IL_0006: 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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_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 //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_00c4: Expected O, but got Unknown //IL_00da: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Expected O, but got Unknown //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Expected O, but got Unknown choicePrimaryLock = BuffManager.CreateBuffDef("PrimaryLock", Color.white, canStack: false, isDebuff: true, isHidden: false); choiceSecondaryLock = BuffManager.CreateBuffDef("SecondaryLock", Color.white, canStack: false, isDebuff: true, isHidden: false); choiceUtilityLock = BuffManager.CreateBuffDef("UtilityLock", Color.white, canStack: false, isDebuff: true, isHidden: false); choiceSpecialLock = BuffManager.CreateBuffDef("SpecialLock", Color.white, canStack: false, isDebuff: true, isHidden: false); choiceLocks = (BuffDef[])(object)new BuffDef[4] { choicePrimaryLock, choiceSecondaryLock, choiceUtilityLock, choiceSpecialLock }; object obj = <>O.<0>__ChoiceSkillHook; if (obj == null) { hook_OnExecute val = ChoiceSkillHook; <>O.<0>__ChoiceSkillHook = val; obj = (object)val; } GenericSkill.OnExecute += (hook_OnExecute)obj; object obj2 = <>O.<1>__ChoiceCooldownHook; if (obj2 == null) { hook_RunRecharge_float val2 = ChoiceCooldownHook; <>O.<1>__ChoiceCooldownHook = val2; obj2 = (object)val2; } GenericSkill.RunRecharge_float += (hook_RunRecharge_float)obj2; object obj3 = <>O.<2>__ChoiceStageStartHook; if (obj3 == null) { hook_Start val3 = ChoiceStageStartHook; <>O.<2>__ChoiceStageStartHook = val3; obj3 = (object)val3; } Stage.Start += (hook_Start)obj3; object obj4 = <>O.<3>__ChoiceBodyStartHook; if (obj4 == null) { hook_OnBodyStart val4 = ChoiceBodyStartHook; <>O.<3>__ChoiceBodyStartHook = val4; obj4 = (object)val4; } CharacterMaster.OnBodyStart += (hook_OnBodyStart)obj4; } public static void RemoveAllChoiceLocks(CharacterBody body) { BuffDef[] array = choiceLocks; foreach (BuffDef val in array) { 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); } private static void ChoiceSkillHook(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 && !HasChoiceLock(characterBody)) { if ((Object)(object)characterBody.skillLocator.primary == (Object)(object)self) { characterBody.AddBuff(choicePrimaryLock); } else if ((Object)(object)characterBody.skillLocator.secondary == (Object)(object)self) { characterBody.AddBuff(choiceSecondaryLock); } else if ((Object)(object)characterBody.skillLocator.utility == (Object)(object)self) { characterBody.AddBuff(choiceUtilityLock); } else if ((Object)(object)characterBody.skillLocator.special == (Object)(object)self) { characterBody.AddBuff(choiceSpecialLock); } } } private static void ChoiceCooldownHook(orig_RunRecharge_float 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 (!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 ChoiceStageStartHook(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) { RemoveAllChoiceLocks(body); } } } private static void ChoiceBodyStartHook(orig_OnBodyStart orig, CharacterMaster self, CharacterBody body) { orig.Invoke(self, body); if ((Object)(object)body != (Object)null) { RemoveAllChoiceLocks(body); } } private static bool IsChosenSkill(CharacterBody body, GenericSkill skill) { if ((Object)(object)body.skillLocator.primary == (Object)(object)skill) { return body.HasBuff(choicePrimaryLock); } if ((Object)(object)body.skillLocator.secondary == (Object)(object)skill) { return body.HasBuff(choiceSecondaryLock); } if ((Object)(object)body.skillLocator.utility == (Object)(object)skill) { return body.HasBuff(choiceUtilityLock); } if ((Object)(object)body.skillLocator.special == (Object)(object)skill) { return body.HasBuff(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<bool> CustomValuesEnabled; public static ConfigEntry<bool> SpawnModeEnabled; public static ConfigEntry<bool> UnfinishedItemsEnabled; public static ConfigEntry<float> Leftovers_RegenBonus; public static ConfigEntry<float> Leftovers_RegenBonusPercent; public static ConfigEntry<float> Leftovers_RegenBonusPerExtraStack; public static ConfigEntry<float> Leftovers_RegenBonusPercentPerExtraStack; public static ConfigEntry<float> FlameOrb_ProcPercentPerStack; public static ConfigEntry<float> FlameOrb_DebuffDuration; public static ConfigEntry<float> AirBalloon_FallSpeedLimit; public static ConfigEntry<float> AirBalloon_FallPercentReductionPerExtraStack; public static ConfigEntry<float> AirBalloon_HpThresholdPercent; public static ConfigEntry<float> ExpShare_ExpPercentBonus; public static ConfigEntry<float> ExpShare_ExpPercentBonusPerExtraStack; public static ConfigEntry<float> ExpShare_ExpRateBonus; public static ConfigEntry<float> AmuletCoin_GoldMulPercentPerStack; public static ConfigEntry<float> HeavyDutyBoots_ArmorBonus; public static ConfigEntry<float> HeavyDutyBoots_ArmorBonusPerExtraStack; public static ConfigEntry<float> ChoiceItems_CooldownPenaltyPerStack; public static ConfigEntry<float> ChoiceBand_DamageBonus; public static ConfigEntry<float> ChoiceBand_DamageBonusPerExtraStack; public static ConfigEntry<float> ChoiceSpecs_DamageBonus; public static ConfigEntry<float> ChoiceSpecs_DamageBonusPerExtraStack; public static ConfigEntry<float> ChoiceScarf_MovementBonus; public static ConfigEntry<float> ChoiceScarf_MovementBonusPerExtraStack; public static ConfigEntry<float> WeaknessPolicy_DamageBonus; public static ConfigEntry<int> WeaknessPolicy_MaxBuffStacks; public static ConfigEntry<int> WeaknessPolicy_MaxBuffStacksPerExtraStack; public static ConfigEntry<float> WeaknessPolicy_Duration; public static ConfigEntry<float> QuickClaw_ProcChance; public static ConfigEntry<float> QuickClaw_ProcChancePerExtraStack; public static ConfigEntry<float> QuickClaw_CooldownReductionPercent; public static ConfigEntry<float> BerryJuice_RegenPercent; public static ConfigEntry<int> BerryJuice_ItemCap; public static ConfigEntry<int> BerryJuice_ItemCapPerExtraStack; public static void Init() { ConfigFile pConfig = PokeItems.PConfig; CustomValuesEnabled = pConfig.Bind<bool>("! 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<bool>("! Important !", "Spawn Mode", false, "Enable Spawn Mode to allow spawning custom items via F-keys."); UnfinishedItemsEnabled = pConfig.Bind<bool>("! 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_RegenBonus = pConfig.Bind<float>("Leftovers", "Initial Regeneration Bonus", Leftovers.regenBonus, "Health regeneration applied from initial stack."); Leftovers_RegenBonusPercent = pConfig.Bind<float>("Leftovers", "Initial Regeneration Bonus Percent", Leftovers.regenBonusPercent, "Health regeneration scaled by max HP (%) applied from initial stack."); Leftovers_RegenBonusPerExtraStack = pConfig.Bind<float>("Leftovers", "Regeneration Bonus Per Extra Stack", Leftovers.regenBonusPerExtraStack, "Health regeneration applied per extra stack."); Leftovers_RegenBonusPercentPerExtraStack = pConfig.Bind<float>("Leftovers", "Regeneration Bonus Percent Per Extra Stack", Leftovers.regenBonusPercentPerExtraStack, "Health regeneration scaled by max HP (%) applied per extra stack."); FlameOrb_ProcPercentPerStack = pConfig.Bind<float>("Flame Orb", "Burn Chance Percent Per Stack", FlameOrb.procPercentPerStack, "Chance to inflict burn per stack."); FlameOrb_DebuffDuration = pConfig.Bind<float>("Flame Orb", "Burn Duration", FlameOrb.debuffDuration, "How long the burn debuff lasts."); AirBalloon_FallSpeedLimit = pConfig.Bind<float>("Air Balloon", "Fall Speed Limit", AirBalloon.fallSpeedLimit, "Limit applied to falling speed (m/s)."); AirBalloon_FallPercentReductionPerExtraStack = pConfig.Bind<float>("Air Balloon", "Fall Percent Reduction Per Extra Stack", AirBalloon.fallPercentReductionPerExtraStack, "Reduction percent over falling speed limit exponentially applied."); AirBalloon_HpThresholdPercent = pConfig.Bind<float>("Air Balloon", "HP Threshold Percent", AirBalloon.hpThresholdPercent, "How low the HP can deplete before the balloon pops."); ExpShare_ExpPercentBonus = pConfig.Bind<float>("EXP Share", "Initial EXP Percent Bonus", ExpShare.expPercentBonus, "Extra percent of EXP is applied from initial stack."); ExpShare_ExpPercentBonusPerExtraStack = pConfig.Bind<float>("EXP Share", "EXP Percent Bonus Per Extra Stack", ExpShare.expPercentBonusPerExtraStack, "Extra percent of EXP is applied per extra stack."); ExpShare_ExpRateBonus = pConfig.Bind<float>("EXP Share", "Required EXP Percent Rate", ExpShare.expRateBonus, "Percent amount of required EXP gained per minute."); AmuletCoin_GoldMulPercentPerStack = pConfig.Bind<float>("Amulet Coin", "Gold Percent Bonus", AmuletCoin.goldMulPercentPerStack, "Extra percent of gold is applied per stack."); HeavyDutyBoots_ArmorBonus = pConfig.Bind<float>("Heavy-Duty Boots", "Initial Armor Bonus", HeavyDutyBoots.armorBonus, "Extra percent of EXP is applied from initial stack."); HeavyDutyBoots_ArmorBonusPerExtraStack = pConfig.Bind<float>("Heavy-Duty Boots", "Armor Bonus Per Extra Stack", HeavyDutyBoots.armorBonusPerExtraStack, "How long the burn debuff lasts."); ChoiceItems_CooldownPenaltyPerStack = pConfig.Bind<float>("Choice Items", "Cooldown Penalty Per Stack", ChoiceManager.cooldownPenaltyPerStack, "How slow the non-preferred skill cooldown recharges."); ChoiceBand_DamageBonus = pConfig.Bind<float>("Choice Band", "Initial Damage Bonus", ChoiceBand.damageBonus, "Initial damage bonus percent for Primary and Secondary skills."); ChoiceBand_DamageBonusPerExtraStack = pConfig.Bind<float>("Choice Band", "Damage Bonus Per Extra Stack", ChoiceBand.damageBonusPerExtraStack, "Damage bonus percent for Primary and Secondary skills per extra stack."); ChoiceSpecs_DamageBonus = pConfig.Bind<float>("Choice Specs", "Initial Damage Bonus", ChoiceSpecs.damageBonus, "Initial damage bonus percent for Utility and Special skills."); ChoiceSpecs_DamageBonusPerExtraStack = pConfig.Bind<float>("Choice Specs", "Damage Bonus Per Extra Stack", ChoiceSpecs.damageBonusPerExtraStack, "Damage bonus percent for Utility and Special skills per extra stack."); ChoiceScarf_MovementBonus = pConfig.Bind<float>("Choice Scarf", "Initial Movement Bonus", ChoiceScarf.movementBonus, "Initial movement bonus percent."); ChoiceScarf_MovementBonusPerExtraStack = pConfig.Bind<float>("Choice Scarf", "Movement Bonus Per Extra Stack", ChoiceScarf.movementBonusPerExtraStack, "Movement bonus percent per extra stack."); WeaknessPolicy_DamageBonus = pConfig.Bind<float>("Weakness Policy", "Damage Bonus", WeaknessPolicy.damageBonus, "Damage bonus percent per buff stack."); WeaknessPolicy_MaxBuffStacks = pConfig.Bind<int>("Weakness Policy", "Initial Max Buff Stacks", WeaknessPolicy.maxBuffStacks, "Initial max amount of Weakness Policy buff stacks."); WeaknessPolicy_MaxBuffStacksPerExtraStack = pConfig.Bind<int>("Weakness Policy", "Max Buff Stacks Per Extra Stack", WeaknessPolicy.maxBuffStacksPerExtraStack, "Max amount per extra stack of Weakness Policy buff stacks."); WeaknessPolicy_Duration = pConfig.Bind<float>("Weakness Policy", "Buff Duration", WeaknessPolicy.duration, "Duration of buff stacks before resetting."); QuickClaw_ProcChance = pConfig.Bind<float>("Quick Claw", "Initial Proc Chance", QuickClaw.procChance, "Initial chance to reduce cooldown after use of that move."); QuickClaw_ProcChancePerExtraStack = pConfig.Bind<float>("Quick Claw", "Proc Chance Per Extra Stack", QuickClaw.procChancePerExtraStack, "Chance per extra stack to reduce cooldown after use of that move."); QuickClaw_CooldownReductionPercent = pConfig.Bind<float>("Quick Claw", "Cooldown Reduction Percent", QuickClaw.cooldownReductionPercent, "Percent of cooldown reduction when a move is used."); BerryJuice_RegenPercent = pConfig.Bind<float>("Berry Juice", "Regen Percent", BerryJuice.regenPercent, "Max HP percent of health regen per buff stack."); BerryJuice_ItemCap = pConfig.Bind<int>("Berry Juice", "Initial Item Cap", BerryJuice.itemCap, "Initial unusable item capacity."); BerryJuice_ItemCapPerExtraStack = pConfig.Bind<int>("Berry Juice", "Item Cap Per Extra Stack", BerryJuice.itemCapPerExtraStack, "Unusable item capacity per extra stack."); } public static float GetFloatValue(ConfigEntry<float> config, float defaultValue) { if (CustomValuesEnabled.Value) { return config.Value; } return defaultValue; } public static int GetIntValue(ConfigEntry<int> config, int defaultValue) { if (CustomValuesEnabled.Value) { return config.Value; } return defaultValue; } } internal class ItemManager { public static ItemDef itemDef; public static readonly Dictionary<string, object[]> tokenMap = new Dictionary<string, object[]>(); 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<ItemDef>(); ((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<GameObject>(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<GameObject>((object)"RoR2/Base/Mystery/PickupMystery.prefab").WaitForCompletion(); } Sprite val2 = AssetManager.bundle.LoadAsset<Sprite>(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<Sprite>((object)"RoR2/Base/Common/MiscIcons/texMysteryIcon.png").WaitForCompletion()); } ModelPanelParameters val3 = val.AddComponent<ModelPanelParameters>(); 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<string, object[]> item in tokenMap) { string stringFormatted = Language.GetStringFormatted(item.Key, item.Value); LanguageAPI.AddOverlay(item.Key, stringFormatted); } } } internal class LookingGlassManager { private const string LookingGlassGUID = "droppod.lookingglass"; private static bool initialized; public static void Init() { if (!initialized) { initialized = true; if (Chainloader.PluginInfos.ContainsKey("droppod.lookingglass")) { Log.Info("Looking Glass detected. Waiting till ItemCatalog is available.", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\LookingGlassManager.cs", 28); ((ResourceAvailability)(ref ItemCatalog.availability)).CallWhenAvailable((Action)RegisterLG); } } } private static void RegisterLG() { Log.Info("Registering PokeItems stats to Looking Glass.", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\LookingGlassManager.cs", 35); try { RegisterItems(); Log.Info("Looking Glass integration initialized successfully.", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\LookingGlassManager.cs", 42); } catch (Exception ex) { Log.Error("Failed to initialize Looking Glass integration:\n" + ex, "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\LookingGlassManager.cs", 46); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void RegisterItems() { RegisterLeftovers(); RegisterFlameOrb(); RegisterAirBalloon(); RegisterExpShare(); RegisterAmuletCoin(); RegisterHeavyDutyBoots(); RegisterChoiceBand(); RegisterChoiceSpecs(); RegisterChoiceScarf(); RegisterWeaknessPolicy(); RegisterQuickClaw(); RegisterBerryJuice(); } private static ItemStatsDef GetItemStats(ItemDef itemDef) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected I4, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown if ((Object)(object)itemDef == (Object)null) { return null; } if ((int)itemDef.itemIndex == -1) { Log.Warning("Looking Glass: ItemDef '" + ((Object)itemDef).name + "' still has ItemIndex.None. Skipping registration.", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\LookingGlassManager.cs", 77); return null; } int key = (int)itemDef.itemIndex; if (ItemDefinitions.allItemDefinitions.TryGetValue(key, out var value)) { return value; } ItemStatsDef val = new ItemStatsDef(); ItemDefinitions.allItemDefinitions[key] = val; return val; } private static void RegisterLeftovers() { if ((Object)(object)Leftovers.itemDef == (Object)null) { return; } ItemStatsDef itemStats = GetItemStats(Leftovers.itemDef); if (itemStats != null) { itemStats.descriptions.Add("Regeneration Bonus: "); itemStats.valueTypes.Add((ValueType)0); itemStats.measurementUnits.Add((MeasurementUnits)3); itemStats.calculateValuesNew = delegate(float luck, int stackCount, float procChance) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.Leftovers_RegenBonus, Leftovers.regenBonus); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.Leftovers_RegenBonusPerExtraStack, Leftovers.regenBonusPerExtraStack); float linearWithExtraStacking = MathUtility.GetLinearWithExtraStacking(floatValue, floatValue2, stackCount); return new List<float> { linearWithExtraStacking }; }; } } private static void RegisterFlameOrb() { if ((Object)(object)FlameOrb.itemDef == (Object)null) { return; } ItemStatsDef itemStats = GetItemStats(FlameOrb.itemDef); if (itemStats != null) { itemStats.descriptions.Add("Burn Chance: "); itemStats.valueTypes.Add((ValueType)1); itemStats.measurementUnits.Add((MeasurementUnits)1); itemStats.calculateValuesNew = delegate(float luck, int stackCount, float procChance) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.FlameOrb_ProcPercentPerStack, FlameOrb.procPercentPerStack); float linearStacking = MathUtility.GetLinearStacking(floatValue, stackCount, procChance); linearStacking = ((!(luck >= 0f)) ? Mathf.Pow(linearStacking, Math.Abs(luck) + 1f) : (1f - Mathf.Pow(1f - linearStacking, luck + 1f))); return new List<float> { linearStacking / 100f }; }; } } private static void RegisterAirBalloon() { if ((Object)(object)AirBalloon.itemDef == (Object)null) { return; } ItemStatsDef itemStats = GetItemStats(AirBalloon.itemDef); if (itemStats != null) { itemStats.descriptions.Add("Fall Speed Limit: "); itemStats.valueTypes.Add((ValueType)2); itemStats.measurementUnits.Add((MeasurementUnits)0); itemStats.calculateValuesNew = delegate(float luck, int stackCount, float procChance) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.AirBalloon_FallSpeedLimit, AirBalloon.fallSpeedLimit); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.AirBalloon_FallPercentReductionPerExtraStack, AirBalloon.fallPercentReductionPerExtraStack); float item = floatValue * MathUtility.GetExponentialPercentReductionStacking(floatValue2, stackCount - 1); return new List<float> { item }; }; } } private static void RegisterExpShare() { if ((Object)(object)ExpShare.itemDef == (Object)null) { return; } ItemStatsDef itemStats = GetItemStats(ExpShare.itemDef); if (itemStats != null) { itemStats.descriptions.Add("EXP Bonus: "); itemStats.valueTypes.Add((ValueType)2); itemStats.measurementUnits.Add((MeasurementUnits)1); itemStats.calculateValuesNew = delegate(float luck, int stackCount, float procChance) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.ExpShare_ExpPercentBonus, ExpShare.expPercentBonus); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.ExpShare_ExpPercentBonusPerExtraStack, ExpShare.expPercentBonusPerExtraStack); float linearWithExtraStacking = MathUtility.GetLinearWithExtraStacking(floatValue, floatValue2, stackCount); return new List<float> { linearWithExtraStacking / 100f }; }; } } private static void RegisterAmuletCoin() { if ((Object)(object)AmuletCoin.itemDef == (Object)null) { return; } ItemStatsDef itemStats = GetItemStats(AmuletCoin.itemDef); if (itemStats != null) { itemStats.descriptions.Add("Gold Bonus: "); itemStats.valueTypes.Add((ValueType)2); itemStats.measurementUnits.Add((MeasurementUnits)1); itemStats.calculateValuesNew = delegate(float luck, int stackCount, float procChance) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.AmuletCoin_GoldMulPercentPerStack, AmuletCoin.goldMulPercentPerStack); return new List<float> { floatValue * (float)stackCount / 100f }; }; } } private static void RegisterHeavyDutyBoots() { if ((Object)(object)HeavyDutyBoots.itemDef == (Object)null) { return; } ItemStatsDef itemStats = GetItemStats(HeavyDutyBoots.itemDef); if (itemStats != null) { itemStats.descriptions.Add("Armor Bonus: "); itemStats.valueTypes.Add((ValueType)17); itemStats.measurementUnits.Add((MeasurementUnits)4); itemStats.calculateValuesNew = delegate(float luck, int stackCount, float procChance) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.HeavyDutyBoots_ArmorBonus, HeavyDutyBoots.armorBonus); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.HeavyDutyBoots_ArmorBonusPerExtraStack, HeavyDutyBoots.armorBonusPerExtraStack); float linearWithExtraStacking = MathUtility.GetLinearWithExtraStacking(floatValue, floatValue2, stackCount); return new List<float> { linearWithExtraStacking }; }; } } private static void RegisterChoiceBand() { if ((Object)(object)ChoiceBand.itemDef == (Object)null) { return; } ItemStatsDef itemStats = GetItemStats(ChoiceBand.itemDef); if (itemStats != null) { itemStats.descriptions.Add("Primary/Secondary Damage Bonus: "); itemStats.valueTypes.Add((ValueType)1); itemStats.measurementUnits.Add((MeasurementUnits)1); itemStats.calculateValuesNew = delegate(float luck, int stackCount, float procChance) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.ChoiceBand_DamageBonus, ChoiceBand.damageBonus); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.ChoiceBand_DamageBonusPerExtraStack, ChoiceBand.damageBonusPerExtraStack); float linearWithExtraStacking = MathUtility.GetLinearWithExtraStacking(floatValue, floatValue2, stackCount); return new List<float> { linearWithExtraStacking / 100f }; }; } } private static void RegisterChoiceSpecs() { if ((Object)(object)ChoiceSpecs.itemDef == (Object)null) { return; } ItemStatsDef itemStats = GetItemStats(ChoiceSpecs.itemDef); if (itemStats != null) { itemStats.descriptions.Add("Utility/Special Damage Bonus: "); itemStats.valueTypes.Add((ValueType)1); itemStats.measurementUnits.Add((MeasurementUnits)1); itemStats.calculateValuesNew = delegate(float luck, int stackCount, float procChance) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.ChoiceSpecs_DamageBonus, ChoiceSpecs.damageBonus); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.ChoiceSpecs_DamageBonusPerExtraStack, ChoiceSpecs.damageBonusPerExtraStack); float linearWithExtraStacking = MathUtility.GetLinearWithExtraStacking(floatValue, floatValue2, stackCount); return new List<float> { linearWithExtraStacking / 100f }; }; } } private static void RegisterChoiceScarf() { if ((Object)(object)ChoiceScarf.itemDef == (Object)null) { return; } ItemStatsDef itemStats = GetItemStats(ChoiceScarf.itemDef); if (itemStats != null) { itemStats.descriptions.Add("Movement Bonus: "); itemStats.valueTypes.Add((ValueType)2); itemStats.measurementUnits.Add((MeasurementUnits)1); itemStats.calculateValuesNew = delegate(float luck, int stackCount, float procChance) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.ChoiceScarf_MovementBonus, ChoiceScarf.movementBonus); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.ChoiceScarf_MovementBonusPerExtraStack, ChoiceScarf.movementBonusPerExtraStack); float linearWithExtraStacking = MathUtility.GetLinearWithExtraStacking(floatValue, floatValue2, stackCount); return new List<float> { linearWithExtraStacking / 100f }; }; } } private static void RegisterWeaknessPolicy() { if ((Object)(object)WeaknessPolicy.itemDef == (Object)null) { return; } ItemStatsDef itemStats = GetItemStats(WeaknessPolicy.itemDef); if (itemStats != null) { itemStats.descriptions.Add("Max Buff Stacks: "); itemStats.valueTypes.Add((ValueType)7); itemStats.measurementUnits.Add((MeasurementUnits)4); itemStats.calculateValuesNew = delegate(float luck, int stackCount, float procChance) { int intValue = ConfigManager.GetIntValue(ConfigManager.WeaknessPolicy_MaxBuffStacks, WeaknessPolicy.maxBuffStacks); int intValue2 = ConfigManager.GetIntValue(ConfigManager.WeaknessPolicy_MaxBuffStacksPerExtraStack, WeaknessPolicy.maxBuffStacksPerExtraStack); int num = (int)MathUtility.GetLinearWithExtraStacking(intValue, intValue2, stackCount); return new List<float> { num }; }; } } private static void RegisterQuickClaw() { if ((Object)(object)QuickClaw.itemDef == (Object)null) { return; } ItemStatsDef itemStats = GetItemStats(QuickClaw.itemDef); if (itemStats != null) { itemStats.descriptions.Add("Proc Chance: "); itemStats.valueTypes.Add((ValueType)2); itemStats.measurementUnits.Add((MeasurementUnits)1); itemStats.calculateValuesNew = delegate(float luck, int stackCount, float procChance) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.QuickClaw_ProcChance, QuickClaw.procChance); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.QuickClaw_ProcChancePerExtraStack, QuickClaw.procChancePerExtraStack); float linearWithExtraStacking = MathUtility.GetLinearWithExtraStacking(floatValue, floatValue2, stackCount, procChance); linearWithExtraStacking = ((!(luck >= 0f)) ? Mathf.Pow(linearWithExtraStacking, Math.Abs(luck) + 1f) : (1f - Mathf.Pow(1f - linearWithExtraStacking, luck + 1f))); return new List<float> { linearWithExtraStacking / 100f }; }; } } private static void RegisterBerryJuice() { if ((Object)(object)BerryJuice.itemDef == (Object)null) { return; } ItemStatsDef itemStats = GetItemStats(BerryJuice.itemDef); if (itemStats != null) { itemStats.descriptions.Add("Regeneration Bonus (%HP): "); itemStats.valueTypes.Add((ValueType)0); itemStats.measurementUnits.Add((MeasurementUnits)1); itemStats.calculateValuesNew = delegate { float floatValue = ConfigManager.GetFloatValue(ConfigManager.BerryJuice_RegenPercent, BerryJuice.regenPercent); float linearStacking = MathUtility.GetLinearStacking(floatValue, BerryJuice.buffCount); return new List<float> { linearStacking / 100f }; }; } } } 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")) { Log.Info("Risk of Options detected. Adding PokeItems configuration to mod menu.", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\RiskOfOptionsManager.cs", 30); InitializeRiskOfOptions(); } } } [MethodImpl(MethodImplOptions.NoInlining)] private static void InitializeRiskOfOptions() { try { Sprite modIcon = AssetManager.bundle.LoadAsset<Sprite>("ModIcon.png"); ModSettingsManager.SetModIcon(modIcon); RegisterOptions(); Log.Info("Risk of Options integration initialized successfully.", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\RiskOfOptionsManager.cs", 47); } catch (Exception ex) { Log.Error("Failed to initialize Risk of Options integration:\n" + ex, "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\RiskOfOptionsManager.cs", 51); } } 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 //IL_0392: Unknown result type (might be due to invalid IL or missing references) //IL_0397: Unknown result type (might be due to invalid IL or missing references) //IL_03a2: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Expected O, but got Unknown //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b7: Expected O, but got Unknown //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c2: Unknown result type (might be due to invalid IL or missing references) //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03dd: Expected O, but got Unknown //IL_03d8: Unknown result type (might be due to invalid IL or missing references) //IL_03e2: Expected O, but got Unknown //IL_03e8: Unknown result type (might be due to invalid IL or missing references) //IL_03ed: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_0408: Expected O, but got Unknown //IL_0403: Unknown result type (might be due to invalid IL or missing references) //IL_040d: Expected O, but got Unknown //IL_0413: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_041f: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Expected O, but got Unknown //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_0431: Expected O, but got Unknown //IL_0437: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Expected O, but got Unknown //IL_044b: Unknown result type (might be due to invalid IL or missing references) //IL_0455: Expected O, but got Unknown //IL_045b: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_046b: Unknown result type (might be due to invalid IL or missing references) //IL_047b: Expected O, but got Unknown //IL_0476: Unknown result type (might be due to invalid IL or missing references) //IL_0480: Expected O, but got Unknown //IL_0486: 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_0496: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Expected O, but got Unknown //IL_04a1: Unknown result type (might be due to invalid IL or missing references) //IL_04ab: Expected O, but got Unknown //IL_04b1: Unknown result type (might be due to invalid IL or missing references) //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04c1: Unknown result type (might be due to invalid IL or missing references) //IL_04d1: Expected O, but got Unknown //IL_04cc: Unknown result type (might be due to invalid IL or missing references) //IL_04d6: Expected O, but got Unknown //IL_04dc: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04ec: Unknown result type (might be due to invalid IL or missing references) //IL_04fc: Expected O, but got Unknown //IL_04f7: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Expected O, but got Unknown //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_050c: Unknown result type (might be due to invalid IL or missing references) //IL_0517: Unknown result type (might be due to invalid IL or missing references) //IL_0527: Expected O, but got Unknown //IL_0522: Unknown result type (might be due to invalid IL or missing references) //IL_052c: Expected O, but got Unknown //IL_0532: Unknown result type (might be due to invalid IL or missing references) //IL_0537: Unknown result type (might be due to invalid IL or missing references) //IL_053e: Unknown result type (might be due to invalid IL or missing references) //IL_054b: Expected O, but got Unknown //IL_0546: Unknown result type (might be due to invalid IL or missing references) //IL_0550: Expected O, but got Unknown //IL_0556: Unknown result type (might be due to invalid IL or missing references) //IL_055b: Unknown result type (might be due to invalid IL or missing references) //IL_0562: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Expected O, but got Unknown //IL_056a: Unknown result type (might be due to invalid IL or missing references) //IL_0574: 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_RegenBonus, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.Leftovers_RegenBonusPercent, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.Leftovers_RegenBonusPerExtraStack, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.Leftovers_RegenBonusPercentPerExtraStack, 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_ExpPercentBonus, 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_ArmorBonus, 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 })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.WeaknessPolicy_DamageBonus, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(ConfigManager.WeaknessPolicy_MaxBuffStacks, new IntSliderConfig { min = 0, max = 100 })); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(ConfigManager.WeaknessPolicy_MaxBuffStacksPerExtraStack, new IntSliderConfig { min = 0, max = 100 })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.WeaknessPolicy_Duration, new SliderConfig { min = 0f, max = 600f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.QuickClaw_ProcChance, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.QuickClaw_ProcChancePerExtraStack, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.QuickClaw_CooldownReductionPercent, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.BerryJuice_RegenPercent, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(ConfigManager.BerryJuice_ItemCap, new IntSliderConfig { min = 0, max = 100 })); ModSettingsManager.AddOption((BaseOption)new IntSliderOption(ConfigManager.BerryJuice_ItemCapPerExtraStack, new IntSliderConfig { min = 0, max = 100 })); } } } 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 = 30f; public static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Expected O, but got Unknown //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("AirBalloon", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)3, (ItemTag)31 }, fallSpeedLimit, fallPercentReductionPerExtraStack, hpThresholdPercent); AirBalloonBroken.Init(); 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_0020: 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_007d: Unknown result type (might be due to invalid IL or missing references) int itemCountEffective = inventory.GetItemCountEffective(itemDef); if (itemCountEffective <= 0) { return; } inventory.RemoveItem(itemDef.itemIndex, itemCountEffective); inventory.GiveItem(AirBalloonBroken.itemDef, itemCountEffective); CharacterMaster component = ((Component)inventory).GetComponent<CharacterMaster>(); 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<ItemTag>()); } } 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 BerryJuice { [CompilerGenerated] private static class <>O { public static StatHookEventHandler <0>__BerryJuiceRegenHook; public static hook_OnInventoryChanged <1>__BerryJuiceInventoryChangedHook; } public static ItemDef itemDef; public static BuffDef berryLevel; private static ItemTier tier = (ItemTier)2; public static float regenPercent = 1.5f; public static int itemCap = 6; public static int itemCapPerExtraStack = 4; public static int buffCount { get; protected set; } public static void Init() { //IL_0006: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("BerryJuice", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)2, (ItemTag)31 }, regenPercent, itemCap, itemCapPerExtraStack); berryLevel = BuffManager.CreateBuffDef("BerryLevel", Color.white, canStack: true, isDebuff: false, isHidden: false); object obj = <>O.<0>__BerryJuiceRegenHook; if (obj == null) { StatHookEventHandler val = BerryJuiceRegenHook; <>O.<0>__BerryJuiceRegenHook = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; object obj2 = <>O.<1>__BerryJuiceInventoryChangedHook; if (obj2 == null) { hook_OnInventoryChanged val2 = BerryJuiceInventoryChangedHook; <>O.<1>__BerryJuiceInventoryChangedHook = val2; obj2 = (object)val2; } CharacterBody.OnInventoryChanged += (hook_OnInventoryChanged)obj2; } private static void BerryJuiceRegenHook(CharacterBody body, StatHookEventArgs args) { if (!((Object)(object)body == (Object)null) && !((Object)(object)body.inventory == (Object)null)) { int num = body.GetBuffCount(berryLevel); if (num > 0) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.BerryJuice_RegenPercent, regenPercent); float num2 = floatValue * body.maxHealth / 100f * (float)num; args.baseRegenAdd += num2; } } } private static void BerryJuiceInventoryChangedHook(orig_OnInventoryChanged orig, CharacterBody self) { //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (!NetworkServer.active || (Object)(object)self == (Object)null || (Object)(object)self.inventory == (Object)null) { return; } int itemCountEffective = self.inventory.GetItemCountEffective(itemDef); if (itemCountEffective <= 0) { if (self.GetBuffCount(berryLevel) <= 0) { self.SetBuffCount(berryLevel.buffIndex, 0); } return; } buffCount = GetNoTierItemCount(self, itemCountEffective); if (self.GetBuffCount(berryLevel) != buffCount) { self.SetBuffCount(berryLevel.buffIndex, buffCount); } } private static int GetNoTierItemCount(CharacterBody body, int itemCount) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0052: 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: Invalid comparison between Unknown and I4 //IL_0081: Unknown result type (might be due to invalid IL or missing references) Inventory inventory = body.inventory; if ((Object)(object)inventory == (Object)null) { return 0; } int num = 0; HashSet<ItemIndex> hashSet = new HashSet<ItemIndex>(); foreach (ItemIndex item in inventory.itemAcquisitionOrder) { if (!hashSet.Add(item)) { continue; } ItemDef val = ItemCatalog.GetItemDef(item); if (!((Object)(object)val == (Object)null) && (int)val.tier == 5) { int itemCountEffective = inventory.GetItemCountEffective(item); if (itemCountEffective > 0) { num += itemCountEffective; } } } int intValue = ConfigManager.GetIntValue(ConfigManager.BerryJuice_ItemCap, itemCap); int intValue2 = ConfigManager.GetIntValue(ConfigManager.BerryJuice_ItemCapPerExtraStack, itemCapPerExtraStack); return Math.Min(num, (int)MathUtility.GetLinearWithExtraStacking(intValue, intValue2, itemCount)); } } 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<CharacterBody>(); 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<CharacterBody>(); 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 expPercentBonus = 200f; public static float expPercentBonusPerExtraStack = 100f; public static float expRateBonus = 20f; private static readonly Dictionary<CharacterMaster, float> timersDict = new Dictionary<CharacterMaster, float>(); private static readonly Dictionary<CharacterMaster, float> prevRunTimesDict = new Dictionary<CharacterMaster, float>(); 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 }, expPercentBonus, 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_ExpPercentBonus, expPercentBonus); 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 = 8f; 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>(); CharacterBody component2 = victim.GetComponent<CharacterBody>(); 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 armorBonus = 25f; public static float armorBonusPerExtraStack = 5f; private static readonly Dictionary<CharacterBody, bool> isGroundedDict = new Dictionary<CharacterBody, bool>(); 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 }, armorBonus, 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_ArmorBonus, armorBonus); 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 regenBonus = 2f; public static float regenBonusPercent = 1f; public static float regenBonusPerExtraStack = 1.5f; public static float regenBonusPercentPerExtraStack = 0.5f; public static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("Leftovers", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)2, (ItemTag)31 }, regenBonus, reg