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 Legacy of the Einherjar v0.1.37
plugins/LegacyOfTheEinherjar.dll
Decompiled 3 days ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; using LoE.AnimationHelpers; using LoE.Mage; using LoE.Paladin; using LoE.UI; using LoE.Warrior; using Microsoft.CodeAnalysis; using SoftReferenceableAssets; using TMPro; using UnityEngine; using UnityEngine.Animations; using UnityEngine.Audio; using UnityEngine.EventSystems; using UnityEngine.Events; using UnityEngine.Playables; using UnityEngine.Rendering; using UnityEngine.UI; using Valheim.SettingsGui; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyCompany("LegacyOfTheEinherjar")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.1.37.0")] [assembly: AssemblyInformationalVersion("0.1.37")] [assembly: AssemblyProduct("LegacyOfTheEinherjar")] [assembly: AssemblyTitle("LegacyOfTheEinherjar")] [assembly: AssemblyVersion("0.1.37.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace LoE { internal enum AffixId { Quick, Regenerating, Splitting, Armored, SplitFocus, Shielded, Berserking, Vampiric, EitrIgnition, Cursed, Fortified, LeechingAura, Resilient, Thorned, Summoner, Commander, Crippling, Sundering, Spellbreaker, SecondWind, MageHunter, Healer, Rejuvenator } internal static class Affixes { internal struct HitState { public float Health; public Character Attacker; public bool Active; } internal const string Key = "loe_affixes"; internal const string InfKey = "loe_infusions"; internal const string ChildKey = "loe_split_child"; internal const string Section = "7 - Elites"; internal static ConfigEntry<bool> Enabled; internal static ConfigEntry<bool> OnBosses; internal static ConfigEntry<bool> GuaranteedLoot; internal static ConfigEntry<float> Chance; internal static ConfigEntry<float> RareChance; internal static ConfigEntry<float> ExtraChance; internal static ConfigEntry<float> XpBonus; internal static ConfigEntry<float> EliteHealth; internal static ConfigEntry<float> EliteSize; internal static ConfigEntry<float> InfChance; internal static ConfigEntry<float> InfShare; internal static ConfigEntry<float> ChaosMin; internal static ConfigEntry<float> ChaosMax; internal static ConfigEntry<int> MaxAffixes; internal static readonly Dictionary<AffixId, ConfigEntry<bool>> Allowed = new Dictionary<AffixId, ConfigEntry<bool>>(); internal static readonly Dictionary<DmgType, ConfigEntry<bool>> InfAllowed = new Dictionary<DmgType, ConfigEntry<bool>>(); internal static ConfigEntry<float> QuickMove; internal static ConfigEntry<float> QuickAttack; internal static ConfigEntry<float> RegenPct; internal static ConfigEntry<float> RegenLowAt; internal static ConfigEntry<float> RegenLowPct; internal static ConfigEntry<float> ArmoredReduction; internal static ConfigEntry<float> ShieldedReduction; internal static ConfigEntry<float> BerserkMax; internal static ConfigEntry<float> BerserkAt; internal static ConfigEntry<float> VampiricPct; internal static ConfigEntry<float> IgniteFlat; internal static ConfigEntry<float> IgnitePct; internal static ConfigEntry<float> IgniteTime; internal static ConfigEntry<float> CursedHeal; internal static ConfigEntry<float> CursedTime; internal static ConfigEntry<float> FortifiedCap; internal static ConfigEntry<float> LeechPct; internal static ConfigEntry<float> LeechRange; internal static ConfigEntry<float> LeechAllyAt; internal static ConfigEntry<float> LeechAllyPct; internal static ConfigEntry<float> LeechAllyRange; internal static ConfigEntry<float> ResilientPct; internal static ConfigEntry<float> ThornedPct; internal static ConfigEntry<float> ThornedCap; internal static ConfigEntry<float> SummonEvery; internal static ConfigEntry<float> CommanderRange; internal static ConfigEntry<float> CommanderTaken; internal static ConfigEntry<float> CommanderDealt; internal static ConfigEntry<float> CrippleSlow; internal static ConfigEntry<float> CrippleMax; internal static ConfigEntry<float> CrippleTime; internal static ConfigEntry<float> SunderPct; internal static ConfigEntry<float> SunderMax; internal static ConfigEntry<float> SunderTime; internal static ConfigEntry<float> SpellbreakerPct; internal static ConfigEntry<float> SecondWindAt; internal static ConfigEntry<float> SecondWindHeal; internal static ConfigEntry<float> SecondWindHot; internal static ConfigEntry<float> SecondWindHotTime; internal static ConfigEntry<float> SecondWindLock; internal static ConfigEntry<float> HunterSpeed; internal static ConfigEntry<float> HunterTime; internal static ConfigEntry<float> HunterRange; internal static ConfigEntry<float> DotTime; internal static ConfigEntry<float> BleedTime; internal static ConfigEntry<float> HealerPct; internal static ConfigEntry<float> HealerEvery; internal static ConfigEntry<float> HealerRange; internal static ConfigEntry<float> RejuvPct; internal static ConfigEntry<float> RejuvTime; internal static ConfigEntry<float> RejuvEvery; internal static ConfigEntry<float> RejuvRange; internal static ConfigEntry<int> RejuvTargets; internal static ConfigEntry<int> SplitCount; internal static ConfigEntry<int> SplitStarDrop; internal static ConfigEntry<int> SummonCount; internal static ConfigEntry<int> SummonMax; internal static ConfigEntry<int> SummonStarDrop; internal static ConfigEntry<int> HunterMaxStacks; internal static readonly AffixId[] All = (AffixId[])Enum.GetValues(typeof(AffixId)); internal static readonly DmgType[] AllTypes = (DmgType[])Enum.GetValues(typeof(DmgType)); private static readonly Dictionary<string, AffixId[]> _parsed = new Dictionary<string, AffixId[]>(); private static readonly Dictionary<string, DmgType[]> _parsedInf = new Dictionary<string, DmgType[]>(); private static readonly AffixId[] None = new AffixId[0]; private static readonly DmgType[] NoInf = new DmgType[0]; private static readonly Dictionary<Character, List<Character>> _summons = new Dictionary<Character, List<Character>>(); private static readonly Dictionary<Character, float> _nextSummon = new Dictionary<Character, float>(); private static readonly Dictionary<Character, float> _nextHeal = new Dictionary<Character, float>(); private static readonly Dictionary<Character, float> _nextRejuv = new Dictionary<Character, float>(); private static List<Character> _commanders = new List<Character>(); private static float _commandersAt = -10f; private static readonly Dictionary<Character, float> _thornFrom = new Dictionary<Character, float>(); private static readonly Dictionary<Character, float> _thornUsed = new Dictionary<Character, float>(); private static readonly ConditionalWeakTable<StatusEffect, object> _shortened = new ConditionalWeakTable<StatusEffect, object>(); internal const string HunterRpc = "LoE_MageHunter"; internal static bool Active { get { if (Enabled != null && Enabled.Value) { return MonsterControl.Enabled; } return false; } } internal static void Bind(ConfigFile cfg) { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Expected O, but got Unknown //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Expected O, but got Unknown //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Expected O, but got Unknown //IL_03cd: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Expected O, but got Unknown //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_0409: Expected O, but got Unknown //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_0446: Expected O, but got Unknown //IL_066f: Unknown result type (might be due to invalid IL or missing references) //IL_0679: Expected O, but got Unknown //IL_06a1: Unknown result type (might be due to invalid IL or missing references) //IL_06ab: Expected O, but got Unknown //IL_06d3: Unknown result type (might be due to invalid IL or missing references) //IL_06dd: Expected O, but got Unknown //IL_08d1: Unknown result type (might be due to invalid IL or missing references) //IL_08db: Expected O, but got Unknown //IL_09c0: Unknown result type (might be due to invalid IL or missing references) //IL_09ca: Expected O, but got Unknown Enabled = cfg.Bind<bool>("7 - Elites", "Enabled", true, "Some monsters spawn as Elites with affixes and infusions (needs LoE's monster controller on)."); Chance = cfg.Bind<float>("7 - Elites", "Elite chance (percent)", 10f, new ConfigDescription("Chance for a monster to spawn as an Elite with an affix.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())); RareChance = cfg.Bind<float>("7 - Elites", "Rare Elite chance (percent)", 10f, new ConfigDescription("Chance for an Elite to be rare: it starts with 2 affixes and can get more (see Extra affix chance).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())); ExtraChance = cfg.Bind<float>("7 - Elites", "Extra affix chance (percent)", 25f, new ConfigDescription("Rare Elites and raid monsters: after their first 2 affixes, the chance of each more one, up to Most affixes.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())); MaxAffixes = cfg.Bind<int>("7 - Elites", "Most affixes", 3, new ConfigDescription("Most affixes one monster can have.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>())); OnBosses = cfg.Bind<bool>("7 - Elites", "Boss affixes", true, "Bosses can be Elites too, with the same chances as other monsters and any affix (except Splitting and Summoner, which would copy the boss)."); XpBonus = F("Elite EXP bonus (percent)", 25f, "Extra class EXP for killing an Elite (rounded up)."); EliteHealth = F("Elite health bonus (percent)", 25f, "Elites have this much more max health, on top of what their stars and the players nearby give (25 = x1.25). 0 = none."); EliteSize = F("Elite size bonus (percent)", 25f, "Elites are this much bigger on top of their stars' size (25 = x1.25), so they stand out. Not in dungeons, like stars' size, unless \"Size increase in dungeons\" (6 - Monsters) is on. 0 = none."); GuaranteedLoot = cfg.Bind<bool>("7 - Elites", "Guaranteed Epic Loot drop", true, "Only with Epic Loot installed: Elites always drop at least one Epic Loot magic item from their own loot table (any rarity), on top of Epic Loot's usual drop chance. Copies from Splitting don't. (Without Epic Loot, Elites always drop LoE gear instead: 20 - Loot.)"); AffixId[] all = All; foreach (AffixId affixId in all) { Allowed[affixId] = cfg.Bind<bool>("7 - Elites", $"Affix {affixId}", true, "Monsters can roll the " + Label(affixId) + " affix."); } InfChance = cfg.Bind<float>("7 - Elites", "Infusion chance (percent)", 100f, new ConfigDescription("Chance for an Elite to be infused with a damage type (Split Focus Elites get two). Only Elites are infused.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 100f), Array.Empty<object>())); InfShare = F("Infusion damage (percent of the hit)", 20f, "An infusion adds this share of each hit as its damage type. Fire burns, Poison poisons, Shadow withers and Blood bleeds over a few seconds; the rest hit at once. Chaos works differently (see below)."); ChaosMin = F("Chaos infusion: lowest hit (percent)", 80f, "Chaos-infused hits don't add damage: each hit deals a random share of its damage between the lowest and highest."); ChaosMax = F("Chaos infusion: highest hit (percent)", 140f, "The top of the Chaos range (80 to 140 averages about 10% more, with big swings)."); DmgType[] allTypes = AllTypes; foreach (DmgType dmgType in allTypes) { if (!NotInfusable(dmgType)) { InfAllowed[dmgType] = cfg.Bind<bool>("7 - Elites", $"Infusion {dmgType}", true, $"Elites can be {dmgType}-infused (never Holy for Undead or Frost for Surtlings)."); } } DotTime = F("Shadow infusion: seconds", 5f, "Shadow-infused hits deal their extra damage over this many seconds."); BleedTime = F("Blood infusion: seconds", 5f, "Blood-infused hits make you bleed: their extra damage over this many seconds."); QuickMove = F("Quick: move speed (percent)", 50f, "Quick monsters move this much faster."); QuickAttack = F("Quick: attack speed (percent)", 25f, "Quick monsters attack this much faster."); RegenPct = F("Regenerating: health per second (percent)", 2f, "Regenerating monsters heal this share of their max health every second."); RegenLowAt = F("Regenerating: low health (percent)", 30f, "Below this much health they heal faster..."); RegenLowPct = F("Regenerating: low health per second (percent)", 4f, "...this share of their max health every second."); SplitCount = cfg.Bind<int>("7 - Elites", "Splitting: monsters", 5, new ConfigDescription("Splitting monsters burst into this many copies of themselves when they die (the copies don't split again).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>())); SplitStarDrop = cfg.Bind<int>("7 - Elites", "Splitting: stars lower", 1, new ConfigDescription("The copies have this many fewer stars.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 10), Array.Empty<object>())); ArmoredReduction = cfg.Bind<float>("7 - Elites", "Armored: damage reduction (percent)", 33f, new ConfigDescription("Armored monsters take this much less damage.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 95f), Array.Empty<object>())); ShieldedReduction = F("Shielded: arrow damage reduction (percent)", 50f, "Shielded monsters take this much less damage from arrows, bolts and thrown weapons."); BerserkMax = F("Berserking: most extra damage (percent)", 40f, "Berserking monsters deal more damage the more hurt they are: none at full health, this much at the low health below."); BerserkAt = F("Berserking: full bonus at health (percent)", 10f, "...reached at this much health."); VampiricPct = F("Vampiric: healing (percent of damage dealt)", 20f, "Vampiric monsters heal for this share of the damage they deal."); IgniteFlat = F("Eitr Ignition: Eitr per second", 5f, "Hits from Eitr Ignition monsters burn this much of your Eitr every second..."); IgnitePct = F("Eitr Ignition: max Eitr per second (percent)", 2f, "...plus this share of your max Eitr every second..."); IgniteTime = F("Eitr Ignition: seconds", 10f, "...for this long (each hit starts it over)."); CursedHeal = F("Cursed: less healing (percent)", 50f, "Hits from Cursed monsters cut the healing you receive by this much..."); CursedTime = F("Cursed: seconds", 8f, "...for this long."); FortifiedCap = F("Fortified: most damage per hit (percent of max health)", 15f, "No single hit takes more than this share of a Fortified monster's max health (before its armor and resistances)."); LeechPct = F("Leeching Aura: drain per second (percent of player max health)", 1f, "Leeching Aura monsters drain this share of each nearby player's own max health every second, and heal for what they take."); LeechRange = F("Leeching Aura: range (m)", 15f, "How close players must be to be drained."); LeechAllyAt = F("Leeching Aura: drains allies below health (percent)", 50f, "Below this much health it also drains its own allies..."); LeechAllyPct = F("Leeching Aura: ally drain per second (percent of ally max health)", 2f, "...this share of each ally's max health every second..."); LeechAllyRange = F("Leeching Aura: ally range (m)", 25f, "...within this range, and heals for it."); ResilientPct = F("Resilient: shorter debuffs (percent)", 50f, "Debuffs on Resilient monsters last this much shorter."); ThornedPct = F("Thorned: damage reflected (percent)", 15f, "Thorned monsters reflect this share of the damage they take back at the attacker."); ThornedCap = F("Thorned: most reflected per second (percent of max health)", 20f, "However hard you hit a Thorned monster, it reflects at most this share of your own max health back at you per second, so bouncing or rapid spells can't kill you in one go. 0 = no limit."); SummonEvery = F("Summoner: seconds between summons", 30f, "While fighting, Summoners call in allies this often..."); SummonCount = cfg.Bind<int>("7 - Elites", "Summoner: allies per summon", 2, new ConfigDescription("...this many at a time...", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>())); SummonMax = cfg.Bind<int>("7 - Elites", "Summoner: most allies", 4, new ConfigDescription("...with at most this many alive at once...", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())); SummonStarDrop = cfg.Bind<int>("7 - Elites", "Summoner: stars lower", 2, new ConfigDescription("...each with this many fewer stars than the Summoner.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 20), Array.Empty<object>())); CommanderRange = F("Commander: aura range (m)", 20f, "Monsters within this range of a Commander (not the Commander itself)..."); CommanderTaken = F("Commander: allies take less damage (percent)", 20f, "...take this much less damage..."); CommanderDealt = F("Commander: allies deal more damage (percent)", 20f, "...and deal this much more."); CrippleSlow = F("Crippling: slow per hit (percent)", 25f, "Hits from Crippling monsters slow you by this much..."); CrippleMax = F("Crippling: most slow (percent)", 50f, "...stacking up to this much..."); CrippleTime = F("Crippling: seconds", 5f, "...for this long after the last hit."); SunderPct = F("Sundering: armor lost per hit (percent)", 10f, "Hits from Sundering monsters lower your armor by this much..."); SunderMax = F("Sundering: most armor lost (percent)", 100f, "...stacking up to this much..."); SunderTime = F("Sundering: seconds", 20f, "...for this long after the last hit."); SpellbreakerPct = F("Spellbreaker: magic damage reduction (percent)", 50f, "Spellbreakers take this much less damage from spells and staffs."); SecondWindAt = F("Second Wind: at health (percent)", 25f, "The first time a Second Wind monster drops to this much health..."); SecondWindHeal = F("Second Wind: instant heal (percent)", 30f, "...it heals this share of its max health at once..."); SecondWindHot = F("Second Wind: heal over time (percent)", 20f, "...and this share more over a few seconds..."); SecondWindHotTime = F("Second Wind: heal over time seconds", 5f, "...this many seconds..."); SecondWindLock = F("Second Wind: lockout (seconds)", 180f, "...and can't do it again for this long."); HunterSpeed = F("Mage Hunter: speed per spell (percent)", 10f, "Every spell cast within range of a Mage Hunter makes it this much faster..."); HunterTime = F("Mage Hunter: seconds", 10f, "...for this long (each spell starts it over)..."); HunterMaxStacks = cfg.Bind<int>("7 - Elites", "Mage Hunter: most stacks", 10, new ConfigDescription("...stacking up to this many times.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 50), Array.Empty<object>())); HunterRange = F("Mage Hunter: range (m)", 50f, "How close a spell has to be cast for a Mage Hunter to notice."); HealerPct = F("Healer: heal (percent of ally max health)", 40f, "Healers heal the most hurt ally nearby for this share of its max health (never themselves)..."); HealerEvery = F("Healer: seconds between heals", 8f, "...this often..."); HealerRange = F("Healer: range (m)", 30f, "...within this range."); RejuvPct = F("Rejuvenator: heal over time (percent of max health)", 20f, "Rejuvenators give allies a heal over time of this share of their max health..."); RejuvTime = F("Rejuvenator: heal over time seconds", 10f, "...over this many seconds..."); RejuvEvery = F("Rejuvenator: seconds between casts", 8f, "...casting it this often..."); RejuvTargets = cfg.Bind<int>("7 - Elites", "Rejuvenator: allies per cast", 3, new ConfigDescription("...on this many allies at a time (allies without it first, then refreshing it on others; never themselves)...", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>())); RejuvRange = F("Rejuvenator: range (m)", 30f, "...within this range."); GameData.AddStatusEffect<SE_LoE_Crippled>("LoE_Crippled", "Crippled", (Func<Sprite>)(() => Skin.Np("dmg_earth"))); GameData.AddStatusEffect<SE_LoE_Sundered>("LoE_Sundered", "Sundered", (Func<Sprite>)(() => Skin.Np("dmg_pierce"))); GameData.AddStatusEffect<SE_LoE_Cursed>("LoE_Cursed", "Cursed", (Func<Sprite>)(() => Skin.Np("dmg_necrotic"))); GameData.AddStatusEffect<SE_LoE_EitrBurn>("LoE_EitrBurn", "Eitr Ignition", (Func<Sprite>)(() => Skin.Np("dmg_arcane"))); GameData.AddStatusEffect<SE_LoE_Wither>("LoE_Wither", "Withering", (Func<Sprite>)(() => Skin.Np("dmg_shadow"))); GameData.AddStatusEffect<SE_LoE_Bleeding>("LoE_Bleeding", "Bleeding", (Func<Sprite>)(() => Skin.Np("dmg_blood"))); GameData.AddStatusEffect<SE_LoE_SecondWind>("LoE_SecondWind", "Second Wind", (Func<Sprite>)(() => Skin.Np("dmg_nature"))); GameData.AddStatusEffect<SE_LoE_Winded>("LoE_Winded", "Second Wind spent", (Func<Sprite>)(() => Skin.Np("dmg_wind"))); GameData.AddStatusEffect<SE_LoE_Hunting>("LoE_Hunting", "Hunting Mages", (Func<Sprite>)(() => Skin.Np("dmg_psychic"))); GameData.AddStatusEffect<SE_LoE_Commanded>("LoE_Commanded", "Commanded", (Func<Sprite>)(() => Skin.Np("dmg_sonic"))); GameData.AddStatusEffect<SE_LoE_Leeched>("LoE_Leeched", "Leeching Aura", (Func<Sprite>)(() => Skin.Np("dmg_necrotic"))); GameData.AddStatusEffect<SE_LoE_Quick>("LoE_Quick", "Quick", (Func<Sprite>)(() => Skin.Np("dmg_wind"))); GameData.AddStatusEffect<SE_LoE_Berserk>("LoE_Berserk", "Berserk", (Func<Sprite>)(() => Skin.Np("dmg_chaos"))); GameData.AddStatusEffect<SE_LoE_Rejuvenation>("LoE_Rejuvenation", "Rejuvenation", (Func<Sprite>)(() => Skin.Np("dmg_nature"))); ConfigEntry<float> F(string key, float def, string desc) { return cfg.Bind<float>("7 - Elites", key, def, desc); } } private static ZDO Zdo(Character c) { if ((Object)(object)c == (Object)null || c.IsPlayer()) { return null; } ZNetView component = ((Component)c).GetComponent<ZNetView>(); if (!((Object)(object)component != (Object)null) || !component.IsValid()) { return null; } return component.GetZDO(); } internal static AffixId[] Of(Character c) { ZDO val = Zdo(c); string text = ((val != null) ? val.GetString("loe_affixes", "") : ""); if (text.Length == 0) { return None; } if (_parsed.TryGetValue(text, out var value)) { return value; } List<AffixId> list = new List<AffixId>(); string[] array = text.Split(new char[1] { ',' }); for (int i = 0; i < array.Length; i++) { if (Enum.TryParse<AffixId>(array[i].Trim(), out var result) && !list.Contains(result)) { list.Add(result); } } return _parsed[text] = list.ToArray(); } internal static DmgType[] InfusionsOf(Character c) { ZDO val = Zdo(c); string text = ((val != null) ? val.GetString("loe_infusions", "") : ""); if (text.Length == 0) { return NoInf; } if (_parsedInf.TryGetValue(text, out var value)) { return value; } List<DmgType> list = new List<DmgType>(); string[] array = text.Split(new char[1] { ',' }); foreach (string text2 in array) { if (Enum.TryParse<DmgType>((text2.Trim() == "Bleed") ? "Blood" : text2.Trim(), out var result) && !NotInfusable(result) && !list.Contains(result)) { list.Add(result); } } return _parsedInf[text] = list.ToArray(); } internal static bool Has(Character c, AffixId a) { return Array.IndexOf(Of(c), a) >= 0; } internal static bool IsElite(Character c) { return Of(c).Length != 0; } internal static string Label(AffixId a) { return a switch { AffixId.SplitFocus => "Split Focus", AffixId.EitrIgnition => "Eitr Ignition", AffixId.LeechingAura => "Leeching Aura", AffixId.SecondWind => "Second Wind", AffixId.MageHunter => "Mage Hunter", _ => a.ToString(), }; } internal static Color ColorOf(AffixId a) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) return (Color)(a switch { AffixId.Quick => new Color(1f, 0.45f, 1f), AffixId.Regenerating => new Color(0.45f, 1f, 0.45f), AffixId.Splitting => new Color(0.92f, 0.92f, 0.92f), AffixId.Armored => new Color(0.5f, 0.7f, 1f), AffixId.SplitFocus => new Color(1f, 0.85f, 0.4f), AffixId.Shielded => new Color(0.7f, 0.8f, 0.9f), AffixId.Berserking => new Color(1f, 0.3f, 0.2f), AffixId.Vampiric => new Color(0.85f, 0.1f, 0.25f), AffixId.EitrIgnition => new Color(0.3f, 0.75f, 1f), AffixId.Cursed => new Color(0.6f, 0.4f, 0.75f), AffixId.Fortified => new Color(0.75f, 0.65f, 0.5f), AffixId.LeechingAura => new Color(0.55f, 0.25f, 0.65f), AffixId.Resilient => new Color(0.9f, 0.75f, 0.5f), AffixId.Thorned => new Color(0.55f, 0.75f, 0.3f), AffixId.Summoner => new Color(0.75f, 0.55f, 1f), AffixId.Commander => new Color(1f, 0.65f, 0.2f), AffixId.Crippling => new Color(0.65f, 0.5f, 0.35f), AffixId.Sundering => new Color(0.85f, 0.55f, 0.45f), AffixId.Spellbreaker => new Color(0.5f, 0.9f, 0.95f), AffixId.SecondWind => new Color(0.6f, 1f, 0.8f), AffixId.MageHunter => new Color(0.95f, 0.45f, 0.55f), AffixId.Healer => new Color(0.4f, 1f, 0.55f), AffixId.Rejuvenator => new Color(0.6f, 0.95f, 0.35f), _ => Color.white, }); } internal static Color ColorOf(DmgType t) { //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: 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_0079: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_010c: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0175: Unknown result type (might be due to invalid IL or missing references) //IL_0160: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) return (Color)(t switch { DmgType.Fire => new Color(1f, 0.5f, 0.15f), DmgType.Frost => new Color(0.55f, 0.9f, 1f), DmgType.Lightning => new Color(0.75f, 0.7f, 1f), DmgType.Poison => new Color(0.55f, 0.85f, 0.25f), DmgType.Spirit => new Color(0.85f, 0.95f, 1f), DmgType.Holy => new Color(1f, 0.92f, 0.55f), DmgType.Shadow => new Color(0.6f, 0.45f, 0.8f), DmgType.Arcane => new Color(0.45f, 0.65f, 1f), DmgType.Nature => new Color(0.45f, 0.85f, 0.4f), DmgType.Chaos => new Color(0.95f, 0.3f, 0.6f), DmgType.Blood => new Color(0.9f, 0.15f, 0.15f), DmgType.Necrotic => new Color(0.55f, 0.7f, 0.5f), DmgType.Water => new Color(0.35f, 0.6f, 0.95f), DmgType.Wind => new Color(0.8f, 0.95f, 0.9f), DmgType.Earth => new Color(0.7f, 0.55f, 0.35f), DmgType.Sonic => new Color(0.95f, 0.85f, 0.95f), DmgType.Psychic => new Color(0.9f, 0.5f, 0.95f), _ => new Color(0.85f, 0.85f, 0.85f), }); } internal static void Roll(Character c, ZDO zdo, bool raid) { if (!Active || zdo.GetBool("loe_split_child", false) || c.IsTamed() || IsPassive(c) || zdo.GetString("loe_affixes", "").Length > 0 || (c.IsBoss() && !OnBosses.Value) || Random.value * 100f >= Chance.Value) { return; } int i = 1; if (raid || Random.value * 100f < RareChance.Value) { for (i = 2; i < MaxAffixes.Value; i++) { if (!(Random.value * 100f < ExtraChance.Value)) { break; } } } List<AffixId> list = new List<AffixId>(); AffixId[] all = All; foreach (AffixId affixId in all) { if (Allowed[affixId].Value && CanHave(c, affixId)) { list.Add(affixId); } } List<AffixId> list2 = new List<AffixId>(); for (int k = 0; k < Mathf.Min(i, MaxAffixes.Value); k++) { if (list.Count <= 0) { break; } int index = Random.Range(0, list.Count); list2.Add(list[index]); list.RemoveAt(index); } if (list2.Count != 0) { zdo.Set("loe_affixes", Join(list2)); if (zdo.GetString("loe_infusions", "").Length == 0 && Random.value * 100f < InfChance.Value) { RollInfusions(c, zdo, (!list2.Contains(AffixId.SplitFocus)) ? 1 : 2); } } } internal static bool IsPassive(Character c) { if ((Object)(object)c != (Object)null) { return (Object)(object)((Component)c).GetComponent<AnimalAI>() != (Object)null; } return false; } internal static void RollInfusions(Character c, ZDO zdo, int count) { List<DmgType> list = new List<DmgType>(InfusionsAllowed(c)); DmgType[] array = InfusionsOf(c); foreach (DmgType item in array) { list.Remove(item); } List<DmgType> list2 = new List<DmgType>(InfusionsOf(c)); for (int j = 0; j < count; j++) { if (list.Count <= 0) { break; } int index = Random.Range(0, list.Count); list2.Add(list[index]); list.RemoveAt(index); } if (list2.Count > 0) { zdo.Set("loe_infusions", Join(list2)); } } internal static bool IsPhysical(DmgType t) { if (t != DmgType.Slash && t != DmgType.Pierce) { return t == DmgType.Blunt; } return true; } internal static bool NotInfusable(DmgType t) { if (!IsPhysical(t) && t != DmgType.True) { return Retired(t); } return true; } internal static bool Retired(DmgType t) { if (t != DmgType.Wind && t != DmgType.Water && t != DmgType.Sonic) { return t == DmgType.Psychic; } return true; } internal static List<DmgType> InfusionsAllowed(Character c) { List<DmgType> list = new List<DmgType>(); string text = MonsterInfo.FamilyOf(c); string text2 = (((Object)(object)c != (Object)null) ? Utils.GetPrefabName(((Component)c).gameObject) : ""); DmgType[] allTypes = AllTypes; foreach (DmgType dmgType in allTypes) { if (!NotInfusable(dmgType) && InfAllowed.TryGetValue(dmgType, out var value) && value.Value && (dmgType != DmgType.Holy || !(text == "Undead")) && (dmgType != DmgType.Frost || !text2.StartsWith("Surtling", StringComparison.OrdinalIgnoreCase))) { list.Add(dmgType); } } return list; } private static string Join<T>(IEnumerable<T> list) { List<string> list2 = new List<string>(); foreach (T item in list) { list2.Add(item.ToString()); } return string.Join(",", list2); } private static bool CanHave(Character c, AffixId a) { if (a == AffixId.Splitting || a == AffixId.Summoner) { return !c.IsBoss(); } return true; } internal static string GlossaryText() { //IL_00ef: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("<size=115%><color=#e8c870><b>Elites</b></color></size>\n"); stringBuilder.Append(N(Chance) + "% of monsters spawn as Elites with an affix. " + N(RareChance) + "% of Elites are rare and start with 2 affixes, sometimes more (up to " + I(MaxAffixes) + "). "); stringBuilder.Append("Elites are " + N(EliteSize) + "% bigger, have " + N(EliteHealth) + "% more health, give " + N(XpBonus) + "% more class EXP and drop better loot. Their nameplate shows their affixes."); if (!Active) { stringBuilder.Append(" <color=#d07060>Elites are turned off on this server.</color>"); } stringBuilder.Append("\n\n<size=115%><color=#e8c870><b>Affixes</b></color></size>\n"); AffixId[] all = All; foreach (AffixId affixId in all) { string text = ColorUtility.ToHtmlStringRGB(ColorOf(affixId)); stringBuilder.Append("<color=#" + text + "><b>" + Label(affixId) + "</b></color>"); if (Allowed.TryGetValue(affixId, out var value) && !value.Value) { stringBuilder.Append(" <color=#a09080>(turned off)</color>"); } stringBuilder.Append(": ").Append(Describe(affixId, N, I)).Append("\n\n"); } stringBuilder.Append("<size=115%><color=#e8c870><b>Infusions</b></color></size>\n"); stringBuilder.Append(N(InfChance) + "% of Elites are infused with a damage type (Split Focus Elites with two), shown on their nameplate. Each of their hits adds " + N(InfShare) + "% of its damage as that type:\n"); List<string> list = new List<string>(); DmgType[] allTypes = AllTypes; for (int i = 0; i < allTypes.Length; i++) { DmgType dmgType = allTypes[i]; if (!NotInfusable(dmgType) && dmgType != DmgType.Fire && dmgType != DmgType.Poison && dmgType != DmgType.Shadow && dmgType != DmgType.Blood && dmgType != DmgType.Chaos) { list.Add(dmgType.ToString()); } } stringBuilder.Append("- <b>Fire</b> burns and <b>Poison</b> poisons you over a few seconds.\n"); stringBuilder.Append("- <b>Shadow</b> withers you over " + N(DotTime) + " s and <b>Blood</b> makes you bleed over " + N(BleedTime) + " s.\n"); stringBuilder.Append("- " + string.Join(", ", list) + " hit at once.\n"); stringBuilder.Append("- <b>Chaos</b> adds nothing: instead each hit deals a random " + N(ChaosMin) + "% to " + N(ChaosMax) + "% of its damage.\n"); stringBuilder.Append("Undead are never Holy-infused and Surtlings never Frost-infused."); return stringBuilder.ToString(); static string I(ConfigEntry<int> e) { if (e == null) { return "?"; } return e.Value.ToString(); } static string N(ConfigEntry<float> e) { if (e == null) { return "?"; } return e.Value.ToString("0.#", CultureInfo.InvariantCulture); } } private static string Describe(AffixId a, Func<ConfigEntry<float>, string> N, Func<ConfigEntry<int>, string> I) { return a switch { AffixId.Quick => "moves " + N(QuickMove) + "% faster and attacks " + N(QuickAttack) + "% faster.", AffixId.Regenerating => "heals " + N(RegenPct) + "% of its max health every second, " + N(RegenLowPct) + "% below " + N(RegenLowAt) + "% health.", AffixId.Splitting => "bursts into " + I(SplitCount) + " copies of itself when it dies, each " + I(SplitStarDrop) + " star(s) lower. The copies don't split again.", AffixId.Armored => "takes " + N(ArmoredReduction) + "% less damage.", AffixId.SplitFocus => "is infused with two damage types instead of one.", AffixId.Shielded => "takes " + N(ShieldedReduction) + "% less damage from arrows, bolts and thrown weapons.", AffixId.Berserking => "deals more damage the more hurt it is, up to " + N(BerserkMax) + "% more at " + N(BerserkAt) + "% health.", AffixId.Vampiric => "heals for " + N(VampiricPct) + "% of the damage it deals.", AffixId.EitrIgnition => "its hits burn " + N(IgniteFlat) + " of your Eitr plus " + N(IgnitePct) + "% of your max Eitr every second for " + N(IgniteTime) + " s (each hit starts it over).", AffixId.Cursed => "its hits cut the healing you receive by " + N(CursedHeal) + "% for " + N(CursedTime) + " s.", AffixId.Fortified => "no single hit takes more than " + N(FortifiedCap) + "% of its max health.", AffixId.LeechingAura => "drains " + N(LeechPct) + "% of the max health of every player within " + N(LeechRange) + " m each second and heals for it. Below " + N(LeechAllyAt) + "% health it also drains its allies within " + N(LeechAllyRange) + " m (" + N(LeechAllyPct) + "% of their max health a second).", AffixId.Resilient => "debuffs on it last " + N(ResilientPct) + "% shorter.", AffixId.Thorned => "reflects " + N(ThornedPct) + "% of the damage it takes back at the attacker" + ((ThornedCap != null && ThornedCap.Value > 0f) ? (", at most " + N(ThornedCap) + "% of your max health per second from all Thorned monsters together.") : "."), AffixId.Summoner => "while fighting, calls in " + I(SummonCount) + " allies every " + N(SummonEvery) + " s (at most " + I(SummonMax) + " alive), each " + I(SummonStarDrop) + " star(s) lower.", AffixId.Commander => "monsters within " + N(CommanderRange) + " m of it take " + N(CommanderTaken) + "% less damage and deal " + N(CommanderDealt) + "% more.", AffixId.Crippling => "each hit slows you " + N(CrippleSlow) + "%, stacking up to " + N(CrippleMax) + "%, until " + N(CrippleTime) + " s after the last hit.", AffixId.Sundering => "each hit lowers your armor " + N(SunderPct) + "%, stacking up to " + N(SunderMax) + "%, until " + N(SunderTime) + " s after the last hit.", AffixId.Spellbreaker => "takes " + N(SpellbreakerPct) + "% less damage from spells and staffs.", AffixId.SecondWind => "the first time it drops to " + N(SecondWindAt) + "% health, it heals " + N(SecondWindHeal) + "% of its max health at once and " + N(SecondWindHot) + "% more over " + N(SecondWindHotTime) + " s. It can't do it again for " + N(SecondWindLock) + " s.", AffixId.MageHunter => "every spell cast within " + N(HunterRange) + " m makes it " + N(HunterSpeed) + "% faster for " + N(HunterTime) + " s, stacking up to " + I(HunterMaxStacks) + " times.", AffixId.Healer => "every " + N(HealerEvery) + " s, heals the most hurt ally within " + N(HealerRange) + " m for " + N(HealerPct) + "% of its max health (never itself).", AffixId.Rejuvenator => "every " + N(RejuvEvery) + " s, gives " + I(RejuvTargets) + " allies within " + N(RejuvRange) + " m a heal over time of " + N(RejuvPct) + "% of their max health over " + N(RejuvTime) + " s (never itself).", _ => "", }; } internal static void SpawnCommand(ConsoleEventArgs args) { //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0260: Unknown result type (might be due to invalid IL or missing references) //IL_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_0274: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) Terminal context = args.Context; string[] args2 = args.Args; if (args2.Length >= 2 && args2[1].ToLowerInvariant() == "list") { if (context != null) { context.AddString("Affixes: " + string.Join(", ", Names(All))); } List<string> list = new List<string>(); DmgType[] allTypes = AllTypes; for (int i = 0; i < allTypes.Length; i++) { DmgType t = allTypes[i]; if (!NotInfusable(t)) { list.Add(t.ToString()); } } if (context != null) { context.AddString("Infusions: " + string.Join(", ", list)); } return; } Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || (Object)(object)ZNetScene.instance == (Object)null) { return; } if (args2.Length < 3) { if (context != null) { context.AddString("Usage: loe_elite <monster> <affix> [more affixes] [stars] [infusions] (loe_elite list for names), e.g. loe_elite Greydwarf Thorned 20"); } return; } GameObject prefab = ZNetScene.instance.GetPrefab(args2[1]); if ((Object)(object)prefab == (Object)null || (Object)(object)prefab.GetComponent<Character>() == (Object)null) { if (context != null) { context.AddString("No monster called \"" + args2[1] + "\" (use the spawn name, e.g. Greydwarf, Troll, Draugr_Elite)."); } return; } List<AffixId> list2 = new List<AffixId>(); List<DmgType> list3 = new List<DmgType>(); int num = -1; for (int j = 2; j < args2.Length; j++) { string text = args2[j].Replace(",", "").Trim(); if (text.Length == 0) { continue; } AffixId result2; DmgType result3; if (int.TryParse(text, out var result)) { num = Mathf.Max(0, result); } else if (Enum.TryParse<AffixId>(text, ignoreCase: true, out result2) && Enum.IsDefined(typeof(AffixId), result2)) { if (!list2.Contains(result2)) { list2.Add(result2); } } else if (Enum.TryParse<DmgType>(text, ignoreCase: true, out result3) && Enum.IsDefined(typeof(DmgType), result3) && !NotInfusable(result3)) { if (!list3.Contains(result3)) { list3.Add(result3); } } else if (context != null) { context.AddString("\"" + text + "\" isn't an affix, an infusion or a star count; skipped (loe_elite list for names)."); } } if (list2.Count == 0) { if (context != null) { context.AddString("Name at least one affix (loe_elite list for names)."); } return; } Vector3 val = ((Component)localPlayer).transform.position + ((Component)localPlayer).transform.forward * 5f + Vector3.up; GameObject obj = Object.Instantiate<GameObject>(prefab, val, Quaternion.LookRotation(-((Component)localPlayer).transform.forward)); Character component = obj.GetComponent<Character>(); ZNetView component2 = obj.GetComponent<ZNetView>(); if ((Object)(object)component2 != (Object)null && component2.IsValid()) { component2.GetZDO().Set("loe_affixes", Join(list2)); if (list3.Count > 0) { component2.GetZDO().Set("loe_infusions", Join(list3)); } } ((MonoBehaviour)Plugin.Instance).StartCoroutine(FinishSpawn(component, list2, list3, num)); if (context != null) { context.AddString("Spawned " + ((Object)prefab).name + " as an Elite: " + string.Join(", ", Names(list2.ToArray())) + ((list3.Count > 0) ? (", infused with " + string.Join(", ", Names(list3.ToArray()))) : "") + ((num >= 0) ? $", {num} stars." : ".")); } } private static string[] Names<T>(T[] list) { string[] array = new string[list.Length]; for (int i = 0; i < list.Length; i++) { array[i] = list[i].ToString(); } return array; } private static IEnumerator FinishSpawn(Character c, List<AffixId> affixes, List<DmgType> infusions, int stars) { yield return null; yield return (object)new WaitForSeconds(0.3f); if (!((Object)(object)c == (Object)null)) { ZNetView component = ((Component)c).GetComponent<ZNetView>(); if (!((Object)(object)component == (Object)null) && component.IsValid() && component.IsOwner()) { component.GetZDO().Set("loe_affixes", Join(affixes)); component.GetZDO().Set("loe_infusions", (infusions.Count > 0) ? Join(infusions) : ""); c.SetLevel((stars >= 0) ? (stars + 1) : c.GetLevel()); c.SetHealth(c.GetMaxHealth()); } } } internal static AffixId[] Add(Character c, IEnumerable<AffixId> add) { ZNetView val = (((Object)(object)c != (Object)null) ? ((Component)c).GetComponent<ZNetView>() : null); if ((Object)(object)val == (Object)null || !val.IsValid() || !val.IsOwner()) { return Of(c); } List<AffixId> list = new List<AffixId>(Of(c)); foreach (AffixId item in add) { if (!list.Contains(item)) { list.Add(item); } } val.GetZDO().Set("loe_affixes", Join(list)); return Of(c); } internal static DmgType[] AddInfusions(Character c, IEnumerable<DmgType> add) { ZNetView val = (((Object)(object)c != (Object)null) ? ((Component)c).GetComponent<ZNetView>() : null); if ((Object)(object)val == (Object)null || !val.IsValid() || !val.IsOwner()) { return InfusionsOf(c); } List<DmgType> list = new List<DmgType>(InfusionsOf(c)); foreach (DmgType item in add) { if (!NotInfusable(item) && !list.Contains(item)) { list.Add(item); } } val.GetZDO().Set("loe_infusions", Join(list)); return InfusionsOf(c); } internal static void Tick(Character c) { if (!Active || (Object)(object)c == (Object)null || c.IsDead()) { return; } ZNetView component = ((Component)c).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid() || !component.IsOwner()) { return; } if (!c.IsPlayer() && NearCommander(c)) { ShowCommanded(c); } AffixId[] array = Of(c); if (array.Length == 0) { return; } if (Array.IndexOf(array, AffixId.Regenerating) >= 0) { float maxHealth = c.GetMaxHealth(); float health = c.GetHealth(); if (health < maxHealth) { float num = ((health / maxHealth * 100f < RegenLowAt.Value) ? RegenLowPct.Value : RegenPct.Value); c.Heal(maxHealth * num / 100f, false); } } if (Array.IndexOf(array, AffixId.Quick) >= 0) { Keep(c, SE_LoE_Quick.Hash); } if (Array.IndexOf(array, AffixId.Berserking) >= 0) { UpdateBerserk(c); } if (Array.IndexOf(array, AffixId.LeechingAura) >= 0) { Leech(c); } if (Array.IndexOf(array, AffixId.Summoner) >= 0) { Summon(c); } if (Array.IndexOf(array, AffixId.Healer) >= 0) { HealAlly(c); } if (Array.IndexOf(array, AffixId.Rejuvenator) >= 0) { Rejuvenate(c); } } private static List<Character> AlliesNear(Character c, float range) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) List<Character> list = new List<Character>(); float num = range * range; Vector3 position = ((Component)c).transform.position; foreach (Character allCharacter in Character.GetAllCharacters()) { if ((Object)(object)allCharacter == (Object)null || (Object)(object)allCharacter == (Object)(object)c || allCharacter.IsPlayer() || allCharacter.IsDead() || allCharacter.IsTamed() || allCharacter.IsBoss() || IsPassive(allCharacter)) { continue; } Vector3 val = ((Component)allCharacter).transform.position - position; if (!(((Vector3)(ref val)).sqrMagnitude > num)) { bool flag = false; try { flag = BaseAI.IsEnemy(c, allCharacter); } catch { } if (!flag) { list.Add(allCharacter); } } } return list; } private static float HealthFrac(Character o) { if (!(o.GetMaxHealth() > 0f)) { return 1f; } return o.GetHealth() / o.GetMaxHealth(); } private static void TidyTimers(Dictionary<Character, float> d) { if (d.Count < 64) { return; } List<Character> list = new List<Character>(); foreach (KeyValuePair<Character, float> item in d) { if ((Object)(object)item.Key == (Object)null) { list.Add(item.Key); } } foreach (Character item2 in list) { d.Remove(item2); } } private static void HealAlly(Character c) { //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) if (_nextHeal.TryGetValue(c, out var value) && Time.time < value) { return; } Character val = null; float num = 0.99f; foreach (Character item in AlliesNear(c, HealerRange.Value)) { float num2 = HealthFrac(item); if (num2 < num) { num = num2; val = item; } } if (!((Object)(object)val == (Object)null)) { TidyTimers(_nextHeal); _nextHeal[c] = Time.time + Mathf.Max(1f, HealerEvery.Value); val.Heal(val.GetMaxHealth() * HealerPct.Value / 100f, true); Fx.PlayEveryone(((Component)val).transform.position, "vfx_HealthUpgrade", "vfx_Potion_health_medium"); Fx.PlayEveryone(((Component)c).transform.position + Vector3.up, "vfx_Potion_health_minor", "vfx_Potion_health_medium"); } } private static void Rejuvenate(Character c) { //IL_00e0: Unknown result type (might be due to invalid IL or missing references) if (_nextRejuv.TryGetValue(c, out var value) && Time.time < value) { return; } List<Character> list = AlliesNear(c, RejuvRange.Value); if (list.Count != 0) { list.Sort(delegate(Character a, Character b) { bool flag = a.GetSEMan().HaveStatusEffect(SE_LoE_Rejuvenation.Hash); bool flag2 = b.GetSEMan().HaveStatusEffect(SE_LoE_Rejuvenation.Hash); return (flag != flag2) ? (flag ? 1 : (-1)) : HealthFrac(a).CompareTo(HealthFrac(b)); }); TidyTimers(_nextRejuv); _nextRejuv[c] = Time.time + Mathf.Max(1f, RejuvEvery.Value); int num = Mathf.Min(Mathf.Max(1, RejuvTargets.Value), list.Count); for (int num2 = 0; num2 < num; num2++) { list[num2].GetSEMan().AddStatusEffect(SE_LoE_Rejuvenation.Hash, true, 0, Mathf.Max(1f, RejuvTime.Value), (short)(-1)); Fx.PlayEveryone(((Component)list[num2]).transform.position, "vfx_Potion_health_minor", "vfx_HealthUpgrade"); } } } private static void ShowCommanded(Character c) { SEMan sEMan = c.GetSEMan(); if (sEMan != null) { StatusEffect statusEffect = sEMan.GetStatusEffect(SE_LoE_Commanded.Hash); if ((Object)(object)statusEffect != (Object)null) { statusEffect.ResetTime(); } else { sEMan.AddStatusEffect(SE_LoE_Commanded.Hash, true, 0, 0f, (short)(-1)); } } } private static void Keep(Character c, int hash) { SEMan sEMan = c.GetSEMan(); if (sEMan != null && !sEMan.HaveStatusEffect(hash)) { sEMan.AddStatusEffect(hash, false, 0, 0f, (short)(-1)); } } internal static float BerserkBonus(Character c) { float num = ((c.GetMaxHealth() > 0f) ? (c.GetHealth() / c.GetMaxHealth()) : 1f); float num2 = Mathf.InverseLerp(1f, Mathf.Clamp01(BerserkAt.Value / 100f), num); return BerserkMax.Value * num2; } private static void UpdateBerserk(Character c) { SEMan sEMan = c.GetSEMan(); if (sEMan == null) { return; } float num = BerserkBonus(c); StatusEffect val = sEMan.GetStatusEffect(SE_LoE_Berserk.Hash); if (num < 1f) { if ((Object)(object)val != (Object)null) { sEMan.RemoveStatusEffect(SE_LoE_Berserk.Hash, true); } return; } if ((Object)(object)val == (Object)null) { val = sEMan.AddStatusEffect(SE_LoE_Berserk.Hash, false, 0, 0f, (short)(-1)); } if (val is SE_LoE_Berserk sE_LoE_Berserk) { sE_LoE_Berserk.Bonus = num; } } private static void Leech(Character c) { //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) float maxHealth = c.GetMaxHealth(); float num = 0f; Vector3 position = ((Component)c).transform.position; List<Player> list = new List<Player>(); Player.GetPlayersInRange(position, LeechRange.Value, list); foreach (Player item in list) { if (!((Object)(object)item == (Object)null) && !((Character)item).IsDead()) { float num2 = ((Character)item).GetMaxHealth() * LeechPct.Value / 100f; Hurt((Character)(object)item, num2); SEMan sEMan = ((Character)item).GetSEMan(); if (sEMan != null) { sEMan.AddStatusEffect(SE_LoE_Leeched.Hash, true, 0, 0f, (short)(-1)); } num += num2; } } if (c.GetHealth() / maxHealth * 100f < LeechAllyAt.Value) { float num3 = LeechAllyRange.Value * LeechAllyRange.Value; foreach (Character allCharacter in Character.GetAllCharacters()) { if (!((Object)(object)allCharacter == (Object)null) && !((Object)(object)allCharacter == (Object)(object)c) && !allCharacter.IsPlayer() && !allCharacter.IsDead() && !allCharacter.IsTamed() && !allCharacter.IsBoss()) { Vector3 val = ((Component)allCharacter).transform.position - position; if (!(((Vector3)(ref val)).sqrMagnitude > num3)) { float num4 = allCharacter.GetMaxHealth() * LeechAllyPct.Value / 100f; Hurt(allCharacter, num4); num += num4; } } } } if (num > 0f && c.GetHealth() < maxHealth) { c.Heal(num, true); } } internal static void Hurt(Character target, float amount) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)target == (Object)null) && !(amount <= 0f)) { HitData val = new HitData(); val.m_damage.m_damage = amount; val.m_point = target.GetCenterPoint(); val.m_dodgeable = false; val.m_blockable = false; val.m_pushForce = 0f; val.m_staggerMultiplier = 0f; target.Damage(val); } } private static void Summon(Character c) { //IL_0130: Unknown result type (might be due to invalid IL or missing references) if (!_summons.TryGetValue(c, out var value)) { value = (_summons[c] = new List<Character>()); } value.RemoveAll((Character x) => (Object)(object)x == (Object)null || x.IsDead()); BaseAI component = ((Component)c).GetComponent<BaseAI>(); if (!((Object)(object)component != (Object)null) || (!component.IsAlerted() && !component.HaveTarget())) { return; } if (!_nextSummon.TryGetValue(c, out var value2)) { _nextSummon[c] = Time.time + 3f; } else { if (Time.time < value2) { return; } _nextSummon[c] = Time.time + SummonEvery.Value; int num = Mathf.Min(SummonMax.Value - value.Count, SummonCount.Value); int level = Mathf.Max(1, c.GetLevel() - SummonStarDrop.Value); for (int num2 = 0; num2 < num; num2++) { Character val = SpawnCopy(c, level, num2, num, 2.5f); if ((Object)(object)val != (Object)null) { value.Add(val); } } if (num > 0) { Fx.PlayFirst(((Component)c).transform.position, "vfx_spawn_small", "vfx_spawn", "fx_summon_start"); } } } internal static void Forget(Character c) { _summons.Remove(c); _nextSummon.Remove(c); } private static Character SpawnCopy(Character c, int level, int i, int n, float dist) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab(Utils.GetPrefabName(((Component)c).gameObject)) : null); if ((Object)(object)val == (Object)null) { return null; } Vector3 val2 = ((Component)c).transform.position + Quaternion.Euler(0f, 360f * (float)i / (float)Mathf.Max(1, n) + Random.Range(-20f, 20f), 0f) * Vector3.forward * (dist + c.GetRadius()); if ((Object)(object)ZoneSystem.instance != (Object)null && !MonsterControl.InDungeon(val2)) { val2.y = Mathf.Max(val2.y, ZoneSystem.instance.GetGroundHeight(val2)) + 0.2f; } GameObject val3 = Object.Instantiate<GameObject>(val, val2, Quaternion.Euler(0f, Random.Range(0f, 360f), 0f)); Character component = val3.GetComponent<Character>(); ZNetView component2 = val3.GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || (Object)(object)component2 == (Object)null || !component2.IsValid()) { return component; } ZDO zDO = component2.GetZDO(); zDO.Set("loe_split_child", true); zDO.Set("loe_rolled", true); component.SetLevel(level); BaseAI component3 = val3.GetComponent<BaseAI>(); MonsterAI val4 = (MonsterAI)(object)((component3 is MonsterAI) ? component3 : null); if (val4 != null) { ZNetView component4 = ((Component)c).GetComponent<ZNetView>(); if ((Object)(object)component4 != (Object)null && component4.IsValid() && component4.GetZDO().GetBool("EventCreature", false)) { val4.SetEventCreature(true); } ((BaseAI)val4).Alert(); } return component; } internal static float AttackSpeed(Character c) { if (!Active || (Object)(object)c == (Object)null || c.IsPlayer()) { return 1f; } if (!Has(c, AffixId.Quick)) { return 1f; } return 1f + QuickAttack.Value / 100f; } private static bool NearCommander(Character c) { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)c == (Object)null || c.IsPlayer()) { return false; } if (Time.time - _commandersAt > 1f) { _commandersAt = Time.time; _commanders = new List<Character>(); foreach (Character allCharacter in Character.GetAllCharacters()) { if ((Object)(object)allCharacter != (Object)null && !allCharacter.IsPlayer() && !allCharacter.IsDead() && Has(allCharacter, AffixId.Commander)) { _commanders.Add(allCharacter); } } } if (_commanders.Count == 0) { return false; } float num = CommanderRange.Value * CommanderRange.Value; foreach (Character commander in _commanders) { if ((Object)(object)commander != (Object)null && (Object)(object)commander != (Object)(object)c && !commander.IsDead()) { Vector3 val = ((Component)commander).transform.position - ((Component)c).transform.position; if (((Vector3)(ref val)).sqrMagnitude <= num) { return true; } } } return false; } private static bool IsMagic(HitData hit) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return MagicSchools.IsMagic(hit.m_skill); } private static bool IsArrow(HitData hit) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Invalid comparison between Unknown and I4 //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Invalid comparison between Unknown and I4 if (!IsMagic(hit)) { if (!hit.m_ranged && (int)hit.m_skill != 8) { return (int)hit.m_skill == 14; } return true; } return false; } internal static HitState OnIncoming(Character target, HitData hit) { HitState result = default(HitState); if (!Active || (Object)(object)target == (Object)null || hit == null) { return result; } Character attacker = hit.GetAttacker(); AffixId[] array = Of(target); AffixId[] array2 = (((Object)(object)attacker != (Object)null) ? Of(attacker) : None); DmgType[] array3 = (((Object)(object)attacker != (Object)null) ? InfusionsOf(attacker) : NoInf); bool flag = (Object)(object)attacker != (Object)null && NearCommander(attacker); bool flag2 = !target.IsPlayer() && NearCommander(target); if (array.Length == 0 && array2.Length == 0 && array3.Length == 0 && !flag && !flag2) { return result; } result.Active = true; result.Health = target.GetHealth(); result.Attacker = attacker; if ((Object)(object)attacker != (Object)null && !attacker.IsPlayer()) { if (Array.IndexOf(array2, AffixId.Berserking) >= 0) { ((DamageTypes)(ref hit.m_damage)).Modify(1f + BerserkBonus(attacker) / 100f); } if (flag) { ((DamageTypes)(ref hit.m_damage)).Modify(1f + CommanderDealt.Value / 100f); } if (array3.Length != 0) { Infuse(target, hit, array3); } Player val = (Player)(object)((target is Player) ? target : null); if (val != null && (Object)(object)val == (Object)(object)Player.m_localPlayer) { OnHitPlayer(val, array2); } } if (!target.IsPlayer()) { float num = 1f; if (Array.IndexOf(array, AffixId.Armored) >= 0) { num *= Mathf.Clamp01(1f - ArmoredReduction.Value / 100f); } if (Array.IndexOf(array, AffixId.Shielded) >= 0 && IsArrow(hit)) { num *= Mathf.Clamp01(1f - ShieldedReduction.Value / 100f); } if (Array.IndexOf(array, AffixId.Spellbreaker) >= 0 && IsMagic(hit)) { num *= Mathf.Clamp01(1f - SpellbreakerPct.Value / 100f); } if (flag2) { num *= Mathf.Clamp01(1f - CommanderTaken.Value / 100f); } if (num != 1f) { ((DamageTypes)(ref hit.m_damage)).Modify(num); } if (Array.IndexOf(array, AffixId.Fortified) >= 0) { float num2 = target.GetMaxHealth() * FortifiedCap.Value / 100f; float totalDamage = hit.GetTotalDamage(); if (totalDamage > num2 && totalDamage > 0f) { ((DamageTypes)(ref hit.m_damage)).Modify(num2 / totalDamage); } } } return result; } private static void Infuse(Character target, HitData hit, DmgType[] inf) { float num = hit.GetTotalDamage() * InfShare.Value / 100f; if (num <= 0f) { return; } bool flag = false; for (int i = 0; i < inf.Length; i++) { switch (inf[i]) { case DmgType.Chaos: flag = true; break; case DmgType.Slash: hit.m_damage.m_slash += num; break; case DmgType.Pierce: hit.m_damage.m_pierce += num; break; case DmgType.Blunt: hit.m_damage.m_blunt += num; break; case DmgType.Fire: hit.m_damage.m_fire += num; break; case DmgType.Poison: hit.m_damage.m_poison += num; break; case DmgType.Frost: hit.m_damage.m_frost += num; break; case DmgType.Lightning: hit.m_damage.m_lightning += num; break; case DmgType.Spirit: hit.m_damage.m_spirit += num; break; case DmgType.Shadow: SE_LoE_Wither.Apply(target, num); break; case DmgType.Blood: SE_LoE_Bleeding.Apply(target, num); break; default: hit.m_damage.m_damage += num; break; } } if (flag) { float num2 = Mathf.Max(0f, ChaosMin.Value); float num3 = Mathf.Max(num2, ChaosMax.Value); float num4 = Random.Range(num2, num3) / 100f; if (!Mathf.Approximately(num4, 1f)) { ((DamageTypes)(ref hit.m_damage)).Modify(num4); } } } private static void OnHitPlayer(Player p, AffixId[] theirs) { SEMan sEMan = ((Character)p).GetSEMan(); if (sEMan == null) { return; } for (int i = 0; i < theirs.Length; i++) { switch (theirs[i]) { case AffixId.EitrIgnition: SE_LoE_EliteDebuff.Stack(sEMan, SE_LoE_EitrBurn.Hash, IgniteTime.Value, 1); break; case AffixId.Cursed: SE_LoE_EliteDebuff.Stack(sEMan, SE_LoE_Cursed.Hash, CursedTime.Value, 1); break; case AffixId.Crippling: SE_LoE_EliteDebuff.Stack(sEMan, SE_LoE_Crippled.Hash, CrippleTime.Value, Mathf.Max(1, Mathf.FloorToInt(CrippleMax.Value / Mathf.Max(1f, CrippleSlow.Value)))); break; case AffixId.Sundering: SE_LoE_EliteDebuff.Stack(sEMan, SE_LoE_Sundered.Hash, SunderTime.Value, Mathf.Max(1, Mathf.FloorToInt(SunderMax.Value / Mathf.Max(1f, SunderPct.Value)))); break; } } } internal static void AfterIncoming(Character target, HitState st) { if (!st.Active || (Object)(object)target == (Object)null) { return; } float num = Mathf.Max(0f, st.Health - target.GetHealth()); Character attacker = st.Attacker; if (num > 0f && (Object)(object)attacker != (Object)null && !attacker.IsDead()) { if (!attacker.IsPlayer() && Has(attacker, AffixId.Vampiric) && attacker.GetHealth() < attacker.GetMaxHealth()) { attacker.Heal(num * VampiricPct.Value / 100f, true); } if (!target.IsPlayer() && Has(target, AffixId.Thorned)) { Hurt(attacker, ThornLimit(attacker, num * ThornedPct.Value / 100f)); } } if (!target.IsPlayer() && !target.IsDead() && Has(target, AffixId.SecondWind)) { SecondWind(target); } } private static float ThornLimit(Character attacker, float amount) { float num = ((ThornedCap != null) ? ThornedCap.Value : 0f); if (num <= 0f || amount <= 0f) { return amount; } float time = Time.time; if (_thornFrom.Count > 64) { _thornFrom.Clear(); _thornUsed.Clear(); } if (!_thornFrom.TryGetValue(attacker, out var value) || time - value >= 1f) { _thornFrom[attacker] = time; _thornUsed[attacker] = 0f; } float value2; float num2 = (_thornUsed.TryGetValue(attacker, out value2) ? value2 : 0f); float num3 = Mathf.Max(0f, attacker.GetMaxHealth() * num / 100f - num2); float num4 = Mathf.Min(amount, num3); _thornUsed[attacker] = num2 + num4; return num4; } private static void SecondWind(Character c) { //IL_014b: Unknown result type (might be due to invalid IL or missing references) float maxHealth = c.GetMaxHealth(); if (maxHealth <= 0f || c.GetHealth() / maxHealth * 100f > SecondWindAt.Value) { return; } SEMan sEMan = c.GetSEMan(); if (sEMan == null || sEMan.HaveStatusEffect(SE_LoE_Winded.Hash)) { return; } ZNetView component = ((Component)c).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid() || !component.IsOwner()) { return; } ZDO zDO = component.GetZDO(); double num = (((Object)(object)ZNet.instance != (Object)null) ? ZNet.instance.GetTimeSeconds() : ((double)Time.time)); if (!(num < (double)zDO.GetFloat("loe_sw_until", 0f))) { zDO.Set("loe_sw_until", (float)(num + (double)SecondWindLock.Value)); c.Heal(maxHealth * SecondWindHeal.Value / 100f, true); if (sEMan.AddStatusEffect(SE_LoE_SecondWind.Hash, true, 0, 0f, (short)(-1)) is SE_LoE_SecondWind sE_LoE_SecondWind) { sE_LoE_SecondWind.Begin(maxHealth * SecondWindHot.Value / 100f, SecondWindHotTime.Value); } StatusEffect val = sEMan.AddStatusEffect(SE_LoE_Winded.Hash, true, 0, 0f, (short)(-1)); if ((Object)(object)val != (Object)null) { val.m_ttl = SecondWindLock.Value; } Fx.PlayFirst(((Component)c).transform.position, "vfx_HealthUpgrade", "vfx_Potion_health_medium"); } } internal static void OnStatusAdded(Character c, StatusEffect se) { if (Active && !((Object)(object)c == (Object)null) && !((Object)(object)se == (Object)null) && !c.IsPlayer() && !(se.m_ttl <= 0f) && Has(c, AffixId.Resilient) && Plate.IsDebuff(se) && !_shortened.TryGetValue(se, out var _)) { _shortened.Add(se, null); se.m_ttl *= Mathf.Clamp01(1f - ResilientPct.Value / 100f); } } internal static void OnSpellCast(Vector3 at) { //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (!Active) { return; } float num = HunterRange.Value * HunterRange.Value; foreach (Character allCharacter in Character.GetAllCharacters()) { if ((Object)(object)allCharacter == (Object)null || allCharacter.IsPlayer() || allCharacter.IsDead()) { continue; } Vector3 val = ((Component)allCharacter).transform.position - at; if (((Vector3)(ref val)).sqrMagnitude > num || !Has(allCharacter, AffixId.MageHunter)) { continue; } ZNetView component = ((Component)allCharacter).GetComponent<ZNetView>(); if (!((Object)(object)component == (Object)null) && component.IsValid()) { if (component.IsOwner()) { AddHunterStack(allCharacter); } else { component.InvokeRPC("LoE_MageHunter", Array.Empty<object>()); } } } } internal static void OnHunterRpc(Character c) { if (Active && !((Object)(object)c == (Object)null) && !c.IsDead()) { ZNetView component = ((Component)c).GetComponent<ZNetView>(); if (!((Object)(object)component == (Object)null) && component.IsValid() && component.IsOwner() && Has(c, AffixId.MageHunter)) { AddHunterStack(c); } } } private static void AddHunterStack(Character c) { SE_LoE_EliteDebuff.Stack(c.GetSEMan(), SE_LoE_Hunting.Hash, HunterTime.Value, HunterMaxStacks.Value); } internal static void OnDeath(Character c) { if ((Object)(object)c == (Object)null || c.IsPlayer()) { return; } Forget(c); if (!Active) { return; } ZNetView component = ((Component)c).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsValid() || !component.IsOwner()) { return; } if (Has(c, AffixId.Splitting) && !component.GetZDO().GetBool("loe_split_child", false)) { int level = Mathf.Max(1, c.GetLevel() - SplitStarDrop.Value); int value = SplitCount.Value; for (int i = 0; i < value; i++) { SpawnCopy(c, level, i, value, 0.8f); } } if (!IsElite(c) || component.GetZDO().GetBool("loe_split_child", false)) { return; } try { EliteLoot.Drop(c); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Elite loot: " + ex.Message)); } } internal static float XpMultiplier(Character c) { if (!Active || !IsElite(c)) { return 1f; } return 1f + Mathf.Max(0f, XpBonus.Value) / 100f; } internal static float HealthFactor(Character c) { if (!Active || !IsElite(c)) { return 1f; } return 1f + Mathf.Max(0f, EliteHealth?.Value ?? 0f) / 100f; } internal static float SizeFactor(Character c) { if (!Active || !IsElite(c)) { return 1f; } return 1f + Mathf.Max(0f, EliteSize?.Value ?? 0f) / 100f; } } internal static class AffixRings { private sealed class RingTint : MonoBehaviour { public Color Color; private int _done = -1; private void Update() { //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>(); if (componentsInChildren.Length == _done) { return; } _done = componentsInChildren.Length; Renderer[] array = componentsInChildren; for (int i = 0; i < array.Length; i++) { Material[] materials = array[i].materials; foreach (Material val in materials) { if (val.HasProperty("_Color")) { val.color = Color; } if (val.HasProperty("_EmissionColor")) { val.SetColor("_EmissionColor", Color); } } } } } internal static readonly Color CommanderColor = new Color(1f, 0.6f, 0.15f, 0.9f); internal static readonly Color LeechColor = new Color(0.65f, 0.25f, 0.85f, 0.9f); private static CircleProjector _template; internal static void Keep(ref GameObject ring, ref float radius, bool want, Character c, float r, Color color, string name) { //IL_0054: Unknown result type (might be due to invalid IL or missing references) if (!want || (Object)(object)c == (Object)null || c.IsDead()) { if ((Object)(object)ring != (Object)null) { Object.Destroy((Object)(object)ring); } ring = null; } else if (!((Object)(object)ring != (Object)null) || !Mathf.Approximately(radius, r)) { if ((Object)(object)ring != (Object)null) { Object.Destroy((Object)(object)ring); } ring = Make(c, r, color, name); radius = r; } } private static GameObject Make(Character c, float r, Color color, string name) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Expected O, but got Unknown if ((Object)(object)_template == (Object)null && (Object)(object)ZNetScene.instance != (Object)null) { GameObject prefab = ZNetScene.instance.GetPrefab("piece_workbench"); _template = (((Object)(object)prefab != (Object)null) ? prefab.GetComponentInChildren<CircleProjector>(true) : null); } if ((Object)(object)_template == (Object)null) { return null; } GameObject val = new GameObject(name); val.transform.SetParent(((Component)c).transform, false); Vector3 lossyScale = ((Component)c).transform.lossyScale; val.transform.localScale = new Vector3((lossyScale.x != 0f) ? (1f / lossyScale.x) : 1f, (lossyScale.y != 0f) ? (1f / lossyScale.y) : 1f, (lossyScale.z != 0f) ? (1f / lossyScale.z) : 1f); CircleProjector obj = val.AddComponent<CircleProjector>(); obj.m_prefab = _template.m_prefab; obj.m_mask = _template.m_mask; obj.m_speed = _template.m_speed; obj.m_turns = _template.m_turns; obj.m_radius = r; obj.m_nrOfSegments = Mathf.Clamp(Mathf.RoundToInt(r * 5f), 24, 160); val.AddComponent<RingTint>().Color = color; return val; } } public class SE_LoE_EliteDebuff : SE_Stats { public int Stacks = 1; internal static StatusEffect Stack(SEMan sem, int hash, float seconds, int maxStacks) { if (sem == null) { return null; } if (sem.GetStatusEffect(hash) is SE_LoE_EliteDebuff sE_LoE_EliteDebuff) { sE_LoE_EliteDebuff.Stacks = Mathf.Min(maxStacks, sE_LoE_EliteDebuff.Stacks + 1); ((StatusEffect)sE_LoE_EliteDebuff).m_ttl = seconds; ((StatusEffect)sE_LoE_EliteDebuff).ResetTime(); sE_LoE_EliteDebuff.Refresh(); return (StatusEffect)(object)sE_LoE_EliteDebuff; } StatusEffect obj = sem.AddStatusEffect(hash, true, 0, 0f, (short)(-1)); if (obj is SE_LoE_EliteDebuff sE_LoE_EliteDebuff2) { sE_LoE_EliteDebuff2.Stacks = 1; ((StatusEffect)sE_LoE_EliteDebuff2).m_ttl = seconds; sE_LoE_EliteDebuff2.Refresh(); } return obj; } public virtual void Refresh() { } public override string GetIconText() { if (Stacks <= 1) { return ((StatusEffect)this).GetIconText(); } return $"x{Stacks}\n{((StatusEffect)this).GetIconText()}"; } } public class SE_LoE_Crippled : SE_LoE_EliteDebuff { public const string SEName = "LoE_Crippled"; public static readonly int Hash = StringExtensionMethods.GetStableHashCode("LoE_Crippled"); public override void Refresh() { float num = Mathf.Min(Affixes.CrippleMax.Value, Affixes.CrippleSlow.Value * (float)Stacks); ((SE_Stats)this).m_speedModifier = (0f - num) / 100f; ((StatusEffect)this).m_tooltip = $"{num:0}% slower"; } } public class SE_LoE_Sundered : SE_LoE_EliteDebuff { public const string SEName = "LoE_Sundered"; public static readonly int Hash = StringExtensionMethods.GetStableHashCode("LoE_Sundered"); internal float ArmorLost => Mathf.Clamp01(Mathf.Min(Affixes.SunderMax.Value, Affixes.SunderPct.Value * (float)Stacks) / 100f); public override void Refresh() { ((StatusEffect)this).m_tooltip = $"{ArmorLost * 100f:0}% less armor"; } } public class SE_LoE_Cursed : SE_LoE_EliteDebuff { public const string SEName = "LoE_Cursed"; public static readonly int Hash = StringExtensionMethods.GetStableHashCode("LoE_Cursed"); public override void Refresh() { ((StatusEffect)this).m_tooltip = $"{Affixes.CursedHeal.Value:0}% less healing"; } } public class SE_LoE_EitrBurn : SE_LoE_EliteDebuff { public const string SEName = "LoE_EitrBurn"; public static readonly int Hash = StringExtensionMethods.GetStableHashCode("LoE_EitrBurn"); private float _carry; public override void Refresh() { ((StatusEffect)this).m_tooltip = $"Burns {Affixes.IgniteFlat.Value:0} + {Affixes.IgnitePct.Value:0.#}% of your max Eitr every second"; } public override void UpdateStatusEffect(float dt) { ((SE_Stats)this).UpdateStatusEffect(dt); Character character = ((StatusEffect)this).m_character; Player val = (Player)(object)((character is Player) ? character : null); if (val != null && !((Object)(object)val != (Object)(object)Player.m_localPlayer) && !((Character)val).IsDead()) { _carry += (Affixes.IgniteFlat.Value + ((Character)val).GetMaxEitr() * Affixes.IgnitePct.Value / 100f) * dt; if (_carry >= 1f) { ((Character)val).UseEitr(Mathf.Min(_carry, val.GetEitr())); _carry = 0f; } } } } public class SE_LoE_InfusionDot : SE_LoE_EliteDebuff, ILoeTickRate { private float _left; private float _tick; public float RatePerSecond => 0f - _left / Mathf.Max(1f, ((StatusEffect)this).GetRemaningTime()); internal static void Add(Character target, int hash, float amount, float seconds, string tooltip) { SEMan val = (((Object)(object)target != (Object)null) ? target.GetSEMan() : null); if (val != null && !(amount <= 0f) && (val.GetStatusEffect(hash) ?? val.AddStatusEffect(hash, true, 0, 0f, (short)(-1))) is SE_LoE_InfusionDot sE_LoE_InfusionDot) { sE_LoE_InfusionDot._left += amount; ((StatusEffect)sE_LoE_InfusionDot).m_ttl = Mathf.Max(1f, seconds); ((StatusEffect)sE_LoE_InfusionDot).ResetTime(); ((StatusEffect)sE_LoE_InfusionDot).m_tooltip = tooltip; } } internal void AddDamage(float amount, float seconds) { if (!(amount <= 0f)) { _left += amount; ((StatusEffect)this).m_ttl = Mathf.Max(1f, seconds); ((StatusEffect)this).ResetTime(); } } public override void UpdateStatusEffect(float dt) { ((SE_Stats)this).UpdateStatusEffect(dt); _tick += dt; if (!(_tick < 1f) && !((Object)(object)((StatusEffect)this).m_character == (Object)null) && !((StatusEffect)this).m_character.IsDead()) { _tick = 0f; float num = Mathf.Max(1f, ((StatusEffect)this).GetRemaningTime()); float num2 = _left / num; _left -= num2; ZNetView component = ((Component)((StatusEffect)this).m_character).GetComponent<ZNetView>(); if ((Object)(object)component != (Object)null && component.IsValid() && component.IsOwner()) { Affixes.Hurt(((StatusEffect)this).m_character, num2); } } } } public class SE_LoE_Wither : SE_LoE_InfusionDot { public const string SEName = "LoE_Wither"; public static readonly int Hash = StringExtensionMethods.GetStableHashCode("LoE_Wither"); internal static void Apply(Character target, float amount) { SE_LoE_InfusionDot.Add(target, Hash, amount, Affixes.DotTime.Value, "Withering: shadow damage over time"); } } public class SE_LoE_Bleeding : SE_LoE_InfusionDot { public const string SEName = "LoE_Bleeding"; public static readonly int Hash = StringExtensionMethods.GetStableHashCode("LoE_Bleeding"); internal static void Apply(Character target, float amount) { SE_LoE_InfusionDot.Add(target, Hash, amount, Affixes.BleedTime.Value, "Bleeding: blood damage over time"); } } public class SE_LoE_SecondWind : SE_Stats { public const string SEName = "LoE_SecondWind"; public static readonly int Hash = StringExtensionMethods.GetStableHashCode("LoE_SecondWind"); private float _perSecond; private float _tick; internal void Begin(float total, float seconds) { ((StatusEffect)this).m_ttl = Mathf.Max(0.5f, seconds); _perSecond = total / ((StatusEffect)this).m_ttl; ((StatusEffect)this).ResetTime(); } public override void UpdateStatusEffect(float dt) { ((SE_Stats)this).UpdateStatusEffect(dt); _tick += dt; if (!(_tick < 1f) && !((Object)(object)((StatusEffect)this).m_character == (Object)null) && !((StatusEffect)this).m_character.IsDead()) { ((StatusEffect)this).m_character.Heal(_perSecond * _tick, true); _tick = 0f; } } } public class SE_LoE_Rejuvenation : SE_Stats { public const string SEName = "LoE_Rejuvenation"; public static readonly int Hash = StringExtensionMethods.GetStableHashCode("LoE_Rejuvenation"); private float _tick; public override void SetLevel(int itemLevel, float skillLevel) { ((StatusEffect)this).SetLevel(itemLevel, skillLevel); if (skillLevel > 0f) { ((StatusEffect)this).m_ttl = skillLevel; } ((StatusEffect)this).m_tooltip = $"Heals {Affixes.RejuvPct.Value:0.#}% of max health over {((StatusEffect)this).m_ttl:0} seconds"; } public override void UpdateStatusEffect(float dt) { ((SE_Stats)this).UpdateStatusEffect(dt); _tick += dt; if (_tick < 1f || (Object)(object)((StatusEffect)this).m_character == (Object)null || ((StatusEffect)this).m_character.IsDead() || ((StatusEffect)this).m_ttl <= 0f) { return; } ZNetView component = ((Component)((StatusEffect)this).m_character).GetComponent<ZNetView>(); if ((Object)(object)component == (Object)null || !component.IsOwner()) { _tick = 0f; return; } float num = ((StatusEffect)this).m_character.GetMaxHealth() * Affixes.RejuvPct.Value / 100f / ((StatusEffect)this).m_ttl; if (((StatusEffect)this).m_character.GetHealth() < ((StatusEffect)this).m_character.GetMaxHealth()) { ((StatusEffect)this).m_character.Heal(num * _tick, true); } _tick = 0f; } } public class SE_LoE_Winded : SE_LoE_EliteDebuff { public const string SEName = "LoE_Winded"; public static readonly int Hash = StringExtensionMethods.GetStableHashCode("LoE_Winded"); } public interface ILoeNoTimer { } public interface ILoeLabel { string Label { get; } } public class SE_LoE_Commanded : SE_Stats, ILoeNoTimer { public const string SEName = "LoE_Commanded"; public static readonly int Hash = StringExtensionMethods.GetStableHashCode("LoE_Commanded"); public override void Setup(Character character) { ((StatusEffect)this).m_ttl = 2.5f; ((StatusEffect)this).m_tooltip = $"Near a Commander: deals {Affixes.CommanderDealt.Value:0}% more damage and takes {Affixes.CommanderTaken.Value:0}% less"; ((SE_Stats)this).Setup(character); } public override string GetIconText() { return ""; } } public class SE_LoE_Leeched : SE_Stats, ILoeNoTimer, ILoeTickRate, ILoeDebuff { public const string SEName = "LoE_Leeched"; public static readonly int Hash = StringExtensionMethods.GetStableHashCode("LoE_Leeched"); public float RatePerSecond { get { if (!((Object)(object)((StatusEffect)this).m_character != (Object)null)) { return 0f; } return (0f - ((StatusEffect)this).m_character.GetMaxHealth()) * Affixes.LeechPct.Value / 100f; } } public override void Setup(Character character) { ((StatusEffect)this).m_ttl = 2.5f; ((StatusEffect)this).m_tooltip = $"A Leeching Aura drains {Affixes.LeechPct.Value:0.#}% of your max health every second. Move away from it."; ((SE_Stats)this).Setup(character); } public override string GetIconText() { return ""; } } public class SE_LoE_Quick : SE_Stats, ILoeNoTimer { public const string SEName = "LoE_Quick"; public static readonly int Hash = StringExtensionMethods.GetStableHashCode("LoE_Quick"); public override void Setup(Character character) { ((StatusEffect)this).m_ttl = 0f; base.m_speedModifier = Affixes.QuickMove.Value / 100f; ((StatusEffect)this).m_tooltip = $"Moves {Affixes.QuickMove.Value:0}% faster and attacks {Affixes.QuickAttack.Value:0}% faster"; ((SE_Stats)this).Setup(character); } } public class SE_LoE_Berserk : SE_Stats, ILoeNoTimer, ILoeLabel { public const string SEName = "LoE_Berserk"; public static readonly int Hash = StringExtensionMethods.GetStableHashCode("LoE_Berserk"); public float Bonus; public string Label => $"+{Mathf.RoundToInt(Bonus)}%"; public override void Setup(Character character) { ((StatusEffect)this).m_ttl = 0f; ((SE_Stats)this).Setup(character); } public override string GetIconText() { return Label; } public override string GetTooltipString() { return $"Berserk: deals {Mathf.RoundToInt(Bonus)}% more damage (more as it gets hurt)"; } } public class SE_LoE_Hunting : SE_LoE_EliteDebuff { public const string SEName = "LoE_Hunting"; public static readonly int Hash = StringExtensionMethods.GetStableHashCode("LoE_Hunting"); public override void Refresh() { ((SE_Stats)this).m_speedModifier = Affixes.HunterSpeed.Value / 100f * (float)Stacks; ((StatusEffect)this).m_tooltip = $"{Affixes.HunterSpeed.Value * (float)Stacks:0}% faster"; } } internal static class AffixAttackSpeedPatch { private sealed class State { public bool InAttack; } private static readonly FieldRef<CharacterAnimEvent, Character> Char = AccessTools.FieldRefAccess<CharacterAnimEvent, Character>("m_character"); private static readonly FieldRef<CharacterAnimEvent, Animator> Anim = AccessTools.FieldRefAccess<CharacterAnimEvent, Animator>("m_animator"); private static readonly ConditionalWeakTable<CharacterAnimEvent, State> _state = new ConditionalWeakTable<CharacterAnimEvent, State>(); private static readonly FieldInfo SemChar = AccessTools.Field(typeof(SEMan), "m_character"); private static readonly FieldInfo AttackChar = AccessTools.Field(typeof(Attack), "m_character"); private static readonly FieldInfo AttackWeapon = AccessTools.Field(typeof(Attack), "m_weapon"); internal static void Patch(Harmony h) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Expected O, but got Unknown //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Expected O, but got Unknown //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown try { h.Patch((MethodBase)AccessTools.Method(typeof(CharacterAnimEvent), "CustomFixedUpdate", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(AffixAttackSpeedPatch), "AfterFixedUpdate", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); h.Patch((MethodBase)AccessTools.Method(typeof(CharacterAnimEvent), "Speed", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(AffixAttackSpeedPatch), "AfterSpeed", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Elite attack speed: " + ex.Message)); } MethodInfo[] methods = typeof(SEMan).GetMethods(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (!(methodInfo.Name != "AddStatusEffect") && !(methodInfo.ReturnType != typeof(StatusEffect))) { try { h.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(typeof(AffixAttackSpeedPatch), "AfterAddStatus", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex2) { Plugin.Log.LogWarning((object)("Elite Resilient: " + ex2.Message)); } } } try { MethodInfo methodInfo2 = AccessTools.Method(typeof(Attack), "Start", (Type[])null, (Type[])null); if (methodInfo2 != null) { h.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, new HarmonyMethod(typeof(AffixAttackSpeedPatch), "AfterAttackStart", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } catch (Exception ex3) { Plugin.Log.LogWarning((object)("Elite Mage Hunter: " + ex3.Message)); } } private static void AfterFixedUpdate(CharacterAnimEvent __instance) { try { Character val = Char.Invoke(__instance); if ((Object)(object)val == (Object)null || val.IsPlayer()) { return; } State orCreateValue = _state.GetOrCreateValue(__instance); bool flag = val.InAttack(); if (flag && !orCreateValue.InAttack) { float num = Affixes.AttackSpeed(val); if (num != 1f) { Animator val2 = Anim.Invoke(__instance); if ((Object)(object)val2 != (Object)null) { val2.speed *= num; } } } orCreateValue.InAttack = flag; } catch { } } private static void AfterSpeed(CharacterAnimEvent __instance) { try { Character val = Char.Invoke(__instance); if ((Object)(object)val == (Object)null || val.IsPlayer()) { return; } float num = Affixes.AttackSpeed(val); if (num != 1f) { Animator val2 = Anim.Invoke(__instance); if ((Object)(object)val2 != (Object)null) { val2.speed *= num; } } } catch { } } private static void AfterAddStatus(SEMan __instance, StatusEffect __result) { try { if ((Object)(object)__result != (Object)null && SemChar != null) { object? value = SemChar.GetValue(__instance); Affixes.OnStatusAdded((Character)((value is Character) ? value : null), __result); } } catch { } } private static void AfterAttackStart(Attack __instance, bool __result) { //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) try { if (!__result || AttackChar == null || AttackWeapon == null) { return; } object? value = AttackChar.GetValue(__instance); Character val = (Character)((value is Character) ? value : null); if (!((Object)(object)val == (Object)null) && !((Object)(object)val != (Object)(object)Player.m_localPlayer)) { object? value2 = AttackWeapon.GetValue(__instance); ItemData val2 = (ItemData)((value2 is ItemData) ? value2 : null); if (MagicSchools.IsMagic((SkillType)((val2 != null) ? ((int)val2.m_shared.m_skillType) : 0))) { Affixes.OnSpellCast(((Component)val).transform.position); } } } catch { } } } [HarmonyPatch(typeof(Character), "RPC_Damage")] internal static class AffixIncomingPatch { [HarmonyPriority(200)] private static void Prefix(Character __instance, HitData __1, out Affixes.HitState __state) { __state = default(Affixes.HitState); try { __state = Affixes.OnIncoming(__instance, __1); } catch (Exception ex) { if (Plugin.DebugLog.Value) { Plugin.Log.LogWarning((object)("Elite hit: " + ex.Message)); } } } private static void Postfix(Character __instance, Affixes.HitState __state) { try { Affixes.AfterIncoming(__instance, __state); } catch (Exception ex) { if (Plugin.DebugLog.Value) { Plugin.Log.LogWarning((object)("Elite hit: " + ex.Message)); } } } } [HarmonyPatch(typeof(Character), "OnDeath")] internal static class AffixDeathPatch { private static void Prefix(Character __instance) { try { Affixes.OnDeath(__instance); } catch (Exception ex) { Plugin.Log.LogWarning((object)("Elite death: " + ex.Message)); } } } [HarmonyPatch(typeof(Character), "Heal")] internal static class AffixCursedPatch { private static void Prefix(Character __instance, ref float __0) { try { if (!(__0 <= 0f) && Affixes.Active) { SEMan sEMan = __instance.GetSEMan(); if (sEMan != null && sEMan.HaveStatusEffect(SE_LoE_Cursed.Hash)) { __0 *= Mathf.Clamp01(1f - Affixes.CursedHeal.Value / 100f); } } } catch { } } } [HarmonyPatch(typeof(Player), "GetBodyArmor")] internal static class AffixSunderPatch { private static void Postfix(Player __instance, ref float __result) { try { SEMan sEMan = ((Character)__instance).GetSEMan(); if (((sEMan != null) ? sEMan.GetStatusEffect(SE_LoE_Sundered.Hash) : null) is SE_LoE_Sundered sE_LoE_Sundered) { __result *= 1f - sE_LoE_Sundered.ArmorLost; } } catch { } } } public static class Api { public static string[] AddAffixes(Character c, params string[] names) { List<AffixId> list = new List<AffixId>(); if (names != null) { for (int i = 0; i < names.Length; i++) { if (Enum.TryParse<AffixId>(names[i].Replace(" ", ""), ignoreCase: true, out var result)) { list.Add(result); } } } return Names(Affixes.Add(c, list)); } public static string[] GetAffixes(Character c) { return Names(Affixes.Of(c)); } public static string[] AllAffixes() { return Names(Affixes.All); } public static bool IsElite(Character c) { return Affixes.IsElite(c); } public static string[] AddInfusions(Character c, params string[] names) { List<DmgType> list = new List<DmgType>(); if (names != null) { for (int i = 0; i < names.Length; i++) { if (Enum.TryParse<DmgType>(names[i], ignoreCase: true, out var result)) { list.Add(result); } } } return Names(Affixes.AddInfusions(c, list)); } public static string[] GetInfusions(Character c) { return Names(Affixes.InfusionsOf(c)); } public static string[] AllowedInfusions(Character c) { return Names(Affixes.InfusionsAllowed(c).ToArray()); } private static string[] Names<T>(T[] list) { string[] array = new string[list.Length]; for (int i = 0; i < list.Length; i++) { array[i] = list[i].ToString(); } return array; } } internal static class AimVisuals { internal static GameObject RangeCircle(Vector3 pos, float range) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Expected O, but got Unknown try { GameObject val = (((Object)(object)ZNetScene.instance != (Object)null) ? ZNetScene.instance.GetPrefab("piece_workbench") : null); CircleProjector val2 = (((Object)(object)val != (Object)null) ? val.GetComponentInChildren<CircleProjector>(true) : null); if ((Object)(object)val2 == (Object)null) { return null; } GameObject val3 = new GameObject("LoE_AimRange"); val3.transform.position = pos; CircleProjector obj = val3.AddComponent<CircleProjector>(); obj.m_prefab = val2.m_prefab; obj.m_mask = val2.m_mask; obj.m_speed = val2.m_speed; obj.m_turns = val2.m_turns; obj.m_start = val2.m_start; obj.m_sliceLines = val2.m_sliceLines; obj.m_radius = range; obj.m_nrOfSegments = Mathf.Clam