Decompiled source of NocturneCraft v1.0.1
NocturneCraft.dll
Decompiled 19 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppSystem.Collections.Generic; using Microsoft.CodeAnalysis; using ProjectM; using ProjectM.Gameplay.Scripting; using ProjectM.Gameplay.Systems; using ProjectM.Network; using ProjectM.Scripting; using ProjectM.Shared; using Stunlock.Core; using TMPro; using Unity.Collections; using Unity.Entities; using Unity.Mathematics; using Unity.Transforms; using UnityEngine; using UnityEngine.Events; using UnityEngine.UI; using VampireCommandFramework; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("NocturneCraft")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("NocturneCraft")] [assembly: AssemblyTitle("NocturneCraft")] [assembly: AssemblyVersion("1.0.0.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 NocturneMod { [BepInPlugin("com.nocturne.craft", "NocturneCraft", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BasePlugin { internal sealed class BossKit { public string Key; public string Name; public string Description; public PrefabGUID[] Slots; public ModifyUnitStatBuff_DOTS[] Stats; } internal sealed class LeagueItem { public int Id; public string Name; public int Cost; public Dictionary<string, float> Stats; } internal sealed class NocturneTier { public int Order; public string Key; public string Name; public int Level; public string KitKey; public PrefabGUID SummonPrefab; } private sealed class ActiveSummon { public PrefabGUID Prefab; public float2 Position; public NocturneTier Tier; public ulong OwnerSteamId; public Entity Boss; public bool Boosted; public double Deadline; } internal sealed class RuneDefinition { public string Tree; public string Key; public string Name; public string Trigger; public string[] Aliases; } internal sealed class RuneCombatState { public int Stacks; public int Attacks; public int DarkHarvestSouls; public bool PtaExposed; public DateTime LastHitUtc; public DateTime CombatStartedUtc; public DateTime CooldownUntilUtc; public Entity LastTarget; public float LastTargetHealth; public float DamageWindow; } private const int BossKitPriority = 99; internal const string BossModeAll = "all"; internal const string BossModeStats = "stats"; internal const string BossModeSkills = "skills"; private static readonly PrefabGUID BossCarrierBuffPrefab = new PrefabGUID(1171608023); internal static readonly Dictionary<string, BossKit> BossCatalog = new Dictionary<string, BossKit>(); private static readonly Dictionary<Entity, string> ActiveBossKitKeys = new Dictionary<Entity, string>(); private static readonly Dictionary<Entity, string> ActiveBossKitModes = new Dictionary<Entity, string>(); private static readonly Dictionary<Entity, Entity> ActiveBossAbilityBuffs = new Dictionary<Entity, Entity>(); private static World _persistedKitScanWorld; private static readonly Dictionary<Entity, Dictionary<Entity, int>> PendingBonusDamageEvents = new Dictionary<Entity, Dictionary<Entity, int>>(); private const int ItemSlotLimit = 5; private static readonly PrefabGUID ItemBuffPrefab = new PrefabGUID(651199070); internal static readonly Dictionary<int, LeagueItem> ItemCatalog = new Dictionary<int, LeagueItem>(); private static readonly Dictionary<Entity, List<int>> PlayerItems = new Dictionary<Entity, List<int>>(); private static readonly Dictionary<Entity, Entity> ActiveItemBuffs = new Dictionary<Entity, Entity>(); private static readonly Dictionary<Entity, int> PendingItemBuffs = new Dictionary<Entity, int>(); private const int PendingItemBuffMaxFrames = 600; private static readonly HashSet<string> ItemTickSources = new HashSet<string>(); private static readonly PrefabGUID LegacyDuskReaverFormPrefab = new PrefabGUID(-31099041); private static bool _legacyChampionCleanupComplete; private const int ItemMenuPageSize = 8; private static readonly PrefabGUID DraculaVBloodPrefab = new PrefabGUID(-327335305); private static readonly PrefabGUID FreeCastSpellBuffPrefab = new PrefabGUID(-650272969); internal static readonly List<NocturneTier> NocturneTiers = new List<NocturneTier>(); private static readonly Dictionary<string, NocturneTier> TierByKey = new Dictionary<string, NocturneTier>(); private static readonly Dictionary<ulong, int> NocturneProgress = new Dictionary<ulong, int>(); private static readonly List<ActiveSummon> ActiveSummons = new List<ActiveSummon>(); private static bool _nocturneProgressLoaded; internal static readonly RuneDefinition[] RuneCatalog = new RuneDefinition[16] { new RuneDefinition { Tree = "precision", Key = "pta", Name = "PTA", Trigger = "hit the same target 3 times for level-scaled damage and 8% damage amplification" }, new RuneDefinition { Tree = "precision", Key = "conqueror", Name = "CONQUEROR", Trigger = "gain 2 stacks per hit, up to 12; full stacks add life leech" }, new RuneDefinition { Tree = "precision", Key = "lethaltempo", Name = "LETHAL TEMPO", Trigger = "gain attack speed for 6 hits, then bonus damage on hit" }, new RuneDefinition { Tree = "precision", Key = "fleet", Name = "FLEET FOOTWORK", Trigger = "build 100 energy from attacks for a heal and 1-second speed boost" }, new RuneDefinition { Tree = "domination", Key = "electrocute", Name = "ELECTROCUTE", Trigger = "hit the same target 3 times within 3 seconds" }, new RuneDefinition { Tree = "domination", Key = "darkharvest", Name = "DARK HARVEST", Trigger = "damage a target below 50% health to deal damage and collect a soul" }, new RuneDefinition { Tree = "domination", Key = "hail", Name = "HAIL OF BLADES", Trigger = "gain 90% attack speed and bonus on-hit damage for 3 attacks" }, new RuneDefinition { Tree = "sorcery", Key = "aery", Name = "SUMMON AERY", Trigger = "deal level-scaled bonus damage on hit" }, new RuneDefinition { Tree = "sorcery", Key = "comet", Name = "ARCANE COMET", Trigger = "deal level-scaled spell damage with a level-scaled cooldown" }, new RuneDefinition { Tree = "sorcery", Key = "phaserush", Name = "STORMRAIDER'S SURGE", Trigger = "deal 25% of a target's max health within 3 seconds for a speed burst", Aliases = new string[2] { "stormraider", "stormraiders" } }, new RuneDefinition { Tree = "resolve", Key = "grasp", Name = "GRASP OF THE UNDYING", Trigger = "stay in combat to empower your next hits" }, new RuneDefinition { Tree = "resolve", Key = "aftershock", Name = "AFTERSHOCK", Trigger = "hit the same enemy 3 times for defenses" }, new RuneDefinition { Tree = "resolve", Key = "guardian", Name = "GUARDIAN", Trigger = "taking a hit grants temporary defenses" }, new RuneDefinition { Tree = "inspiration", Key = "glacial", Name = "GLACIAL AUGMENT", Trigger = "hit the same enemy 3 times for cooldown recovery" }, new RuneDefinition { Tree = "inspiration", Key = "firststrike", Name = "FIRST STRIKE", Trigger = "hitting a new enemy grants a short power burst" }, new RuneDefinition { Tree = "inspiration", Key = "spellbook", Name = "UNSEALED SPELLBOOK", Trigger = "cycle rune-like bonuses every 5 hits" } }; private const int LethalTempoMaxStacks = 6; private const float LethalTempoStackDuration = 6f; private const float LethalTempoAttackSpeedPerStack = 0.06f; private static readonly PrefabGUID RuneBuffPrefab = new PrefabGUID(-650272969); private static readonly Dictionary<Entity, Entity> ActiveRuneBuffs = new Dictionary<Entity, Entity>(); private static readonly Dictionary<Entity, int> LethalTempoStacks = new Dictionary<Entity, int>(); private static readonly Dictionary<Entity, string> SelectedRunes = new Dictionary<Entity, string>(); private static readonly Dictionary<Entity, RuneCombatState> RuneStates = new Dictionary<Entity, RuneCombatState>(); internal static ConfigEntry<bool> DebugLogging { get; private set; } private static string NocturneProgressPath => Path.Combine(Paths.ConfigPath, "NocturneCraft", "nocturne_progression.txt"); internal static ManualLogSource Logger { get; private set; } [Command("bosses", "List available V Rising boss ability kits: .bosses list", null, null, null, false)] public void Bosses(ChatCommandContext ctx, string action) { if (action.ToLowerInvariant() != "list") { ctx.Reply("Use .bosses list to see available boss kits."); return; } foreach (BossKit value in BossCatalog.Values) { ctx.Reply(value.Key + ": " + value.Name + " - " + value.Description + " | " + DescribeBossStats(value)); } ctx.Reply("Use .boss <name> for skills + stats, .boss <name> stats for stats only, .boss <name> skills for abilities only. .boss status / .boss off also work."); } [Command("boss", "Equip a boss kit: .boss dracula | .boss dracula stats | .boss off", null, null, null, false)] public void Boss(ChatCommandContext ctx, string action, string mode = null) { //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0239: 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_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_024f: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0293: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00e0: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) string text = action.ToLowerInvariant(); if (!TryGetPlayerContext(ctx, "Boss", out var entityManager, out var player, out var serverGameManager)) { return; } if (text == "off" || text == "none" || text == "release") { ctx.Reply(RemoveBossAbilityKit(player, entityManager, serverGameManager) ? "Boss kit removed and any stuck cast released; your normal abilities are restored. Runes and items were left untouched." : "No boss kit is active. Any stuck cast was released."); return; } if (text == "status") { Entity value; string kitKey; Entity val = ((ActiveBossAbilityBuffs.TryGetValue(player, out value) && ((EntityManager)(ref entityManager)).Exists(value)) ? value : FindBossAbilityKit(entityManager, player, out kitKey)); string value2; string text2 = (ActiveBossKitKeys.TryGetValue(player, out value2) ? value2 : null); if (text2 == null && val != Entity.Null && FindBossAbilityKit(entityManager, player, out var kitKey2) != Entity.Null) { text2 = kitKey2; } if (val != Entity.Null && text2 != null && BossCatalog.TryGetValue(text2, out var value3)) { string value4; string mode2 = (ActiveBossKitModes.TryGetValue(player, out value4) ? value4 : InferBossMode(entityManager, val, text2)); ctx.Reply(value3.Name + " is active (" + DescribeBossMode(mode2) + "). Stat bonus: " + DescribeBossStats(value3) + ". Use .boss off to restore your normal setup."); } else if (val != Entity.Null) { ctx.Reply("A boss kit is active. Use .boss off to restore your normal setup."); } else { ctx.Reply("No boss kit is active."); } return; } if (!TryParseBossMode(mode, out var mode3)) { ctx.Reply("Unknown mode: " + mode + ". Use all, stats or skills. Example: .boss dracula stats"); return; } if (!BossCatalog.TryGetValue(text, out var value5)) { ctx.Reply("Unknown boss kit: " + action + ". Use .bosses list."); return; } Entity senderUserEntity = ctx.Event.SenderUserEntity; ulong steamId = GetSteamId(entityManager, senderUserEntity); if (IsNocturneKitLocked(value5, steamId, out var tier) && RefreshNocturneProgress(entityManager, player, senderUserEntity, steamId) < tier.Order) { ctx.Reply(value5.Name + " is sealed. Kill Dracula, then climb the Nocturne path: " + DescribeNocturneProgress(steamId)); return; } if (!ApplyBossAbilityKit(player, entityManager, serverGameManager, value5, mode3)) { ctx.Reply(value5.Name + "'s kit could not be applied. Check the server log for details."); return; } string text3 = mode3; string text4 = text3; if (!(text4 == "stats")) { if (text4 == "skills") { ctx.Reply(value5.Name + " abilities equipped: " + value5.Description + ". No stat bonus in this mode; add ' stats' for it, or use .boss off to remove."); return; } ctx.Reply(value5.Name + " abilities equipped: " + value5.Description + ". Stat bonus: " + DescribeBossStats(value5) + ". Your appearance, runes and items are unchanged. Use .boss off to remove."); } else { ctx.Reply(value5.Name + " stats applied: " + DescribeBossStats(value5) + ". Your abilities, appearance, runes and items are unchanged. Use .boss off to remove."); } } private static void LoadBossCatalog() { //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_01b3: Unknown result type (might be due to invalid IL or missing references) //IL_01b8: 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_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0213: Unknown result type (might be due to invalid IL or missing references) //IL_0221: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0238: 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_025b: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026e: Unknown result type (might be due to invalid IL or missing references) //IL_027b: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Unknown result type (might be due to invalid IL or missing references) //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02d5: Unknown result type (might be due to invalid IL or missing references) //IL_02da: Unknown result type (might be due to invalid IL or missing references) //IL_02f8: Unknown result type (might be due to invalid IL or missing references) //IL_02fd: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Unknown result type (might be due to invalid IL or missing references) //IL_0310: Unknown result type (might be due to invalid IL or missing references) //IL_031d: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0340: Unknown result type (might be due to invalid IL or missing references) //IL_0345: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_0365: Unknown result type (might be due to invalid IL or missing references) //IL_036a: Unknown result type (might be due to invalid IL or missing references) //IL_0377: Unknown result type (might be due to invalid IL or missing references) //IL_037c: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_039f: Unknown result type (might be due to invalid IL or missing references) //IL_03ac: Unknown result type (might be due to invalid IL or missing references) //IL_03b1: Unknown result type (might be due to invalid IL or missing references) //IL_03be: Unknown result type (might be due to invalid IL or missing references) //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03e6: Unknown result type (might be due to invalid IL or missing references) //IL_03f3: Unknown result type (might be due to invalid IL or missing references) //IL_03f8: Unknown result type (might be due to invalid IL or missing references) //IL_0406: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0427: Unknown result type (might be due to invalid IL or missing references) //IL_042d: Expected O, but got Unknown AddBossKit("dracula", "Dracula the Immortal King", "Down Swing, Sword Throw, Quick Teleport, Blood Bolt Swarm, Ring of Blood, Blood Shower", -459642635, 532210332, -1940289109, 797450963, -7407393, -1765846328); AddBossKit("solarus", "Solarus the Immaculate", "Charged Swing, Divine Rays, Empowered Melee, Holy Flak Cannon, Holy Spinners, Summon Angel", 922419960, 51772774, -947518364, 834886466, -1852467646, 1825130923); AddBossKit("morgana", "Morgana the Shadow Queen", "Spectral Beam, Spectral Blast, Spectral Orb Barrage, Rings of Terror, Corrupted Vines, Spectral Hell", 2099754785, 1173842428, 1990869093, -616120746, 1680946425, 1185642044); AddBossKit("tristan", "Tristan the Vampire Hunter", "Crossbow, Fire Rain, Leap Thrust, Horizontal Slash, Straight Slash, Whirlwind", -737556373, 985201241, 1501188283, 1552780633, 224496996, -1503146131); AddBossKit("vincent", "Vincent the Frostbringer", "Frost Cleave, Frost Nova, Frost Shield, Ice Bolt Volley, Ice Breaker, Ice Breaker Init", -841402173, 1624827356, 308360499, -1110188840, -743963442, 1607170837); AddBossKit("livith", "Livith the Abyssal Blade", "Blade Combo, Cutting Wind, Shadow Dance, Round Kick, Slicing Dash, Spirit Orbs", 139802405, -315621824, 168833229, -385314771, -407341422, 1584749067); AddBossKit("magnus", "Sir Magnus the Vigilant", "Lance Swing, Spin Attack, Ice Rink, Icicle Field, Lance Charge, Piercing Charge", 613355091, -985136954, 896963123, 1964067196, 526997488, -1973550282); AddBossKit("tourok", "Tourok the Chaos-Bringer", "Double Swing, Double Swing Finish, Chaos Charge, Chaos Parry, Chaos Wave, Rage of Chaos", 455219779, -453755281, 840159262, 1452056926, 2003603501, 69086718); AddBossKit("carver", "The Carver", "Chop Chop, Chop Leap, Mega Cleave, Summon Carvers, Weapon Throw, Spew Corruption", 74226303, -1796211602, 2102431676, -1592003626, -1193077056, -833255541); SetBossStats("dracula", PercentStat((UnitStatType)25, 0.12f), PercentStat((UnitStatType)4, 0.08f), PercentStat((UnitStatType)70, 0.1f)); SetBossStats("solarus", PercentStat((UnitStatType)0, 0.1f), PercentStat((UnitStatType)25, 0.1f), PercentStat((UnitStatType)4, 0.1f), PercentStat((UnitStatType)8, 0.08f)); SetBossStats("morgana", PercentStat((UnitStatType)25, 0.14f), PercentStat((UnitStatType)70, 0.12f), PercentStat((UnitStatType)5, 0.05f)); SetBossStats("tristan", PercentStat((UnitStatType)0, 0.12f), PercentStat((UnitStatType)59, 0.1f), PercentStat((UnitStatType)5, 0.05f)); SetBossStats("vincent", PercentStat((UnitStatType)0, 0.1f), PercentStat((UnitStatType)25, 0.08f), PercentStat((UnitStatType)8, 0.1f), PercentStat((UnitStatType)4, 0.08f)); SetBossStats("livith", PercentStat((UnitStatType)0, 0.12f), PercentStat((UnitStatType)59, 0.12f), PercentStat((UnitStatType)5, 0.06f)); SetBossStats("magnus", PercentStat((UnitStatType)4, 0.14f), PercentStat((UnitStatType)8, 0.12f), PercentStat((UnitStatType)23, 0.12f), PercentStat((UnitStatType)0, 0.06f)); SetBossStats("tourok", PercentStat((UnitStatType)0, 0.14f), PercentStat((UnitStatType)4, 0.08f), PercentStat((UnitStatType)5, 0.05f)); SetBossStats("carver", PercentStat((UnitStatType)0, 0.12f), PercentStat((UnitStatType)4, 0.1f), PercentStat((UnitStatType)59, 0.08f)); LoadNocturneCatalog(); ManualLogSource logger = Logger; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(26, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loaded "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(BossCatalog.Count); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" boss ability kits."); } logger.LogInfo(val); } private static void AddBossKit(string key, string name, string description, params int[] slotGuids) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) PrefabGUID[] array = (PrefabGUID[])(object)new PrefabGUID[slotGuids.Length]; for (int i = 0; i < slotGuids.Length; i++) { array[i] = new PrefabGUID(slotGuids[i]); } BossCatalog[key] = new BossKit { Key = key, Name = name, Description = description, Slots = array }; } private static void SetBossStats(string key, params ModifyUnitStatBuff_DOTS[] stats) { if (BossCatalog.TryGetValue(key, out var value)) { value.Stats = stats; } } internal static string DescribeBossStats(BossKit kit) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) if (kit.Stats == null || kit.Stats.Length == 0) { return "no stat bonus"; } List<string> list = new List<string>(); ModifyUnitStatBuff_DOTS[] stats = kit.Stats; foreach (ModifyUnitStatBuff_DOTS val in stats) { list.Add($"+{val.Value * 100f:0.#}% {BossStatName(val.StatType)}"); } return string.Join(", ", list); } private unsafe static string BossStatName(UnitStatType statType) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Invalid comparison between Unknown and I4 //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Invalid comparison between Unknown and I4 //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Expected I4, but got Unknown //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Invalid comparison between Unknown and I4 //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Invalid comparison between Unknown and I4 UnitStatType val = statType; UnitStatType val2 = val; if ((int)val2 <= 23) { if ((int)val2 == 0) { return "physical power"; } switch (val2 - 4) { default: if ((int)val2 != 23) { break; } return "spell resistance"; case 0: return "max health"; case 4: return "physical resistance"; case 1: return "movement speed"; case 2: case 3: break; } } else if ((int)val2 <= 59) { if ((int)val2 == 25) { return "spell power"; } if ((int)val2 == 59) { return "attack speed"; } } else { if ((int)val2 == 70) { return "spell cooldown recovery"; } if ((int)val2 == 71) { return "weapon cooldown recovery"; } } return ((object)(*(UnitStatType*)(&statType))/*cast due to .constrained prefix*/).ToString(); } private static bool TryParseBossMode(string value, out string mode) { mode = "all"; switch (value?.ToLowerInvariant()) { case "": case "all": case "full": case "both": case null: return true; case "stats": case "stat": case "statsonly": case "noskills": case "passive": mode = "stats"; return true; case "skills": case "skill": case "abilities": case "active": mode = "skills"; return true; default: return false; } } private static string DescribeBossMode(string mode) { if (!(mode == "stats")) { if (mode == "skills") { return "skills only"; } return "skills + stats"; } return "stats only"; } private static string InferBossMode(EntityManager entityManager, Entity buffEntity, string kitKey) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) if (MatchesBossKit(entityManager, buffEntity, out var _)) { return BuffHasKitStats(entityManager, buffEntity, kitKey) ? "all" : "skills"; } return "stats"; } private static bool BuffHasKitStats(EntityManager entityManager, Entity buffEntity, string kitKey) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) BossKit value; return BossCatalog.TryGetValue(kitKey, out value) && value.Stats != null && value.Stats.Length != 0 && ((EntityManager)(ref entityManager)).HasBuffer<ModifyUnitStatBuff_DOTS>(buffEntity) && BuffStatsMatch(((EntityManager)(ref entityManager)).GetBuffer<ModifyUnitStatBuff_DOTS>(buffEntity, false), value.Stats); } private static bool BuffStatsMatch(DynamicBuffer<ModifyUnitStatBuff_DOTS> stats, ModifyUnitStatBuff_DOTS[] expected) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) if (stats.Length != expected.Length) { return false; } for (int i = 0; i < expected.Length; i++) { if (stats[i].StatType != expected[i].StatType || stats[i].ModificationType != expected[i].ModificationType || Math.Abs(stats[i].Value - expected[i].Value) > 0.0001f) { return false; } } return true; } private static bool ApplyBossAbilityKit(Entity player, EntityManager entityManager, ServerGameManager serverGameManager, BossKit kit, string mode) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: 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_00fd: 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_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_025e: Unknown result type (might be due to invalid IL or missing references) //IL_0201: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Expected O, but got Unknown //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0272: 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_0268: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_0279: Unknown result type (might be due to invalid IL or missing references) //IL_030a: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0321: Unknown result type (might be due to invalid IL or missing references) //IL_0322: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02e1: Unknown result type (might be due to invalid IL or missing references) //IL_02e6: Unknown result type (might be due to invalid IL or missing references) //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_037d: Unknown result type (might be due to invalid IL or missing references) //IL_037e: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0394: Unknown result type (might be due to invalid IL or missing references) //IL_039b: Unknown result type (might be due to invalid IL or missing references) //IL_039c: Unknown result type (might be due to invalid IL or missing references) //IL_03a6: Unknown result type (might be due to invalid IL or missing references) //IL_0373: Unknown result type (might be due to invalid IL or missing references) //IL_03df: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03ec: Unknown result type (might be due to invalid IL or missing references) //IL_03fe: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Unknown result type (might be due to invalid IL or missing references) //IL_03b5: Unknown result type (might be due to invalid IL or missing references) //IL_03b6: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03d0: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Unknown result type (might be due to invalid IL or missing references) //IL_043c: Unknown result type (might be due to invalid IL or missing references) //IL_043d: Unknown result type (might be due to invalid IL or missing references) //IL_043e: Unknown result type (might be due to invalid IL or missing references) //IL_043f: Unknown result type (might be due to invalid IL or missing references) string kitKey; Entity val = FindBossAbilityKit(entityManager, player, out kitKey); if (val != Entity.Null) { string value; string text = (ActiveBossKitModes.TryGetValue(player, out value) ? value : InferBossMode(entityManager, val, kitKey)); if (kitKey == kit.Key && text == mode) { ActiveBossAbilityBuffs[player] = val; ActiveBossKitKeys[player] = kitKey; ActiveBossKitModes[player] = mode; ApplyBossStats(entityManager, val, (mode == "skills") ? null : kit); return true; } RemoveBossAbilityKit(player, entityManager, serverGameManager); } Entity val2 = Entity.Null; foreach (Entity bossCarrierBuff in GetBossCarrierBuffs(entityManager, player)) { DestroyUtility.Destroy(entityManager, bossCarrierBuff, (DestroyDebugReason)13, (string)null, 0); } bool flag = ((ServerGameManager)(ref serverGameManager)).TryInstantiateBuffEntityImmediate(player, player, BossCarrierBuffPrefab, ref val2, (OnSpawnedDelegate)null, 1); if ((!flag || !((EntityManager)(ref entityManager)).Exists(val2)) && (!BuffUtility.TryGetBuff<EntityManager>(entityManager, player, PrefabIdentifier.op_Implicit(BossCarrierBuffPrefab), ref val2) || !((EntityManager)(ref entityManager)).Exists(val2))) { using List<Entity>.Enumerator enumerator2 = GetBossCarrierBuffs(entityManager, player).GetEnumerator(); if (enumerator2.MoveNext()) { Entity current2 = enumerator2.Current; val2 = current2; } } Diagnostic($"boss {kit.Key}: mode={mode} spawned={flag} carrier={val2} " + "abilities=" + DescribeKitAbilities(entityManager, kit)); if (val2 == Entity.Null || !((EntityManager)(ref entityManager)).Exists(val2)) { ManualLogSource logger = Logger; bool flag2 = default(bool); BepInExErrorLogInterpolatedStringHandler val3 = new BepInExErrorLogInterpolatedStringHandler(48, 2, ref flag2); if (flag2) { ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Boss ability kit '"); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<string>(kit.Key); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("' failed to spawn for player "); ((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<Entity>(player); ((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("."); } logger.LogError(val3); return false; } DynamicBuffer<ReplaceAbilityOnSlotBuff> val4 = (((EntityManager)(ref entityManager)).HasBuffer<ReplaceAbilityOnSlotBuff>(val2) ? ((EntityManager)(ref entityManager)).GetBuffer<ReplaceAbilityOnSlotBuff>(val2, false) : ((EntityManager)(ref entityManager)).AddBuffer<ReplaceAbilityOnSlotBuff>(val2)); val4.Clear(); if (mode != "stats") { for (int i = 0; i < kit.Slots.Length; i++) { val4.Add(new ReplaceAbilityOnSlotBuff { Target = (ReplaceAbilityTarget)0, Slot = i + 1, NewGroupId = kit.Slots[i], Priority = 99, CopyCooldown = true, CastBlockType = (GroupSlotModificationCastBlockType)0 }); } } if (((EntityManager)(ref entityManager)).HasComponent<FreeCastBuff>(val2)) { ((EntityManager)(ref entityManager)).RemoveComponent<FreeCastBuff>(val2); } int num = ApplyBossStats(entityManager, val2, (mode == "skills") ? null : kit); Diagnostic($"boss {kit.Key}: stats in buffer={num} ({DescribeBossStats(kit)})"); if (!((EntityManager)(ref entityManager)).HasComponent<LifeTime>(val2)) { ((EntityManager)(ref entityManager)).AddComponent<LifeTime>(val2); } LifeTime componentData = ((EntityManager)(ref entityManager)).GetComponentData<LifeTime>(val2); componentData.Duration = -1f; componentData.EndAction = (LifeTimeEndAction)0; ((EntityManager)(ref entityManager)).SetComponentData<LifeTime>(val2, componentData); if (((EntityManager)(ref entityManager)).HasComponent<BuffCategory>(val2)) { BuffCategory componentData2 = ((EntityManager)(ref entityManager)).GetComponentData<BuffCategory>(val2); ref BuffCategoryFlag groups = ref componentData2.Groups; groups = (BuffCategoryFlag)((ulong)groups | 0x200000uL); ((EntityManager)(ref entityManager)).SetComponentData<BuffCategory>(val2, componentData2); } ActiveBossAbilityBuffs[player] = val2; ActiveBossKitKeys[player] = kit.Key; ActiveBossKitModes[player] = mode; Diagnostic("boss " + kit.Key + ": before=" + DescribeSlots(entityManager, player)); if (mode != "stats") { PushBossKitSlots(player, entityManager, serverGameManager, val2, kit); } return true; } private static int ApplyBossStats(EntityManager entityManager, Entity buffEntity, BossKit kit) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: 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) DynamicBuffer<ModifyUnitStatBuff_DOTS> val = (((EntityManager)(ref entityManager)).HasBuffer<ModifyUnitStatBuff_DOTS>(buffEntity) ? ((EntityManager)(ref entityManager)).GetBuffer<ModifyUnitStatBuff_DOTS>(buffEntity, false) : ((EntityManager)(ref entityManager)).AddBuffer<ModifyUnitStatBuff_DOTS>(buffEntity)); val.Clear(); if (kit != null && kit.Stats != null) { ModifyUnitStatBuff_DOTS[] stats = kit.Stats; foreach (ModifyUnitStatBuff_DOTS val2 in stats) { ModifyUnitStatBuff_DOTS val3 = val2; val3.Id = ModificationId.NewId(0); val.Add(val3); } } return val.Length; } private static bool RemoveBossAbilityKit(Entity player, EntityManager entityManager, ServerGameManager serverGameManager) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: 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_00f7: Unknown result type (might be due to invalid IL or missing references) try { ((ServerGameManager)(ref serverGameManager)).InterruptCast(player); } catch (Exception ex) { Diagnostic("boss off: InterruptCast failed " + ex.GetType().Name + ": " + ex.Message); } bool flag = false; if (ActiveBossAbilityBuffs.TryGetValue(player, out var value)) { if (((EntityManager)(ref entityManager)).Exists(value)) { DestroyUtility.Destroy(entityManager, value, (DestroyDebugReason)13, (string)null, 0); flag = true; } ActiveBossAbilityBuffs.Remove(player); } ActiveBossKitKeys.Remove(player); ActiveBossKitModes.Remove(player); string kitKey; Entity val = FindBossAbilityKit(entityManager, player, out kitKey); if (val != Entity.Null && ((EntityManager)(ref entityManager)).Exists(val) && val != value) { DestroyUtility.Destroy(entityManager, val, (DestroyDebugReason)13, (string)null, 0); flag = true; } if (flag) { Logger.LogInfo((object)"Boss ability kit removed; the engine restores the original ability slots."); ForceAbilitySlotRefresh(); Diagnostic("boss off: after=" + DescribeSlots(entityManager, player)); } return flag; } private static Entity FindBossAbilityKit(EntityManager entityManager, Entity player, out string kitKey) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0062: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0092: 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) kitKey = null; List<Entity> bossCarrierBuffs = GetBossCarrierBuffs(entityManager, player); foreach (Entity item in bossCarrierBuffs) { if (MatchesBossKit(entityManager, item, out kitKey)) { return item; } } foreach (Entity item2 in bossCarrierBuffs) { if (MatchesBossStatsOnly(entityManager, item2, out kitKey)) { return item2; } } return Entity.Null; } private static bool MatchesBossStatsOnly(EntityManager entityManager, Entity buffEntity, out string kitKey) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) kitKey = null; if (((EntityManager)(ref entityManager)).HasBuffer<ReplaceAbilityOnSlotBuff>(buffEntity) && ((EntityManager)(ref entityManager)).GetBuffer<ReplaceAbilityOnSlotBuff>(buffEntity, false).Length > 0) { return false; } if (!((EntityManager)(ref entityManager)).HasBuffer<ModifyUnitStatBuff_DOTS>(buffEntity)) { return false; } DynamicBuffer<ModifyUnitStatBuff_DOTS> buffer = ((EntityManager)(ref entityManager)).GetBuffer<ModifyUnitStatBuff_DOTS>(buffEntity, false); foreach (BossKit value in BossCatalog.Values) { if (value.Stats == null || value.Stats.Length == 0 || !BuffStatsMatch(buffer, value.Stats)) { continue; } kitKey = value.Key; return true; } return false; } private static bool MatchesBossKit(EntityManager entityManager, Entity buffEntity, out string kitKey) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) kitKey = null; if (!((EntityManager)(ref entityManager)).HasBuffer<ReplaceAbilityOnSlotBuff>(buffEntity)) { return false; } DynamicBuffer<ReplaceAbilityOnSlotBuff> buffer = ((EntityManager)(ref entityManager)).GetBuffer<ReplaceAbilityOnSlotBuff>(buffEntity, false); foreach (BossKit value in BossCatalog.Values) { if (buffer.Length != value.Slots.Length) { continue; } bool flag = true; for (int i = 0; i < value.Slots.Length; i++) { ReplaceAbilityOnSlotBuff val = buffer[i]; if (val.Slot != i + 1 || val.Priority != 99 || !((PrefabGUID)(ref val.NewGroupId)).Equals(value.Slots[i])) { flag = false; break; } } if (!flag) { continue; } kitKey = value.Key; return true; } return false; } private static List<Entity> GetBossCarrierBuffs(EntityManager entityManager, Entity player) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: 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) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //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_0078: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) List<Entity> list = new List<Entity>(); Entity val = default(Entity); if (BuffUtility.TryGetBuff<EntityManager>(entityManager, player, PrefabIdentifier.op_Implicit(BossCarrierBuffPrefab), ref val) && ((EntityManager)(ref entityManager)).Exists(val)) { list.Add(val); } EntityQuery val2 = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[2] { ComponentType.ReadOnly<PrefabGUID>(), ComponentType.ReadOnly<Buff>() }); NativeArray<Entity> val3 = ((EntityQuery)(ref val2)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); NativeArray<PrefabGUID> val4 = ((EntityQuery)(ref val2)).ToComponentDataArray<PrefabGUID>(AllocatorHandle.op_Implicit((Allocator)2)); try { for (int i = 0; i < val3.Length; i++) { Entity val5 = val3[i]; if (!((EntityManager)(ref entityManager)).HasComponent<Prefab>(val5)) { PrefabGUID val6 = val4[i]; if (((PrefabGUID)(ref val6)).Equals(BossCarrierBuffPrefab) && !list.Contains(val5) && ((EntityManager)(ref entityManager)).HasComponent<EntityOwner>(val5) && ((EntityManager)(ref entityManager)).GetComponentData<EntityOwner>(val5).Owner == player) { list.Add(val5); } } } } finally { val3.Dispose(); val4.Dispose(); } return list; } private static void PushBossKitSlots(Entity player, EntityManager entityManager, ServerGameManager serverGameManager, Entity buffEntity, BossKit kit) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_006e: 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) int num = (((EntityManager)(ref entityManager)).HasBuffer<AbilityGroupSlotBuffer>(player) ? ((EntityManager)(ref entityManager)).GetBuffer<AbilityGroupSlotBuffer>(player, false).Length : 0); for (int i = 0; i < kit.Slots.Length; i++) { int num2 = i + 1; if (num2 >= num) { Diagnostic($"boss {kit.Key}: slot={num2} skipped, live slot buffer is only {num} long"); continue; } try { ((ServerGameManager)(ref serverGameManager)).ModifyAbilityGroupOnSlot(buffEntity, player, num2, kit.Slots[i], 0); } catch (Exception ex) { Diagnostic($"boss {kit.Key}: ModifyAbilityGroupOnSlot slot={num2} threw " + ex.GetType().Name + ": " + ex.Message); } } MarkBossSlotsDirty(entityManager, player, kit.Slots.Length); ForceAbilitySlotRefresh(); Diagnostic("boss " + kit.Key + ": after=" + DescribeSlots(entityManager, player)); } private static void MarkBossSlotsDirty(EntityManager entityManager, Entity player, int slotCount) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_007e: 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) if (!((EntityManager)(ref entityManager)).HasBuffer<AbilityGroupSlotBuffer>(player)) { Diagnostic("slot dirty tag skipped: player has no AbilityGroupSlotBuffer"); return; } DynamicBuffer<AbilityGroupSlotBuffer> buffer = ((EntityManager)(ref entityManager)).GetBuffer<AbilityGroupSlotBuffer>(player, false); for (int i = 1; i <= slotCount && i < buffer.Length; i++) { Entity entity = buffer[i].GroupSlotEntity._Entity; if (!((EntityManager)(ref entityManager)).Exists(entity)) { continue; } try { ComponentType val = ComponentType.ReadWrite(Il2CppType.Of<DirtyTag>()); if (!((EntityManager)(ref entityManager)).HasComponent(entity, val)) { ((EntityManager)(ref entityManager)).AddComponent(entity, val); } } catch (Exception ex) { Diagnostic("slot dirty tag failed: " + ex.GetType().Name + ": " + ex.Message); break; } } } private static void ForceAbilitySlotRefresh() { Enumerator<World> enumerator = World.All.GetEnumerator(); while (enumerator.MoveNext()) { World current = enumerator.Current; if (!current.IsCreated || current.Name != "Server") { continue; } ReplaceAbilityOnSlotSystem existingSystemManaged = current.GetExistingSystemManaged<ReplaceAbilityOnSlotSystem>(); if (existingSystemManaged != null) { ((SystemBase)existingSystemManaged).OnUpdate(); } break; } } private static string DescribeSlots(EntityManager entityManager, Entity player) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00b6: 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_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) if (!((EntityManager)(ref entityManager)).HasBuffer<AbilityGroupSlotBuffer>(player)) { return "no-slot-buffer"; } DynamicBuffer<AbilityGroupSlotBuffer> buffer = ((EntityManager)(ref entityManager)).GetBuffer<AbilityGroupSlotBuffer>(player, false); StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append("len=").Append(buffer.Length); for (int i = 1; i < buffer.Length && i <= 6; i++) { stringBuilder.Append(" [").Append(i).Append(':') .Append(buffer[i].BaseAbilityGroupOnSlot._Value); Entity entity = buffer[i].GroupSlotEntity._Entity; if (((EntityManager)(ref entityManager)).Exists(entity) && ((EntityManager)(ref entityManager)).HasComponent<AbilityGroupSlot>(entity)) { Entity entity2 = ((EntityManager)(ref entityManager)).GetComponentData<AbilityGroupSlot>(entity).StateEntity._Entity; if (((EntityManager)(ref entityManager)).Exists(entity2)) { stringBuilder.Append(" -> ").Append(((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(entity2)._Value); } } stringBuilder.Append(']'); } return stringBuilder.ToString(); } private static string DescribeKitAbilities(EntityManager entityManager, BossKit kit) { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: 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) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0045: 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) StringBuilder stringBuilder = new StringBuilder(); PrefabCollectionSystem existingSystemManaged = ((EntityManager)(ref entityManager)).World.GetExistingSystemManaged<PrefabCollectionSystem>(); PrefabGUID[] slots = kit.Slots; Entity val2 = default(Entity); foreach (PrefabGUID val in slots) { stringBuilder.Append(val._Value); if (existingSystemManaged != null && existingSystemManaged._PrefabGuidToEntityMap.TryGetValue(val, ref val2)) { stringBuilder.Append(((EntityManager)(ref entityManager)).HasComponent<VBloodAbilityData>(val2) ? "(vblood)" : "(boss)"); } else { stringBuilder.Append("(missing)"); } stringBuilder.Append(" | "); } return stringBuilder.ToString(); } internal static void RemovePersistedBossKits(EntityManager entityManager) { //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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) World world = ((EntityManager)(ref entityManager)).World; if (_persistedKitScanWorld == world) { return; } _persistedKitScanWorld = world; EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<ReplaceAbilityOnSlotBuff>() }); NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); try { Enumerator<Entity> enumerator = val2.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; if (!((EntityManager)(ref entityManager)).HasComponent<Prefab>(current) && MatchesAnyBossKitSlots(entityManager, current)) { if (((EntityManager)(ref entityManager)).HasComponent<ReplaceAbilityOnSlotData>(current)) { ((EntityManager)(ref entityManager)).RemoveComponent<ReplaceAbilityOnSlotData>(current); } ((EntityManager)(ref entityManager)).RemoveComponent<ReplaceAbilityOnSlotBuff>(current); DestroyUtility.Destroy(entityManager, current, (DestroyDebugReason)13, (string)null, 0); Logger.LogInfo((object)"Removed a persisted boss ability kit so the ability slots could be restored."); } } } finally { val2.Dispose(); } } private static bool MatchesAnyBossKitSlots(EntityManager entityManager, Entity entity) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) DynamicBuffer<ReplaceAbilityOnSlotBuff> buffer = ((EntityManager)(ref entityManager)).GetBuffer<ReplaceAbilityOnSlotBuff>(entity, false); foreach (BossKit value in BossCatalog.Values) { if (buffer.Length != value.Slots.Length) { continue; } bool flag = true; for (int i = 0; i < value.Slots.Length; i++) { ReplaceAbilityOnSlotBuff val = buffer[i]; if (!((PrefabGUID)(ref val.NewGroupId)).Equals(value.Slots[i])) { flag = false; break; } } if (!flag) { continue; } return true; } return false; } [Command("checkbuffs", "Show boss, rune and item buffs together: .checkbuffs", null, null, null, false)] public void CheckBuffs(ChatCommandContext ctx) { ShowBuffStatus(ctx); } internal static void ShowBuffStatus(ChatCommandContext ctx) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: 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) //IL_002c: 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_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: 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_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: 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_010a: 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_0131: 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_0113: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0171: 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_0173: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_029c: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_02bf: Unknown result type (might be due to invalid IL or missing references) //IL_02c1: Unknown result type (might be due to invalid IL or missing references) if (!TryGetPlayerContext(ctx, "Buffs", out var entityManager, out var player, out var _)) { return; } string kitKey; Entity val = FindBossAbilityKit(entityManager, player, out kitKey); if (val != Entity.Null && BossCatalog.TryGetValue(kitKey, out var value)) { string value2; string mode = (ActiveBossKitModes.TryGetValue(player, out value2) ? value2 : InferBossMode(entityManager, val, kitKey)); ctx.Reply("Boss: " + value.Name + " (" + DescribeBossMode(mode) + ") | " + DescribeStatBuffer(entityManager, val)); } else { ctx.Reply("Boss: none."); } if (!ActiveRuneBuffs.TryGetValue(player, out var value3) || !((EntityManager)(ref entityManager)).Exists(value3)) { Entity val2 = default(Entity); value3 = ((BuffUtility.TryGetBuff<EntityManager>(entityManager, player, PrefabIdentifier.op_Implicit(RuneBuffPrefab), ref val2) && ((EntityManager)(ref entityManager)).Exists(val2)) ? val2 : Entity.Null); } string value4; string text = (SelectedRunes.TryGetValue(player, out value4) ? value4 : "none"); ctx.Reply((value3 != Entity.Null) ? ("Rune: " + text + " | active proc: " + DescribeStatBuffer(entityManager, value3)) : ("Rune: " + text + " | no timed buff right now (stats appear while a proc is active).")); List<Entity> playerBuffEntities = GetPlayerBuffEntities(entityManager, player, ItemBuffPrefab); PlayerItems.TryGetValue(player, out var value5); value5 = value5 ?? new List<int>(); if (value5.Count == 0) { ctx.Reply("Items: none."); } else { List<string> list = new List<string>(); foreach (Entity item in playerBuffEntities) { list.Add(DescribeStatBuffer(entityManager, item)); } string text2 = ((playerBuffEntities.Count == value5.Count) ? string.Empty : $" MISMATCH (expected {value5.Count})"); ctx.Reply($"Items: {value5.Count}/{5}, buff entities {playerBuffEntities.Count}{text2} | " + string.Join(" + ", list)); } ctx.Reply("Coexistence: boss=" + ((val != Entity.Null) ? "on" : "off") + ", rune=" + ((value3 != Entity.Null) ? "on" : "waiting") + ", " + $"items={playerBuffEntities.Count}/{value5.Count}. Each subsystem owns separate buff entities, so none removes another."); } private static List<Entity> GetPlayerBuffEntities(EntityManager entityManager, Entity player, PrefabGUID prefab) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: 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_0059: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_006f: 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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) List<Entity> list = new List<Entity>(); EntityQuery val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[2] { ComponentType.ReadOnly<PrefabGUID>(), ComponentType.ReadOnly<Buff>() }); NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); NativeArray<PrefabGUID> val3 = ((EntityQuery)(ref val)).ToComponentDataArray<PrefabGUID>(AllocatorHandle.op_Implicit((Allocator)2)); try { for (int i = 0; i < val2.Length; i++) { Entity val4 = val2[i]; if (!((EntityManager)(ref entityManager)).HasComponent<Prefab>(val4)) { PrefabGUID val5 = val3[i]; if (((PrefabGUID)(ref val5)).Equals(prefab) && ((EntityManager)(ref entityManager)).HasComponent<EntityOwner>(val4) && ((EntityManager)(ref entityManager)).GetComponentData<EntityOwner>(val4).Owner == player) { list.Add(val4); } } } } finally { val2.Dispose(); val3.Dispose(); } return list; } private static string DescribeStatBuffer(EntityManager entityManager, Entity buffEntity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Invalid comparison between Unknown and I4 //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) if (buffEntity == Entity.Null || !((EntityManager)(ref entityManager)).Exists(buffEntity) || !((EntityManager)(ref entityManager)).HasBuffer<ModifyUnitStatBuff_DOTS>(buffEntity)) { return "no stats"; } DynamicBuffer<ModifyUnitStatBuff_DOTS> buffer = ((EntityManager)(ref entityManager)).GetBuffer<ModifyUnitStatBuff_DOTS>(buffEntity, false); List<string> list = new List<string>(); Enumerator<ModifyUnitStatBuff_DOTS> enumerator = buffer.GetEnumerator(); while (enumerator.MoveNext()) { ModifyUnitStatBuff_DOTS current = enumerator.Current; bool flag = (int)current.ModificationType != 3; float num = (flag ? (current.Value * 100f) : current.Value); string text = ((num < 0f) ? "-" : "+"); list.Add(string.Format("{0}{1:0.#}{2} {3}", text, Math.Abs(num), flag ? "%" : string.Empty, BossStatName(current.StatType))); } return (list.Count == 0) ? "no stats" : string.Join(", ", list); } private static int GetLeagueLevel(Entity entity, EntityManager entityManager) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0017: 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_001d: Unknown result type (might be due to invalid IL or missing references) if (!((EntityManager)(ref entityManager)).HasComponent<UnitLevel>(entity)) { return 1; } int value = ((EntityManager)(ref entityManager)).GetComponentData<UnitLevel>(entity).Level._Value; int num = Math.Min(Math.Max(value, 1), 100); return 1 + (num - 1) * 17 / 99; } private static float ScaleByLeagueLevel(float minimum, float maximum, Entity entity, EntityManager entityManager) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Unknown result type (might be due to invalid IL or missing references) int leagueLevel = GetLeagueLevel(entity, entityManager); return minimum + (maximum - minimum) * (float)(leagueLevel - 1) / 17f; } private static void DealBonusDamage(Entity player, Entity target, EntityManager entityManager, ServerGameManager serverGameManager, float amount, MainDamageType damageType = (MainDamageType)0) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0051: 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_0068: 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_0072: Unknown result type (might be due to invalid IL or missing references) if (((EntityManager)(ref entityManager)).Exists(target) && ((EntityManager)(ref entityManager)).HasComponent<Health>(target)) { Health componentData = ((EntityManager)(ref entityManager)).GetComponentData<Health>(target); if (!componentData.IsDead && !(componentData.Value <= 0f)) { ((ServerGameManager)(ref serverGameManager)).DealDamage(player, target, default(EntityTypeModifiers), amount, 0f, 1f, true, false, false, (StatChangeCallbackDelegate)null, damageType, false); MarkBonusDamageEvent(player, target); } } } private static void Heal(Entity entity, EntityManager entityManager, float amount) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) if (((EntityManager)(ref entityManager)).Exists(entity) && ((EntityManager)(ref entityManager)).HasComponent<Health>(entity)) { Health componentData = ((EntityManager)(ref entityManager)).GetComponentData<Health>(entity); componentData.Value = Math.Min(componentData.Value + amount, ((ModifiableFloat)(ref componentData.MaxHealth)).Value); ((EntityManager)(ref entityManager)).SetComponentData<Health>(entity, componentData); } } private static void MarkBonusDamageEvent(Entity player, Entity target) { //IL_0006: 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) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (!PendingBonusDamageEvents.TryGetValue(player, out var value)) { value = new Dictionary<Entity, int>(); PendingBonusDamageEvents[player] = value; } value.TryGetValue(target, out var value2); value[target] = value2 + 1; } internal static bool ConsumeBonusDamageEvent(Entity player, Entity target) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0011: 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) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) if (!PendingBonusDamageEvents.TryGetValue(player, out var value) || !value.TryGetValue(target, out var value2)) { return false; } if (value2 <= 1) { value.Remove(target); if (value.Count == 0) { PendingBonusDamageEvents.Remove(player); } } else { value[target] = value2 - 1; } return true; } private static void Diagnostic(string message) { if (DebugLogging != null && !DebugLogging.Value) { return; } try { string directoryName = Path.GetDirectoryName(typeof(Plugin).Assembly.Location); using FileStream stream = new FileStream(Path.Combine(directoryName, "NocturneCraft-debug.log"), FileMode.Append, FileAccess.Write, FileShare.ReadWrite); using StreamWriter streamWriter = new StreamWriter(stream); streamWriter.WriteLine($"{DateTime.UtcNow:O} {message}"); } catch { } } private static ModifyUnitStatBuff_DOTS Stat(UnitStatType statType, float value) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) return new ModifyUnitStatBuff_DOTS { StatType = statType, ModificationType = (ModificationType)3, AttributeCapType = (AttributeCapType)(-1), Value = value, Modifier = 1f, Id = ModificationId.NewId(0) }; } private static ModifyUnitStatBuff_DOTS PercentStat(UnitStatType statType, float value) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) return new ModifyUnitStatBuff_DOTS { StatType = statType, ModificationType = (ModificationType)5, AttributeCapType = (AttributeCapType)(-1), Value = value, Modifier = 1f, Id = ModificationId.NewId(0) }; } private static ModifyUnitStatBuff_DOTS AttackSpeed(float value) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_000d: 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_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) return new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)59, ModificationType = (ModificationType)5, AttributeCapType = (AttributeCapType)(-1), Value = value, Modifier = 1f, Id = ModificationId.NewId(0) }; } private static bool TryGetPlayerContext(ChatCommandContext ctx, string feature, out EntityManager entityManager, out Entity player, out ServerGameManager serverGameManager) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: 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_0089: 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_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) entityManager = default(EntityManager); player = Entity.Null; serverGameManager = default(ServerGameManager); World val = null; Enumerator<World> enumerator = World.All.GetEnumerator(); while (enumerator.MoveNext()) { World current = enumerator.Current; if (current.Name == "Server" && current.IsCreated) { val = current; break; } } if (val == null) { ctx.Reply(feature + " failed: the server world is not available."); return false; } entityManager = val.EntityManager; player = ctx.Event.SenderCharacterEntity; if (!((EntityManager)(ref entityManager)).Exists(player)) { ctx.Reply(feature + " failed: your character is not available."); return false; } ServerScriptMapper existingSystemManaged = val.GetExistingSystemManaged<ServerScriptMapper>(); if (existingSystemManaged == null) { ctx.Reply(feature + " failed: the server buff system is not ready."); return false; } serverGameManager = existingSystemManaged.GetServerGameManager(); return true; } [Command("items", "Show League items: .items 1", null, null, null, false)] public void Items(ChatCommandContext ctx, int page) { LeagueItem[] array = ItemCatalog.Values.OrderBy((LeagueItem item) => item.Id).ToArray(); int num = (array.Length + 8 - 1) / 8; if (page < 1 || page > num) { ctx.Reply($"Item page must be between 1 and {num}."); return; } ctx.Reply($"LoL item catalog page {page}/{num}. Use .item buy <id> (up to 5 items; no gold cost)."); int num2 = (page - 1) * 8; int num3 = Math.Min(num2 + 8, array.Length); for (int num4 = num2; num4 < num3; num4++) { LeagueItem leagueItem = array[num4]; ctx.Reply($"{leagueItem.Id}: {leagueItem.Name} - {FormatItemStats(leagueItem)} (LoL cost: {leagueItem.Cost})"); } } [Command("item", "Buy or sell an item: .item buy 3031", null, null, null, false)] public void Item(ChatCommandContext ctx, string action, string itemKey) { //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_014e: 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_0150: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_0238: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) if (!TryFindItem(itemKey, out var item)) { ctx.Reply("Unknown or unsupported item: " + itemKey + ". Use .items 1 to browse."); } else { if (!TryGetPlayerContext(ctx, "Item", out var entityManager, out var player, out var serverGameManager)) { return; } string text = action.ToLowerInvariant(); if (!PlayerItems.TryGetValue(player, out var value)) { if (text != "buy" && text != "add") { ctx.Reply("You have no LoL items equipped."); return; } value = new List<int>(); PlayerItems[player] = value; } if (text == "buy" || text == "add") { if (value.Contains(item.Id)) { ctx.Reply(item.Name + " is already in your item slots."); return; } if (value.Count >= 5) { ctx.Reply($"You already have {5} items. Sell one first with .item sell <id>."); return; } value.Add(item.Id); if (!ApplyItemStats(player, entityManager, serverGameManager)) { value.Remove(item.Id); if (value.Count == 0) { PlayerItems.Remove(player); } ctx.Reply("Item failed: V Rising could not apply the item stats."); } else { ctx.Reply($"Bought {item.Name} ({value.Count}/{5}): {FormatItemStats(item)}. Its own buff is now active; your V Rising weapon is unchanged."); } } else if (text == "sell" || text == "remove") { if (!value.Remove(item.Id)) { ctx.Reply(item.Name + " is not in your item slots."); } else if (!ApplyItemStats(player, entityManager, serverGameManager)) { ctx.Reply("Item removal failed: the remaining item stats could not be refreshed."); } else { ctx.Reply($"Sold {item.Name}. Item slots: {value.Count}/{5}."); } } else { ctx.Reply("Use .item buy <id> or .item sell <id>."); } } } [Command("myitems", "Show your equipped LoL items", null, null, null, false)] public void MyItems(ChatCommandContext ctx) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if (!TryGetPlayerContext(ctx, "Item", out var _, out var player, out var _)) { return; } if (!PlayerItems.TryGetValue(player, out var value) || value.Count == 0) { ctx.Reply($"You have no LoL items equipped (0/{5})."); return; } ctx.Reply($"Your LoL items ({value.Count}/{5}):"); foreach (int item in value) { LeagueItem leagueItem = ItemCatalog[item]; ctx.Reply($"{leagueItem.Id}: {leagueItem.Name} - {FormatItemStats(leagueItem)}"); } } private static void LoadItemCatalog() { //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Expected O, but got Unknown LeagueItemDefinition[] items = LeagueItemCatalogData.Items; foreach (LeagueItemDefinition leagueItemDefinition in items) { LeagueItem leagueItem = new LeagueItem { Id = leagueItemDefinition.Id, Name = leagueItemDefinition.Name, Cost = leagueItemDefinition.Cost, Stats = leagueItemDefinition.Stats }; if (ItemCatalog.ContainsKey(leagueItem.Id)) { throw new InvalidOperationException($"Duplicate League item ID: {leagueItem.Id}"); } ItemCatalog.Add(leagueItem.Id, leagueItem); } if (ItemCatalog.Count == 0) { throw new InvalidOperationException("The League item catalog is empty."); } ManualLogSource logger = Logger; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(46, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Loaded "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<int>(ItemCatalog.Count); ((BepInExLogInterpolatedStringHandler)val).Appen