Decompiled source of FlatItemBuff v1.20.1
plugins/FlatItemBuff.dll
Decompiled 3 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.CodeDom.Compiler; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Resources; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security.Permissions; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.Squid.SquidWeapon; using EntityStates.TeleporterHealNovaController; using FlatItemBuff.Artifacts; using FlatItemBuff.Components; using FlatItemBuff.Items; using FlatItemBuff.Items.Behaviors; using FlatItemBuff.Modules; using FlatItemBuff.Orbs; using FlatItemBuff.Utils; using IL.EntityStates; using IL.EntityStates.Squid.SquidWeapon; using IL.EntityStates.TeleporterHealNovaController; using IL.RoR2; using IL.RoR2.Artifacts; using IL.RoR2.Items; using Mono.Cecil.Cil; using MonoMod.Cil; using On.EntityStates.TeleporterHealNovaController; using On.RoR2; using On.RoR2.Items; using On.RoR2.Projectile; using On.RoR2.Stats; using R2API; using RoR2; using RoR2.CharacterAI; using RoR2.ContentManagement; using RoR2.Items; using RoR2.Navigation; using RoR2.Orbs; using RoR2.Projectile; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Events; 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.0", FrameworkDisplayName = "")] [assembly: AssemblyCompany("FlatItemBuff")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("FlatItemBuff")] [assembly: AssemblyTitle("FlatItemBuff")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] namespace FlatItemBuff { public static class Configs { public static ConfigFile GeneralConfig; public static ConfigFile ItemConfig; public static ConfigFile ArtifactConfig; private const string Section_BisonSteak_Buff = "Bison Steak"; private const string Section_BisonSteak_Rework = "Bison Steak Rework"; private const string Section_TopazBrooch_Buff = "Topaz Brooch"; private const string Section_RollOfPennies_Rework = "Roll of Pennies Rework"; private const string Section_Chronobauble_Buff = "Chronobauble"; private const string Section_DeathMark_Rework = "Death Mark Rework"; private const string Section_LeptonDaisy_Buff = "Lepton Daisy"; private const string Section_LeechingSeed_Buff = "Leeching Seed"; private const string Section_LeechingSeed_Rework = "Leeching Seed Rework"; private const string Section_IgnitionTank_Rework = "Ignition Tank Rework"; private const string Section_Infusion_Buff = "Infusion"; private const string Section_WarHorn_Buff = "War Horn"; private const string Section_HuntersHarpoon_Buff = "Hunters Harpoon"; private const string Section_Stealthkit_Buff = "Old War Stealthkit"; private const string Section_SquidPolyp_Buff = "Squid Polyp"; private const string Section_WaxQuail_Buff = "Wax Quail"; private const string Section_Aegis_Buff = "Aegis"; private const string Section_BensRaincoat_Buff = "Bens Raincoat"; private const string Section_HappiestMask_Rework = "Happiest Mask Rework"; private const string Section_LaserScope_Buff = "Laser Scope"; private const string Section_SymbioticScorpion_Rework = "Symbiotic Scorpion Rework"; private const string Section_Planula_Buff = "Planula"; private const string Section_Planula_Rework = "Planula Rework"; private const string Section_TitanicKnurl_Buff = "Titanic Knurl"; private const string Section_TitanicKnurl_Rework = "Titanic Knurl Rework"; private const string Section_DefenseNucleus_Buff = "Defense Nucleus"; private const string Section_DefenseNucleus_Rework = "Defense Nucleus Rework"; private const string Section_DefenseNucleus_Shared = "Alpha Construct Ally"; private const string Section_LigmaLenses_Buff = "Lost Seers Lenses"; private const string Section_VoidsentFlame_Buff = "Voidsent Flame"; private const string Section_NewlyHatchedZoea_Rework = "Newly Hatched Zoea Rework"; private const string Section_Artifact_Spite = "Artifact of Spite"; private const string Label_EnableBuff = "Enable Changes"; private const string Label_EnableRework = "Enable Rework"; private const string Desc_EnableBuff = "Enables changes for this item."; private const string Desc_EnableRework = "Enables the rework for this item. Has priority over the the normal changes."; private const string Section_General_Bugs = "Bug Fixes"; private const string Section_General_Mechanics = "Mechanics"; public static string ConfigFolderPath => Path.Combine(Paths.ConfigPath, MainPlugin.pluginInfo.Metadata.GUID); public static void Setup() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Expected O, but got Unknown GeneralConfig = new ConfigFile(Path.Combine(ConfigFolderPath, "General.cfg"), true); ItemConfig = new ConfigFile(Path.Combine(ConfigFolderPath, "Items.cfg"), true); ArtifactConfig = new ConfigFile(Path.Combine(ConfigFolderPath, "Artifacts.cfg"), true); Read_BisonSteak(); Read_TopazBrooch(); Read_RollOfPennies(); Read_Chronobauble(); Read_DeathMark(); Read_IgnitionTank(); Read_Infusion(); Read_LeechingSeed(); Read_LeptonDaisy(); Read_Stealthkit(); Read_HuntersHarpoon(); Read_SquidPolyp(); Read_WarHorn(); Read_WaxQuail(); Read_Aegis(); Read_BensRaincoat(); Read_HappiestMask(); Read_LaserScope(); Read_SymbioticScorpion(); Read_Planula(); Read_TitanicKnurl(); Read_DefenseNucleus(); Read_LigmaLenses(); Read_VoidsentFlame(); Read_NewlyHatchedZoea(); Read_ArtifactSpite(); Read_General(); } private static void Read_General() { GeneralChanges.FixExpiredPings = GeneralConfig.Bind<bool>("Bug Fixes", "Fix Expired Pings", false, "Fixes a bug with expired pings blocking new ones. Recommended if using the Death Mark rework.").Value; GeneralChanges.TweakBarrierDecay = GeneralConfig.Bind<bool>("Mechanics", "Tweak Barrier Decay", false, "Changes barrier decay to scale from max health + shields instead of max barrier, recommended and specifically catered for Aegis changes.").Value; } private static void Read_BisonSteak() { BisonSteak.Enable = ItemConfig.Bind<bool>("Bison Steak", "Enable Changes", false, "Enables changes for this item.").Value; BisonSteak.BaseHP = ItemConfig.Bind<float>("Bison Steak", "Base HP", 10f, "Health each stack gives.").Value; BisonSteak.LevelHP = ItemConfig.Bind<float>("Bison Steak", "Level HP", 3f, "Health each stack gives per level.").Value; BisonSteak_Rework.Enable = ItemConfig.Bind<bool>("Bison Steak Rework", "Enable Rework", false, "Enables the rework for this item. Has priority over the the normal changes.").Value; BisonSteak_Rework.BaseRegen = ItemConfig.Bind<float>("Bison Steak Rework", "Base Regen", 1f, "Health regen at a single stack. (Scales with level)").Value; BisonSteak_Rework.StackRegen = ItemConfig.Bind<float>("Bison Steak Rework", "Stack Regen", 0f, "Health regen for each additional stack. (Scales with level)").Value; BisonSteak_Rework.BaseDuration = ItemConfig.Bind<float>("Bison Steak Rework", "Base Regen Duration", 3f, "Duration of the regen buff at a single stack.").Value; BisonSteak_Rework.StackDuration = ItemConfig.Bind<float>("Bison Steak Rework", "Stack Regen Duration", 3f, "Duration of the regen buff for each additional stack.").Value; BisonSteak_Rework.ExtendDuration = ItemConfig.Bind<float>("Bison Steak Rework", "Extend Duration", 1f, "How much to extend the effect duration on kill.").Value; BisonSteak_Rework.NerfFakeKill = ItemConfig.Bind<bool>("Bison Steak Rework", "Nerf Fake Kills", false, "Prevents fake kills from extending the duration.").Value; } private static void Read_TopazBrooch() { TopazBrooch.Enable = ItemConfig.Bind<bool>("Topaz Brooch", "Enable Changes", false, "Enables changes for this item.").Value; TopazBrooch.BaseFlatBarrier = ItemConfig.Bind<float>("Topaz Brooch", "Base Flat Barrier", 15f, "Flat amount of barrier given at a single stack.").Value; TopazBrooch.StackFlatBarrier = ItemConfig.Bind<float>("Topaz Brooch", "Stack Flat Barrier", 15f, "Flat amount of barrier given for each additional stack.").Value; TopazBrooch.BaseCentBarrier = ItemConfig.Bind<float>("Topaz Brooch", "Base Percent Barrier", 0.005f, "Percent amount of barrier given at a single stack.").Value; TopazBrooch.StackCentBarrier = ItemConfig.Bind<float>("Topaz Brooch", "Stack Percent Barrier", 0.005f, "Percent amount of barrier given for each additional stack.").Value; } private static void Read_RollOfPennies() { RollOfPennies_Rework.Enable = ItemConfig.Bind<bool>("Roll of Pennies Rework", "Enable Rework", false, "Enables the rework for this item. Has priority over the the normal changes.").Value; RollOfPennies_Rework.BaseGold = ItemConfig.Bind<float>("Roll of Pennies Rework", "Base Gold", 3f, "Gold amount given at a single stack.").Value; RollOfPennies_Rework.StackGold = ItemConfig.Bind<float>("Roll of Pennies Rework", "Stack Gold", 0f, "Gold amount given for each additional stack.").Value; RollOfPennies_Rework.BaseArmor = ItemConfig.Bind<float>("Roll of Pennies Rework", "Base Armor", 5f, "Armor given at a single stack.").Value; RollOfPennies_Rework.StackArmor = ItemConfig.Bind<float>("Roll of Pennies Rework", "Stack Armor", 1f, "Armor given for each additional stack.").Value; RollOfPennies_Rework.BaseDuration = ItemConfig.Bind<float>("Roll of Pennies Rework", "Base Armor Duration", 2f, "Duration given to the armor at a single stack.").Value; RollOfPennies_Rework.StackDuration = ItemConfig.Bind<float>("Roll of Pennies Rework", "Stack Armor Duration", 1f, "Duration given to the armor for each additional stack.").Value; RollOfPennies_Rework.GoldDuration = ItemConfig.Bind<float>("Roll of Pennies Rework", "Gold Armor Duration", 0.5f, "Multiplier for the gold's value when calculating the extra duration.").Value; } private static void Read_Chronobauble() { Chronobauble.Enable = ItemConfig.Bind<bool>("Chronobauble", "Enable Changes", false, "Enables changes for this item.").Value; Chronobauble.SlowDown = ItemConfig.Bind<float>("Chronobauble", "Move Speed Reduction", 0.6f, "Move Speed debuff amount.").Value; Chronobauble.AttackDown = ItemConfig.Bind<float>("Chronobauble", "Attack Speed Reduction", 0.3f, "Attack Speed debuff amount.").Value; Chronobauble.BaseDuration = ItemConfig.Bind<float>("Chronobauble", "Base Duration", 2f, "Debuff duration at a single stack.").Value; Chronobauble.StackDuration = ItemConfig.Bind<float>("Chronobauble", "Stack Duration", 2f, "Debuff duration for each additional.").Value; } private static void Read_DeathMark() { FlatItemBuff.Items.DeathMark_Rework.Enable = ItemConfig.Bind<bool>("Death Mark Rework", "Enable Rework", false, "Enables the rework for this item. Has priority over the the normal changes.").Value; FlatItemBuff.Items.DeathMark_Rework.BaseDuration = ItemConfig.Bind<float>("Death Mark Rework", "Base Duration", 6f, "Duration of the Death Mark at a single stack.").Value; FlatItemBuff.Items.DeathMark_Rework.StackDuration = ItemConfig.Bind<float>("Death Mark Rework", "Stack Duration", 3f, "Duration of the Death Mark for each additional stack.").Value; FlatItemBuff.Items.DeathMark_Rework.BaseCooldown = ItemConfig.Bind<int>("Death Mark Rework", "Cooldown", 0, "Cooldown between uses. (Whole numbers only)").Value; FlatItemBuff.Items.DeathMark_Rework.MarkBaseBonus = ItemConfig.Bind<float>("Death Mark Rework", "Base Damage Bonus", 0.5f, "Damage bonus against Death Marked targets.").Value; FlatItemBuff.Items.DeathMark_Rework.MarkStackBonus = ItemConfig.Bind<float>("Death Mark Rework", "Stack Damage Bonus", 0.2f, "Damage bonus against Death Marked targets for each additional stack of the debuff.").Value; FlatItemBuff.Items.DeathMark_Rework.AllowMarkStacking = ItemConfig.Bind<bool>("Death Mark Rework", "Allow Stacking", false, "Allows for multiple stacks of Death Mark on a target.").Value; } private static void Read_LeptonDaisy() { LeptonDaisy.Enable = ItemConfig.Bind<bool>("Lepton Daisy", "Enable Changes", false, "Enables changes for this item.").Value; LeptonDaisy.BaseHeal = ItemConfig.Bind<float>("Lepton Daisy", "Base Healing", 0.1f, "Healing at a single stack.").Value; LeptonDaisy.StackHeal = ItemConfig.Bind<float>("Lepton Daisy", "Stack Healing", 0.1f, "Healing for each additional stack.").Value; LeptonDaisy.CapHeal = ItemConfig.Bind<float>("Lepton Daisy", "Capped Healing", 2f, "Hyperbolic healing limit. (Set to 0 or less to disable.)").Value; LeptonDaisy.Cooldown = ItemConfig.Bind<float>("Lepton Daisy", "Cooldown", 10f, "Cooldown of the healing nova.").Value; } private static void Read_IgnitionTank() { IgnitionTank_Rework.Enable = ItemConfig.Bind<bool>("Ignition Tank Rework", "Enable Rework", false, "Enables the rework for this item. Has priority over the the normal changes.").Value; IgnitionTank_Rework.BurnChance = ItemConfig.Bind<float>("Ignition Tank Rework", "Burn Chance", 10f, "Chance to Burn on hit.").Value; IgnitionTank_Rework.BurnBaseDamage = ItemConfig.Bind<float>("Ignition Tank Rework", "Burn Damage", 0.8f, "How much damage Burn deals per second.").Value; IgnitionTank_Rework.BurnDuration = ItemConfig.Bind<float>("Ignition Tank Rework", "Burn Duration", 3f, "How long in seconds Burn lasts for.").Value; IgnitionTank_Rework.BlastTicks = ItemConfig.Bind<int>("Ignition Tank Rework", "Explode Ticks", 10, "Explodes after X instances of damage over time.").Value; IgnitionTank_Rework.BlastBaseDamage = ItemConfig.Bind<float>("Ignition Tank Rework", "Explosion Base Damage", 3f, "Damage the explosion deals at a single stack.").Value; IgnitionTank_Rework.BlastStackDamage = ItemConfig.Bind<float>("Ignition Tank Rework", "Explosion Stack Damage", 2f, "Extra damage the explosion deals for each additional stack.").Value; IgnitionTank_Rework.BlastBaseRadius = ItemConfig.Bind<float>("Ignition Tank Rework", "Explosion Base Radius", 12f, "Radius of the the explosion at a single stack.").Value; IgnitionTank_Rework.BlastStackRadius = ItemConfig.Bind<float>("Ignition Tank Rework", "Explosion Stack Radius", 2.4f, "Extra explosion radius for each additional stack.").Value; IgnitionTank_Rework.BlastInheritDamageType = ItemConfig.Bind<bool>("Ignition Tank Rework", "Explosion Inherit Damage Type", false, "Makes the explosion inherit the damage types used from the hit that procced. (For example it would make the explosion non-lethal if it was from Acrid's poison)").Value; IgnitionTank_Rework.BlastRollCrit = ItemConfig.Bind<bool>("Ignition Tank Rework", "Explosion Roll Crits", false, "Allows the explosion to roll for crits, it will still inherit crits from the hit that procced regardless of this setting.").Value; } private static void Read_Infusion() { Infusion.Enable = ItemConfig.Bind<bool>("Infusion", "Enable Changes", false, "Enables changes for this item.").Value; Infusion.StackLevel = ItemConfig.Bind<int>("Infusion", "Stack Level", 2, "Number of levels gained per stack.").Value; Infusion.Infinite = ItemConfig.Bind<bool>("Infusion", "Soft Cap", true, "Allows samples to be collected beyond the cap with diminishing returns.").Value; Infusion.Inherit = ItemConfig.Bind<bool>("Infusion", "Inherit", true, "Should your minions with infusions inherit your count.").Value; Infusion.ChampionGain = ItemConfig.Bind<int>("Infusion", "Champion Value", 5, "Sample value of champion enemies. (Wandering Vagrant, Magma Worm, etc)").Value; Infusion.EliteGainMult = ItemConfig.Bind<int>("Infusion", "Elite Multiplier", 3, "Sample value multiplier from elite enemies.").Value; Infusion.BossGainMult = ItemConfig.Bind<int>("Infusion", "Boss Multiplier", 2, "Sample value multiplier from boss enemies.").Value; } private static void Read_LeechingSeed() { LeechingSeed.Enable = ItemConfig.Bind<bool>("Leeching Seed", "Enable Changes", false, "Enables changes for this item.").Value; LeechingSeed.ProcHeal = ItemConfig.Bind<float>("Leeching Seed", "Proc Healing", 0.75f, "Healing amount that's affected by proc coefficient.").Value; LeechingSeed.BaseHeal = ItemConfig.Bind<float>("Leeching Seed", "Base Healing", 0.75f, "Extra healing amount regardless of proc coefficient.").Value; LeechingSeed_Rework.Enable = ItemConfig.Bind<bool>("Leeching Seed Rework", "Enable Rework", false, "Enables the rework for this item. Has priority over the the normal changes.").Value; LeechingSeed_Rework.BaseDoTHeal = ItemConfig.Bind<float>("Leeching Seed Rework", "Base DoT Healing", 4f, "Healing amount given from damage over time ticks at a single stack.").Value; LeechingSeed_Rework.StackDoTHeal = ItemConfig.Bind<float>("Leeching Seed Rework", "Stack DoT Healing", 4f, "Healing amount given from damage over time for each additional stack.").Value; LeechingSeed_Rework.LeechChance = ItemConfig.Bind<float>("Leeching Seed Rework", "Leech Chance", 20f, "Chance of applying the Leech debuff.").Value; LeechingSeed_Rework.LeechLifeSteal = ItemConfig.Bind<float>("Leeching Seed Rework", "Leech Life Steal", 0.1f, "Percent of damage received as healing when damaging a target with Leech.").Value; LeechingSeed_Rework.LeechMinLifeSteal = ItemConfig.Bind<float>("Leeching Seed Rework", "Leech Minimum Life Steal", 1f, "Minimum amount of healing received when damaging a target with Leech.").Value; LeechingSeed_Rework.LeechBaseDamage = ItemConfig.Bind<float>("Leeching Seed Rework", "Leech Base Damage", 0.5f, "Damage dealt per second from Leech.").Value; LeechingSeed_Rework.LeechBaseDuration = ItemConfig.Bind<float>("Leeching Seed Rework", "Leech Base Duration", 5f, "How long Leech is applied for at a single stack.").Value; LeechingSeed_Rework.LeechStackDuration = ItemConfig.Bind<float>("Leeching Seed Rework", "Leech Stack Duration", 0f, "How much longer Leech is applied for each additional stack.").Value; } private static void Read_WaxQuail() { FlatItemBuff.Items.WaxQuail.Enable = ItemConfig.Bind<bool>("Wax Quail", "Enable Changes", false, "Enables changes for this item.").Value; FlatItemBuff.Items.WaxQuail.BaseHori = ItemConfig.Bind<float>("Wax Quail", "Base Horizontal Boost", 12f, "Horizontal force at a single stack.").Value; FlatItemBuff.Items.WaxQuail.StackHori = ItemConfig.Bind<float>("Wax Quail", "Stack Horizontal Boost", 8f, "Horizontal force for each additional stack.").Value; FlatItemBuff.Items.WaxQuail.CapHori = ItemConfig.Bind<float>("Wax Quail", "Capped Horizontal Boost", 120f, "Hyperbolic cap to horizontal force. (Set to 0 or less to disable.)").Value; FlatItemBuff.Items.WaxQuail.BaseVert = ItemConfig.Bind<float>("Wax Quail", "Base Vertical Boost", 0.2f, "Vertical force at a single stack.").Value; FlatItemBuff.Items.WaxQuail.StackVert = ItemConfig.Bind<float>("Wax Quail", "Stack Vertical", 0f, "Vertical force for each additional stack.").Value; FlatItemBuff.Items.WaxQuail.CapVert = ItemConfig.Bind<float>("Wax Quail", "Capped Vertical Boost", 0f, "Hyperbolic cap to vertical force. (Set to 0 or less to disable.)").Value; FlatItemBuff.Items.WaxQuail.BaseAirSpeed = ItemConfig.Bind<float>("Wax Quail", "Base Air Speed", 0.12f, "Airborne movement speed at a single stack.").Value; FlatItemBuff.Items.WaxQuail.StackAirSpeed = ItemConfig.Bind<float>("Wax Quail", "Stack Air Speed", 0.08f, "Airborne movement speed for each additional stack.").Value; FlatItemBuff.Items.WaxQuail.CapAirSpeed = ItemConfig.Bind<float>("Wax Quail", "Capped Air Speed", 1.2f, "Hyperbolic cap to airborne movement speed. (Set to 0 or less to disable.)").Value; } private static void Read_Stealthkit() { Stealthkit.Enable = ItemConfig.Bind<bool>("Old War Stealthkit", "Enable Changes", false, "Enables changes for this item.").Value; Stealthkit.BaseRecharge = ItemConfig.Bind<float>("Old War Stealthkit", "Base Cooldown", 30f, "Cooldown between uses.").Value; Stealthkit.StackRecharge = ItemConfig.Bind<float>("Old War Stealthkit", "Stack Cooldown", 0.5f, "Cooldown rate for each additional stack.").Value; Stealthkit.BuffDuration = ItemConfig.Bind<float>("Old War Stealthkit", "Buff Duration", 5f, "Duration of the Stealth buff.").Value; Stealthkit.Stealth_MoveSpeed = ItemConfig.Bind<float>("Old War Stealthkit", "Stealth Movement Speed", 0.4f, "How much Movement Speed is given from the Stealth buff.").Value; Stealthkit.Stealth_ArmorPerBuff = ItemConfig.Bind<float>("Old War Stealthkit", "Stealth Armor", 20f, "How much Armor to give per stack of the Stealth buff.").Value; Stealthkit.CancelCombat = ItemConfig.Bind<bool>("Old War Stealthkit", "Cancel Combat", true, "Puts you in 'Out of Combat' upon activation.").Value; Stealthkit.CancelDanger = ItemConfig.Bind<bool>("Old War Stealthkit", "Cancel Danger", true, "Puts you in 'Out of Danger' upon activation.").Value; Stealthkit.CleanseDoT = ItemConfig.Bind<bool>("Old War Stealthkit", "Clean DoTs", true, "Removes damage over time effects upon activation.").Value; } private static void Read_HuntersHarpoon() { HuntersHarpoon.Enable = ItemConfig.Bind<bool>("Hunters Harpoon", "Enable Changes", false, "Enables changes for this item.").Value; HuntersHarpoon.BaseDuration = ItemConfig.Bind<float>("Hunters Harpoon", "Base Duration", 1f, "Buff duration at a single stack.").Value; HuntersHarpoon.StackDuration = ItemConfig.Bind<float>("Hunters Harpoon", "Stack Duration", 1f, "Extra buff duration for each additional stack.").Value; HuntersHarpoon.MovementSpeed = ItemConfig.Bind<float>("Hunters Harpoon", "Movement Speed Bonus", 1.25f, "Movement speed each stack of the buff gives.").Value; HuntersHarpoon.ExtendDuration = ItemConfig.Bind<bool>("Hunters Harpoon", "Extend Duration", true, "Adds duration to the buff with each kill instead of refreshing it.").Value; HuntersHarpoon.BaseCooldownReduction = ItemConfig.Bind<float>("Hunters Harpoon", "Cooldown Reduction", 1f, "Cooldown reduction on kill.").Value; HuntersHarpoon.CoolPrimary = ItemConfig.Bind<bool>("Hunters Harpoon", "Cooldown Primary", false, "Cooldown reduction affects Primary skills?").Value; HuntersHarpoon.CoolSecondary = ItemConfig.Bind<bool>("Hunters Harpoon", "Cooldown Secondary", true, "Cooldown reduction affects Secondary skills?").Value; HuntersHarpoon.CoolUtility = ItemConfig.Bind<bool>("Hunters Harpoon", "Cooldown Utility", false, "Cooldown reduction affects Utility skills?").Value; HuntersHarpoon.CoolSpecial = ItemConfig.Bind<bool>("Hunters Harpoon", "Cooldown Special", false, "Cooldown reduction affects Special skills?").Value; } private static void Read_SquidPolyp() { SquidPolyp.Enable = ItemConfig.Bind<bool>("Squid Polyp", "Enable Changes", false, "Enables changes for this item.").Value; SquidPolyp.ApplyTar = ItemConfig.Bind<bool>("Squid Polyp", "Apply Tar", true, "Makes Squid Turrets apply the Tar debuff with their attack.").Value; SquidPolyp.BaseDuration = ItemConfig.Bind<int>("Squid Polyp", "Base Duration", 25, "Squid Turret duration at a single stack.").Value; SquidPolyp.StackDuration = ItemConfig.Bind<int>("Squid Polyp", "Stack Duration", 5, "Squid Turret duration for each additional stack.").Value; SquidPolyp.StackHealth = ItemConfig.Bind<int>("Squid Polyp", "Stack Health", 2, "Extra Squid Turret health for each additional stack. (1 = +10%)").Value; SquidPolyp.MaxTurrets = ItemConfig.Bind<int>("Squid Polyp", "Max Turrets", 8, "How many Squid Turrets each player can have, newer turrets will replace old ones. (Set to 0 for vanilla behavior.)").Value; } private static void Read_WarHorn() { WarHorn.Enable = ItemConfig.Bind<bool>("War Horn", "Enable Changes", false, "Enables changes for this item.").Value; WarHorn.BaseDuration = ItemConfig.Bind<float>("War Horn", "Base Duration", 6f, "Duration at a single stack.").Value; WarHorn.StackDuration = ItemConfig.Bind<float>("War Horn", "Stack Duration", 3f, "Duration for each additional stack.").Value; WarHorn.BaseAttack = ItemConfig.Bind<float>("War Horn", "Base Attack", 0.6f, "Attack Speed at a single stack.").Value; WarHorn.StackAttack = ItemConfig.Bind<float>("War Horn", "Stack Attack", 0.15f, "Attack Speed for each additional stack.").Value; } private static void Read_Aegis() { Aegis.Enable = ItemConfig.Bind<bool>("Aegis", "Enable Changes", false, "Enables changes for this item.").Value; Aegis.AllowRegen = ItemConfig.Bind<bool>("Aegis", "Count Regen", true, "Allows excess regen to be converted into barrier.").Value; Aegis.BaseOverheal = ItemConfig.Bind<float>("Aegis", "Base Overheal", 0.5f, "Conversion rate of overheal to barrier at single stack.").Value; Aegis.StackOverheal = ItemConfig.Bind<float>("Aegis", "Stack Overheal", 0.5f, "Conversion rate of overheal to barrier for each additional stack.").Value; Aegis.BaseMaxBarrier = ItemConfig.Bind<float>("Aegis", "Base Max Barrier", 0.25f, "Increases maximum barrier by this much at single stack.").Value; Aegis.StackMaxBarrier = ItemConfig.Bind<float>("Aegis", "Stack Max Barrier", 0.25f, "Increases maximum barrier by this much for each additional stack.").Value; } private static void Read_BensRaincoat() { BensRaincoat.Enable = ItemConfig.Bind<bool>("Bens Raincoat", "Enable Changes", false, "Enables changes for this item.").Value; BensRaincoat.BaseBlock = ItemConfig.Bind<int>("Bens Raincoat", "Base Block", 2, "Debuff blocks to give at a single stack.").Value; BensRaincoat.StackBlock = ItemConfig.Bind<int>("Bens Raincoat", "Stack Block", 1, "Debuff blocks to give for each additional stack.").Value; BensRaincoat.Cooldown = ItemConfig.Bind<float>("Bens Raincoat", "Cooldown", 7f, "Time in seconds it takes to restock debuff blocks. (Anything less than 0 will skip this change.)").Value; BensRaincoat.GraceTime = ItemConfig.Bind<float>("Bens Raincoat", "Debuff Grace Time", 0.25f, "Time in seconds after consuming a block that further debuffs are negated for free.").Value; } private static void Read_HappiestMask() { FlatItemBuff.Items.HappiestMask_Rework.Enable = ItemConfig.Bind<bool>("Happiest Mask Rework", "Enable Rework", false, "Enables the rework for this item. Has priority over the the normal changes.").Value; FlatItemBuff.Items.HappiestMask_Rework.BaseDamage = ItemConfig.Bind<float>("Happiest Mask Rework", "Base Damage", 2f, "Damage increase for ghosts at a single stack.").Value; FlatItemBuff.Items.HappiestMask_Rework.StackDamage = ItemConfig.Bind<float>("Happiest Mask Rework", "Stack Damage", 1.5f, "Damage increase for ghosts for each additional stack.").Value; FlatItemBuff.Items.HappiestMask_Rework.BaseMoveSpeed = ItemConfig.Bind<float>("Happiest Mask Rework", "Movement Speed", 0.45f, "Movement speed increase for ghosts.").Value; FlatItemBuff.Items.HappiestMask_Rework.BaseDuration = ItemConfig.Bind<int>("Happiest Mask Rework", "Duration", 30, "How long in seconds the ghosts lasts before dying.").Value; FlatItemBuff.Items.HappiestMask_Rework.BaseCooldown = ItemConfig.Bind<int>("Happiest Mask Rework", "Cooldown", 3, "How long in seconds until a new ghost is summoned.").Value; FlatItemBuff.Items.HappiestMask_Rework.OnKillOnDeath = ItemConfig.Bind<bool>("Happiest Mask Rework", "On Kill On Death", true, "Credits the ghost's death as your kill.").Value; FlatItemBuff.Items.HappiestMask_Rework.PassKillCredit = ItemConfig.Bind<bool>("Happiest Mask Rework", "Kill Credit Owner", true, "Credits all kills the ghost scores as yours.").Value; } private static void Read_LaserScope() { LaserScope.Enable = ItemConfig.Bind<bool>("Laser Scope", "Enable Changes", false, "Enables changes for this item.").Value; LaserScope.BaseCrit = ItemConfig.Bind<float>("Laser Scope", "Crit Chance", 5f, "Crit chance at a single stack.").Value; } private static void Read_SymbioticScorpion() { FlatItemBuff.Items.SymbioticScorpion_Rework.Enable = ItemConfig.Bind<bool>("Symbiotic Scorpion Rework", "Enable Rework", false, "Enables the rework for this item. Has priority over the the normal changes.").Value; FlatItemBuff.Items.SymbioticScorpion_Rework.Slayer_BaseDamage = ItemConfig.Bind<float>("Symbiotic Scorpion Rework", "Slayer DoT Base Damage", 1f, "Slayer DoT damage increase at a single stack.").Value; FlatItemBuff.Items.SymbioticScorpion_Rework.Slayer_StackDamage = ItemConfig.Bind<float>("Symbiotic Scorpion Rework", "Slayer DoT Stack Damage", 0f, "Slayer DoT damage increase for each additional stack.").Value; FlatItemBuff.Items.SymbioticScorpion_Rework.SlayerDot_AffectTotalDamage = ItemConfig.Bind<bool>("Symbiotic Scorpion Rework", "Slayer DoT Affects Total Damage", false, "Makes the Slayer DoT affect the total damage for the purpose of proc items. (False = Vanilla)").Value; FlatItemBuff.Items.SymbioticScorpion_Rework.Radius = ItemConfig.Bind<float>("Symbiotic Scorpion Rework", "Venom Radius", 13f, "The targetting radius for the Venom attack. (Set to 0 to disable the effect entirely.)").Value; FlatItemBuff.Items.SymbioticScorpion_Rework.Cooldown = ItemConfig.Bind<float>("Symbiotic Scorpion Rework", "Venom Cooldown", 5f, "Cooldown between Venom attacks.").Value; FlatItemBuff.Items.SymbioticScorpion_Rework.VenomBaseDamage = ItemConfig.Bind<float>("Symbiotic Scorpion Rework", "Venom Base Damage", 8f, "Damage of the Venom at a single stack.").Value; FlatItemBuff.Items.SymbioticScorpion_Rework.VenomStackDamage = ItemConfig.Bind<float>("Symbiotic Scorpion Rework", "Venom Stack Damage", 8f, "Damage of the Venom for each additional stack.").Value; } private static void Read_Planula() { Planula.Enable = ItemConfig.Bind<bool>("Planula", "Enable Changes", false, "Enables changes for this item.").Value; Planula.BaseFlatHeal = ItemConfig.Bind<float>("Planula", "Base Flat Healing", 10f, "Flat healing at a single stack.").Value; Planula.StackFlatHeal = ItemConfig.Bind<float>("Planula", "Stack Flat Healing", 10f, "Flat healing for each additional stack.").Value; Planula.BaseMaxHeal = ItemConfig.Bind<float>("Planula", "Base Max Healing", 0.02f, "Percent healing at a single stack.").Value; Planula.StackMaxHeal = ItemConfig.Bind<float>("Planula", "Stack Max Healing", 0.02f, "Percent healing for each additional stack.").Value; FlatItemBuff.Items.Planula_Rework.Enable = ItemConfig.Bind<bool>("Planula Rework", "Enable Rework", false, "Enables the rework for this item. Has priority over the the normal changes.").Value; FlatItemBuff.Items.Planula_Rework.BaseDamage = ItemConfig.Bind<float>("Planula Rework", "Base Damage", 0.8f, "Damage per second the burn deals at a single stack.").Value; FlatItemBuff.Items.Planula_Rework.StackDamage = ItemConfig.Bind<float>("Planula Rework", "Stack Damage", 0.6f, "Damage per second the burn deals for each additional stack.").Value; FlatItemBuff.Items.Planula_Rework.Duration = ItemConfig.Bind<float>("Planula Rework", "Burn Duration", 5f, "Duration of the burn.").Value; FlatItemBuff.Items.Planula_Rework.Radius = ItemConfig.Bind<float>("Planula Rework", "Burn Radius", 15f, "Radius for enemies to be within to start burning.").Value; } private static void Read_TitanicKnurl() { TitanicKnurl.Enable = ItemConfig.Bind<bool>("Titanic Knurl", "Enable Changes", false, "Enables changes for this item.").Value; TitanicKnurl.BaseHP = ItemConfig.Bind<float>("Titanic Knurl", "Base Health", 30f, "Health each stack gives.").Value; TitanicKnurl.LevelHP = ItemConfig.Bind<float>("Titanic Knurl", "Level Health", 9f, "Health each stack gives per level.").Value; TitanicKnurl.BaseRegen = ItemConfig.Bind<float>("Titanic Knurl", "Base Regen", 1.6f, "Health Regen each stack gives.").Value; TitanicKnurl.LevelRegen = ItemConfig.Bind<float>("Titanic Knurl", "Level Regen", 0.32f, "Health Regen each stack gives per level.").Value; FlatItemBuff.Items.TitanicKnurl_Rework.Enable = ItemConfig.Bind<bool>("Titanic Knurl Rework", "Enable Rework", false, "Enables the rework for this item. Has priority over the the normal changes.").Value; FlatItemBuff.Items.TitanicKnurl_Rework.BaseDamage = ItemConfig.Bind<float>("Titanic Knurl Rework", "Base Damage", 8f, "Base damage at a single stack.").Value; FlatItemBuff.Items.TitanicKnurl_Rework.StackDamage = ItemConfig.Bind<float>("Titanic Knurl Rework", "Stack Damage", 6f, "Base damage for each additional stack.").Value; FlatItemBuff.Items.TitanicKnurl_Rework.BaseCooldown = ItemConfig.Bind<float>("Titanic Knurl Rework", "Base Cooldown", 6f, "Cooldown at a single stack.").Value; FlatItemBuff.Items.TitanicKnurl_Rework.StackCooldown = ItemConfig.Bind<float>("Titanic Knurl Rework", "Stack Cooldown", 0.15f, "Cooldown rate for each additional stack.").Value; FlatItemBuff.Items.TitanicKnurl_Rework.ProcRate = ItemConfig.Bind<float>("Titanic Knurl Rework", "Proc Coefficient", 1f, "Proc coefficient of the stone fist.").Value; FlatItemBuff.Items.TitanicKnurl_Rework.ProcBands = ItemConfig.Bind<bool>("Titanic Knurl Rework", "Proc Bands", true, "Should the stone fist proc bands?").Value; FlatItemBuff.Items.TitanicKnurl_Rework.TargetRadius = ItemConfig.Bind<float>("Titanic Knurl Rework", "Target Radius", 60f, "Targeting radius in metres.").Value; FlatItemBuff.Items.TitanicKnurl_Rework.TargetMode = ItemConfig.Bind<int>("Titanic Knurl Rework", "Target Mode", 0, "Decides how the target is selected. (0 = Weak, 1 = Closest)").Value; } private static void Read_DefenseNucleus() { DefenseNucleus.Enable = ItemConfig.Bind<bool>("Defense Nucleus", "Enable Changes", false, "Enables changes for this item.").Value; DefenseNucleus.BaseHealth = ItemConfig.Bind<int>("Defense Nucleus", "Base Health", 10, "Extra health the construct gets at a single stack. (1 = +10%)").Value; DefenseNucleus.StackHealth = ItemConfig.Bind<int>("Defense Nucleus", "Stack Health", 10, "Extra health the construct gets for each additional stack.").Value; DefenseNucleus.BaseAttack = ItemConfig.Bind<int>("Defense Nucleus", "Base Attack Speed", 3, "Extra attack speed the construct gets at a single stack. (1 = +10%)").Value; DefenseNucleus.StackAttack = ItemConfig.Bind<int>("Defense Nucleus", "Stack Attack Speed", 0, "Extra attack speed the construct gets for each additional stack.").Value; DefenseNucleus.BaseDamage = ItemConfig.Bind<int>("Defense Nucleus", "Base Damage", 0, "Extra damage the construct gets at a single stack. (1 = +10%)").Value; DefenseNucleus.StackDamage = ItemConfig.Bind<int>("Defense Nucleus", "Stack Damage", 5, "Extra damage the construct gets for each additional stack.").Value; DefenseNucleus.Cooldown = ItemConfig.Bind<float>("Defense Nucleus", "Cooldown", 1f, "Cooldown for summoning constructs.").Value; DefenseNucleus_Rework.Enable = ItemConfig.Bind<bool>("Defense Nucleus Rework", "Enable Rework", false, "Enables the rework for this item. Has priority over the the normal changes.").Value; DefenseNucleus_Rework.SummonCount = ItemConfig.Bind<int>("Defense Nucleus Rework", "Summon Count", 3, "How many constructs to summon on activation. (Cannot go above 6 because I said so.)").Value; DefenseNucleus_Rework.BaseHealth = ItemConfig.Bind<int>("Defense Nucleus Rework", "Base Health", 10, "Extra health the construct gets at a single stack. (1 = +10%)").Value; DefenseNucleus_Rework.StackHealth = ItemConfig.Bind<int>("Defense Nucleus Rework", "Stack Health", 10, "Extra health the construct gets for each additional stack.").Value; DefenseNucleus_Rework.BaseAttack = ItemConfig.Bind<int>("Defense Nucleus Rework", "Base Attack Speed", 3, "Extra attack speed the construct gets at a single stack. (1 = +10%)").Value; DefenseNucleus_Rework.StackAttack = ItemConfig.Bind<int>("Defense Nucleus Rework", "Stack Attack Speed", 0, "Extra attack speed the construct gets for each additional stack.").Value; DefenseNucleus_Rework.BaseDamage = ItemConfig.Bind<int>("Defense Nucleus Rework", "Base Damage", 0, "Extra damage the construct gets at a single stack. (1 = +10%)").Value; DefenseNucleus_Rework.StackDamage = ItemConfig.Bind<int>("Defense Nucleus Rework", "Stack Damage", 5, "Extra damage the construct gets for each additional stack.").Value; DefenseNucleus_Rework.ShieldBaseDuration = ItemConfig.Bind<float>("Defense Nucleus Rework", "Shield Base Duration", 5f, "Duration of the projectile shield at a single stack.").Value; DefenseNucleus_Rework.ShieldStackDuration = ItemConfig.Bind<float>("Defense Nucleus Rework", "Shield Stack Duration", 1f, "Duration of the projectile shield for each additional stack.").Value; DefenseNucleus_Shared.TweakAI = ItemConfig.Bind<bool>("Alpha Construct Ally", "Better AI", false, "Gives 360 Degree vision and prevents retaliation against allies.").Value; DefenseNucleus_Shared.ForceMechanical = ItemConfig.Bind<bool>("Alpha Construct Ally", "Is Mechanical", false, "Gives it the Mechanical flag, allowing it to get Spare Drone Parts and Captain's Microbots.").Value; DefenseNucleus_Shared.ExtraDisplays = ItemConfig.Bind<bool>("Alpha Construct Ally", "Modded Displays", false, "Adds Spare Drone Parts item displays to the Alpha Construct.").Value; } private static void Read_LigmaLenses() { LigmaLenses.Enable = ItemConfig.Bind<bool>("Lost Seers Lenses", "Enable Changes", false, "Enables changes for this item.").Value; LigmaLenses.BaseChance = ItemConfig.Bind<float>("Lost Seers Lenses", "Base Chance", 0.5f, "Detain chance at a single stack.").Value; LigmaLenses.StackChance = ItemConfig.Bind<float>("Lost Seers Lenses", "Stack Chance", 0.5f, "Detain chance for each additional stack.").Value; LigmaLenses.BaseDamage = ItemConfig.Bind<float>("Lost Seers Lenses", "Base Damage", 50f, "Base damage at a single stack.").Value; LigmaLenses.StackDamage = ItemConfig.Bind<float>("Lost Seers Lenses", "Stack Damage", 0f, "Base damage for each additional stack.").Value; LigmaLenses.UseTotalDamage = ItemConfig.Bind<bool>("Lost Seers Lenses", "Deal Total", false, "Deal Total Damage of the attack instead of the attacker's damage stat?").Value; } private static void Read_VoidsentFlame() { VoidsentFlame.Enable = ItemConfig.Bind<bool>("Voidsent Flame", "Enable Changes", false, "Enables changes for this item.").Value; VoidsentFlame.BaseRadius = ItemConfig.Bind<float>("Voidsent Flame", "Base Radius", 12f, "Blast radius at a single stack.").Value; VoidsentFlame.StackRadius = ItemConfig.Bind<float>("Voidsent Flame", "Stack Radius", 2.4f, "Extra blast radius for each additional stack.").Value; VoidsentFlame.BaseDamage = ItemConfig.Bind<float>("Voidsent Flame", "Base Damage", 2.6f, "Blast damage at a single stack.").Value; VoidsentFlame.StackDamage = ItemConfig.Bind<float>("Voidsent Flame", "Stack Damage", 1.56f, "Blast damage for each additional stack.").Value; VoidsentFlame.ProcRate = ItemConfig.Bind<float>("Voidsent Flame", "Proc Coefficient", 1f, "Blast proc coefficient.").Value; } private static void Read_NewlyHatchedZoea() { FlatItemBuff.Items.NewlyHatchedZoea_Rework.Enable = ItemConfig.Bind<bool>("Newly Hatched Zoea Rework", "Enable Rework", false, "Enables the rework for this item. Has priority over the the normal changes.").Value; FlatItemBuff.Items.NewlyHatchedZoea_Rework.BaseStock = ItemConfig.Bind<int>("Newly Hatched Zoea Rework", "Base Stock", 12, "How many missiles to store at a single stack.").Value; FlatItemBuff.Items.NewlyHatchedZoea_Rework.StackStock = ItemConfig.Bind<int>("Newly Hatched Zoea Rework", "Stack Stock", 4, "Extra missiles for each additional stack.").Value; FlatItemBuff.Items.NewlyHatchedZoea_Rework.BaseDamage = ItemConfig.Bind<float>("Newly Hatched Zoea Rework", "Base Damage", 3f, "Missile damage at a single stack.").Value; FlatItemBuff.Items.NewlyHatchedZoea_Rework.StackDamage = ItemConfig.Bind<float>("Newly Hatched Zoea Rework", "Stack Damage", 0.75f, "Missile damage for each additional stack.").Value; FlatItemBuff.Items.NewlyHatchedZoea_Rework.ProcRate = ItemConfig.Bind<float>("Newly Hatched Zoea Rework", "Proc Coefficient", 0.2f, "Missile proc coefficient.").Value; FlatItemBuff.Items.NewlyHatchedZoea_Rework.RestockTime = ItemConfig.Bind<int>("Newly Hatched Zoea Rework", "Restock Time", 30, "How long it takes in seconds to fully restock.").Value; FlatItemBuff.Items.NewlyHatchedZoea_Rework.CanCorrupt = ItemConfig.Bind<bool>("Newly Hatched Zoea Rework", "Allow Corruption", true, "Set to false to disable the item corruption effect.").Value; FlatItemBuff.Items.NewlyHatchedZoea_Rework.CorruptList = ItemConfig.Bind<string>("Newly Hatched Zoea Rework", "Corruption List", "", "List of items that this item will corrupt. (Leave blank for vanilla values.)").Value; FlatItemBuff.Items.NewlyHatchedZoea_Rework.CorruptText = ItemConfig.Bind<string>("Newly Hatched Zoea Rework", "Corruption Text", "<style=cIsTierBoss>yellow items</style>", "The item(s) for the \"Corrupts all X\" text.").Value; } private static void Read_ArtifactSpite() { Spite.Enable = ArtifactConfig.Bind<bool>("Artifact of Spite", "Enable Changes", false, "Enables changes to this Artifact").Value; Spite.BaseDamage = ArtifactConfig.Bind<float>("Artifact of Spite", "Base Damage", 12f, "Base damage of Spite bombs.").Value; Spite.LevelDamage = ArtifactConfig.Bind<float>("Artifact of Spite", "Stack Damage", 2.4f, "Extra damage Spite bombs gain per victim's level.").Value; } } public class GeneralChanges { internal static bool FixExpiredPings; internal static bool TweakBarrierDecay; public GeneralChanges() { MainPlugin.ModLogger.LogInfo((object)"Performing general changes."); Hooks(); } private void Hooks() { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Expected O, but got Unknown if (FixExpiredPings) { MainPlugin.ModLogger.LogInfo((object)"Attempting IL to fix expired pings."); PingerController.AttemptPing += new Manipulator(IL_AttemptPing); } if (TweakBarrierDecay) { MainPlugin.ModLogger.LogInfo((object)"Attempting IL to tweak barrier decay."); CharacterBody.RecalculateStats += new Manipulator(IL_RecalculateStats); } } private void IL_AttemptPing(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(PingInfo), "targetNetworkIdentity") }) && val.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(PingInfo), "targetNetworkIdentity") })) { int index = val.Index; val.Index = index + 1; val.RemoveRange(4); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<PingInfo, PingerController, bool>>((Func<PingInfo, PingerController, bool>)((PingInfo newInfo, PingerController pingerController) => Object.op_Implicit((Object)(object)pingerController.pingIndicator) && (Object)(object)pingerController.currentPing.targetNetworkIdentity == (Object)(object)newInfo.targetNetworkIdentity)); val.Emit(OpCodes.Ldc_I4_1); } else { Debug.LogError((object)"FlatItemBuff: General - Expired Ping Fix - IL Hook failed"); } } private void IL_RecalculateStats(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCall(x, typeof(CharacterBody), "get_maxBarrier") })) { val.Remove(); val.EmitDelegate<Func<CharacterBody, float>>((Func<CharacterBody, float>)((CharacterBody self) => self.maxHealth + self.maxShield)); } else { Debug.LogError((object)"FlatItemBuff: General - Improve Barrier Decay - IL Hook failed"); } } } [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInPlugin("com.kking117.FlatItemBuff", "FlatItemBuff", "1.20.1")] public class MainPlugin : BaseUnityPlugin { public const string MODUID = "com.kking117.FlatItemBuff"; public const string MODNAME = "FlatItemBuff"; public const string MODTOKEN = "KKING117_FLATITEMBUFF_"; public const string MODVERSION = "1.20.1"; internal static ManualLogSource ModLogger; public static PluginInfo pluginInfo; private void Awake() { ModLogger = ((BaseUnityPlugin)this).Logger; pluginInfo = ((BaseUnityPlugin)this).Info; Configs.Setup(); EnableChanges(); SharedHooks.Setup(); ((ResourceAvailability)(ref GameModeCatalog.availability)).CallWhenAvailable((Action)PostLoad); ModLogger.LogInfo((object)"Initializing ContentPack."); new ContentPacks().Initialize(); } private void EnableChanges() { new GeneralChanges(); new BisonSteak_Rework(); new TopazBrooch(); new RollOfPennies_Rework(); new Chronobauble(); new FlatItemBuff.Items.DeathMark_Rework(); new HuntersHarpoon(); new IgnitionTank_Rework(); new Infusion(); new LeechingSeed_Rework(); new LeptonDaisy(); new Stealthkit(); new SquidPolyp(); new WarHorn(); new FlatItemBuff.Items.WaxQuail(); new Aegis(); new BensRaincoat(); new FlatItemBuff.Items.HappiestMask_Rework(); new LaserScope(); new FlatItemBuff.Items.SymbioticScorpion_Rework(); new DefenseNucleus_Rework(); new FlatItemBuff.Items.Planula_Rework(); new FlatItemBuff.Items.TitanicKnurl_Rework(); new LigmaLenses(); new FlatItemBuff.Items.NewlyHatchedZoea_Rework(); new VoidsentFlame(); new Spite(); } private void PostLoad() { DefenseNucleus_Shared.ExtraChanges(); } } public class SharedHooks { public delegate void Handle_GetStatCoefficients(CharacterBody sender, StatHookEventArgs args, Inventory inventory); public delegate void Handle_GlobalKillEvent(DamageReport damageReport); public delegate void Handle_GlobalDamageEvent(DamageReport damageReport); public delegate void Handle_GlobalHitEvent(CharacterBody victim, CharacterBody attacker, DamageInfo damageInfo); public delegate void Handle_CharacterMaster_OnBodyDeath(CharacterMaster master, CharacterBody body); public delegate void Handle_GlobalInventoryChangedEvent(CharacterBody self); public static Handle_GetStatCoefficients Handle_GetStatCoefficients_Actions; public static Handle_GlobalKillEvent Handle_GlobalKillEvent_Actions; public static Handle_GlobalDamageEvent Handle_GlobalDamageEvent_Actions; public static Handle_GlobalHitEvent Handle_GlobalHitEvent_Actions; public static Handle_CharacterMaster_OnBodyDeath Handle_CharacterMaster_OnBodyDeath_Actions; public static Handle_GlobalInventoryChangedEvent Handle_GlobalInventoryChangedEvent_Actions; public static void Setup() { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected O, but got Unknown //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Expected O, but got Unknown if (Handle_GetStatCoefficients_Actions != null) { RecalculateStatsAPI.GetStatCoefficients += new StatHookEventHandler(GetStatCoefficients); } if (Handle_GlobalKillEvent_Actions != null) { GlobalEventManager.onCharacterDeathGlobal += GlobalEventManager_onCharacterDeathGlobal; } if (Handle_GlobalDamageEvent_Actions != null) { GlobalEventManager.onServerDamageDealt += GlobalEventManager_DamageDealt; } if (Handle_GlobalHitEvent_Actions != null) { GlobalEventManager.OnHitEnemy += new hook_OnHitEnemy(GlobalEventManager_HitEnemy); } if (Handle_GlobalInventoryChangedEvent_Actions != null) { CharacterBody.onBodyInventoryChangedGlobal += GlobalEventManager_OnInventoryChanged; } if (Handle_CharacterMaster_OnBodyDeath_Actions != null) { CharacterMaster.OnBodyDeath += new hook_OnBodyDeath(CharacterMaster_OnBodyDeath); } } internal static void GetStatCoefficients(CharacterBody sender, StatHookEventArgs args) { if (Object.op_Implicit((Object)(object)sender.inventory)) { Handle_GetStatCoefficients_Actions(sender, args, sender.inventory); } } internal static void GlobalEventManager_onCharacterDeathGlobal(DamageReport damageReport) { if (NetworkServer.active && Object.op_Implicit((Object)(object)damageReport.attacker) && Object.op_Implicit((Object)(object)damageReport.attackerBody)) { Handle_GlobalKillEvent_Actions(damageReport); } } internal static void GlobalEventManager_DamageDealt(DamageReport damageReport) { if (NetworkServer.active && Object.op_Implicit((Object)(object)damageReport.attacker) && Object.op_Implicit((Object)(object)damageReport.attackerBody)) { Handle_GlobalDamageEvent_Actions(damageReport); } } internal static void GlobalEventManager_HitEnemy(orig_OnHitEnemy orig, GlobalEventManager self, DamageInfo damageInfo, GameObject victim) { orig.Invoke(self, damageInfo, victim); if (NetworkServer.active && Object.op_Implicit((Object)(object)victim) && Object.op_Implicit((Object)(object)damageInfo.attacker)) { CharacterBody component = damageInfo.attacker.GetComponent<CharacterBody>(); CharacterBody component2 = victim.GetComponent<CharacterBody>(); if (Object.op_Implicit((Object)(object)component) && Object.op_Implicit((Object)(object)component2)) { Handle_GlobalHitEvent_Actions(component2, component, damageInfo); } } } internal static void CharacterMaster_OnBodyDeath(orig_OnBodyDeath orig, CharacterMaster self, CharacterBody body) { orig.Invoke(self, body); if (NetworkServer.active) { Handle_CharacterMaster_OnBodyDeath_Actions(self, body); } } internal static void GlobalEventManager_OnInventoryChanged(CharacterBody self) { if (NetworkServer.active) { Handle_GlobalInventoryChangedEvent_Actions(self); } } } } namespace FlatItemBuff.Utils { internal class Helpers { public static bool InflictorHasModdedDamageType(GameObject inflictor, ModdedDamageType moddedDamageType) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)inflictor)) { ModdedDamageTypeHolderComponent component = inflictor.GetComponent<ModdedDamageTypeHolderComponent>(); if (Object.op_Implicit((Object)(object)component)) { return component.Has(moddedDamageType); } } return false; } public static void AddOrExtendBuff(CharacterBody body, BuffDef buffDef, float duration) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: 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) BuffIndex buffIndex = buffDef.buffIndex; for (int i = 0; i < body.timedBuffs.Count; i++) { if (body.timedBuffs[i].buffIndex == buffIndex) { duration += body.timedBuffs[i].timer; break; } } body.ClearTimedBuffs(buffIndex); body.AddTimedBuff(buffDef, duration); } public static void Add_ExtendBuffDuration(CharacterBody body, BuffDef buffDef, float addDuration) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) BuffIndex buffIndex = buffDef.buffIndex; List<float> list = new List<float>(); for (int i = 0; i < body.timedBuffs.Count; i++) { if (body.timedBuffs[i].buffIndex == buffIndex) { list.Add(body.timedBuffs[i].timer + addDuration); } } body.ClearTimedBuffs(buffIndex); for (int j = 0; j < list.Count; j++) { body.AddTimedBuff(buffDef, list[j]); } } public static float GetBuffDuration(CharacterBody body, BuffDef buffDef) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) List<TimedBuff> timedBuffs = body.timedBuffs; for (int i = 0; i < timedBuffs.Count; i++) { if (timedBuffs[i].buffIndex == buffDef.buffIndex) { return timedBuffs[i].timer; } } return 0f; } public static float HyperbolicResult(int itemCount, float baseBonus, float stackBonus, int hardCap) { float num = baseBonus + stackBonus * (float)(itemCount - 1); return (float)hardCap - (float)hardCap / (1f + num); } public static CharacterMaster GetOwner(MinionOwnership minionowner) { CharacterMaster ownerMaster = minionowner.ownerMaster; if (Object.op_Implicit((Object)(object)minionowner.ownerMaster)) { minionowner = ownerMaster.minionOwnership; if (Object.op_Implicit((Object)(object)minionowner.ownerMaster)) { ownerMaster = minionowner.ownerMaster; } } return ownerMaster; } public static CharacterMaster GetTrueOwner(MinionOwnership minionowner) { CharacterMaster ownerMaster = minionowner.ownerMaster; if (Object.op_Implicit((Object)(object)ownerMaster)) { do { minionowner = ownerMaster.minionOwnership; if (Object.op_Implicit((Object)(object)minionowner.ownerMaster)) { ownerMaster = minionowner.ownerMaster; } } while (Object.op_Implicit((Object)(object)minionowner.ownerMaster)); } return ownerMaster; } public static CharacterMaster GetOwnerAsDeployable(CharacterMaster self, DeployableSlot slot) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 //IL_004b: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) Deployable component = ((Component)self).GetComponent<Deployable>(); if (Object.op_Implicit((Object)(object)component)) { CharacterMaster ownerMaster = component.ownerMaster; if (Object.op_Implicit((Object)(object)ownerMaster) && ownerMaster.deployablesList != null) { for (int i = 0; i < ownerMaster.deployablesList.Count; i++) { if (((int)slot == 22 || ownerMaster.deployablesList[i].slot == slot) && (Object)(object)ownerMaster.deployablesList[i].deployable == (Object)(object)component) { return ownerMaster; } } } } return null; } public static bool IsDeployableSlot(CharacterMaster self, DeployableSlot slot) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Invalid comparison between Unknown and I4 //IL_004b: 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_0055: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) Deployable component = ((Component)self).GetComponent<Deployable>(); if (Object.op_Implicit((Object)(object)component)) { CharacterMaster ownerMaster = component.ownerMaster; if (Object.op_Implicit((Object)(object)ownerMaster) && ownerMaster.deployablesList != null) { for (int i = 0; i < ownerMaster.deployablesList.Count; i++) { if (((int)slot == 22 || ownerMaster.deployablesList[i].slot == slot) && (Object)(object)ownerMaster.deployablesList[i].deployable == (Object)(object)component) { return true; } } } } return false; } public static void KillCloseDeployables(CharacterMaster exception, TeamIndex team, DeployableSlot slot, Vector3 origin, float killRange) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) List<Deployable> list = new List<Deployable>(GetDeployableListFromTeam(team, slot)); for (int i = 0; i < list.Count; i++) { CharacterMaster component = ((Component)list[i]).GetComponent<CharacterMaster>(); if (!Object.op_Implicit((Object)(object)component) || !((Object)(object)component != (Object)(object)exception)) { continue; } CharacterBody body = component.GetBody(); if (!Object.op_Implicit((Object)(object)body)) { continue; } HealthComponent healthComponent = body.healthComponent; if (Object.op_Implicit((Object)(object)healthComponent) && healthComponent.alive && Vector3.Distance(body.transform.position, origin) <= killRange) { CharacterMaster ownerMaster = list[i].ownerMaster; if (Object.op_Implicit((Object)(object)ownerMaster)) { ownerMaster.RemoveDeployable(list[i]); } component.TrueKill(); } } } internal static void RemoveBuffStacks(CharacterBody body, BuffDef buffDef, int amount) { amount = ((amount >= 1) ? Math.Min(amount, body.GetBuffCount(buffDef)) : body.GetBuffCount(buffDef)); if (amount > 0) { for (int i = 0; i < amount; i++) { body.RemoveBuff(buffDef); } } } private static List<Deployable> GetDeployableListFromTeam(TeamIndex team, DeployableSlot slot) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) List<Deployable> list = new List<Deployable>(); ReadOnlyCollection<TeamComponent> teamMembers = TeamComponent.GetTeamMembers(team); for (int i = 0; i < teamMembers.Count; i++) { CharacterBody body = teamMembers[i].body; if (!Object.op_Implicit((Object)(object)body)) { continue; } CharacterMaster master = body.master; if (!Object.op_Implicit((Object)(object)master) || master.deployablesList == null) { continue; } for (int j = 0; j < master.deployablesList.Count; j++) { if (Object.op_Implicit((Object)(object)master.deployablesList[j].deployable) && master.deployablesList[j].slot == slot) { list.Add(master.deployablesList[j].deployable); } } } return list; } public static void KillDeployables(CharacterMaster owner, DeployableSlot slot, int killAmount) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) if (killAmount <= 0 || !Object.op_Implicit((Object)(object)owner) || owner.GetDeployableCount(slot) <= 0) { return; } for (int i = 0; i < CharacterMaster.readOnlyInstancesList.Count; i++) { if (killAmount <= 0) { break; } CharacterMaster val = CharacterMaster.readOnlyInstancesList[i]; if (!Object.op_Implicit((Object)(object)val)) { continue; } Deployable component = ((Component)val).GetComponent<Deployable>(); if (!Object.op_Implicit((Object)(object)component) || !((Object)(object)component.ownerMaster == (Object)(object)owner) || owner.deployablesList == null) { continue; } for (int j = 0; j < owner.deployablesList.Count; j++) { if ((Object)(object)owner.deployablesList[j].deployable == (Object)(object)component && owner.deployablesList[j].slot == slot) { owner.RemoveDeployable(component); val.TrueKill(); killAmount--; break; } } } } } } namespace FlatItemBuff.States { public class SquidFire : BaseState { public static GameObject hitEffectPrefab = FireSpine.hitEffectPrefab; public static GameObject muzzleflashEffectPrefab = FireSpine.muzzleflashEffectPrefab; public static float damageCoefficient = 5f; public static float procCoefficient = 0.1f; public static float baseDuration = 0.75f; private const float maxVisionDistance = float.PositiveInfinity; public bool fullVision = true; private bool hasFiredArrow; private BullseyeSearch enemyFinder; private float duration; public override void OnEnter() { //IL_001b: Unknown result type (might be due to invalid IL or missing references) ((BaseState)this).OnEnter(); duration = baseDuration / base.attackSpeedStat; ((BaseState)this).GetAimRay(); ((EntityState)this).PlayAnimation("Gesture", "FireGoo"); if (((EntityState)this).isAuthority) { FireOrbArrow(); } } private void FireOrbArrow() { //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: 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_0070: 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_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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_0146: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Expected O, but got Unknown //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) if (hasFiredArrow || !NetworkServer.active) { return; } Ray aimRay = ((BaseState)this).GetAimRay(); enemyFinder = new BullseyeSearch(); enemyFinder.viewer = ((EntityState)this).characterBody; enemyFinder.maxDistanceFilter = float.PositiveInfinity; enemyFinder.searchOrigin = ((Ray)(ref aimRay)).origin; enemyFinder.searchDirection = ((Ray)(ref aimRay)).direction; enemyFinder.sortMode = (SortMode)1; enemyFinder.teamMaskFilter = TeamMask.allButNeutral; enemyFinder.minDistanceFilter = 0f; enemyFinder.maxAngleFilter = (fullVision ? 180f : 90f); enemyFinder.filterByLoS = true; if (Object.op_Implicit((Object)(object)((EntityState)this).teamComponent)) { ((TeamMask)(ref enemyFinder.teamMaskFilter)).RemoveTeam(((EntityState)this).teamComponent.teamIndex); } enemyFinder.RefreshCandidates(); HurtBox val = enemyFinder.GetResults().FirstOrDefault(); if (Object.op_Implicit((Object)(object)val)) { Vector3 position = ((Component)val).transform.position; Ray aimRay2 = ((BaseState)this).GetAimRay(); Vector3 val2 = position - ((Ray)(ref aimRay2)).origin; aimRay2 = ((BaseState)this).GetAimRay(); ((Ray)(ref aimRay)).origin = ((Ray)(ref aimRay2)).origin; ((Ray)(ref aimRay)).direction = val2; ((EntityState)this).inputBank.aimDirection = val2; ((BaseState)this).StartAimMode(aimRay, 2f, false); hasFiredArrow = true; SquidOrb val3 = new SquidOrb(); ((GenericDamageOrb)val3).damageValue = ((EntityState)this).characterBody.damage * damageCoefficient; ((GenericDamageOrb)val3).isCrit = Util.CheckRoll(((EntityState)this).characterBody.crit, ((EntityState)this).characterBody.master); ((GenericDamageOrb)val3).teamIndex = TeamComponent.GetObjectTeam(((EntityState)this).gameObject); ((GenericDamageOrb)val3).attacker = ((EntityState)this).gameObject; ((GenericDamageOrb)val3).procCoefficient = procCoefficient; ((GenericDamageOrb)val3).damageType = (DamageType)512; HurtBox val4 = val; if (Object.op_Implicit((Object)(object)val4)) { Transform val5 = ((Component)((EntityState)this).characterBody.modelLocator.modelTransform).GetComponent<ChildLocator>().FindChild("Muzzle"); EffectManager.SimpleMuzzleFlash(muzzleflashEffectPrefab, ((EntityState)this).gameObject, "Muzzle", true); ((Orb)val3).origin = val5.position; ((Orb)val3).target = val4; OrbManager.instance.AddOrb((Orb)(object)val3); } } } public override void OnExit() { ((EntityState)this).OnExit(); } public override void FixedUpdate() { ((EntityState)this).FixedUpdate(); if (((EntityState)this).fixedAge >= duration && ((EntityState)this).isAuthority) { ((EntityState)this).outer.SetNextStateToMain(); } } public override InterruptPriority GetMinimumInterruptPriority() { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) return (InterruptPriority)1; } } } namespace FlatItemBuff.Properties { [GeneratedCode("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")] [DebuggerNonUserCode] [CompilerGenerated] internal class Resources { private static ResourceManager resourceMan; private static CultureInfo resourceCulture; [EditorBrowsable(EditorBrowsableState.Advanced)] internal static ResourceManager ResourceManager { get { if (resourceMan == null) { ResourceManager resourceManager = new ResourceManager("FlatItemBuff.Properties.Resources", typeof(Resources).Assembly); resourceMan = resourceManager; } return resourceMan; } } [EditorBrowsable(EditorBrowsableState.Advanced)] internal static CultureInfo Culture { get { return resourceCulture; } set { resourceCulture = value; } } internal static byte[] texInfusionTracker { get { object @object = ResourceManager.GetObject("texInfusionTracker", resourceCulture); return (byte[])@object; } } internal Resources() { } } } namespace FlatItemBuff.Orbs { public class ScorpionOrb : GenericDamageOrb { public override void Begin() { base.speed = 30f; ((GenericDamageOrb)this).Begin(); } public override GameObject GetOrbEffect() { return FlatItemBuff.Items.SymbioticScorpion_Rework.OrbVFX; } public override void OnArrival() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)((Orb)this).target)) { HealthComponent healthComponent = ((Orb)this).target.healthComponent; if (Object.op_Implicit((Object)(object)healthComponent)) { DamageInfo val = new DamageInfo(); val.damage = base.damageValue; val.attacker = base.attacker; val.inflictor = null; val.force = Vector3.zero; val.crit = base.isCrit; val.procChainMask = base.procChainMask; val.procCoefficient = base.procCoefficient; val.position = ((Component)((Orb)this).target).transform.position; val.damageColorIndex = base.damageColorIndex; val.damageType = base.damageType; DamageAPI.AddModdedDamageType(val, FlatItemBuff.Items.SymbioticScorpion_Rework.ScorpionVenomOnHit); healthComponent.TakeDamage(val); GlobalEventManager.instance.OnHitEnemy(val, ((Component)healthComponent).gameObject); GlobalEventManager.instance.OnHitAll(val, ((Component)healthComponent).gameObject); } } } } } namespace FlatItemBuff.Modules { public static class Buffs { internal static List<BuffDef> buffDefs = new List<BuffDef>(); internal static BuffDef AddNewBuff(string buffName, Sprite buffIcon, Color buffColor, bool canStack, bool isDebuff, bool isCooldown) { //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) BuffDef val = ScriptableObject.CreateInstance<BuffDef>(); ((Object)val).name = buffName + " (FlatItemBuff)"; val.buffColor = buffColor; val.canStack = canStack; val.isDebuff = isDebuff; val.eliteDef = null; val.iconSprite = buffIcon; val.isCooldown = isCooldown; ((Object)val).name = ((Object)val).name; buffDefs.Add(val); return val; } } internal class ContentPacks : IContentPackProvider { internal ContentPack contentPack = new ContentPack(); public string identifier => "com.kking117.FlatItemBuff"; public void Initialize() { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ContentManager.collectContentPackProviders += new CollectContentPackProvidersDelegate(ContentManager_collectContentPackProviders); } private void ContentManager_collectContentPackProviders(AddContentPackProviderDelegate addContentPackProvider) { addContentPackProvider.Invoke((IContentPackProvider)(object)this); } public IEnumerator LoadStaticContentAsync(LoadStaticContentAsyncArgs args) { contentPack.identifier = identifier; contentPack.itemDefs.Add(Items.itemDefs.ToArray()); contentPack.buffDefs.Add(Buffs.buffDefs.ToArray()); contentPack.entityStateTypes.Add(States.entityStates.ToArray()); contentPack.projectilePrefabs.Add(Projectiles.Prefabs.ToArray()); args.ReportProgress(1f); yield break; } public IEnumerator GenerateContentPackAsync(GetContentPackAsyncArgs args) { ContentPack.Copy(contentPack, args.output); args.ReportProgress(1f); yield break; } public IEnumerator FinalizeAsync(FinalizeAsyncArgs args) { args.ReportProgress(1f); yield break; } } public static class Items { internal static List<ItemDef> itemDefs = new List<ItemDef>(); internal static void AddNewItem(ItemDef itemDef) { ((Object)itemDef).name = ((Object)itemDef).name; itemDefs.Add(itemDef); } } internal static class Projectiles { internal static List<GameObject> Prefabs = new List<GameObject>(); internal static void AddProjectile(GameObject proj) { Prefabs.Add(proj); } } public static class States { internal static List<Type> entityStates = new List<Type>(); public static void RegisterState(Type state) { entityStates.Add(state); } } } namespace FlatItemBuff.Items { public class BisonSteak { internal static bool Enable = true; internal static float BaseHP = 10f; internal static float LevelHP = 3f; public BisonSteak() { if (Enable) { MainPlugin.ModLogger.LogInfo((object)"Changing Bison Steak"); ClampConfig(); UpdateText(); Hooks(); } } private void ClampConfig() { BaseHP = Math.Max(0f, BaseHP); LevelHP = Math.Max(0f, LevelHP); } private void UpdateText() { MainPlugin.ModLogger.LogInfo((object)"Updating item text"); string text = ""; string text2 = ""; text += "Gain max health."; text2 = ((!(LevelHP > 0f)) ? (text2 + string.Format("Increases <style=cIsHealing>maximum health</style> by <style=cIsHealing>{0}</style> <style=cStack>(+{0} per stack)</style>.", BaseHP)) : (text2 + string.Format("Increases <style=cIsHealing>base health</style> by <style=cIsHealing>{0}</style> <style=cStack>(+{0} per stack)</style>.", BaseHP))); LanguageAPI.Add("ITEM_FLATHEALTH_PICKUP", text); LanguageAPI.Add("ITEM_FLATHEALTH_DESC", text2); } private void Hooks() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown MainPlugin.ModLogger.LogInfo((object)"Applying IL modifications"); CharacterBody.RecalculateStats += new Manipulator(IL_RecalculateStats); } private void IL_RecalculateStats(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0096: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 62), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 36), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x) })) { val.Index += 3; val.Remove(); val.Emit(OpCodes.Ldarg_0); val.EmitDelegate<Func<CharacterBody, float>>((Func<CharacterBody, float>)delegate(CharacterBody body) { float num = BaseHP; if (LevelHP > 0f) { num += (body.level - 1f) * LevelHP; } return num; }); } else { Debug.LogError((object)"FlatItemBuff: Bison Steak - Health Stat - IL Hook failed"); } } } public class BisonSteak_Rework { public static BuffDef FreshRegenBuff; internal static bool Enable = true; internal static bool NerfFakeKill = false; internal static float ExtendDuration = 1f; internal static float BaseRegen = 1f; internal static float StackRegen = 0f; internal static float BaseDuration = 3f; internal static float StackDuration = 3f; public BisonSteak_Rework() { if (!Enable) { new BisonSteak(); return; } MainPlugin.ModLogger.LogInfo((object)"Changing Bison Steak"); ClampConfig(); CreateBuffs(); UpdateItemDef(); UpdateText(); Hooks(); } private void ClampConfig() { BaseRegen = Math.Max(0f, BaseRegen); StackRegen = Math.Max(0f, StackRegen); BaseDuration = Math.Max(0f, BaseDuration); StackDuration = Math.Max(0f, StackDuration); ExtendDuration = Math.Max(0f, ExtendDuration); } private void CreateBuffs() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) BuffDef val = Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Junk/Common/bdMeatRegenBoost.asset").WaitForCompletion(); FreshRegenBuff = Buffs.AddNewBuff("MeatRegen", val.iconSprite, val.buffColor, canStack: true, isDebuff: false, isCooldown: false); } private void UpdateItemDef() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) ItemDef val = Addressables.LoadAssetAsync<ItemDef>((object)"RoR2/Base/FlatHealth/FlatHealth.asset").WaitForCompletion(); if (Object.op_Implicit((Object)(object)val)) { List<ItemTag> list = val.tags.ToList(); list.Add((ItemTag)4); list.Add((ItemTag)6); val.tags = list.ToArray(); } } private void UpdateText() { MainPlugin.ModLogger.LogInfo((object)"Updating item text"); string text = ""; string text2 = ""; text += "Regenerate health after killing an enemy."; text2 = ((!(StackRegen > 0f)) ? (text2 + $"Increases <style=cIsHealing>base health regeneration</style> by <style=cIsHealing>+{BaseRegen} hp/s</style>") : (text2 + $"Increases <style=cIsHealing>base health regeneration</style> by <style=cIsHealing>+{BaseRegen} hp/s <style=cStack>(+{StackRegen} hp/s per stack)</style></style>")); text2 = ((!(StackDuration > 0f)) ? (text2 + $" for <style=cIsUtility>{BaseDuration}s</style> after killing an enemy.") : (text2 + $" for <style=cIsUtility>{BaseDuration}s <style=cStack>(+{StackDuration}s per stack)</style></style> after killing an enemy.")); if (ExtendDuration > 0f) { text2 += $" Consecutive kills extend the duration by <style=cIsUtility>{ExtendDuration}s</style>."; } LanguageAPI.Add("ITEM_FLATHEALTH_PICKUP", text); LanguageAPI.Add("ITEM_FLATHEALTH_DESC", text2); } private void Hooks() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown MainPlugin.ModLogger.LogInfo((object)"Applying IL modifications"); CharacterBody.RecalculateStats += new Manipulator(IL_RecalculateStats); if (BaseDuration > 0f || StackDuration > 0f) { SharedHooks.Handle_GlobalKillEvent_Actions = (SharedHooks.Handle_GlobalKillEvent)Delegate.Combine(SharedHooks.Handle_GlobalKillEvent_Actions, new SharedHooks.Handle_GlobalKillEvent(GlobalKillEvent)); } if (BaseRegen > 0f || StackRegen > 0f) { SharedHooks.Handle_GetStatCoefficients_Actions = (SharedHooks.Handle_GetStatCoefficients)Delegate.Combine(SharedHooks.Handle_GetStatCoefficients_Actions, new SharedHooks.Handle_GetStatCoefficients(GetStatCoefficients)); } } private void GetStatCoefficients(CharacterBody sender, StatHookEventArgs args, Inventory inventory) { int buffCount = sender.GetBuffCount(FreshRegenBuff); if (buffCount > 0) { int num = 0; if (Object.op_Implicit((Object)(object)sender.inventory)) { num = Math.Max(0, sender.inventory.GetItemCount(Items.FlatHealth) - 1); } float num2 = BaseRegen + (float)num * StackRegen; float num3 = 1f + (sender.level - 1f) * 0.2f; args.baseRegenAdd += num2 * num3 * (float)buffCount; } } private void GlobalKillEvent(DamageReport damageReport) { CharacterBody attackerBody = damageReport.attackerBody; if (!Object.op_Implicit((Object)(object)attackerBody.inventory)) { return; } int itemCount = attackerBody.inventory.GetItemCount(Items.FlatHealth); if (itemCount <= 0) { return; } if (NerfFakeKill) { if (Object.op_Implicit((Object)(object)damageReport.victimMaster) && Object.op_Implicit((Object)(object)damageReport.victimBody)) { Helpers.Add_ExtendBuffDuration(attackerBody, FreshRegenBuff, ExtendDuration); } } else { Helpers.Add_ExtendBuffDuration(attackerBody, FreshRegenBuff, ExtendDuration); } float num = BaseDuration + (float)Math.Max(0, itemCount - 1) * StackDuration; if (num > 0f) { attackerBody.AddTimedBuff(FreshRegenBuff, num); } } private void IL_RecalculateStats(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "FlatHealth"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCount") })) { val.Index += 2; val.Emit(OpCodes.Ldc_I4_0); val.Emit(OpCodes.Mul); } else { Debug.LogError((object)"FlatItemBuff: Bison Steak Rework - Effect Override - IL Hook failed"); } } } public class RollOfPennies_Rework { public static BuffDef PennyArmorBuff; private static Color BuffColor = new Color(1f, 0.788f, 0.055f, 1f); internal static bool Enable = true; internal static float BaseGold = 3f; internal static float StackGold = 0f; internal static float BaseArmor = 5f; internal static float StackArmor = 1f; internal static float BaseDuration = 2f; internal static float StackDuration = 1f; internal static float GoldDuration = 0.5f; public RollOfPennies_Rework() { if (Enable) { MainPlugin.ModLogger.LogInfo((object)"Changing Roll of Pennies"); ClampConfig(); if (BaseArmor > 0f || StackArmor > 0f) { CreateBuff(); } UpdateText(); Hooks(); } } private void ClampConfig() { BaseGold = Math.Max(0f, BaseGold); StackGold = Math.Max(0f, StackGold); BaseArmor = Math.Max(0f, BaseArmor); StackArmor = Math.Max(0f, StackArmor); BaseDuration = Math.Max(0f, BaseDuration); StackDuration = Math.Max(0f, StackDuration); GoldDuration = Math.Max(0f, GoldDuration); } private void CreateBuff() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: 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) PennyArmorBuff = Buffs.AddNewBuff("Penny Armor", Addressables.LoadAssetAsync<BuffDef>((object)"RoR2/Base/Grandparent/bdOverheat.asset").WaitForCompletion().iconSprite, BuffColor, canStack: true, isDebuff: false, isCooldown: false); } private void UpdateText() { MainPlugin.ModLogger.LogInfo((object)"Updating item text"); string text = ""; string text2 = ""; string text3 = ""; string text4 = ""; string text5 = ""; string text6 = ""; if (BaseGold > 0f || StackGold > 0f) { text5 = ((!(StackGold > 0f)) ? $"Gain <style=cIsUtility>{BaseGold} gold</style> when <style=cIsDamage>hit</style>, <style=cIsUtility>scaling with time</style>." : string.Format("Gain <style=cIsUtility>{0} <style=cStack>(+{0} per stack)</style> gold</style> when <style=cIsDamage>hit</style>, <style=cIsUtility>scaling with time</style>.", BaseGold, StackGold)); text3 = "Gain gold when hit."; if (BaseArmor > 0f || StackArmor > 0f) { text5 += " "; text3 += " "; } } if (BaseArmor > 0f || StackArmor > 0f) { string arg = ((!(StackArmor > 0f)) ? $" gain <style=cIsHealing>{BaseArmor} armor</style>" : $" gain <style=cIsHealing>{BaseArmor} <style=cStack>(+{StackArmor} per stack)</style> armor</style>"); string arg2 = " with duration based on the <style=cIsUtility>gold's value</style>"; if (BaseDuration > 0f || StackDuration > 0f) { arg2 = ((!(StackDuration > 0f)) ? $" for <style=cIsUtility>{BaseDuration}s</style> plus the <style=cIsUtility>gold's value</style>" : $" for <style=cIsUtility>{BaseDuration}s <style=cStack>(+{StackDuration}s per stack)</style></style> plus the <style=cIsUtility>gold's value</style>"); } text6 += $"When <style=cIsUtility>collecting gold</style>{arg}{arg2}."; text4 += "Gain temporary armor when collecting gold."; } text = $"{text3}{text4}"; text2 = $"{text5}{text6}"; LanguageAPI.Add("ITEM_GOLDONHURT_PICKUP", text); LanguageAPI.Add("ITEM_GOLDONHURT_DESC", text2); } private void Hooks() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Expected O, but got Unknown MainPlugin.ModLogger.LogInfo((object)"Applying IL modifications"); HealthComponent.TakeDamage += new Manipulator(IL_OnTakeDamage); if (BaseArmor > 0f || StackArmor > 0f) { StatManager.OnGoldCollected += new hook_OnGoldCollected(OnGoldCollected); SharedHooks.Handle_GetStatCoefficients_Actions = (SharedHooks.Handle_GetStatCoefficients)Delegate.Combine(SharedHooks.Handle_GetStatCoefficients_Actions, new SharedHooks.Handle_GetStatCoefficients(GetStatCoefficients)); } if (BaseGold > 0f || StackGold > 0f) { SharedHooks.Handle_GlobalDamageEvent_Actions = (SharedHooks.Handle_GlobalDamageEvent)Delegate.Combine(SharedHooks.Handle_GlobalDamageEvent_Actions, new SharedHooks.Handle_GlobalDamageEvent(GlobalDamageEvent)); } } private void GlobalDamageEvent(DamageReport damageReport) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Expected O, but got Unknown //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) float procCoefficient = damageReport.damageInfo.procCoefficient; CharacterBody victimBody = damageReport.victimBody; CharacterBody victimBody2 = damageReport.victimBody; if (!(procCoefficient > 0f) || !Object.op_Implicit((Object)(object)victimBody2) || !Object.op_Implicit((Object)(object)victimBody)) { return; } Inventory inventory = victimBody.inventory; if (!Object.op_Implicit((Object)(object)inventory)) { return; } int itemCount = inventory.GetItemCount(Items.GoldOnHurt); if (itemCount > 0) { uint num = (uint)GetGoldFromHit(itemCount, procCoefficient); if (num != 0) { GoldOrb val = new GoldOrb(); ((Orb)val).origin = damageReport.damageInfo.position; ((Orb)val).target = victimBody2.mainHurtBox; val.goldAmount = num; OrbManager.instance.AddOrb((Orb)(object)val); EffectManager.SimpleImpactEffect(AssetReferences.gainCoinsImpactEffectPrefab, damageReport.damageInfo.position, Vector3.up, true); } } } private void OnGoldCollected(orig_OnGoldCollected orig, CharacterMaster master, ulong amount) { orig.Invoke(master, amount); if (amount == 0) { return; } int itemCount = master.inventory.GetItemCount(Items.GoldOnHurt); if (itemCount <= 0) { return; } CharacterBody body = master.GetBody(); if (Object.op_Implicit((Object)(object)body) && Object.op_Implicit((Object)(object)body.healthComponent)) { float buffDurationFromGold = GetBuffDurationFromGold(itemCount, (int)amount); if (buffDurationFromGold > 0f) { body.AddTimedBuff(PennyArmorBuff, buffDurationFromGold); } } } private void GetStatCoefficients(CharacterBody sender, StatHookEventArgs args, Inventory inventory) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) int buffCount = sender.GetBuffCount(PennyArmorBuff.buffIndex); if (buffCount > 0) { int num = 0; if (Object.op_Implicit((Object)(object)sender.inventory)) { num = Math.Max(0, sender.inventory.GetItemCount(Items.GoldOnHurt) - 1); } args.armorAdd += (float)buffCount * (BaseArmor + StackArmor * (float)num); } } private void IL_OnTakeDamage(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(ItemCounts), "goldOnHurt") })) { val.Index += 1; val.Emit(OpCodes.Ldc_I4_0); val.Emit(OpCodes.Mul); } else { Debug.LogError((object)"FlatItemBuff: Roll Of Pennies Rework - Effect Override - IL Hook failed"); } } private float GetGoldFromHit(int itemCount, float procRate) { itemCount = Math.Max(0, itemCount); float num = BaseGold + StackGold * (float)itemCount; num *= procRate; num *= Run.instance.difficultyCoefficient; return Math.Max(1f, num); } private float GetBuffDurationFromGold(int itemCount, int gold) { itemCount = Math.Max(0, itemCount - 1); float num = BaseDuration + StackDuration * (float)itemCount; if (GoldDuration > 0f) { float num2 = (float)gold * GoldDuration / Run.instance.difficultyCoefficient; num += (float)Math.Round(num2, 1); } return num; } } public class TopazBrooch { internal static bool Enable = true; internal static float BaseFlatBarrier = 15f; internal static float StackFlatBarrier = 15f; internal static float BaseCentBarrier = 0.005f; internal static float StackCentBarrier = 0.005f; public TopazBrooch() { if (Enable) { MainPlugin.ModLogger.LogInfo((object)"Changing Topaz Brooch"); ClampConfig(); UpdateText(); Hooks(); } } private void ClampConfig() { BaseFlatBarrier = Math.Max(0f, BaseFlatBarrier); StackFlatBarrier = Math.Max(0f, StackFlatBarrier); BaseCentBarrier = Math.Max(0f, BaseCentBarrier); StackCentBarrier = Math.Max(0f, StackCentBarrier); } private void UpdateText() { MainPlugin.ModLogger.LogInfo((object)"Updating item text"); string text = "Gain a <style=cIsHealing>temporary barrier</style> on kill for "; if (BaseFlatBarrier > 0f || StackFlatBarrier > 0f) { string arg = ""; if (StackFlatBarrier > 0f) { arg = $" <style=cStack>(+{StackFlatBarrier} per stack)</style>"; } text += $"<style=cIsHealing>{BaseFlatBarrier}{arg} health</style>"; } if (BaseCentBarrier > 0f || StackCentBarrier > 0f) { if (BaseFlatBarrier > 0f || StackCentBarrier > 0f) { text += " plus an additional "; } string arg2 = ""; if (StackCentBarrier > 0f) { arg2 = $" <style=cStack>(+{StackCentBarrier * 100f}% per stack)</style>"; } text += $"<style=cIsHealing>{BaseCentBarrier * 100f}%{arg2}</style> of <style=cIsHealing>maximum health</style>"; } text += "."; LanguageAPI.Add("ITEM_BARRIERONKILL_DESC", text); } private void Hooks() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown MainPlugin.ModLogger.LogInfo((object)"Applying IL modifications"); GlobalEventManager.OnCharacterDeath += new Manipulator(IL_OnCharacterDeath); } private void IL_OnCharacterDeath(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 15f), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 49), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x), (Instruction x) => ILPatternMatchingExt.MatchMul(x) })) { val.RemoveRange(4); val.Emit(OpCodes.Ldarg_1); val.Emit(OpCodes.Ldloc, 49); val.EmitDelegate<Func<DamageReport, int, float>>((Func<DamageReport, int, float>)delegate(DamageReport dr, int itemCount) { itemCount--; float num = BaseFlatBarrier; float num2 = StackFlatBarrier; if (Object.op_Implicit((Object)(object)dr.attackerBody.healthComponent)) { num += dr.attackerBody.healthComponent.fullCombinedHealth * BaseCentBarrier; num2 += dr.attackerBody.healthComponent.fullCombinedHealth * StackCentBarrier; } num2 *= (float)itemCount; return num + num2; }); } else { Debug.LogError((object)"FlatItemBuff: Topaz Brooch - Effect Override - IL Hook failed"); } } } public class Aegis { internal static bool Enable = false; internal static bool AllowRegen = true; internal static float BaseOverheal = 0.5f; internal static float StackOverheal = 0.5f; internal static float BaseMaxBarrier = 0.25f; internal static float StackMaxBarrier = 0.25f; public Aegis() { if (Enable) { MainPlugin.ModLogger.LogInfo((object)"Changing Aegis"); ClampConfig(); UpdateText(); Hooks(); } } private void ClampConfig() { BaseOverheal = Math.Max(0f, BaseOverheal); StackOverheal = Math.Max(0f, StackOverheal); BaseMaxBarrier = Math.Max(0f, BaseMaxBarrier); StackMaxBarrier = Math.Max(0f, StackMaxBarrier); } private void UpdateText() { MainPlugin.ModLogger.LogInfo((object)"Updating item text"); string text = ""; string text2 = ""; string text3 = ""; string text4 = ""; if (BaseOverheal > 0f || StackOverheal > 0f) { text = "Healing past full grants you a temporary barrier."; text3 = ((!(StackOverheal > 0f)) ? $"Healing past full grants you <style=cIsHealing>barrier</style> equal to <style=cIsHealing>{BaseOverheal * 100f}%</style> of the amount <style=cIsHealing>healed</style>." : $"Healing past full grants you <style=cIsHealing>barrier</style> equal to <style=cIsHealing>{BaseOverheal * 100f}% <style=cStack>(+{StackOverheal * 100f}% per stack)</style></style> of the amount <style=cIsHealing>healed</style>."); } if (BaseMaxBarrier > 0f || StackMaxBarrier > 0f) { if (BaseOverheal > 0f || StackOverheal > 0f) { text2 = " "; text4 = " "; } text2 += "Increases maximum barrier."; text4 = ((!(StackMaxBarrier > 0f)) ? (text4 + $"Increases <style=cIsHealing>maximum barrier</style> by <style=cIsHealing>{BaseMaxBarrier * 100f}%</style>.") : (text4 + $"Increases <style=cIsHealing>maximum barrier</style> by <style=cIsHealing>{BaseMaxBarrier * 100f}% <style=cStack>(+{StackMaxBarrier * 100f}% per stack)</style></style>.")); } string text5 = text + text2; string text6 = text3 + text4; LanguageAPI.Add("ITEM_BARRIERONOVERHEAL_PICKUP", text5); LanguageAPI.Add("ITEM_BARRIERONOVERHEAL_DESC", text6); } private void Hooks() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Expected O, but got Unknown //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown MainPlugin.ModLogger.LogInfo((object)"Applying IL modifications"); HealthComponent.Heal += new Manipulator(IL_Heal); CharacterBody.RecalculateStats += new Manipulator(IL_RecalculateStats); HealthComponent.GetHealthBarValues += new Manipulator(IL_GetHealthBarValues); } private void IL_RecalculateStats(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[7] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCall(x, typeof(CharacterBody), "get_maxHealth"), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchCall(x, typeof(CharacterBody), "get_maxShield"), (Instruction x) => ILPatternMatchingExt.MatchAdd(x), (Instruction x) => ILPatternMatchingExt.MatchCall(x, typeof(CharacterBody), "set_maxBarrier") })) { val.Index += 2; val.RemoveRange(4); val.EmitDelegate<Func<CharacterBody, float>>((Func<CharacterBody, float>)delegate(CharacterBody self) { float num = self.maxHealth + self.maxShield; if (Object.op_Implicit((Object)(object)self.inventory)) { int itemCount = self.inventory.GetItemCount(Items.BarrierOnOverHeal); if (itemCount > 0) { itemCount = Math.Max(0, itemCount - 1); return num * (1f + BaseMaxBarrier + StackMaxBarrier * (float)itemCount); } } return num; }); } else { Debug.LogError((object)"FlatItemBuff: Aegis - Max Barrier - IL Hook failed"); } } private void IL_GetHealthBarValues(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00b9: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, typeof(HealthComponent), "barrier"), (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 1), (Instruction x) => ILPatternMatchingExt.MatchMul(x) })) { val.Index += 1; val.RemoveRange(3); val.Emit(OpCodes.Ldloc, 0); val.EmitDelegate<Func<HealthComponent, float, float>>((Func<HealthComponent, float, float>)delegate(HealthComponent self, float curse) { float num = (1f - curse) / self.fullBarrier; return num * self.barrier; }); } else { Debug.LogError((object)"FlatItemBuff: Aegis - Barrier Health Bar Visual Fix - IL Hook failed"); } } private void IL_Heal(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val = new ILCursor(il); if (AllowRegen) { if (val.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 2), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0f) })) { val.Index += 3; val.RemoveRange(2); } else { Debug.LogError((object)"FlatItemBuff: Aegis - Overheal from regen - IL Hook failed"); } } if (val.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, 2), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 0), (Instruction x) => ILPatternMatchingExt.MatchLdflda(x,