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.1
plugins/PokeItems.dll
Decompiled 5 days agousing 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+d8364cb90c4a8b9f219767c756357364fc83a52b")] [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.1")] [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.1"; 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(); isUnfinishedEnabled = ConfigManager.UnfinishedItemsEnabled.Value; LookingGlassManager.Init(); if (isUnfinishedEnabled) { LifeOrb.Init(); WeaknessPolicy.Init(); QuickClaw.Init(); BerryJuice.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(LifeOrb.itemDef.itemIndex, isUnfinished: true); } if (Input.GetKeyDown((KeyCode)284)) { spawnItem(WeaknessPolicy.itemDef.itemIndex, isUnfinished: true); } if (Input.GetKeyDown((KeyCode)285)) { spawnItem(QuickClaw.itemDef.itemIndex, isUnfinished: true); } if (Input.GetKeyDown((KeyCode)286)) { spawnItem(BerryJuice.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}", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\SpawnMode.cs", 105); } } } 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_0031: 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.white; buffDef.canStack = false; buffDef.isDebuff = true; buffDef.isHidden = false; ContentAddition.AddBuffDef(buffDef); return buffDef; } private static Sprite TryGetSprite(string spriteName) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) Sprite val = AssetManager.bundle.LoadAsset<Sprite>(spriteName + ".png"); if ((Object)(object)val == (Object)null) { Log.Warning("Missing debuff sprite file for choice items. Substituting default...", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\BuffManager.cs", 36); 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 <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 val2 = ChoiceCooldownHook; <>O.<1>__ChoiceCooldownHook = val2; obj2 = (object)val2; } GenericSkill.RunRecharge += (hook_RunRecharge)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 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_RegenBonusPerStack; public static ConfigEntry<float> Leftovers_RegenBonusPerExtraStack; 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_ExpPercentBonusPerStack; public static ConfigEntry<float> ExpShare_ExpPercentBonusPerExtraStack; public static ConfigEntry<float> ExpShare_ExpRateBonus; public static ConfigEntry<float> AmuletCoin_GoldMulPercentPerStack; public static ConfigEntry<float> HeavyDutyBoots_ArmorBonusPerStack; 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 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_RegenBonusPerStack = pConfig.Bind<float>("Leftovers", "Initial Regeneration Bonus", Leftovers.regenBonusPerStack, "Health regeneration applied from initial stack."); Leftovers_RegenBonusPerExtraStack = pConfig.Bind<float>("Leftovers", "Regeneration Bonus Per Extra Stack", Leftovers.regenBonusPerExtraStack, "Health regeneration 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_ExpPercentBonusPerStack = pConfig.Bind<float>("EXP Share", "Initial EXP Percent Bonus", ExpShare.expPercentBonusPerStack, "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_ArmorBonusPerStack = pConfig.Bind<float>("Heavy-Duty Boots", "Initial Armor Bonus", HeavyDutyBoots.armorBonusPerStack, "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."); } public static float GetFloatValue(ConfigEntry<float> config, float 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", 27); ((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", 34); try { RegisterItems(); Log.Info("Looking Glass integration initialized successfully.", "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\LookingGlassManager.cs", 41); } catch (Exception ex) { Log.Error("Failed to initialize Looking Glass integration:\n" + ex, "C:\\Users\\dylan\\Documents\\GitHub\\PokeItemsRoR2\\Managers\\LookingGlassManager.cs", 45); } } [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.NoOptimization)] private static void RegisterItems() { RegisterLeftovers(); RegisterFlameOrb(); RegisterAirBalloon(); RegisterExpShare(); RegisterAmuletCoin(); RegisterHeavyDutyBoots(); RegisterChoiceBand(); RegisterChoiceSpecs(); RegisterChoiceScarf(); } 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", 73); 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_RegenBonusPerStack, Leftovers.regenBonusPerStack); 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); 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_ExpPercentBonusPerStack, ExpShare.expPercentBonusPerStack); 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_ArmorBonusPerStack, HeavyDutyBoots.armorBonusPerStack); 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 }; }; } } } 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 ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ConfigManager.CustomValuesEnabled)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ConfigManager.SpawnModeEnabled)); ModSettingsManager.AddOption((BaseOption)new CheckBoxOption(ConfigManager.UnfinishedItemsEnabled)); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.Leftovers_RegenBonusPerStack, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.Leftovers_RegenBonusPerExtraStack, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.FlameOrb_ProcPercentPerStack, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.FlameOrb_DebuffDuration, new SliderConfig { min = 0f, max = 30f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.AirBalloon_FallSpeedLimit, new SliderConfig { min = 0f, max = 200f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.AirBalloon_FallPercentReductionPerExtraStack, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.AirBalloon_HpThresholdPercent, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ExpShare_ExpPercentBonusPerStack, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ExpShare_ExpPercentBonusPerExtraStack, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ExpShare_ExpRateBonus, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.AmuletCoin_GoldMulPercentPerStack, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.HeavyDutyBoots_ArmorBonusPerStack, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.HeavyDutyBoots_ArmorBonusPerExtraStack, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ChoiceItems_CooldownPenaltyPerStack, new SliderConfig { min = 0f, max = 100f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ChoiceBand_DamageBonus, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ChoiceBand_DamageBonusPerExtraStack, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ChoiceSpecs_DamageBonus, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ChoiceSpecs_DamageBonusPerExtraStack, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ChoiceScarf_MovementBonus, new SliderConfig { min = 0f, max = 1000f })); ModSettingsManager.AddOption((BaseOption)new SliderOption(ConfigManager.ChoiceScarf_MovementBonusPerExtraStack, new SliderConfig { min = 0f, max = 1000f })); } } } namespace PokeItems.Items { internal class AirBalloon { [CompilerGenerated] private static class <>O { public static hook_TakeDamage <0>__AirBalloonDamagedHook; public static hook_FixedUpdate <1>__AirBalloonHook; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)0; public static float fallSpeedLimit = 50f; public static float fallPercentReductionPerExtraStack = 10f; public static float hpThresholdPercent = 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) int itemCountEffective = inventory.GetItemCountEffective(itemDef); if (itemCountEffective <= 0) { return; } inventory.RemoveItem(itemDef, itemCountEffective); inventory.GiveItem(AirBalloonBroken.itemDef, itemCountEffective); CharacterMaster component = ((Component)inventory).GetComponent<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 ItemDef itemDef; public static BuffDef berryLevel; private static ItemTier tier = (ItemTier)2; public static float regenPercent = 2f; public static float regenPercentPerExtraStack = 0.5f; public static int itemCap = 6; public static int itemCapPerExtraStack = 4; public static void Init() { //IL_0006: 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) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("BerryJuice", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)2, (ItemTag)31 }, regenPercent, regenPercentPerExtraStack, 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; } private static void BerryJuiceRegenHook(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) { return; } int noTierItemCount = GetNoTierItemCount(body); if (noTierItemCount > 0) { int num = (int)MathUtility.GetLinearWithExtraStacking(itemCap, itemCapPerExtraStack, itemCountEffective); if (num > 0) { float linearWithExtraStacking = MathUtility.GetLinearWithExtraStacking(regenPercent, regenPercentPerExtraStack, itemCountEffective); float num2 = body.maxHealth * (linearWithExtraStacking / 100f) * (float)Mathf.Min(noTierItemCount, num); args.baseRegenAdd += num2; } } } private static int GetNoTierItemCount(CharacterBody body) { //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) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Invalid comparison between Unknown and I4 //IL_007f: 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; } } } return num; } } 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 expPercentBonusPerStack = 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 }, expPercentBonusPerStack, expPercentBonusPerExtraStack, expRateBonus); object obj = <>O.<0>__ExpShareHook; if (obj == null) { hook_AwardExperience val = ExpShareHook; <>O.<0>__ExpShareHook = val; obj = (object)val; } ExperienceManager.AwardExperience += (hook_AwardExperience)obj; object obj2 = <>O.<1>__ExpShareRateHook; if (obj2 == null) { hook_FixedUpdate val2 = ExpShareRateHook; <>O.<1>__ExpShareRateHook = val2; obj2 = (object)val2; } CharacterBody.FixedUpdate += (hook_FixedUpdate)obj2; object obj3 = <>O.<2>__DictionaryDestroy; if (obj3 == null) { hook_OnDestroy val3 = DictionaryDestroy; <>O.<2>__DictionaryDestroy = val3; obj3 = (object)val3; } CharacterMaster.OnDestroy += (hook_OnDestroy)obj3; } private static void ExpShareHook(orig_AwardExperience orig, ExperienceManager self, Vector3 origin, CharacterBody body, ulong experience) { //IL_008e: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)body != (Object)null && (Object)(object)body.inventory != (Object)null && !isPassiveEXP) { int itemCountEffective = body.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.ExpShare_ExpPercentBonusPerStack, expPercentBonusPerStack); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.ExpShare_ExpPercentBonusPerExtraStack, expPercentBonusPerExtraStack); float num = 1f + MathUtility.GetLinearWithExtraStacking(floatValue, floatValue2, itemCountEffective) / 100f; experience = (ulong)((float)experience * num); } } orig.Invoke(self, origin, body, experience); } private static void ExpShareRateHook(orig_FixedUpdate orig, CharacterBody self) { //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0091: Invalid comparison between Unknown and I4 orig.Invoke(self); if (!NetworkServer.active || (Object)(object)self == (Object)null || (Object)(object)self.inventory == (Object)null || (Object)(object)self.master == (Object)null) { return; } int itemCountEffective = self.inventory.GetItemCountEffective(itemDef); bool flag = itemCountEffective > 0; Run instance = Run.instance; if ((Object)(object)instance == (Object)null) { return; } SceneDef sceneDefForCurrentScene = SceneCatalog.GetSceneDefForCurrentScene(); bool flag2 = (Object)(object)sceneDefForCurrentScene != (Object)null && (int)sceneDefForCurrentScene.sceneType == 1; CharacterMaster master = self.master; float fixedTime = instance.fixedTime; if (!prevRunTimesDict.ContainsKey(master) || !flag2 || !flag) { ResetTimer(master, fixedTime); return; } float num = prevRunTimesDict[master]; float num2 = fixedTime - num; prevRunTimesDict[master] = fixedTime; if (!(num2 <= 0f)) { timersDict[master] += num2; if (timersDict[master] >= 1f) { timersDict[master] -= 1f; GainPassiveEXP(self, itemCountEffective); } } } private static void GainPassiveEXP(CharacterBody body, int itemCount) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) if (NetworkServer.active) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.ExpShare_ExpRateBonus, expRateBonus); uint num = (uint)Mathf.FloorToInt(body.level); ulong experienceForLevel = TeamManager.GetExperienceForLevel(num); ulong experienceForLevel2 = TeamManager.GetExperienceForLevel(num + 1); ulong num2 = experienceForLevel2 - experienceForLevel; ulong num3 = (ulong)((float)num2 * (floatValue / 100f / 60f)); if (num3 == 0) { num3 = 1uL; } isPassiveEXP = true; ExperienceManager.instance.AwardExperience(body.corePosition, body, num3); isPassiveEXP = false; } } private static void ResetTimer(CharacterMaster master, float currTime) { prevRunTimesDict[master] = currTime; timersDict[master] = 0f; } private static void DictionaryDestroy(orig_OnDestroy orig, CharacterMaster self) { timersDict.Remove(self); prevRunTimesDict.Remove(self); orig.Invoke(self); } } internal class FlameOrb { [CompilerGenerated] private static class <>O { public static hook_OnHitEnemy <0>__FlameOrbHook; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)0; public static float procPercentPerStack = 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 armorBonusPerStack = 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 }, armorBonusPerStack, armorBonusPerExtraStack); object obj = <>O.<0>__HeavyDutyBootsHook; if (obj == null) { StatHookEventHandler val = HeavyDutyBootsHook; <>O.<0>__HeavyDutyBootsHook = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; object obj2 = <>O.<1>__HeavyDutyBootsGroundedHook; if (obj2 == null) { hook_FixedUpdate val2 = HeavyDutyBootsGroundedHook; <>O.<1>__HeavyDutyBootsGroundedHook = val2; obj2 = (object)val2; } CharacterMotor.FixedUpdate += (hook_FixedUpdate)obj2; object obj3 = <>O.<2>__DictionaryDestroy; if (obj3 == null) { hook_OnDestroy val3 = DictionaryDestroy; <>O.<2>__DictionaryDestroy = val3; obj3 = (object)val3; } CharacterBody.OnDestroy += (hook_OnDestroy)obj3; } private static void HeavyDutyBootsHook(CharacterBody body, StatHookEventArgs args) { if ((Object)(object)body == (Object)null || (Object)(object)body.inventory == (Object)null) { return; } int itemCountEffective = body.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { CharacterMotor characterMotor = body.characterMotor; if ((Object)(object)characterMotor == (Object)null || characterMotor.isGrounded) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.HeavyDutyBoots_ArmorBonusPerStack, armorBonusPerStack); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.HeavyDutyBoots_ArmorBonusPerExtraStack, armorBonusPerExtraStack); args.armorAdd += MathUtility.GetLinearWithExtraStacking(floatValue, floatValue2, itemCountEffective); } } } private static void HeavyDutyBootsGroundedHook(orig_FixedUpdate orig, CharacterMotor self) { orig.Invoke(self); CharacterBody body = self.body; if ((Object)(object)body == (Object)null || (Object)(object)body.inventory == (Object)null) { return; } int itemCountEffective = body.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { bool isGrounded = self.isGrounded; if (!isGroundedDict.TryGetValue(body, out var value)) { isGroundedDict[body] = isGrounded; } else if (value != isGrounded) { isGroundedDict[body] = isGrounded; body.MarkAllStatsDirty(); } } } private static void DictionaryDestroy(orig_OnDestroy orig, CharacterBody self) { isGroundedDict.Remove(self); orig.Invoke(self); } } internal class Leftovers { [CompilerGenerated] private static class <>O { public static StatHookEventHandler <0>__LeftoversHook; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)1; public static float regenBonusPerStack = 5f; public static float regenBonusPerExtraStack = 3f; public static void Init() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("Leftovers", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)2, (ItemTag)31 }, regenBonusPerStack, regenBonusPerExtraStack); object obj = <>O.<0>__LeftoversHook; if (obj == null) { StatHookEventHandler val = LeftoversHook; <>O.<0>__LeftoversHook = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; } private static void LeftoversHook(CharacterBody body, StatHookEventArgs args) { if (!((Object)(object)body == (Object)null) && Object.op_Implicit((Object)(object)body.inventory)) { int itemCountEffective = body.inventory.GetItemCountEffective(itemDef); if (itemCountEffective > 0) { float floatValue = ConfigManager.GetFloatValue(ConfigManager.Leftovers_RegenBonusPerStack, regenBonusPerStack); float floatValue2 = ConfigManager.GetFloatValue(ConfigManager.Leftovers_RegenBonusPerExtraStack, regenBonusPerExtraStack); args.baseRegenAdd += MathUtility.GetLinearWithExtraStacking(floatValue, floatValue2, itemCountEffective); } } } } internal class LifeOrb { [CompilerGenerated] private static class <>O { public static hook_TakeDamage <0>__LifeOrbDamageHook; } public static ItemDef itemDef; private static ItemTier tier = (ItemTier)3; public static float hpPercentSacrificePerStack = 2f; 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("LifeOrb", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)1, (ItemTag)31 }, hpPercentSacrificePerStack); object obj = <>O.<0>__LifeOrbDamageHook; if (obj == null) { hook_TakeDamage val = LifeOrbDamageHook; <>O.<0>__LifeOrbDamageHook = val; obj = (object)val; } HealthComponent.TakeDamage += (hook_TakeDamage)obj; } private static void LifeOrbDamageHook(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { if (!NetworkServer.active) { orig.Invoke(self, damageInfo); return; } if ((Object)(object)damageInfo.attacker == (Object)null) { orig.Invoke(self, damageInfo); return; } if (damageInfo.procCoefficient <= 0f) { 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; } if ((Object)(object)self.body == (Object)(object)component) { orig.Invoke(self, damageInfo); return; } int itemCountEffective = component.inventory.GetItemCountEffective(itemDef); if (itemCountEffective <= 0) { orig.Invoke(self, damageInfo); return; } float num = MathUtility.GetLinearStacking(hpPercentSacrificePerStack, itemCountEffective, damageInfo.procCoefficient) / 100f; float num2 = component.maxHealth * num; if (num2 <= 0f) { orig.Invoke(self, damageInfo); return; } num2 = Mathf.Min(num2, Mathf.Max(0f, component.healthComponent.combinedHealth - 1f)); if (num2 <= 0f) { orig.Invoke(self, damageInfo); return; } damageInfo.damage += num2; component.healthComponent.health = Mathf.Max(1f, component.healthComponent.health - num2); orig.Invoke(self, damageInfo); } } internal class QuickClaw { [CompilerGenerated] private static class <>O { public static hook_ExecuteIfReady <0>__QuickClawSkillHook; public static hook_RunRecharge <1>__QuickClawRechargeHook; public static hook_OnDestroy <2>__QuickClawBodyDestroy; } public static ItemDef itemDef; private static readonly Dictionary<GenericSkill, float> activeRechargeMultipliers = new Dictionary<GenericSkill, float>(); private static readonly Dictionary<GenericSkill, int> startingStock = new Dictionary<GenericSkill, int>(); private static ItemTier tier = (ItemTier)1; public static float procChance = 10f; public static float procChancePerExtraStack = 5f; public static float cooldownReductionPercent = 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 //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("QuickClaw", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)3, (ItemTag)31 }, procChance, procChancePerExtraStack, cooldownReductionPercent); object obj = <>O.<0>__QuickClawSkillHook; if (obj == null) { hook_ExecuteIfReady val = QuickClawSkillHook; <>O.<0>__QuickClawSkillHook = val; obj = (object)val; } GenericSkill.ExecuteIfReady += (hook_ExecuteIfReady)obj; object obj2 = <>O.<1>__QuickClawRechargeHook; if (obj2 == null) { hook_RunRecharge val2 = QuickClawRechargeHook; <>O.<1>__QuickClawRechargeHook = val2; obj2 = (object)val2; } GenericSkill.RunRecharge += (hook_RunRecharge)obj2; object obj3 = <>O.<2>__QuickClawBodyDestroy; if (obj3 == null) { hook_OnDestroy val3 = QuickClawBodyDestroy; <>O.<2>__QuickClawBodyDestroy = val3; obj3 = (object)val3; } CharacterBody.OnDestroy += (hook_OnDestroy)obj3; } private static bool QuickClawSkillHook(orig_ExecuteIfReady orig, GenericSkill self) { bool flag = orig.Invoke(self); if (!NetworkServer.active) { return flag; } if ((Object)(object)self == (Object)null) { return flag; } CharacterBody characterBody = self.characterBody; if ((Object)(object)characterBody == (Object)null || (Object)(object)characterBody.inventory == (Object)null) { return flag; } if (!flag) { return flag; } int itemCountEffective = characterBody.inventory.GetItemCountEffective(itemDef); if (itemCountEffective <= 0) { return flag; } if (self.baseRechargeInterval <= 0f) { return flag; } if (activeRechargeMultipliers.ContainsKey(self)) { return flag; } float linearWithExtraStacking = MathUtility.GetLinearWithExtraStacking(procChance, procChancePerExtraStack, itemCountEffective); if (!Util.CheckRoll(linearWithExtraStacking, characterBody.master)) { return flag; } if (cooldownReductionPercent <= 0f) { return flag; } float num = 1f / (1f - cooldownReductionPercent / 100f); if (float.IsNaN(num) || float.IsInfinity(num) || num <= 1f) { return flag; } activeRechargeMultipliers[self] = num; startingStock[self] = self.stock; return flag; } private static void QuickClawRechargeHook(orig_RunRecharge orig, GenericSkill self, float dt) { float value; int value2; if (!NetworkServer.active || (Object)(object)self == (Object)null) { orig.Invoke(self, dt); } else if (!activeRechargeMultipliers.TryGetValue(self, out value)) { orig.Invoke(self, dt); } else if (startingStock.TryGetValue(self, out value2) && self.stock > value2) { RemoveQuickClawState(self); orig.Invoke(self, dt); } else { float num = dt * value; orig.Invoke(self, num); } } private static void QuickClawBodyDestroy(orig_OnDestroy orig, CharacterBody self) { if (!((Object)(object)self != (Object)null)) { return; } List<GenericSkill> list = new List<GenericSkill>(); foreach (GenericSkill key in activeRechargeMultipliers.Keys) { if ((Object)(object)key == (Object)null || (Object)(object)key.characterBody == (Object)(object)self) { list.Add(key); } } foreach (GenericSkill item in list) { RemoveQuickClawState(item); } } private static void RemoveQuickClawState(GenericSkill skill) { if (!((Object)(object)skill == (Object)null)) { activeRechargeMultipliers.Remove(skill); startingStock.Remove(skill); } } } internal class WeaknessPolicy { [CompilerGenerated] private static class <>O { public static StatHookEventHandler <0>__WeaknessPolicyDamageHook; public static hook_TakeDamage <1>__WeaknessPolicyDamagedHook; public static hook_FixedUpdate <2>__WeaknessPolicyFixedUpdateHook; public static hook_OnDestroy <3>__WeaknessPolicyBodyDestroyHook; } public static ItemDef itemDef; public static BuffDef weaknessPrivilege; private static readonly Dictionary<CharacterBody, float> resetTimers = new Dictionary<CharacterBody, float>(); private static ItemTier tier = (ItemTier)0; public static float damageBonus = 10f; public static int maxBuffStacks = 5; public static int maxBuffStacksPerExtraStack = 3; public static float duration = 5f; public static void Init() { //IL_0006: 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) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Expected O, but got Unknown //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown itemDef = ItemManager.CreateItemDef("WeaknessPolicy", tier, true, false, (ItemTag[])(object)new ItemTag[2] { (ItemTag)1, (ItemTag)31 }, damageBonus, maxBuffStacks, maxBuffStacksPerExtraStack, duration); weaknessPrivilege = BuffManager.CreateBuffDef("WeaknessPrivilege", Color.white, canStack: true, isDebuff: false, isHidden: false); object obj = <>O.<0>__WeaknessPolicyDamageHook; if (obj == null) { StatHookEventHandler val = WeaknessPolicyDamageHook; <>O.<0>__WeaknessPolicyDamageHook = val; obj = (object)val; } RecalculateStatsAPI.GetStatCoefficients += (StatHookEventHandler)obj; object obj2 = <>O.<1>__WeaknessPolicyDamagedHook; if (obj2 == null) { hook_TakeDamage val2 = WeaknessPolicyDamagedHook; <>O.<1>__WeaknessPolicyDamagedHook = val2; obj2 = (object)val2; } HealthComponent.TakeDamage += (hook_TakeDamage)obj2; object obj3 = <>O.<2>__WeaknessPolicyFixedUpdateHook; if (obj3 == null) { hook_FixedUpdate val3 = WeaknessPolicyFixedUpdateHook; <>O.<2>__WeaknessPolicyFixedUpdateHook = val3; obj3 = (object)val3; } CharacterBody.FixedUpdate += (hook_FixedUpdate)obj3; object obj4 = <>O.<3>__WeaknessPolicyBodyDestroyHook; if (obj4 == null) { hook_OnDestroy val4 = WeaknessPolicyBodyDestroyHook; <>O.<3>__WeaknessPolicyBodyDestroyHook = val4; obj4 = (object)val4; } CharacterBody.OnDestroy += (hook_OnDestroy)obj4; } private static void WeaknessPolicyDamageHook(CharacterBody body, StatHookEventArgs args) { if (!((Object)(object)body == (Object)null) && Object.op_Implicit((Object)(object)body.inventory)) { int buffCount = body.GetBuffCount(weaknessPrivilege); if (buffCount > 0) { float num = damageBonus * (float)buffCount; args.damageMultAdd += num / 100f; } } } private static void WeaknessPolicyDamagedHook(orig_TakeDamage orig, HealthComponent self, DamageInfo damageInfo) { orig.Invoke(self, damageInfo); if (!NetworkServer.active || (Object)(object)self == (Object)null) { return; } 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 && !(damageInfo.damage <= 0f) && !(damageInfo.procCoefficient <= 0f) && body.healthComponent.alive) { int buffCount = body.GetBuffCount(weaknessPrivilege); int num = (int)MathUtility.GetLinearWithExtraStacking(maxBuffStacks, maxBuffStacksPerExtraStack, itemCountEffective); if (buffCount < num) { body.AddBuff(weaknessPrivilege); } resetTimers[body] = duration; } } private static void WeaknessPolicyFixedUpdateHook(orig_FixedUpdate orig, CharacterBody self) { //IL_0066: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self); if (NetworkServer.active && !((Object)(object)self == (Object)null) && resetTimers.TryGetValue(self, out var value)) { value -= Time.fixedDeltaTime; if (value <= 0f) { resetTimers.Remove(self); self.SetBuffCount(weaknessPrivilege.buffIndex, 0); } else { resetTimers[self] = value; } } } private static void WeaknessPolicyBodyDestroyHook(orig_OnDestroy orig, CharacterBody self) { if ((Object)(object)self != (Object)null) { resetTimers.Remove(self); } orig.Invoke(self); } } }