Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of ZetItemTweaks v1.4.0
plugins/ZetItemTweaks/ZetItemTweaks.dll
Decompiled 5 months ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using EntityStates; using EntityStates.CaptainDefenseMatrixItem; using EntityStates.TeleporterHealNovaController; using IL.EntityStates.CaptainDefenseMatrixItem; using IL.EntityStates.TeleporterHealNovaController; using IL.RoR2; using IL.RoR2.Items; using Mono.Cecil; using Mono.Cecil.Cil; using MonoMod.Cil; using MonoMod.RuntimeDetour; using On.EntityStates.TeleporterHealNovaController; using On.RoR2; using On.RoR2.Items; using On.RoR2.Skills; using RoR2; using RoR2.ContentManagement; using RoR2.Items; using RoR2.Orbs; using RoR2.Skills; using RoR2.UI; using TMPro; using UnityEngine; using UnityEngine.AddressableAssets; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("ZetItemTweaks")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("ZetItemTweaks")] [assembly: AssemblyTitle("ZetItemTweaks")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] namespace TPDespair.ZetItemTweaks; public static class Aegis { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<Instruction, bool> <>9__41_1; public static Func<Instruction, bool> <>9__41_2; public static Func<Instruction, bool> <>9__41_3; public static Func<Instruction, bool> <>9__41_4; public static Func<Instruction, bool> <>9__41_5; public static Func<HealthComponent, float> <>9__41_6; public static Manipulator <>9__41_0; internal void <OverhealHook>b__41_0(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); if (val.TryGotoNext(new Func<Instruction, bool>[5] { (Instruction x) => ILPatternMatchingExt.MatchLdflda(x, "RoR2.HealthComponent", "itemCounts"), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "RoR2.HealthComponent/ItemCounts", "barrierOnOverHeal"), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.5f), (Instruction x) => ILPatternMatchingExt.MatchMul(x) })) { val.Index += 5; val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldarg, 0); val.EmitDelegate<Func<HealthComponent, float>>((Func<HealthComponent, float>)delegate(HealthComponent healthComponent) { int barrierOnOverHeal = healthComponent.itemCounts.barrierOnOverHeal; return BaseOverheal.Value + StackOverheal.Value * (float)(barrierOnOverHeal - 1); }); } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: OverhealHook Failed!"); } } internal bool <OverhealHook>b__41_1(Instruction x) { return ILPatternMatchingExt.MatchLdflda(x, "RoR2.HealthComponent", "itemCounts"); } internal bool <OverhealHook>b__41_2(Instruction x) { return ILPatternMatchingExt.MatchLdfld(x, "RoR2.HealthComponent/ItemCounts", "barrierOnOverHeal"); } internal bool <OverhealHook>b__41_3(Instruction x) { return ILPatternMatchingExt.MatchConvR4(x); } internal bool <OverhealHook>b__41_4(Instruction x) { return ILPatternMatchingExt.MatchLdcR4(x, 0.5f); } internal bool <OverhealHook>b__41_5(Instruction x) { return ILPatternMatchingExt.MatchMul(x); } internal float <OverhealHook>b__41_6(HealthComponent healthComponent) { int barrierOnOverHeal = healthComponent.itemCounts.barrierOnOverHeal; return BaseOverheal.Value + StackOverheal.Value * (float)(barrierOnOverHeal - 1); } } internal static BuffDef BarrierBuff; public static List<string> autoCompatList = new List<string> { "com.kking117.FlatItemBuff", "com.Ben.BenBalanceMod" }; public static string itemIdentifier = "Aegis"; public static bool appliedChanges = false; public static ConfigEntry<int> EnableChanges { get; set; } public static ConfigEntry<bool> OverrideText { get; set; } public static ConfigEntry<float> BaseOverheal { get; set; } public static ConfigEntry<float> StackOverheal { get; set; } public static ConfigEntry<float> BaseArmor { get; set; } public static ConfigEntry<float> StackArmor { get; set; } public static ConfigEntry<float> BaseBarrierArmor { get; set; } public static ConfigEntry<float> StackBarrierArmor { get; set; } internal static void Init() { SetupConfig(); if (EnableChanges.Value > 0) { ZetItemTweaksPlugin.OnLateSetup = (Action)Delegate.Combine(ZetItemTweaksPlugin.OnLateSetup, new Action(LateSetup)); } } private static void SetupConfig() { EnableChanges = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "EnableChanges", 1, ZetItemTweaksPlugin.SectionEnableDesc); if (ZetItemTweaksPlugin.GenerateOverrideText.Value) { OverrideText = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "OverrideText", defaultValue: true, "Replace item description text."); } BaseOverheal = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseOverheal", 0.5f, "Overheal barrier gained from item."); StackOverheal = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackOverheal", 0.5f, "Overheal barrier gained from item per stack."); BaseArmor = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseArmor", 30f, "Armor gained from item."); StackArmor = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackArmor", 15f, "Armor gained from item per stack."); BaseBarrierArmor = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseBarrierArmor", 0f, "Armor gained while barrier is active from item."); StackBarrierArmor = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackBarrierArmor", 0f, "Armor gained while barrier is active from item per stack."); } private static void LateSetup() { if (ZetItemTweaksPlugin.ProceedChanges(itemIdentifier, EnableChanges.Value, autoCompatList)) { CharacterBody.onBodyInventoryChangedGlobal += HandleItemBehavior; OverhealHook(); if (!ZetItemTweaksPlugin.GenerateOverrideText.Value || OverrideText.Value) { ZetItemTweaksPlugin.targetLanguage = "default"; ZetItemTweaksPlugin.RegisterFragment("OVERHEAL_BARRIER", "Excess healing generates <style=cIsHealing>barrier</style> for {0} of the amount you <style=cIsHealing>healed</style>."); ZetItemTweaksPlugin.RegisterFragment("BARRIER_ARMOR", "\nIncreases <style=cIsHealing>armor</style> by {0} while <style=cIsHealing>barrier</style> is active."); ZetItemTweaksPlugin.RegisterToken("ITEM_BARRIERONOVERHEAL_DESC", DescriptionText()); ZetItemTweaksPlugin.targetLanguage = "pt-BR"; ZetItemTweaksPlugin.RegisterFragment("OVERHEAL_BARRIER", "O excesso de cura gera uma <style=cIsHealing>barreira</style> em {0} do valor que você <style=cIsHealing>curou</style>."); ZetItemTweaksPlugin.RegisterFragment("BARRIER_ARMOR", "\nAumenta a <style=cIsHealing>armadura</style> em {0} enquanto a <style=cIsHealing>barreira</style> estiver ativa."); ZetItemTweaksPlugin.RegisterToken("ITEM_BARRIERONOVERHEAL_DESC", DescriptionText()); ZetItemTweaksPlugin.targetLanguage = ""; } appliedChanges = true; } } private static string DescriptionText() { string text = string.Format(ZetItemTweaksPlugin.TextFragment("OVERHEAL_BARRIER"), ZetItemTweaksPlugin.ScalingText(BaseOverheal.Value, StackOverheal.Value, "percent", "cIsHealing")); if (BaseArmor.Value > 0f) { text += string.Format(ZetItemTweaksPlugin.TextFragment("STAT_ARMOR"), ZetItemTweaksPlugin.ScalingText(BaseArmor.Value, StackArmor.Value, "flat", "cIsHealing")); } if (BaseBarrierArmor.Value > 0f) { text += string.Format(ZetItemTweaksPlugin.TextFragment("BARRIER_ARMOR"), ZetItemTweaksPlugin.ScalingText(BaseBarrierArmor.Value, StackBarrierArmor.Value, "flat", "cIsHealing")); } return text; } private static void HandleItemBehavior(CharacterBody body) { if (NetworkServer.active) { body.AddItemBehavior<BarrierArmorBehavior>(body.inventory.GetItemCountEffective(Items.BarrierOnOverHeal)); } } private static void OverhealHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__41_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); if (val2.TryGotoNext(new Func<Instruction, bool>[5] { (Instruction x) => ILPatternMatchingExt.MatchLdflda(x, "RoR2.HealthComponent", "itemCounts"), (Instruction x) => ILPatternMatchingExt.MatchLdfld(x, "RoR2.HealthComponent/ItemCounts", "barrierOnOverHeal"), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 0.5f), (Instruction x) => ILPatternMatchingExt.MatchMul(x) })) { val2.Index += 5; val2.Emit(OpCodes.Pop); val2.Emit(OpCodes.Ldarg, 0); val2.EmitDelegate<Func<HealthComponent, float>>((Func<HealthComponent, float>)delegate(HealthComponent healthComponent) { int barrierOnOverHeal = healthComponent.itemCounts.barrierOnOverHeal; return BaseOverheal.Value + StackOverheal.Value * (float)(barrierOnOverHeal - 1); }); } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: OverhealHook Failed!"); } }; <>c.<>9__41_0 = val; obj = (object)val; } HealthComponent.Heal += (Manipulator)obj; } } public class BarrierArmorBehavior : ItemBehavior { private HealthComponent healthComponent; private int buffActive = 0; public void Awake() { ((Behaviour)this).enabled = false; } public void OnEnable() { //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)base.body)) { healthComponent = ((Component)base.body).GetComponent<HealthComponent>(); buffActive = 0; base.body.SetBuffCount(Aegis.BarrierBuff.buffIndex, 0); } } public void OnDisable() { //IL_0023: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)base.body)) { buffActive = 0; base.body.SetBuffCount(Aegis.BarrierBuff.buffIndex, 0); } healthComponent = null; } public void FixedUpdate() { //IL_0058: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)base.body)) { int num = ((Object.op_Implicit((Object)(object)healthComponent) && healthComponent.barrier > 0f) ? 1 : 0); if (buffActive != num) { buffActive = num; base.body.SetBuffCount(Aegis.BarrierBuff.buffIndex, num); } } } } public static class AlienHead { internal static Sprite PickupIcon; public static List<string> autoCompatList = new List<string> { "com.Borbo.GreenAlienHead" }; public static string itemIdentifier = "AlienHead"; public static bool appliedChanges = false; public static ConfigEntry<int> EnableChanges { get; set; } public static ConfigEntry<bool> OverrideText { get; set; } public static ConfigEntry<float> BaseCooldown { get; set; } public static ConfigEntry<float> StackCooldown { get; set; } public static ConfigEntry<float> BaseFlatCooldown { get; set; } public static ConfigEntry<float> StackFlatCooldown { get; set; } public static ConfigEntry<bool> GreenTier { get; set; } internal static void Init() { SetupConfig(); if (EnableChanges.Value > 0) { ZetItemTweaksPlugin.OnItemCatalogPreInit = (Action)Delegate.Combine(ZetItemTweaksPlugin.OnItemCatalogPreInit, new Action(ModifyItem)); ZetItemTweaksPlugin.OnLateSetup = (Action)Delegate.Combine(ZetItemTweaksPlugin.OnLateSetup, new Action(LateSetup)); } } private static void SetupConfig() { EnableChanges = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "EnableChanges", 1, ZetItemTweaksPlugin.SectionEnableDesc); if (ZetItemTweaksPlugin.GenerateOverrideText.Value) { OverrideText = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "OverrideText", defaultValue: true, "Replace item description text."); } BaseCooldown = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseCooldown", 0.1f, "Cooldown reduction gained from item."); StackCooldown = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackCooldown", 0.1f, "Cooldown reduction gained from item per stack."); BaseFlatCooldown = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseFlatCooldown", 0f, "Cooldown deduction gained from item."); StackFlatCooldown = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackFlatCooldown", 0f, "Cooldown deduction gained from item per stack."); GreenTier = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "GreenTier", defaultValue: true, "Change item to green tier."); } private static void ModifyItem() { if (!ZetItemTweaksPlugin.ProceedChanges(itemIdentifier, EnableChanges.Value, autoCompatList, ZetItemTweaksPlugin.Feedback.LogAll)) { return; } bool flag = false; ItemDef alienHead = Items.AlienHead; if (GreenTier.Value) { alienHead._itemTierDef = LegacyResourcesAPI.Load<ItemTierDef>("ItemTierDefs/Tier2Def"); if (Object.op_Implicit((Object)(object)PickupIcon)) { alienHead.pickupIconSprite = PickupIcon; } flag = true; } if (flag) { ZetItemTweaksPlugin.ModifiedItemDefCount++; } } private static void LateSetup() { if (ZetItemTweaksPlugin.ProceedChanges(itemIdentifier, EnableChanges.Value, autoCompatList)) { if (!ZetItemTweaksPlugin.GenerateOverrideText.Value || OverrideText.Value) { ZetItemTweaksPlugin.targetLanguage = "default"; ZetItemTweaksPlugin.RegisterFragment("COOLDOWN_DEDUCT", "\nReduces <style=cIsUtility>skill cooldowns</style> by {0} seconds."); ZetItemTweaksPlugin.RegisterToken("ITEM_ALIENHEAD_DESC", DescriptionText()); ZetItemTweaksPlugin.targetLanguage = "pt-BR"; ZetItemTweaksPlugin.RegisterFragment("COOLDOWN_DEDUCT", "\nReduz as <style=cIsUtility>recargas de habilidades</style> em {0} segundos."); ZetItemTweaksPlugin.RegisterToken("ITEM_ALIENHEAD_DESC", DescriptionText()); ZetItemTweaksPlugin.targetLanguage = ""; } appliedChanges = true; } } private static string DescriptionText() { string text = ""; if (BaseCooldown.Value > 0f) { text += string.Format(ZetItemTweaksPlugin.TextFragment("STAT_COOLDOWN", trim: true), ZetItemTweaksPlugin.ScalingText(BaseCooldown.Value, StackCooldown.Value, "percent", "cIsUtility")); } if (BaseFlatCooldown.Value > 0f) { if (text != "") { text += "\n"; } text += string.Format(ZetItemTweaksPlugin.TextFragment("COOLDOWN_DEDUCT", trim: true), ZetItemTweaksPlugin.ScalingText(BaseFlatCooldown.Value, StackFlatCooldown.Value, "flat", "cIsUtility")); } return text; } } public static class AtgMissileMk1 { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<Instruction, bool> <>9__29_1; public static Func<Instruction, bool> <>9__29_2; public static Func<Instruction, bool> <>9__29_3; public static Manipulator <>9__29_0; public static Func<Instruction, bool> <>9__30_1; public static Func<Instruction, bool> <>9__30_2; public static Func<Instruction, bool> <>9__30_3; public static Func<Instruction, bool> <>9__30_4; public static Func<float> <>9__30_5; public static Manipulator <>9__30_0; public static Func<Instruction, bool> <>9__31_1; public static Func<Instruction, bool> <>9__31_2; public static Func<Instruction, bool> <>9__31_3; public static Func<Instruction, bool> <>9__31_4; public static Func<int, float> <>9__31_5; public static Manipulator <>9__31_0; internal void <FindIndexHook>b__29_0(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>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items).GetField("Missile")), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref ItemCountLocIndex) })) { StlocCursorIndex = val.Index; } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: FindIndexHook Failed!"); } } internal bool <FindIndexHook>b__29_1(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, typeof(Items).GetField("Missile")); } internal bool <FindIndexHook>b__29_2(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"); } internal bool <FindIndexHook>b__29_3(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, ref ItemCountLocIndex); } internal void <ProcChanceHook>b__30_0(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.Index = StlocCursorIndex; if (val.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 10f), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1), (Instruction x) => ILPatternMatchingExt.MatchLdfld<DamageInfo>(x, "procCoefficient"), (Instruction x) => ILPatternMatchingExt.MatchMul(x) })) { val.Index += 1; val.Emit(OpCodes.Pop); val.EmitDelegate<Func<float>>((Func<float>)(() => ProcChance.Value)); } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: ProcChanceHook Failed!"); } } internal bool <ProcChanceHook>b__30_1(Instruction x) { return ILPatternMatchingExt.MatchLdcR4(x, 10f); } internal bool <ProcChanceHook>b__30_2(Instruction x) { return ILPatternMatchingExt.MatchLdarg(x, 1); } internal bool <ProcChanceHook>b__30_3(Instruction x) { return ILPatternMatchingExt.MatchLdfld<DamageInfo>(x, "procCoefficient"); } internal bool <ProcChanceHook>b__30_4(Instruction x) { return ILPatternMatchingExt.MatchMul(x); } internal float <ProcChanceHook>b__30_5() { return ProcChance.Value; } internal void <DamageHook>b__31_0(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.Index = StlocCursorIndex; int num = default(int); if (val.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ItemCountLocIndex), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num) })) { val.Index += 3; val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldloc, ItemCountLocIndex); val.EmitDelegate<Func<int, float>>((Func<int, float>)((int count) => BaseDamage.Value + StackDamage.Value * (float)(count - 1))); } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: DamageHook Failed!"); } } internal bool <DamageHook>b__31_1(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, ItemCountLocIndex); } internal bool <DamageHook>b__31_2(Instruction x) { return ILPatternMatchingExt.MatchConvR4(x); } internal bool <DamageHook>b__31_3(Instruction x) { return ILPatternMatchingExt.MatchMul(x); } internal bool <DamageHook>b__31_4(Instruction x) { int num = default(int); return ILPatternMatchingExt.MatchStloc(x, ref num); } internal float <DamageHook>b__31_5(int count) { return BaseDamage.Value + StackDamage.Value * (float)(count - 1); } } public static List<string> autoCompatList = new List<string> { "com.RiskyLives.RiskyMod" }; public static string itemIdentifier = "AtgMissileMk1"; public static bool appliedChanges = false; private static int ItemCountLocIndex = 0; private static int StlocCursorIndex = 0; public static ConfigEntry<int> EnableChanges { get; set; } public static ConfigEntry<bool> OverrideText { get; set; } public static ConfigEntry<float> ProcChance { get; set; } public static ConfigEntry<float> BaseDamage { get; set; } public static ConfigEntry<float> StackDamage { get; set; } internal static void Init() { SetupConfig(); if (EnableChanges.Value > 0) { ZetItemTweaksPlugin.OnLateSetup = (Action)Delegate.Combine(ZetItemTweaksPlugin.OnLateSetup, new Action(LateSetup)); } } private static void SetupConfig() { EnableChanges = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "EnableChanges", 1, ZetItemTweaksPlugin.SectionEnableDesc); if (ZetItemTweaksPlugin.GenerateOverrideText.Value) { OverrideText = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "OverrideText", defaultValue: true, "Replace item description text."); } ProcChance = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "ProcChance", 10f, "Chance to proc item effect. 10 = 10%"); BaseDamage = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseDamage", 3f, "Missile damage gained from item."); StackDamage = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackDamage", 2f, "Missile damage gained from item per stack."); } private static void LateSetup() { if (!ZetItemTweaksPlugin.ProceedChanges(itemIdentifier, EnableChanges.Value, autoCompatList)) { return; } FindIndexHook(); if (ItemCountLocIndex != 0) { ProcChanceHook(); DamageHook(); if (!ZetItemTweaksPlugin.GenerateOverrideText.Value || OverrideText.Value) { ZetItemTweaksPlugin.targetLanguage = "default"; ZetItemTweaksPlugin.RegisterFragment("ATG_MISSILE", "{0} chance to fire a <style=cIsDamage>missile</style> that deals {1} TOTAL damage."); ZetItemTweaksPlugin.RegisterToken("ITEM_MISSILE_DESC", DescriptionText()); ZetItemTweaksPlugin.targetLanguage = "pt-BR"; ZetItemTweaksPlugin.RegisterFragment("ATG_MISSILE", "{0} de chance de disparar um <style=cIsDamage>míssil</style> que causa {1} de dano TOTAL."); ZetItemTweaksPlugin.RegisterToken("ITEM_MISSILE_DESC", DescriptionText()); ZetItemTweaksPlugin.targetLanguage = ""; } appliedChanges = true; } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: LateSetup Failed!"); } } private static string DescriptionText() { return string.Format(ZetItemTweaksPlugin.TextFragment("ATG_MISSILE"), ZetItemTweaksPlugin.ScalingText(ProcChance.Value, "chance", "cIsDamage"), ZetItemTweaksPlugin.ScalingText(BaseDamage.Value, StackDamage.Value, "percent", "cIsDamage")); } private static void FindIndexHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__29_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val2 = new ILCursor(il); if (val2.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items).GetField("Missile")), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref ItemCountLocIndex) })) { StlocCursorIndex = val2.Index; } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: FindIndexHook Failed!"); } }; <>c.<>9__29_0 = val; obj = (object)val; } GlobalEventManager.ProcessHitEnemy += (Manipulator)obj; } private static void ProcChanceHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__30_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); val2.Index = StlocCursorIndex; if (val2.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 10f), (Instruction x) => ILPatternMatchingExt.MatchLdarg(x, 1), (Instruction x) => ILPatternMatchingExt.MatchLdfld<DamageInfo>(x, "procCoefficient"), (Instruction x) => ILPatternMatchingExt.MatchMul(x) })) { val2.Index += 1; val2.Emit(OpCodes.Pop); val2.EmitDelegate<Func<float>>((Func<float>)(() => ProcChance.Value)); } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: ProcChanceHook Failed!"); } }; <>c.<>9__30_0 = val; obj = (object)val; } GlobalEventManager.ProcessHitEnemy += (Manipulator)obj; } private static void DamageHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__31_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); val2.Index = StlocCursorIndex; int num = default(int); if (val2.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ItemCountLocIndex), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x), (Instruction x) => ILPatternMatchingExt.MatchMul(x), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref num) })) { val2.Index += 3; val2.Emit(OpCodes.Pop); val2.Emit(OpCodes.Ldloc, ItemCountLocIndex); val2.EmitDelegate<Func<int, float>>((Func<int, float>)((int count) => BaseDamage.Value + StackDamage.Value * (float)(count - 1))); } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: DamageHook Failed!"); } }; <>c.<>9__31_0 = val; obj = (object)val; } GlobalEventManager.ProcessHitEnemy += (Manipulator)obj; } } public static class BensRainCoat { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_RecalculateStats <>9__82_0; public static hook_OnEnable <>9__84_0; public static hook_OnDisable <>9__84_1; public static hook_FixedUpdate <>9__84_2; public static hook_TryApplyOverride <>9__85_0; public static hook_CleanseBodyServer_CharacterBody_bool_bool_bool_bool_bool_bool <>9__86_0; internal void <AttachTrackerHook>b__82_0(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (NetworkServer.active && Object.op_Implicit((Object)(object)self)) { UpdateImmunityTracker(self); } } internal void <DisableDefaultHook>b__84_0(orig_OnEnable orig, ImmuneToDebuffBehavior self) { } internal void <DisableDefaultHook>b__84_1(orig_OnDisable orig, ImmuneToDebuffBehavior self) { } internal void <DisableDefaultHook>b__84_2(orig_FixedUpdate orig, ImmuneToDebuffBehavior self) { } internal bool <TryApplyOverrideHook>b__85_0(orig_TryApplyOverride orig, CharacterBody body) { ImmunityTracker component = ((Component)body).GetComponent<ImmunityTracker>(); if (Object.op_Implicit((Object)(object)component)) { if (component.isProtected) { return true; } if (component.canProtect) { component.TriggerProtection(); return true; } } return false; } internal void <HandleCleanseHook>b__86_0(orig_CleanseBodyServer_CharacterBody_bool_bool_bool_bool_bool_bool orig, CharacterBody body, bool debuff, bool buff, bool cooldown, bool dot, bool stun, bool proj) { if (Object.op_Implicit((Object)(object)body) && cooldown) { ImmunityTracker component = ((Component)body).GetComponent<ImmunityTracker>(); if (Object.op_Implicit((Object)(object)component)) { component.CleanseCooldown(); } } orig.Invoke(body, debuff, buff, cooldown, dot, stun, proj); } } public static GameObject ImmunityEffectPrefab; public static List<string> autoCompatList = new List<string> { "com.kking117.FlatItemBuff", "PhysicsFox.BetterBensRaincoat", "ImBonkers.OGRaincoat", "prototype.raincoat" }; public static string itemIdentifier = "BensRainCoat"; public static bool appliedChanges = false; public static ConfigEntry<int> EnableChanges { get; set; } public static ConfigEntry<bool> OverrideText { get; set; } public static ConfigEntry<int> BaseImmunity { get; set; } public static ConfigEntry<int> StackImmunity { get; set; } public static ConfigEntry<bool> ImmunityCheat { get; set; } public static ConfigEntry<float> ImmunityDuration { get; set; } public static ConfigEntry<float> ImmunityCheatDuration { get; set; } public static ConfigEntry<float> BaseRecharge { get; set; } public static ConfigEntry<float> StackReduction { get; set; } public static ConfigEntry<float> BaseHealth { get; set; } public static ConfigEntry<float> StackHealth { get; set; } public static ConfigEntry<float> BaseHealthPercent { get; set; } public static ConfigEntry<float> StackHealthPercent { get; set; } public static ConfigEntry<float> BaseBarrierRecovery { get; set; } public static ConfigEntry<float> StackBarrierRecovery { get; set; } public static ConfigEntry<float> BaseSafeRegenFraction { get; set; } public static ConfigEntry<float> StackSafeRegenFraction { get; set; } public static ConfigEntry<bool> Blacklist { get; set; } internal static void Init() { SetupConfig(); if (EnableChanges.Value > 0) { ZetItemTweaksPlugin.OnItemCatalogPreInit = (Action)Delegate.Combine(ZetItemTweaksPlugin.OnItemCatalogPreInit, new Action(ModifyItem)); ZetItemTweaksPlugin.OnLateSetup = (Action)Delegate.Combine(ZetItemTweaksPlugin.OnLateSetup, new Action(LateSetup)); } } private static void SetupConfig() { EnableChanges = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "EnableChanges", 1, ZetItemTweaksPlugin.SectionEnableDesc); if (ZetItemTweaksPlugin.GenerateOverrideText.Value) { OverrideText = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "OverrideText", defaultValue: true, "Replace item description text."); } BaseImmunity = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseImmunity", 2, "Maximum immunity charges gained from item."); StackImmunity = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackImmunity", 1, "Maximum immunity charges gained from item per stack."); ImmunityCheat = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "ImmunityCheat", defaultValue: false, "Debuff immunity is always active."); ImmunityDuration = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "ImmunityDuration", 0.25f, "Debuff immunity duration when protection is triggered."); ImmunityCheatDuration = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "ImmunityCheatDuration", 1f, "Serves as barrier recovery cooldown while cheat enabled."); BaseRecharge = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseRecharge", 5f, "Recharge interval for gaining immunity charge."); StackReduction = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackReduction", 0.1f, "Recharge interval reduction per stack."); BaseHealth = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseHealth", 0f, "Health gained from item."); StackHealth = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackHealth", 0f, "Health gained from item per stack."); BaseHealthPercent = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseHealthPercent", 0f, "Health percent gained from item."); StackHealthPercent = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackHealthPercent", 0f, "Health percent gained from item per stack."); BaseBarrierRecovery = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseBarrierRecovery", 0.1f, "Barrier recovery fraction when protection is triggered."); StackBarrierRecovery = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackBarrierRecovery", 0f, "Barrier recovery fraction per stack when protection is triggered."); BaseSafeRegenFraction = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseSafeRegenFraction", 0f, "Health regeneration fraction gained while safe from item. 0.01 = 1% regeneration."); StackSafeRegenFraction = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackSafeRegenFraction", 0f, "Health regeneration fraction gained while safe from item per stack."); Blacklist = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "Blacklist", defaultValue: false, "Add AIBlacklist ItemTag to item."); } private static void ModifyItem() { if (ZetItemTweaksPlugin.ProceedChanges(itemIdentifier, EnableChanges.Value, autoCompatList, ZetItemTweaksPlugin.Feedback.LogAll)) { bool flag = false; ItemDef immuneToDebuff = Items.ImmuneToDebuff; if (Blacklist.Value && immuneToDebuff.DoesNotContainTag((ItemTag)4)) { List<ItemTag> list = immuneToDebuff.tags.ToList(); list.Add((ItemTag)4); immuneToDebuff.tags = list.ToArray(); flag = true; } if (flag) { ZetItemTweaksPlugin.ModifiedItemDefCount++; } } } private static void LateSetup() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) if (ZetItemTweaksPlugin.ProceedChanges(itemIdentifier, EnableChanges.Value, autoCompatList)) { Buffs.ImmuneToDebuffCooldown.canStack = true; ImmunityEffectPrefab = Addressables.LoadAssetAsync<GameObject>((object)"RoR2/DLC1/ImmuneToDebuff/ImmuneToDebuffEffect.prefab").WaitForCompletion(); AttachTrackerHook(); DisableDefaultHook(); TryApplyOverrideHook(); HandleCleanseHook(); if (!ZetItemTweaksPlugin.GenerateOverrideText.Value || OverrideText.Value) { ZetItemTweaksPlugin.targetLanguage = "default"; ZetItemTweaksPlugin.RegisterFragment("IMMUNITY_CHEAT", "Become immune to <style=cIsDamage>debuffs</style>."); ZetItemTweaksPlugin.RegisterFragment("IMMUNITY_CHEAT_BARRIER", "Prevents <style=cIsDamage>debuffs</style> and instead generates {0} <style=cIsHealing>barrier</style>."); ZetItemTweaksPlugin.RegisterFragment("IMMUNITY_CHARGES", "Maximum of {0} <style=cIsUtility>cleanse</style> charges."); ZetItemTweaksPlugin.RegisterFragment("IMMUNITY_RECHARGE", "\nGain a charge {0}."); ZetItemTweaksPlugin.RegisterFragment("IMMUNITY_RECHARGE_REDUCE", "\nGain a charge {0} <style=cStack>(-{1} per stack)</style>."); ZetItemTweaksPlugin.RegisterFragment("IMMUNITY_PROTECTION", "\nEach charge prevents <style=cIsDamage>debuffs</style> {0}."); ZetItemTweaksPlugin.RegisterFragment("IMMUNITY_PROTECTION_BARRIER", "\nEach charge prevents <style=cIsDamage>debuffs</style> {0} and generates {1} <style=cIsHealing>barrier</style>."); ZetItemTweaksPlugin.RegisterFragment("SAFE_REGENERATION", "\nIncreases <style=cIsHealing>health regeneration</style> by {0} while out of danger."); ZetItemTweaksPlugin.RegisterFragment("BEN_PICKUP_CHEATBARRIER", "Prevent debuffs, instead gaining a temporary barrier."); ZetItemTweaksPlugin.RegisterFragment("BEN_PICKUP_CHEAT", "Become immune to debuffs."); ZetItemTweaksPlugin.RegisterFragment("BEN_PICKUP_CHARGEBARRIER", "Prevent debuffs, instead gaining a temporary barrier. Recharges over time."); ZetItemTweaksPlugin.RegisterFragment("BEN_PICKUP_CHARGE", "Prevent debuffs. Recharges over time."); ZetItemTweaksPlugin.RegisterToken("ITEM_IMMUNETODEBUFF_DESC", DescriptionText()); ZetItemTweaksPlugin.RegisterToken("ITEM_IMMUNETODEBUFF_PICKUP", PickupText()); ZetItemTweaksPlugin.targetLanguage = "pt-BR"; ZetItemTweaksPlugin.RegisterFragment("IMMUNITY_CHEAT", "Se torne imune a <style=cIsDamage>penalidades</style>."); ZetItemTweaksPlugin.RegisterFragment("IMMUNITY_CHEAT_BARRIER", "Previne <style=cIsDamage>penalidades</style> e, em troca, concede {0} de <style=cIsHealing>barreira</style>."); ZetItemTweaksPlugin.RegisterFragment("IMMUNITY_CHARGES", "Máximo de {0} cargas de <style=cIsUtility>purificação</style>."); ZetItemTweaksPlugin.RegisterFragment("IMMUNITY_RECHARGE", "\nGanhe uma carga de {0}."); ZetItemTweaksPlugin.RegisterFragment("IMMUNITY_RECHARGE_REDUCE", "\nGanhe uma carga de {0} <style=cStack>(-{1} por acúmulo)</style>."); ZetItemTweaksPlugin.RegisterFragment("IMMUNITY_PROTECTION", "\nCada carga previne <style=cIsDamage>penalidades</style> {0}."); ZetItemTweaksPlugin.RegisterFragment("IMMUNITY_PROTECTION_BARRIER", "\nCada carga previne <style=cIsDamage>penalidades</style> {0} e gera uma {1} <style=cIsHealing>barreira</style>."); ZetItemTweaksPlugin.RegisterFragment("SAFE_REGENERATION", "\nAumenta a <style=cIsHealing>regeneração de saúde</style> em {0} enquanto fora de perigo."); ZetItemTweaksPlugin.RegisterFragment("BEN_PICKUP_CHEATBARRIER", "Previne penalidades, e, em troca, concede uma barreira temporária."); ZetItemTweaksPlugin.RegisterFragment("BEN_PICKUP_CHEAT", "Se torna imune a penalidades."); ZetItemTweaksPlugin.RegisterFragment("BEN_PICKUP_CHARGEBARRIER", "Previne penalidades, e, em troca, concede uma barreira temporária. Recharrega ao longo do temp."); ZetItemTweaksPlugin.RegisterFragment("BEN_PICKUP_CHARGE", "Previne penalidades. Recharrega ao longo do tempo."); ZetItemTweaksPlugin.RegisterToken("ITEM_IMMUNETODEBUFF_DESC", DescriptionText()); ZetItemTweaksPlugin.RegisterToken("ITEM_IMMUNETODEBUFF_PICKUP", PickupText()); ZetItemTweaksPlugin.targetLanguage = ""; } appliedChanges = true; } } private static string DescriptionText() { string text = ""; if (BaseHealth.Value > 0f) { text += string.Format(ZetItemTweaksPlugin.TextFragment("STAT_HEALTH", trim: true), ZetItemTweaksPlugin.ScalingText(BaseHealth.Value, StackHealth.Value, "flat", "cIsHealing")); } if (BaseHealthPercent.Value > 0f) { if (text != "") { text += "\n"; } text += string.Format(ZetItemTweaksPlugin.TextFragment("STAT_HEALTH", trim: true), ZetItemTweaksPlugin.ScalingText(BaseHealthPercent.Value, StackHealthPercent.Value, "percent", "cIsHealing")); } if (ImmunityCheat.Value) { if (text != "") { text += "\n"; } text = ((!(BaseBarrierRecovery.Value > 0f)) ? (text + ZetItemTweaksPlugin.TextFragment("IMMUNITY_CHEAT")) : (text + string.Format(ZetItemTweaksPlugin.TextFragment("IMMUNITY_CHEAT_BARRIER"), ZetItemTweaksPlugin.ScalingText(BaseBarrierRecovery.Value, StackBarrierRecovery.Value, "percent", "cIsHealing")))); } else { if (text != "") { text += "\n"; } text += string.Format(ZetItemTweaksPlugin.TextFragment("IMMUNITY_CHARGES"), ZetItemTweaksPlugin.ScalingText(BaseImmunity.Value, StackImmunity.Value, "flat", "cIsUtility")); text = ((StackReduction.Value != 0f) ? (text + string.Format(ZetItemTweaksPlugin.TextFragment("IMMUNITY_RECHARGE_REDUCE"), ZetItemTweaksPlugin.SecondText(BaseRecharge.Value, "every", "cIsUtility"), ZetItemTweaksPlugin.ScalingText(StackReduction.Value, "percent"))) : (text + string.Format(ZetItemTweaksPlugin.TextFragment("IMMUNITY_RECHARGE"), ZetItemTweaksPlugin.SecondText(BaseRecharge.Value, "every", "cIsUtility")))); text = ((!(BaseBarrierRecovery.Value > 0f)) ? (text + string.Format(ZetItemTweaksPlugin.TextFragment("IMMUNITY_PROTECTION"), ZetItemTweaksPlugin.SecondText(ImmunityDuration.Value, "for"))) : (text + string.Format(ZetItemTweaksPlugin.TextFragment("IMMUNITY_PROTECTION_BARRIER"), ZetItemTweaksPlugin.SecondText(ImmunityDuration.Value, "for"), ZetItemTweaksPlugin.ScalingText(BaseBarrierRecovery.Value, StackBarrierRecovery.Value, "percent", "cIsHealing")))); } if (BaseSafeRegenFraction.Value > 0f) { text += string.Format(ZetItemTweaksPlugin.TextFragment("SAFE_REGENERATION"), ZetItemTweaksPlugin.ScalingText(BaseSafeRegenFraction.Value, StackSafeRegenFraction.Value, "percentregen", "cIsHealing")); } return text; } private static string PickupText() { if (ImmunityCheat.Value) { if (BaseBarrierRecovery.Value > 0f) { return ZetItemTweaksPlugin.TextFragment("BEN_PICKUP_CHEATBARRIER"); } return ZetItemTweaksPlugin.TextFragment("BEN_PICKUP_CHEAT"); } if (BaseBarrierRecovery.Value > 0f) { return ZetItemTweaksPlugin.TextFragment("BEN_PICKUP_CHARGEBARRIER"); } return ZetItemTweaksPlugin.TextFragment("BEN_PICKUP_CHARGE"); } private static void AttachTrackerHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__82_0; if (obj == null) { hook_RecalculateStats val = delegate(orig_RecalculateStats orig, CharacterBody self) { orig.Invoke(self); if (NetworkServer.active && Object.op_Implicit((Object)(object)self)) { UpdateImmunityTracker(self); } }; <>c.<>9__82_0 = val; obj = (object)val; } CharacterBody.RecalculateStats += (hook_RecalculateStats)obj; } private static void UpdateImmunityTracker(CharacterBody self) { Inventory inventory = self.inventory; if (Object.op_Implicit((Object)(object)inventory)) { int itemCountEffective = inventory.GetItemCountEffective(Items.ImmuneToDebuff); ImmunityTracker immunityTracker = ((Component)self).GetComponent<ImmunityTracker>(); if (!Object.op_Implicit((Object)(object)immunityTracker) && itemCountEffective > 0) { immunityTracker = ((Component)self).gameObject.AddComponent<ImmunityTracker>(); immunityTracker.body = self; } if (Object.op_Implicit((Object)(object)immunityTracker)) { immunityTracker.UpdateStacks(itemCountEffective); } } } private static void DisableDefaultHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Expected O, but got Unknown object obj = <>c.<>9__84_0; if (obj == null) { hook_OnEnable val = delegate { }; <>c.<>9__84_0 = val; obj = (object)val; } ImmuneToDebuffBehavior.OnEnable += (hook_OnEnable)obj; object obj2 = <>c.<>9__84_1; if (obj2 == null) { hook_OnDisable val2 = delegate { }; <>c.<>9__84_1 = val2; obj2 = (object)val2; } ImmuneToDebuffBehavior.OnDisable += (hook_OnDisable)obj2; object obj3 = <>c.<>9__84_2; if (obj3 == null) { hook_FixedUpdate val3 = delegate { }; <>c.<>9__84_2 = val3; obj3 = (object)val3; } ImmuneToDebuffBehavior.FixedUpdate += (hook_FixedUpdate)obj3; } private static void TryApplyOverrideHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__85_0; if (obj == null) { hook_TryApplyOverride val = delegate(orig_TryApplyOverride orig, CharacterBody body) { ImmunityTracker component = ((Component)body).GetComponent<ImmunityTracker>(); if (Object.op_Implicit((Object)(object)component)) { if (component.isProtected) { return true; } if (component.canProtect) { component.TriggerProtection(); return true; } } return false; }; <>c.<>9__85_0 = val; obj = (object)val; } ImmuneToDebuffBehavior.TryApplyOverride += (hook_TryApplyOverride)obj; } private static void HandleCleanseHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__86_0; if (obj == null) { hook_CleanseBodyServer_CharacterBody_bool_bool_bool_bool_bool_bool val = delegate(orig_CleanseBodyServer_CharacterBody_bool_bool_bool_bool_bool_bool orig, CharacterBody body, bool debuff, bool buff, bool cooldown, bool dot, bool stun, bool proj) { if (Object.op_Implicit((Object)(object)body) && cooldown) { ImmunityTracker component = ((Component)body).GetComponent<ImmunityTracker>(); if (Object.op_Implicit((Object)(object)component)) { component.CleanseCooldown(); } } orig.Invoke(body, debuff, buff, cooldown, dot, stun, proj); }; <>c.<>9__86_0 = val; obj = (object)val; } CleanseSystem.CleanseBodyServer_CharacterBody_bool_bool_bool_bool_bool_bool += (hook_CleanseBodyServer_CharacterBody_bool_bool_bool_bool_bool_bool)obj; } } public class ImmunityTracker : MonoBehaviour { public CharacterBody body; public bool isProtected = false; public bool canProtect = false; private int ItemCount = 0; private float RecoveryFraction = 0f; private bool ProtectionCheat = false; private int ProtectionLimit = 0; private int ProtectionCount = 0; private float ProtectionDuration = 0.25f; private float ProtectionTimer = 0f; private float RechargeInterval = 5f; private float RechargeTimer = 0f; public void FixedUpdate() { //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) float fixedDeltaTime = Time.fixedDeltaTime; isProtected = ProtectionTimer > 0f; ProtectionTimer = Mathf.Max(0f, ProtectionTimer - fixedDeltaTime); int num = 0; int num2 = 0; if (ProtectionCheat) { canProtect = ProtectionLimit > 0; ProtectionCount = 0; RechargeTimer = RechargeInterval; } else { if (ProtectionCount < ProtectionLimit) { if (!isProtected) { RechargeTimer -= fixedDeltaTime; } if (RechargeTimer <= 0f) { ProtectionCount++; RechargeTimer += RechargeInterval; } } else { RechargeTimer = RechargeInterval; } if (ProtectionLimit > 0) { if (ProtectionCount > 0) { canProtect = true; num2 = ProtectionCount; } else { canProtect = false; num = Mathf.CeilToInt(RechargeTimer); } } else { canProtect = false; } } int buffCount = body.GetBuffCount(Buffs.ImmuneToDebuffCooldown); if (buffCount != num) { body.SetBuffCount(Buffs.ImmuneToDebuffCooldown.buffIndex, num); } buffCount = body.GetBuffCount(Buffs.ImmuneToDebuffReady); if (buffCount != num2) { body.SetBuffCount(Buffs.ImmuneToDebuffReady.buffIndex, num2); } } public void UpdateStacks(int count) { if (ItemCount == count) { return; } if (count > 0) { ProtectionLimit = BensRainCoat.BaseImmunity.Value + BensRainCoat.StackImmunity.Value * (count - 1); RechargeInterval = BensRainCoat.BaseRecharge.Value * Mathf.Pow(1f - BensRainCoat.StackReduction.Value, (float)(count - 1)); ProtectionCheat = BensRainCoat.ImmunityCheat.Value; if (BensRainCoat.BaseBarrierRecovery.Value > 0f) { RecoveryFraction = BensRainCoat.BaseBarrierRecovery.Value + BensRainCoat.StackBarrierRecovery.Value * (float)(count - 1); } else { RecoveryFraction = 0f; } } else { ProtectionLimit = 0; RechargeInterval = BensRainCoat.BaseRecharge.Value; ProtectionCheat = false; RecoveryFraction = 0f; } if (ProtectionCheat) { ProtectionDuration = BensRainCoat.ImmunityCheatDuration.Value; } else { ProtectionDuration = BensRainCoat.ImmunityDuration.Value; } if (ProtectionCount > ProtectionLimit) { ProtectionCount = ProtectionLimit; RechargeTimer = RechargeInterval; } if (ItemCount == 0 && count > 0) { ProtectionCount = 1; RechargeTimer = RechargeInterval; } ItemCount = count; } public void TriggerProtection() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) isProtected = true; ProtectionCount--; ProtectionTimer = ProtectionDuration; if (Object.op_Implicit((Object)(object)BensRainCoat.ImmunityEffectPrefab)) { EffectManager.SimpleImpactEffect(BensRainCoat.ImmunityEffectPrefab, body.corePosition, Vector3.up, true); } if (RecoveryFraction > 0f) { HealthComponent healthComponent = body.healthComponent; if (Object.op_Implicit((Object)(object)healthComponent)) { healthComponent.AddBarrier(RecoveryFraction * healthComponent.fullCombinedHealth); } } } public void CleanseCooldown() { //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) if (!ProtectionCheat && ProtectionCount <= 0 && ProtectionLimit > 0) { canProtect = true; ProtectionCount = 1; RechargeTimer = RechargeInterval; body.SetBuffCount(Buffs.ImmuneToDebuffCooldown.buffIndex, 0); body.SetBuffCount(Buffs.ImmuneToDebuffReady.buffIndex, 1); } } } public static class BerzerkersPauldron { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<Instruction, bool> <>9__45_1; public static Func<Instruction, bool> <>9__45_2; public static Manipulator <>9__45_0; public static hook_OnCharacterDeath <>9__46_0; internal void <DisableDefaultHook>b__45_0(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) <>c__DisplayClass45_0 CS$<>8__locals0 = new <>c__DisplayClass45_0(); ILCursor val = new ILCursor(il); CS$<>8__locals0.index = -1; if (val.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "WarCryOnMultiKill"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref CS$<>8__locals0.index) })) { val.Index += 3; val.Emit(OpCodes.Ldc_I4, 0); val.Emit(OpCodes.Stloc, CS$<>8__locals0.index); } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: DisableDefaultHook Failed!"); } } internal bool <DisableDefaultHook>b__45_1(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "WarCryOnMultiKill"); } internal bool <DisableDefaultHook>b__45_2(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"); } internal void <ApplyBuffHook>b__46_0(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport) { //IL_0106: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, damageReport); if (!NetworkServer.active || damageReport == null || !(BaseBuffDuration.Value > 0f) || !Object.op_Implicit((Object)(object)damageReport.attacker) || !Object.op_Implicit((Object)(object)damageReport.attackerBody)) { return; } CharacterBody attackerBody = damageReport.attackerBody; if (!Object.op_Implicit((Object)(object)attackerBody)) { return; } Inventory inventory = attackerBody.inventory; if (!Object.op_Implicit((Object)(object)inventory)) { return; } int itemCountEffective = inventory.GetItemCountEffective(Items.WarCryOnMultiKill); if (itemCountEffective > 0) { float num = BaseBuffDuration.Value + StackBuffDuration.Value * (float)(itemCountEffective - 1); int num2 = BaseBuffCount.Value + StackBuffCount.Value * (itemCountEffective - 1); attackerBody.AddTimedBuff(MultiKillBuff, num, num2); if (BuffRefresh.Value) { ZetItemTweaksPlugin.RefreshTimedBuffStacks(attackerBody, MultiKillBuff.buffIndex, num); } } } } [CompilerGenerated] private sealed class <>c__DisplayClass45_0 { public int index; internal bool <DisableDefaultHook>b__3(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, ref index); } } internal static BuffDef MultiKillBuff; public static List<string> autoCompatList = new List<string> { "com.RiskyLives.RiskyMod" }; public static string itemIdentifier = "BerzerkersPauldron"; public static bool appliedChanges = false; public static ConfigEntry<int> EnableChanges { get; set; } public static ConfigEntry<bool> OverrideText { get; set; } public static ConfigEntry<float> BuffMove { get; set; } public static ConfigEntry<float> BuffAtkSpd { get; set; } public static ConfigEntry<int> BaseBuffCount { get; set; } public static ConfigEntry<int> StackBuffCount { get; set; } public static ConfigEntry<float> BaseBuffDuration { get; set; } public static ConfigEntry<float> StackBuffDuration { get; set; } public static ConfigEntry<bool> BuffRefresh { get; set; } internal static void Init() { SetupConfig(); if (EnableChanges.Value > 0) { ZetItemTweaksPlugin.OnLateSetup = (Action)Delegate.Combine(ZetItemTweaksPlugin.OnLateSetup, new Action(LateSetup)); } } private static void SetupConfig() { EnableChanges = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "EnableChanges", 1, ZetItemTweaksPlugin.SectionEnableDesc); if (ZetItemTweaksPlugin.GenerateOverrideText.Value) { OverrideText = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "OverrideText", defaultValue: true, "Replace item description text."); } BuffMove = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BuffMove", 0.075f, "Movement speed gained per buff."); BuffAtkSpd = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BuffAtkSpd", 0.15f, "Attack speed gained per buff."); BaseBuffCount = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseBuffCount", 3, "Maximum buff count gained from item."); StackBuffCount = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackBuffCount", 2, "Maximum buff count gained from item per stack."); BaseBuffDuration = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseBuffDuration", 4f, "Buff duration gained from item."); StackBuffDuration = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackBuffDuration", 0f, "Buff duration gained from item per stack."); BuffRefresh = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BuffRefresh", defaultValue: true, "Refresh all buff durations on kill."); } private static void LateSetup() { if (ZetItemTweaksPlugin.ProceedChanges(itemIdentifier, EnableChanges.Value, autoCompatList)) { DisableDefaultHook(); ApplyBuffHook(); if (!ZetItemTweaksPlugin.GenerateOverrideText.Value || OverrideText.Value) { ZetItemTweaksPlugin.targetLanguage = "default"; ZetItemTweaksPlugin.RegisterFragment("MULTIKILL_ATKSPD", "Killing an enemy increase <style=cIsDamage>attack speed</style> by {0} for {1}."); ZetItemTweaksPlugin.RegisterFragment("MULTIKILL_MOVE", "Killing an enemy increase <style=cIsUtility>movement speed</style> by {0} for {1}."); ZetItemTweaksPlugin.RegisterFragment("MULTIKILL_BOTH", "Killing an enemy increase <style=cIsUtility>movement speed</style> by {0} and <style=cIsDamage>attack speed</style> by {1} for {2}."); ZetItemTweaksPlugin.RegisterFragment("MULTIKILL_ATKSPD_CAP", "\nMaximum cap of {0} <style=cIsDamage>attack speed</style>."); ZetItemTweaksPlugin.RegisterFragment("MULTIKILL_MOVE_CAP", "\nMaximum cap of {0} <style=cIsUtility>movement speed</style>."); ZetItemTweaksPlugin.RegisterFragment("MULTIKILL_BOTH_CAP", "\nMaximum cap of {0} <style=cIsUtility>movement speed</style> and {1} <style=cIsDamage>attack speed</style>."); ZetItemTweaksPlugin.RegisterFragment("BERZERK_PICKUP_BOTH", "Killing enemies grants movement speed and attack speed."); ZetItemTweaksPlugin.RegisterFragment("BERZERK_PICKUP_MOVESPD", "Killing enemies grants movement speed."); ZetItemTweaksPlugin.RegisterFragment("BERZERK_PICKUP_ATKSPD", "Killing enemies grants attack speed."); ZetItemTweaksPlugin.RegisterToken("ITEM_WARCRYONMULTIKILL_DESC", DescriptionText()); ZetItemTweaksPlugin.RegisterToken("ITEM_WARCRYONMULTIKILL_PICKUP", PickupText()); ZetItemTweaksPlugin.targetLanguage = "pt-BR"; ZetItemTweaksPlugin.RegisterFragment("MULTIKILL_ATKSPD", "Abater um inimigo aumenta a <style=cIsDamage>velocidade de ataque</style> em {0} por {1}."); ZetItemTweaksPlugin.RegisterFragment("MULTIKILL_MOVE", "Abater um inimigo aumenta a <style=cIsUtility>velocidade de movimento</style> em {0} por {1}."); ZetItemTweaksPlugin.RegisterFragment("MULTIKILL_BOTH", "Abater um inimigo aumenta a <style=cIsUtility>velocidade de movimento</style> em {0} e a <style=cIsDamage>velocidade de ataque</style> em {1} por {2}."); ZetItemTweaksPlugin.RegisterFragment("MULTIKILL_ATKSPD_CAP", "\nLimite máximo de {0} de <style=cIsDamage>velocidade de ataque</style>."); ZetItemTweaksPlugin.RegisterFragment("MULTIKILL_MOVE_CAP", "\nLimite máximo de {0} de <style=cIsUtility>velocidade de movimento</style>."); ZetItemTweaksPlugin.RegisterFragment("MULTIKILL_BOTH_CAP", "\nLimite máximo de {0} de <style=cIsUtility>velocidade de movimento</style> e {1} de <style=cIsDamage>velocidade de ataque</style>."); ZetItemTweaksPlugin.RegisterFragment("BERZERK_PICKUP_BOTH", "Abater um inimigos concede velocidade de movimento e velocidade de ataque."); ZetItemTweaksPlugin.RegisterFragment("BERZERK_PICKUP_MOVESPD", "Abater um inimigos concede velocidade de movimento."); ZetItemTweaksPlugin.RegisterFragment("BERZERK_PICKUP_ATKSPD", "Abater um inimigos concede velocidade de ataque."); ZetItemTweaksPlugin.RegisterToken("ITEM_WARCRYONMULTIKILL_DESC", DescriptionText()); ZetItemTweaksPlugin.RegisterToken("ITEM_WARCRYONMULTIKILL_PICKUP", PickupText()); ZetItemTweaksPlugin.targetLanguage = ""; } appliedChanges = true; } } private static string DescriptionText() { string result = "wat"; if (BuffMove.Value > 0f && BuffAtkSpd.Value > 0f) { result = string.Format(ZetItemTweaksPlugin.TextFragment("MULTIKILL_BOTH"), ZetItemTweaksPlugin.ScalingText(BuffMove.Value, "percent", "cIsUtility"), ZetItemTweaksPlugin.ScalingText(BuffAtkSpd.Value, "percent", "cIsDamage"), ZetItemTweaksPlugin.ScalingText(BaseBuffDuration.Value, StackBuffDuration.Value, "duration", "cIsDamage")); result += string.Format(ZetItemTweaksPlugin.TextFragment("MULTIKILL_BOTH_CAP"), ZetItemTweaksPlugin.ScalingText(BuffMove.Value * (float)BaseBuffCount.Value, BuffMove.Value * (float)StackBuffCount.Value, "percent", "cIsUtility"), ZetItemTweaksPlugin.ScalingText(BuffAtkSpd.Value * (float)BaseBuffCount.Value, BuffAtkSpd.Value * (float)StackBuffCount.Value, "percent", "cIsDamage")); } else if (BuffMove.Value > 0f) { result = string.Format(ZetItemTweaksPlugin.TextFragment("MULTIKILL_MOVE"), ZetItemTweaksPlugin.ScalingText(BuffMove.Value, "percent", "cIsUtility"), ZetItemTweaksPlugin.ScalingText(BaseBuffDuration.Value, StackBuffDuration.Value, "duration", "cIsUtility")); result += string.Format(ZetItemTweaksPlugin.TextFragment("MULTIKILL_MOVE_CAP"), ZetItemTweaksPlugin.ScalingText(BuffMove.Value * (float)BaseBuffCount.Value, BuffMove.Value * (float)StackBuffCount.Value, "percent", "cIsUtility")); } else if (BuffAtkSpd.Value > 0f) { result = string.Format(ZetItemTweaksPlugin.TextFragment("MULTIKILL_ATKSPD"), ZetItemTweaksPlugin.ScalingText(BuffAtkSpd.Value, "percent", "cIsDamage"), ZetItemTweaksPlugin.ScalingText(BaseBuffDuration.Value, StackBuffDuration.Value, "duration", "cIsDamage")); result += string.Format(ZetItemTweaksPlugin.TextFragment("MULTIKILL_ATKSPD_CAP"), ZetItemTweaksPlugin.ScalingText(BuffAtkSpd.Value * (float)BaseBuffCount.Value, BuffAtkSpd.Value * (float)StackBuffCount.Value, "percent", "cIsDamage")); } return result; } private static string PickupText() { if (BuffMove.Value > 0f && BuffAtkSpd.Value > 0f) { return ZetItemTweaksPlugin.TextFragment("BERZERK_PICKUP_BOTH"); } if (BuffMove.Value > 0f) { return ZetItemTweaksPlugin.TextFragment("BERZERK_PICKUP_MOVESPD"); } if (BuffAtkSpd.Value > 0f) { return ZetItemTweaksPlugin.TextFragment("BERZERK_PICKUP_ATKSPD"); } return "wat"; } private static void DisableDefaultHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__45_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Expected O, but got Unknown //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); int index = -1; if (val2.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items), "WarCryOnMultiKill"), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref index) })) { val2.Index += 3; val2.Emit(OpCodes.Ldc_I4, 0); val2.Emit(OpCodes.Stloc, index); } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: DisableDefaultHook Failed!"); } }; <>c.<>9__45_0 = val; obj = (object)val; } CharacterBody.AddMultiKill += (Manipulator)obj; } private static void ApplyBuffHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__46_0; if (obj == null) { hook_OnCharacterDeath val = delegate(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport) { //IL_0106: Unknown result type (might be due to invalid IL or missing references) orig.Invoke(self, damageReport); if (NetworkServer.active && damageReport != null && BaseBuffDuration.Value > 0f && Object.op_Implicit((Object)(object)damageReport.attacker) && Object.op_Implicit((Object)(object)damageReport.attackerBody)) { CharacterBody attackerBody = damageReport.attackerBody; if (Object.op_Implicit((Object)(object)attackerBody)) { Inventory inventory = attackerBody.inventory; if (Object.op_Implicit((Object)(object)inventory)) { int itemCountEffective = inventory.GetItemCountEffective(Items.WarCryOnMultiKill); if (itemCountEffective > 0) { float num = BaseBuffDuration.Value + StackBuffDuration.Value * (float)(itemCountEffective - 1); int num2 = BaseBuffCount.Value + StackBuffCount.Value * (itemCountEffective - 1); attackerBody.AddTimedBuff(MultiKillBuff, num, num2); if (BuffRefresh.Value) { ZetItemTweaksPlugin.RefreshTimedBuffStacks(attackerBody, MultiKillBuff.buffIndex, num); } } } } } }; <>c.<>9__46_0 = val; obj = (object)val; } GlobalEventManager.OnCharacterDeath += (hook_OnCharacterDeath)obj; } } public static class BisonSteak { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_OnCharacterDeath <>9__44_0; internal void <MeatRegenHook>b__44_0(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport) { orig.Invoke(self, damageReport); if (!NetworkServer.active || damageReport == null || !(BaseKillRegen.Value > 0f) || !(BaseBuffDuration.Value > 0f) || !Object.op_Implicit((Object)(object)damageReport.attacker) || !Object.op_Implicit((Object)(object)damageReport.attackerBody)) { return; } CharacterBody attackerBody = damageReport.attackerBody; if (!Object.op_Implicit((Object)(object)attackerBody)) { return; } Inventory inventory = attackerBody.inventory; if (Object.op_Implicit((Object)(object)inventory)) { int itemCountEffective = inventory.GetItemCountEffective(Items.FlatHealth); if (itemCountEffective > 0) { float num = BaseBuffDuration.Value + StackBuffDuration.Value * (float)(itemCountEffective - 1); attackerBody.AddTimedBuff(Buffs.MeatRegenBoost, num); } } } } public static List<string> autoCompatList = new List<string> { "com.RiskyLives.RiskyMod", "com.kking117.FlatItemBuff", "Hayaku.VanillaRebalance", "com.OkIGotIt.Fresh_Bison_Steak" }; public static string itemIdentifier = "BisonSteak"; public static bool appliedChanges = false; public static ConfigEntry<int> EnableChanges { get; set; } public static ConfigEntry<bool> OverrideText { get; set; } public static ConfigEntry<float> BaseHealth { get; set; } public static ConfigEntry<float> StackHealth { get; set; } public static ConfigEntry<bool> BuffStack { get; set; } public static ConfigEntry<float> BaseKillRegen { get; set; } public static ConfigEntry<float> StackKillRegen { get; set; } public static ConfigEntry<float> BaseBuffDuration { get; set; } public static ConfigEntry<float> StackBuffDuration { get; set; } internal static void Init() { SetupConfig(); if (EnableChanges.Value > 0) { ZetItemTweaksPlugin.OnLateSetup = (Action)Delegate.Combine(ZetItemTweaksPlugin.OnLateSetup, new Action(LateSetup)); } } private static void SetupConfig() { EnableChanges = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "EnableChanges", 1, ZetItemTweaksPlugin.SectionEnableDesc); if (ZetItemTweaksPlugin.GenerateOverrideText.Value) { OverrideText = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "OverrideText", defaultValue: true, "Replace item description text."); } BaseHealth = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseHealth", 25f, "Health gained from item."); StackHealth = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackHealth", 25f, "Health gained from item per stack."); BuffStack = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BuffStack", defaultValue: true, "Whether buff can stack."); BaseKillRegen = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseKillRegen", 2.4f, "Health regeneration gained from buff."); StackKillRegen = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackKillRegen", 0f, "Health regeneration gained from buff per item stack."); BaseBuffDuration = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseBuffDuration", 3f, "Regeneration buff duration."); StackBuffDuration = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackBuffDuration", 2f, "Regeneration buff duration per stack."); } private static void LateSetup() { if (ZetItemTweaksPlugin.ProceedChanges(itemIdentifier, EnableChanges.Value, autoCompatList)) { Buffs.MeatRegenBoost.canStack = BuffStack.Value; MeatRegenHook(); if (!ZetItemTweaksPlugin.GenerateOverrideText.Value || OverrideText.Value) { ZetItemTweaksPlugin.targetLanguage = "default"; ZetItemTweaksPlugin.RegisterFragment("REGEN_ON_KILL", "\nKilling an enemy increases <style=cIsHealing>health regeneration</style> by {0} for {1} seconds."); ZetItemTweaksPlugin.RegisterFragment("STEAK_PICKUP_HEALTHREGEN", "Increase max health. Boost regen on kill."); ZetItemTweaksPlugin.RegisterFragment("STEAK_PICKUP_HEALTH", "Increase max health."); ZetItemTweaksPlugin.RegisterFragment("STEAK_PICKUP_REGEN", "Boost regen on kill."); ZetItemTweaksPlugin.RegisterToken("ITEM_FLATHEALTH_DESC", DescriptionText()); ZetItemTweaksPlugin.RegisterToken("ITEM_FLATHEALTH_PICKUP", PickupText()); ZetItemTweaksPlugin.targetLanguage = "pt-BR"; ZetItemTweaksPlugin.RegisterFragment("REGEN_ON_KILL", "\nAbater um inimigo aumenta a <style=cIsHealing>regeneração de saúde</style> em {0} por {1} segundos."); ZetItemTweaksPlugin.RegisterFragment("STEAK_PICKUP_HEALTHREGEN", "Aumenta a saúde máxima. Concede um bônus de regeneração no abate."); ZetItemTweaksPlugin.RegisterFragment("STEAK_PICKUP_HEALTH", "Aumenta a saúde máxima."); ZetItemTweaksPlugin.RegisterFragment("STEAK_PICKUP_REGEN", "Concede um bônus de regeneração no abate."); ZetItemTweaksPlugin.RegisterToken("ITEM_FLATHEALTH_DESC", DescriptionText()); ZetItemTweaksPlugin.RegisterToken("ITEM_FLATHEALTH_PICKUP", PickupText()); ZetItemTweaksPlugin.targetLanguage = ""; } appliedChanges = true; } } private static string DescriptionText() { string text = ""; if (BaseHealth.Value > 0f) { text += string.Format(ZetItemTweaksPlugin.TextFragment("STAT_HEALTH", trim: true), ZetItemTweaksPlugin.ScalingText(BaseHealth.Value, StackHealth.Value, "flat", "cIsHealing")); } if (BaseKillRegen.Value > 0f && BaseBuffDuration.Value > 0f) { if (text != "") { text += "\n"; } text += string.Format(ZetItemTweaksPlugin.TextFragment("REGEN_ON_KILL", trim: true), ZetItemTweaksPlugin.ScalingText(BaseKillRegen.Value, StackKillRegen.Value, "flatregen", "cIsHealing"), ZetItemTweaksPlugin.ScalingText(BaseBuffDuration.Value, StackBuffDuration.Value, "flat", "cIsUtility")); } if (text == "") { text += ZetItemTweaksPlugin.TextFragment("CFG_NO_EFFECT"); } return text; } private static string PickupText() { bool flag = BaseKillRegen.Value > 0f && BaseBuffDuration.Value > 0f; if (BaseHealth.Value > 0f) { if (flag) { return ZetItemTweaksPlugin.TextFragment("STEAK_PICKUP_HEALTHREGEN"); } return ZetItemTweaksPlugin.TextFragment("STEAK_PICKUP_HEALTH"); } if (flag) { return ZetItemTweaksPlugin.TextFragment("STEAK_PICKUP_REGEN"); } return ZetItemTweaksPlugin.TextFragment("PICKUP_NO_EFFECT"); } private static void MeatRegenHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__44_0; if (obj == null) { hook_OnCharacterDeath val = delegate(orig_OnCharacterDeath orig, GlobalEventManager self, DamageReport damageReport) { orig.Invoke(self, damageReport); if (NetworkServer.active && damageReport != null && BaseKillRegen.Value > 0f && BaseBuffDuration.Value > 0f && Object.op_Implicit((Object)(object)damageReport.attacker) && Object.op_Implicit((Object)(object)damageReport.attackerBody)) { CharacterBody attackerBody = damageReport.attackerBody; if (Object.op_Implicit((Object)(object)attackerBody)) { Inventory inventory = attackerBody.inventory; if (Object.op_Implicit((Object)(object)inventory)) { int itemCountEffective = inventory.GetItemCountEffective(Items.FlatHealth); if (itemCountEffective > 0) { float num = BaseBuffDuration.Value + StackBuffDuration.Value * (float)(itemCountEffective - 1); attackerBody.AddTimedBuff(Buffs.MeatRegenBoost, num); } } } } }; <>c.<>9__44_0 = val; obj = (object)val; } GlobalEventManager.OnCharacterDeath += (hook_OnCharacterDeath)obj; } } public static class BlackMonolith { internal static Sprite PickupIcon; public static List<string> autoCompatList = new List<string>(); public static string itemIdentifier = "BlackMonolith"; public static bool appliedChanges = false; public static ConfigEntry<int> EnableChanges { get; set; } public static ConfigEntry<bool> RedTier { get; set; } internal static void Init() { SetupConfig(); if (EnableChanges.Value > 0) { ZetItemTweaksPlugin.OnItemCatalogPreInit = (Action)Delegate.Combine(ZetItemTweaksPlugin.OnItemCatalogPreInit, new Action(ModifyItem)); } } private static void SetupConfig() { EnableChanges = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "EnableChanges", 0, ZetItemTweaksPlugin.SectionEnableDesc); RedTier = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "RedTier", defaultValue: true, "Change item to red tier."); } private static void ModifyItem() { if (!ZetItemTweaksPlugin.ProceedChanges(itemIdentifier, EnableChanges.Value, "com.themysticsword.mysticsitems", (ZetItemTweaksPlugin.Feedback)13)) { return; } bool flag = false; ItemDef val = ZetItemTweaksPlugin.FindItemDefPreCatalogInit("MysticsItems_ExtraShrineUse"); if (!Object.op_Implicit((Object)(object)val)) { return; } if (RedTier.Value) { val._itemTierDef = LegacyResourcesAPI.Load<ItemTierDef>("ItemTierDefs/Tier3Def"); ZetItemTweaksPlugin.AssignDepricatedTier(val, (ItemTier)2); if (Object.op_Implicit((Object)(object)PickupIcon)) { val.pickupIconSprite = PickupIcon; } flag = true; } if (flag) { ZetItemTweaksPlugin.ModifiedItemDefCount++; ZetItemTweaksPlugin.AddTweakedItem(itemIdentifier); appliedChanges = true; } } } public static class BrainStalks { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static hook_OnExecute <>9__30_0; public static Func<Instruction, bool> <>9__31_1; public static Func<Instruction, bool> <>9__31_2; public static Func<Instruction, bool> <>9__31_3; public static Manipulator <>9__31_0; public static Func<Instruction, bool> <>9__32_1; public static Func<Instruction, bool> <>9__32_2; public static Func<Instruction, bool> <>9__32_3; public static Func<Instruction, bool> <>9__32_4; public static Func<int, float> <>9__32_5; public static Manipulator <>9__32_0; internal void <RestockHook>b__30_0(orig_OnExecute orig, SkillDef self, GenericSkill slot) { orig.Invoke(self, slot); if (!slot.beginSkillCooldownOnSkillEnd && slot.characterBody.HasBuff(Buffs.NoCooldowns) && Restock.Value) { slot.RestockSteplike(); } } internal void <FindIndexHook>b__31_0(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>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items).GetField("KillEliteFrenzy")), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref ItemCountLocIndex) })) { StlocCursorIndex = val.Index; } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: FindIndexHook Failed!"); } } internal bool <FindIndexHook>b__31_1(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, typeof(Items).GetField("KillEliteFrenzy")); } internal bool <FindIndexHook>b__31_2(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"); } internal bool <FindIndexHook>b__31_3(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, ref ItemCountLocIndex); } internal void <DurationHook>b__32_0(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.Index = StlocCursorIndex; if (val.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ItemCountLocIndex), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 4f), (Instruction x) => ILPatternMatchingExt.MatchMul(x) })) { val.Index += 4; val.Emit(OpCodes.Pop); val.Emit(OpCodes.Ldloc, ItemCountLocIndex); val.EmitDelegate<Func<int, float>>((Func<int, float>)((int count) => BaseDuration.Value + StackDuration.Value * (float)(count - 1))); } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: DurationHook Failed!"); } } internal bool <DurationHook>b__32_1(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, ItemCountLocIndex); } internal bool <DurationHook>b__32_2(Instruction x) { return ILPatternMatchingExt.MatchConvR4(x); } internal bool <DurationHook>b__32_3(Instruction x) { return ILPatternMatchingExt.MatchLdcR4(x, 4f); } internal bool <DurationHook>b__32_4(Instruction x) { return ILPatternMatchingExt.MatchMul(x); } internal float <DurationHook>b__32_5(int count) { return BaseDuration.Value + StackDuration.Value * (float)(count - 1); } } public static List<string> autoCompatList = new List<string>(); public static string itemIdentifier = "BrainStalks"; public static bool appliedChanges = false; public static bool appliedRestock = false; private static int ItemCountLocIndex = 0; private static int StlocCursorIndex = 0; public static ConfigEntry<int> EnableChanges { get; set; } public static ConfigEntry<bool> OverrideText { get; set; } public static ConfigEntry<bool> Restock { get; set; } public static ConfigEntry<float> BaseDuration { get; set; } public static ConfigEntry<float> StackDuration { get; set; } internal static void Init() { SetupConfig(); if (EnableChanges.Value > 0) { ZetItemTweaksPlugin.OnLateSetup = (Action)Delegate.Combine(ZetItemTweaksPlugin.OnLateSetup, new Action(LateSetup)); } } private static void SetupConfig() { EnableChanges = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "EnableChanges", 1, ZetItemTweaksPlugin.SectionEnableDesc); if (ZetItemTweaksPlugin.GenerateOverrideText.Value) { OverrideText = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "OverrideText", defaultValue: true, "Replace item description text."); } Restock = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "Restock", defaultValue: true, "Refund skill stock on use, bypassing 0.5 second cooldown."); BaseDuration = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseDuration", 4f, "Duration of buff gained from item."); StackDuration = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackDuration", 4f, "Duration of buff gained from item per stack."); } private static void LateSetup() { if (!ZetItemTweaksPlugin.ProceedChanges(itemIdentifier, EnableChanges.Value, autoCompatList)) { return; } bool flag = Restock.Value; if (flag && ZetItemTweaksPlugin.PluginLoaded("xyz.yekoc.SnapStalk")) { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: Restock Disabled because " + ZetItemTweaksPlugin.LastPluginChecked + " is installed!"); flag = false; } if (flag) { RestockHook(); appliedRestock = true; } FindIndexHook(); if (ItemCountLocIndex != 0) { DurationHook(); if (!ZetItemTweaksPlugin.GenerateOverrideText.Value || OverrideText.Value) { ZetItemTweaksPlugin.targetLanguage = "default"; ZetItemTweaksPlugin.RegisterFragment("BRAINSTALK_DURATION", "Upon killing an elite monster, <style=cIsDamage>enter a frenzy</style> for {0}"); ZetItemTweaksPlugin.RegisterFragment("BRAINSTALK_EFFECT", " where <style=cIsUtility>skills have no cooldowns</style>."); ZetItemTweaksPlugin.RegisterToken("ITEM_KILLELITEFRENZY_DESC", DescriptionText()); ZetItemTweaksPlugin.targetLanguage = "pt-BR"; ZetItemTweaksPlugin.RegisterFragment("BRAINSTALK_DURATION", "Ao abater um monstro de elite, <style=cIsDamage>entre em frenesi</style> por {0}"); ZetItemTweaksPlugin.RegisterFragment("BRAINSTALK_EFFECT", " em que <style=cIsUtility>as habilidades não têm tempo de recarga</style>."); ZetItemTweaksPlugin.RegisterToken("ITEM_KILLELITEFRENZY_DESC", DescriptionText()); ZetItemTweaksPlugin.targetLanguage = ""; } appliedChanges = true; } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: LateSetup Failed!"); } } private static string DescriptionText() { string text = string.Format(ZetItemTweaksPlugin.TextFragment("BRAINSTALK_DURATION", trim: true), ZetItemTweaksPlugin.ScalingText(BaseDuration.Value, StackDuration.Value, "duration", "cIsDamage")); return text + ZetItemTweaksPlugin.TextFragment("BRAINSTALK_EFFECT"); } private static void RestockHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__30_0; if (obj == null) { hook_OnExecute val = delegate(orig_OnExecute orig, SkillDef self, GenericSkill slot) { orig.Invoke(self, slot); if (!slot.beginSkillCooldownOnSkillEnd && slot.characterBody.HasBuff(Buffs.NoCooldowns) && Restock.Value) { slot.RestockSteplike(); } }; <>c.<>9__30_0 = val; obj = (object)val; } SkillDef.OnExecute += (hook_OnExecute)obj; } private static void FindIndexHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__31_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val2 = new ILCursor(il); if (val2.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items).GetField("KillEliteFrenzy")), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref ItemCountLocIndex) })) { StlocCursorIndex = val2.Index; } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: FindIndexHook Failed!"); } }; <>c.<>9__31_0 = val; obj = (object)val; } GlobalEventManager.OnCharacterDeath += (Manipulator)obj; } private static void DurationHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__32_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); val2.Index = StlocCursorIndex; if (val2.TryGotoNext(new Func<Instruction, bool>[4] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ItemCountLocIndex), (Instruction x) => ILPatternMatchingExt.MatchConvR4(x), (Instruction x) => ILPatternMatchingExt.MatchLdcR4(x, 4f), (Instruction x) => ILPatternMatchingExt.MatchMul(x) })) { val2.Index += 4; val2.Emit(OpCodes.Pop); val2.Emit(OpCodes.Ldloc, ItemCountLocIndex); val2.EmitDelegate<Func<int, float>>((Func<int, float>)((int count) => BaseDuration.Value + StackDuration.Value * (float)(count - 1))); } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: DurationHook Failed!"); } }; <>c.<>9__32_0 = val; obj = (object)val; } GlobalEventManager.OnCharacterDeath += (Manipulator)obj; } } public static class BrilliantBehemoth { [Serializable] [CompilerGenerated] private sealed class <>c { public static readonly <>c <>9 = new <>c(); public static Func<Instruction, bool> <>9__37_1; public static Func<Instruction, bool> <>9__37_2; public static Func<Instruction, bool> <>9__37_3; public static Manipulator <>9__37_0; public static Func<Instruction, bool> <>9__38_1; public static Func<DamageInfo, int, float> <>9__38_2; public static Manipulator <>9__38_0; public static Func<Instruction, bool> <>9__39_1; public static Func<int, float> <>9__39_2; public static Manipulator <>9__39_0; public static Func<Instruction, bool> <>9__40_1; public static Func<Instruction, bool> <>9__40_2; public static Func<Instruction, bool> <>9__40_3; public static Func<BlastAttack, BlastAttack> <>9__40_4; public static Manipulator <>9__40_0; internal void <FindIndexHook>b__37_0(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>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items).GetField("Behemoth")), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref ItemCountLocIndex) })) { StlocCursorIndex = val.Index; } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: FindIndexHook Failed!"); } } internal bool <FindIndexHook>b__37_1(Instruction x) { return ILPatternMatchingExt.MatchLdsfld(x, typeof(Items).GetField("Behemoth")); } internal bool <FindIndexHook>b__37_2(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"); } internal bool <FindIndexHook>b__37_3(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, ref ItemCountLocIndex); } internal void <RadiusHook>b__38_0(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) ILCursor val = new ILCursor(il); val.Index = StlocCursorIndex; if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ItemCountLocIndex + 1) })) { val.Index += 1; val.Emit(OpCodes.Ldarg, 1); val.Emit(OpCodes.Ldloc, ItemCountLocIndex); val.EmitDelegate<Func<DamageInfo, int, float>>((Func<DamageInfo, int, float>)delegate(DamageInfo damageInfo, int count) { float num = Mathf.Max(0.25f, damageInfo.procCoefficient); return (BaseRadius.Value + StackRadius.Value * (float)(count - 1)) * num; }); val.Emit(OpCodes.Stloc, ItemCountLocIndex + 1); } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: RadiusHook Failed!"); } } internal bool <RadiusHook>b__38_1(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, ItemCountLocIndex + 1); } internal float <RadiusHook>b__38_2(DamageInfo damageInfo, int count) { float num = Mathf.Max(0.25f, damageInfo.procCoefficient); return (BaseRadius.Value + StackRadius.Value * (float)(count - 1)) * num; } internal void <DamageHook>b__39_0(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0059: 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) ILCursor val = new ILCursor(il); val.Index = StlocCursorIndex; if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ItemCountLocIndex + 2) })) { val.Index += 1; val.Emit(OpCodes.Ldloc, ItemCountLocIndex); val.EmitDelegate<Func<int, float>>((Func<int, float>)((int count) => BaseDamage.Value + StackDamage.Value * (float)(count - 1))); val.Emit(OpCodes.Stloc, ItemCountLocIndex + 2); } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: DamageHook Failed!"); } } internal bool <DamageHook>b__39_1(Instruction x) { return ILPatternMatchingExt.MatchStloc(x, ItemCountLocIndex + 2); } internal float <DamageHook>b__39_2(int count) { return BaseDamage.Value + StackDamage.Value * (float)(count - 1); } internal void <FalloffHook>b__40_0(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); val.Index = StlocCursorIndex; if (val.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ItemCountLocIndex + 1), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, typeof(BlastAttack).GetField("radius")) })) { int index = val.Index; if (val.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(BlastAttack).GetMethod("Fire")) })) { int num = val.Index - index; if (num <= 50) { val.EmitDelegate<Func<BlastAttack, BlastAttack>>((Func<BlastAttack, BlastAttack>)delegate(BlastAttack blastAttack) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) int value = DamageFalloff.Value; if (value > 0 && value < 3) { blastAttack.falloffModel = (FalloffModel)value; } return blastAttack; }); } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: FalloffHook Failed! - BlastAttack.Fire Offset [" + num + "]"); } } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: FalloffHook Failed!"); } } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: FalloffHook:FindRadius Failed!"); } } internal bool <FalloffHook>b__40_1(Instruction x) { return ILPatternMatchingExt.MatchLdloc(x, ItemCountLocIndex + 1); } internal bool <FalloffHook>b__40_2(Instruction x) { return ILPatternMatchingExt.MatchStfld(x, typeof(BlastAttack).GetField("radius")); } internal bool <FalloffHook>b__40_3(Instruction x) { return ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(BlastAttack).GetMethod("Fire")); } internal BlastAttack <FalloffHook>b__40_4(BlastAttack blastAttack) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) int value = DamageFalloff.Value; if (value > 0 && value < 3) { blastAttack.falloffModel = (FalloffModel)value; } return blastAttack; } } public static List<string> autoCompatList = new List<string> { "com.RiskyLives.RiskyMod", "Hayaku.VanillaRebalance" }; public static string itemIdentifier = "BrilliantBehemoth"; public static bool appliedChanges = false; private static int ItemCountLocIndex = 0; private static int StlocCursorIndex = 0; public static ConfigEntry<int> EnableChanges { get; set; } public static ConfigEntry<bool> OverrideText { get; set; } public static ConfigEntry<float> BaseDamage { get; set; } public static ConfigEntry<float> StackDamage { get; set; } public static ConfigEntry<int> DamageFalloff { get; set; } public static ConfigEntry<float> BaseRadius { get; set; } public static ConfigEntry<float> StackRadius { get; set; } internal static void Init() { SetupConfig(); if (EnableChanges.Value > 0) { ZetItemTweaksPlugin.OnLateSetup = (Action)Delegate.Combine(ZetItemTweaksPlugin.OnLateSetup, new Action(LateSetup)); } } private static void SetupConfig() { EnableChanges = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "EnableChanges", 1, ZetItemTweaksPlugin.SectionEnableDesc); if (ZetItemTweaksPlugin.GenerateOverrideText.Value) { OverrideText = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "OverrideText", defaultValue: true, "Replace item description text."); } BaseDamage = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseDamage", 0.6f, "Explosion damage."); StackDamage = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackDamage", 0.2f, "Explosion damage per stack."); DamageFalloff = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "DamageFalloff", 1, "Explosion damage falloff. 0 = None, 1 = Linear, 2 = SweetSpot."); BaseRadius = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "BaseRadius", 5f, "Explosion radius."); StackRadius = ZetItemTweaksPlugin.ConfigEntry(itemIdentifier, "StackRadius", 2.5f, "Explosion radius per stack."); } private static void LateSetup() { if (!ZetItemTweaksPlugin.ProceedChanges(itemIdentifier, EnableChanges.Value, autoCompatList)) { return; } FindIndexHook(); if (ItemCountLocIndex != 0) { RadiusHook(); DamageHook(); FalloffHook(); if (!ZetItemTweaksPlugin.GenerateOverrideText.Value || OverrideText.Value) { ZetItemTweaksPlugin.targetLanguage = "default"; ZetItemTweaksPlugin.RegisterFragment("EXPLODE_ON_HIT", "Attacks <style=cIsDamage>explode</style> on hit in a {0} radius for {1} TOTAL damage."); ZetItemTweaksPlugin.RegisterToken("ITEM_BEHEMOTH_DESC", DescriptionText()); ZetItemTweaksPlugin.targetLanguage = "pt-BR"; ZetItemTweaksPlugin.RegisterFragment("EXPLODE_ON_HIT", "Ataques <style=cIsDamage>explodem</style> ao golpear em uma area de {0} que causa {1} de dano TOTAL."); ZetItemTweaksPlugin.RegisterToken("ITEM_BEHEMOTH_DESC", DescriptionText()); ZetItemTweaksPlugin.targetLanguage = ""; } appliedChanges = true; } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: LateSetup Failed!"); } } private static string DescriptionText() { return string.Format(ZetItemTweaksPlugin.TextFragment("EXPLODE_ON_HIT"), ZetItemTweaksPlugin.ScalingText(BaseRadius.Value, StackRadius.Value, "distance", "cIsDamage"), ZetItemTweaksPlugin.ScalingText(BaseDamage.Value, StackDamage.Value, "percent", "cIsDamage")); } private static void FindIndexHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__37_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val2 = new ILCursor(il); if (val2.TryGotoNext(new Func<Instruction, bool>[3] { (Instruction x) => ILPatternMatchingExt.MatchLdsfld(x, typeof(Items).GetField("Behemoth")), (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt<Inventory>(x, "GetItemCountEffective"), (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ref ItemCountLocIndex) })) { StlocCursorIndex = val2.Index; } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: FindIndexHook Failed!"); } }; <>c.<>9__37_0 = val; obj = (object)val; } GlobalEventManager.OnHitAllProcess += (Manipulator)obj; } private static void RadiusHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__38_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) ILCursor val2 = new ILCursor(il); val2.Index = StlocCursorIndex; if (val2.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ItemCountLocIndex + 1) })) { val2.Index += 1; val2.Emit(OpCodes.Ldarg, 1); val2.Emit(OpCodes.Ldloc, ItemCountLocIndex); val2.EmitDelegate<Func<DamageInfo, int, float>>((Func<DamageInfo, int, float>)delegate(DamageInfo damageInfo, int count) { float num = Mathf.Max(0.25f, damageInfo.procCoefficient); return (BaseRadius.Value + StackRadius.Value * (float)(count - 1)) * num; }); val2.Emit(OpCodes.Stloc, ItemCountLocIndex + 1); } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: RadiusHook Failed!"); } }; <>c.<>9__38_0 = val; obj = (object)val; } GlobalEventManager.OnHitAllProcess += (Manipulator)obj; } private static void DamageHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__39_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown //IL_0059: 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) ILCursor val2 = new ILCursor(il); val2.Index = StlocCursorIndex; if (val2.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchStloc(x, ItemCountLocIndex + 2) })) { val2.Index += 1; val2.Emit(OpCodes.Ldloc, ItemCountLocIndex); val2.EmitDelegate<Func<int, float>>((Func<int, float>)((int count) => BaseDamage.Value + StackDamage.Value * (float)(count - 1))); val2.Emit(OpCodes.Stloc, ItemCountLocIndex + 2); } else { ZetItemTweaksPlugin.LogWarn(itemIdentifier + " :: DamageHook Failed!"); } }; <>c.<>9__39_0 = val; obj = (object)val; } GlobalEventManager.OnHitAllProcess += (Manipulator)obj; } private static void FalloffHook() { //IL_0015: 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) //IL_0020: Expected O, but got Unknown object obj = <>c.<>9__40_0; if (obj == null) { Manipulator val = delegate(ILContext il) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Expected O, but got Unknown ILCursor val2 = new ILCursor(il); val2.Index = StlocCursorIndex; if (val2.TryGotoNext(new Func<Instruction, bool>[2] { (Instruction x) => ILPatternMatchingExt.MatchLdloc(x, ItemCountLocIndex + 1), (Instruction x) => ILPatternMatchingExt.MatchStfld(x, typeof(BlastAttack).GetField("radius")) })) { int index = val2.Index; if (val2.TryGotoNext(new Func<Instruction, bool>[1] { (Instruction x) => ILPatternMatchingExt.MatchCallOrCallvirt(x, (MethodBase)typeof(BlastAttack).GetMethod("Fire")) })) { int num = val2.Index - index; if (num <= 50) { val2.EmitDelegate<Func<BlastAttack, BlastAttack>>((Func<BlastAttack, BlastAttack>)delegate(BlastAttack blastAttack) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) int value = DamageFalloff.Value; if (value > 0 && value < 3) { blastAttack.falloffModel = (FalloffModel)value; } return blastAttack; }); } else {