Decompiled source of Elements v0.6.49
SpellBrigadeElements.dll
Decompiled 4 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.IO.Compression; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using System.Text; using System.Text.RegularExpressions; using BepInEx; using BepInEx.Configuration; using BepInEx.Core.Logging.Interpolation; using BepInEx.Logging; using BepInEx.Unity.IL2CPP; using HarmonyLib; using Il2CppInterop.Common; using Il2CppInterop.Runtime; using Il2CppInterop.Runtime.Injection; using Il2CppInterop.Runtime.InteropTypes; using Il2CppInterop.Runtime.InteropTypes.Arrays; using Il2CppInterop.Runtime.Runtime; using Il2CppInterop.Runtime.Runtime.VersionSpecific.MethodInfo; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Reflection; using SpellBrigadeElements.Core; using SpellBrigadeElements.Game; using TMPro; using Unity.Collections; using Unity.Netcode; using UnityEngine; using UnityEngine.Bindings; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.Localization; using UnityEngine.Localization.Components; using UnityEngine.Localization.Settings; using UnityEngine.Localization.Tables; using UnityEngine.Rendering; using UnityEngine.SceneManagement; using UnityEngine.UI; using UnityEngine.VFX; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("SpellBrigadeElements")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.6.49.0")] [assembly: AssemblyInformationalVersion("0.6.49+1b4298dcd1e09cfdc201df8589c42d5b36ec88b0")] [assembly: AssemblyProduct("SpellBrigadeElements")] [assembly: AssemblyTitle("SpellBrigadeElements")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("0.6.49.0")] [module: UnverifiableCode] namespace SpellBrigadeElements { public static class DamageSource { public const string EarthBurst = "Earth burst"; public const string AirThud = "Air thud"; public const string AirSlam = "Air slam"; public static string? Current { get { if (!EarthBursts.Bursting) { if (AirLift.Landing != 1) { if (AirLift.Landing != 2) { return null; } return "Air slam"; } return "Air thud"; } return "Earth burst"; } } } public static class ElementScale { private sealed class Restore : IDisposable { private readonly float _s; private readonly bool _n; private bool _done; public Restore(float s, bool n) { _s = s; _n = n; } public void Dispose() { if (!_done) { _done = true; Strength = _s; NoLanding = _n; } } } public static float Strength { get; private set; } = 1f; public static bool NoLanding { get; private set; } public static void Set(float strength, bool noLanding) { Strength = (float.IsNaN(strength) ? 1f : Math.Clamp(strength, 0f, 1f)); NoLanding = noLanding; } public static void Reset() { Strength = 1f; NoLanding = false; } public static IDisposable Scope(float strength, bool noLanding) { (float, bool) tuple = (Strength, NoLanding); Set(strength, noLanding); return new Restore(tuple.Item1, tuple.Item2); } } public static class ElementsVisuals { public static bool ShowEarth(GameObject enemy, float radius) { //IL_001f: Unknown result type (might be due to invalid IL or missing references) try { if ((Object)(object)enemy == (Object)null || !ModConfig.EarthEnabled.Value) { return false; } return EarthBursts.ShowOnly(enemy.transform.position, radius); } catch (Exception ex) { ModLog.ErrorThrottled("show-earth", ex, Time.unscaledTime); return false; } } public static bool ShowEarthAt(Vector3 position, float radius) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) try { return ModConfig.EarthEnabled.Value && EarthBursts.ShowOnly(position, radius); } catch (Exception ex) { ModLog.ErrorThrottled("show-earth", ex, Time.unscaledTime); return false; } } public static bool ShowAir(GameObject enemy, float strength) { try { if ((Object)(object)enemy == (Object)null || !ModConfig.AirEnabled.Value) { return false; } return AirLift.ShowOnly(enemy, strength); } catch (Exception ex) { ModLog.ErrorThrottled("show-air", ex, Time.unscaledTime); return false; } } } internal static class ModConfig { public static ConfigEntry<bool> EarthEnabled; public static ConfigEntry<bool> AlwaysUnlocked; public static ConfigEntry<bool> OfferInShop; public static ConfigEntry<string> StandInElement; public static ConfigEntry<bool> AirEnabled; public static ConfigEntry<bool> Combos; public static ConfigEntry<string> AirStandInElement; public static ConfigEntry<float> AirLiftSeconds; public static ConfigEntry<float> AirLiftHeight; public static ConfigEntry<float> AirDamageTakenBonus; public static ConfigEntry<float> AirThudRadius; public static ConfigEntry<float> AirThudDamage; public static ConfigEntry<float> AirRelandImmunity; public static ConfigEntry<float> AirJuggleExtraSeconds; public static ConfigEntry<int> AirJugglesForSlam; public static ConfigEntry<float> AirSlamRadius; public static ConfigEntry<float> AirSlamDamage; public static ConfigEntry<int> AirMaxAirborne; public static ConfigEntry<float> AirLandingHitCooldown; public static ConfigEntry<int> AirThudMaxTargets; public static ConfigEntry<int> AirSlamMaxTargets; public static ConfigEntry<float> AirThermalHeight; public static ConfigEntry<float> AirRodStrikeDamage; public static ConfigEntry<float> AirAcidRainSeconds; public static ConfigEntry<float> AirHailThudFactor; public static ConfigEntry<float> AirDropZoneThudFactor; public static ConfigEntry<bool> AirSwirl; public static ConfigEntry<bool> AirGameTornado; public static ConfigEntry<float> AirTornadoScale; public static ConfigEntry<float> CrackDelay; public static ConfigEntry<float> BurstRadius; public static ConfigEntry<float> BurstDamage; public static ConfigEntry<float> SecondBurstDelay; public static ConfigEntry<float> SecondBurstDamage; public static ConfigEntry<float> PerEnemyCooldown; public static ConfigEntry<float> BurstShield; public static ConfigEntry<float> BurstHitCooldown; public static ConfigEntry<int> MaxPendingCracks; public static ConfigEntry<int> BurstMaxTargets; public static ConfigEntry<int> BalanceVersion; public static ConfigEntry<float> ShieldPerBurst; public static ConfigEntry<float> MaxShield; public static ConfigEntry<float> MaxShieldDouble; public static ConfigEntry<float> ShieldHoldSeconds; public static ConfigEntry<float> ShieldFadeSeconds; public static ConfigEntry<bool> ShieldBar; public static ConfigEntry<bool> AnimatedArt; public static ConfigEntry<bool> UnityEffects; public static ConfigEntry<bool> GameArt; public static ConfigEntry<bool> LiveDust; public static ConfigEntry<bool> CrackSpikes; public static ConfigEntry<bool> Boulders; public static ConfigEntry<bool> SpellLook; public static ConfigEntry<bool> TestHotkeys; public static ConfigEntry<bool> DumpSprites; public static ConfigEntry<bool> SelfTest; public static ConfigEntry<bool> VerboseLog; public static bool AnyEnabled { get { if (!EarthEnabled.Value) { return AirEnabled.Value; } return true; } } public static void Init(ConfigFile cfg) { //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: Expected O, but got Unknown //IL_0126: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Expected O, but got Unknown //IL_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Expected O, but got Unknown //IL_0206: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Expected O, but got Unknown //IL_023e: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Expected O, but got Unknown //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Expected O, but got Unknown //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Expected O, but got Unknown //IL_02db: Unknown result type (might be due to invalid IL or missing references) //IL_02e5: Expected O, but got Unknown //IL_030c: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Expected O, but got Unknown //IL_0344: Unknown result type (might be due to invalid IL or missing references) //IL_034e: Expected O, but got Unknown //IL_0371: Unknown result type (might be due to invalid IL or missing references) //IL_037b: Expected O, but got Unknown //IL_039e: Unknown result type (might be due to invalid IL or missing references) //IL_03a8: Expected O, but got Unknown //IL_03d6: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Expected O, but got Unknown //IL_040e: Unknown result type (might be due to invalid IL or missing references) //IL_0418: Expected O, but got Unknown //IL_0446: Unknown result type (might be due to invalid IL or missing references) //IL_0450: Expected O, but got Unknown //IL_047e: Unknown result type (might be due to invalid IL or missing references) //IL_0488: Expected O, but got Unknown //IL_04b6: Unknown result type (might be due to invalid IL or missing references) //IL_04c0: Expected O, but got Unknown //IL_0524: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Expected O, but got Unknown //IL_055c: Unknown result type (might be due to invalid IL or missing references) //IL_0566: Expected O, but got Unknown //IL_0594: Unknown result type (might be due to invalid IL or missing references) //IL_059e: Expected O, but got Unknown //IL_05cc: Unknown result type (might be due to invalid IL or missing references) //IL_05d6: Expected O, but got Unknown //IL_0604: Unknown result type (might be due to invalid IL or missing references) //IL_060e: Expected O, but got Unknown //IL_063c: Unknown result type (might be due to invalid IL or missing references) //IL_0646: Expected O, but got Unknown //IL_0674: Unknown result type (might be due to invalid IL or missing references) //IL_067e: Expected O, but got Unknown //IL_06e3: Unknown result type (might be due to invalid IL or missing references) //IL_06ed: Expected O, but got Unknown //IL_0710: Unknown result type (might be due to invalid IL or missing references) //IL_071a: Expected O, but got Unknown //IL_0768: Unknown result type (might be due to invalid IL or missing references) //IL_0772: Expected O, but got Unknown //IL_07a0: Unknown result type (might be due to invalid IL or missing references) //IL_07aa: Expected O, but got Unknown //IL_07d8: Unknown result type (might be due to invalid IL or missing references) //IL_07e2: Expected O, but got Unknown //IL_0810: Unknown result type (might be due to invalid IL or missing references) //IL_081a: Expected O, but got Unknown //IL_0848: Unknown result type (might be due to invalid IL or missing references) //IL_0852: Expected O, but got Unknown EarthEnabled = cfg.Bind<bool>("General", "Earth", true, "Add the Earth element (Aftershock + Stoneskin)."); AlwaysUnlocked = cfg.Bind<bool>("General", "AlwaysUnlocked", true, "Earth can be offered without its unlock challenge. Phase 1 has no challenge yet, so leave this on for testing."); OfferInShop = cfg.Bind<bool>("General", "OfferInShop", true, "Offer Earth in the infusion shop next to the game's own elements (only on spells with no element or with Earth)."); StandInElement = cfg.Bind<string>("Placeholder", "StandInElement", "Fire", "Phase 1 has no Earth art yet. Damage numbers, icons and shop card colours borrow this game element's look (Fire, Lightning, Acid, Ice or Dark)."); AirEnabled = cfg.Bind<bool>("General", "Air", true, "Add the Air element (Updraft: hits throw enemies into the air)."); Combos = cfg.Bind<bool>("General", "Combos", true, "Earth and Air combine with the game's elements (Earth + Fire = Magma, Air + Ice = Hailstone, ...) and with each other. Off: an Earth or Air spell takes only more of the same, as before 0.6.0."); AirStandInElement = cfg.Bind<string>("Placeholder", "AirStandInElement", "Lightning", "Air has no art yet. Its damage numbers, icons and shop card borrow this game element's look (Fire, Lightning, Acid, Ice or Dark). Its UI colour is sage green either way."); AirLiftSeconds = cfg.Bind<float>("Air", "LiftSeconds", 0.8f, new ConfigDescription("Seconds an Air hit keeps an enemy in the air.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>())); AirLiftHeight = cfg.Bind<float>("Air", "LiftHeight", 1.6f, new ConfigDescription("Peak height of a lift in world units.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 10f), Array.Empty<object>())); AirDamageTakenBonus = cfg.Bind<float>("Air", "DamageTakenBonus", 0.2f, new ConfigDescription("Extra damage airborne enemies take (0.2 = +20%). Bosses get it for the lift time instead of lifting.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); AirThudRadius = cfg.Bind<float>("Air", "ThudRadius", 1.8f, new ConfigDescription("Radius of the landing thud in world units.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); AirThudDamage = cfg.Bind<float>("Air", "ThudDamage", 0.35f, new ConfigDescription("Landing thud damage as a share of the hit that lifted the enemy.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>())); AirRelandImmunity = cfg.Bind<float>("Air", "LiftCooldown", 2f, new ConfigDescription("After landing, an enemy can't be lifted again for this many seconds (replaces RelandImmunity, which was 0.6).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); AirJuggleExtraSeconds = cfg.Bind<float>("Air", "JuggleExtraSeconds", 0.45f, new ConfigDescription("Air + Air: seconds each juggle adds to the airtime.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); AirJugglesForSlam = cfg.Bind<int>("Air", "JugglesForSlam", 3, new ConfigDescription("Air + Air: the hit in the air (counting the lift) that slams the enemy down.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(2, 10), Array.Empty<object>())); AirSlamRadius = cfg.Bind<float>("Air", "SlamRadius", 3.2f, new ConfigDescription("Air + Air: slam radius in world units.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); AirSlamDamage = cfg.Bind<float>("Air", "SlamDamage", 1.5f, new ConfigDescription("Air + Air: slam damage as a share of the hit that triggered it.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); AirMaxAirborne = cfg.Bind<int>("Air", "MaxAirborne", 60, new ConfigDescription("Most enemies in the air at once.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 300), Array.Empty<object>())); AirLandingHitCooldown = cfg.Bind<float>("Air", "LandingHitCooldown", 0.5f, new ConfigDescription("An enemy takes at most one landing thud or slam per this many seconds, however many landings overlap it (0 = off).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>())); AirThudMaxTargets = cfg.Bind<int>("Air", "ThudMaxTargets", 6, new ConfigDescription("A landing thud hits at most this many enemies, nearest first (0 = no limit).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); AirSlamMaxTargets = cfg.Bind<int>("Air", "SlamMaxTargets", 8, new ConfigDescription("An Air + Air slam hits at most this many enemies, nearest first (0 = no limit).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); AirThermalHeight = cfg.Bind<float>("Air pairs", "ThermalHeight", 2f, new ConfigDescription("Thermal (Air + Fire): burning enemies fly this many times as high, and their landing spreads burn.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 4f), Array.Empty<object>())); AirRodStrikeDamage = cfg.Bind<float>("Air pairs", "LightningRodStrike", 0.6f, new ConfigDescription("Lightning Rod (Air + Lightning): hitting an enemy that's already in the air strikes it again with the game's lightning double strike, at this share of the hit (0 = off).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); AirAcidRainSeconds = cfg.Bind<float>("Air pairs", "AcidRainSeconds", 3f, new ConfigDescription("Acid Rain (Air + Acid): seconds the acid puddle stays where a lifted enemy lands (0 = none).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 10f), Array.Empty<object>())); AirHailThudFactor = cfg.Bind<float>("Air pairs", "HailstoneLanding", 1.5f, new ConfigDescription("Hailstone (Air + Ice): chilled enemies freeze mid-air a little longer and land this many times as hard, chilling around them.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 5f), Array.Empty<object>())); AirDropZoneThudFactor = cfg.Bind<float>("Air pairs", "DropZoneLanding", 2f, new ConfigDescription("Drop Zone (Air + Dark): corrupted enemies land this many times as hard on their old allies (corrupted enemies are never hit).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 5f), Array.Empty<object>())); AirSwirl = cfg.Bind<bool>("Visuals", "AirWhirlwind", true, "A small whirlwind spins under every enemy Air lifts."); AirGameTornado = cfg.Bind<bool>("Visuals", "AirGameTornado", true, "The whirlwind is a small copy of the game's own map tornado (falls back to a drawn one if the game's isn't loaded)."); AirTornadoScale = cfg.Bind<float>("Visuals", "AirTornadoScale", 1f, new ConfigDescription("Size of the game-tornado whirlwind (1 = reaches the enemy at the top of the lift).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 4f), Array.Empty<object>())); CrackDelay = cfg.Bind<float>("Earth", "CrackDelay", 1f, new ConfigDescription("Seconds from an Earth hit to its crack's burst.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 5f), Array.Empty<object>())); BurstRadius = cfg.Bind<float>("Earth", "BurstRadius", 2f, new ConfigDescription("Burst radius in world units.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 10f), Array.Empty<object>())); BurstDamage = cfg.Bind<float>("Earth", "BurstDamage", 0.3f, new ConfigDescription("Burst damage as a share of the hit that made the crack (0.3 = 30%).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>())); SecondBurstDelay = cfg.Bind<float>("Earth", "SecondBurstDelay", 0.5f, new ConfigDescription("Earth + Earth: seconds between the first and second burst.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.1f, 3f), Array.Empty<object>())); SecondBurstDamage = cfg.Bind<float>("Earth", "SecondBurstDamage", 0.6f, new ConfigDescription("Earth + Earth: second burst damage as a share of the first.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); PerEnemyCooldown = cfg.Bind<float>("Earth", "PerEnemyCooldown", 0.5f, new ConfigDescription("One new crack per enemy per this many seconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5f), Array.Empty<object>())); BurstShield = cfg.Bind<float>("Earth", "BurstShield", 1.5f, "Seconds an enemy hit by a burst can't get a new crack. Stops one Earth hit from snowballing into bursts everywhere."); BurstHitCooldown = cfg.Bind<float>("Earth", "BurstHitCooldown", 0.45f, "An enemy takes at most one Earth burst per this many seconds, however many cracks overlap it (0 = no cap)."); MaxPendingCracks = cfg.Bind<int>("Earth", "MaxPendingCracks", 40, new ConfigDescription("Most cracks waiting to burst at once.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 200), Array.Empty<object>())); BurstMaxTargets = cfg.Bind<int>("Earth", "BurstMaxTargets", 4, new ConfigDescription("A burst hits at most this many enemies, nearest first (0 = no limit).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); BalanceVersion = cfg.Bind<int>("Debug", "BalanceVersion", 0, "Internal: which balance migration ran on this file. Don't edit."); MigrateBalance(); ShieldPerBurst = cfg.Bind<float>("Stoneskin shield", "ShieldPerBurst", 40f, new ConfigDescription("Shield HP each Earth burst that hits something adds. The shield takes damage before your HP.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1000f), Array.Empty<object>())); MaxShield = cfg.Bind<float>("Stoneskin shield", "MaxShield", 200f, new ConfigDescription("Most shield HP with Earth.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5000f), Array.Empty<object>())); MaxShieldDouble = cfg.Bind<float>("Stoneskin shield", "MaxShieldDouble", 320f, new ConfigDescription("Most shield HP with Earth + Earth.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 5000f), Array.Empty<object>())); ShieldHoldSeconds = cfg.Bind<float>("Stoneskin shield", "HoldSeconds", 5f, new ConfigDescription("Seconds the shield holds after the last burst that added to it.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 60f), Array.Empty<object>())); ShieldFadeSeconds = cfg.Bind<float>("Stoneskin shield", "FadeSeconds", 1.5f, new ConfigDescription("Seconds the shield then takes to crumble away.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 30f), Array.Empty<object>())); ShieldBar = cfg.Bind<bool>("Visuals", "StoneskinBar", true, "Show the Stoneskin shield as a brown bar to the right of your health bar."); GameArt = cfg.Bind<bool>("Visuals", "GameArt", true, "Dress the Earth effects in the game's own crack, smoke and rock art (found at runtime)."); UnityEffects = cfg.Bind<bool>("Visuals", "UnityEffects", true, "Use the Unity-built particle effects for the crack and burst when this build has them."); AnimatedArt = cfg.Bind<bool>("Visuals", "AnimatedArt", true, "Use the rendered crack and burst animations. Off = the simple flat decals."); CrackSpikes = cfg.Bind<bool>("Visuals", "CrackSpikes", true, "Rocks punch up at the ends of each Earth crack as it spreads (instead of spikes in the burst)."); Boulders = cfg.Bind<bool>("Visuals", "Boulders", true, "2-4 boulders heave up inside the cracked area at each burst."); SpellLook = cfg.Bind<bool>("Visuals", "SpellLook", true, "Earth-infused spells get their own brown look (a recoloured copy of the plain spell)."); LiveDust = cfg.Bind<bool>("Visuals", "LiveDust", true, "Sand puffs and pebbles fly out of each burst."); SelfTest = cfg.Bind<bool>("Debug", "SelfTest", true, "10 s after start, load the Earth effects, spawn a crack and burst out of sight and log whether everything loaded."); DumpSprites = cfg.Bind<bool>("Debug", "DumpSprites", true, "Write the brown Earth sprite copies (and their Fire sources) as PNGs to BepInEx/SpellBrigadeElements-debug."); TestHotkeys = cfg.Bind<bool>("Debug", "TestHotkeys", true, "Ctrl+E infuses one of your spells with Earth, Ctrl+Q with Air (solo or host, in a mission). Ctrl+Shift+E logs the game's element table."); VerboseLog = cfg.Bind<bool>("Debug", "VerboseLog", true, "Log the first few cracks, bursts and armor changes."); } private static void MigrateBalance() { if (BalanceVersion.Value < 1) { if (Math.Abs(BurstDamage.Value - 0.6f) < 0.0001f) { BurstDamage.Value = 0.3f; } if (Math.Abs(SecondBurstDamage.Value - 0.75f) < 0.0001f) { SecondBurstDamage.Value = 0.6f; } BalanceVersion.Value = 1; } } public static AirTuning AirTuning() { return new AirTuning { LiftSeconds = AirLiftSeconds.Value, LiftHeight = AirLiftHeight.Value, DamageTakenBonus = AirDamageTakenBonus.Value, ThudRadius = AirThudRadius.Value, ThudDamage = AirThudDamage.Value, RelandImmunity = AirRelandImmunity.Value, JuggleExtraSeconds = AirJuggleExtraSeconds.Value, JugglesForSlam = AirJugglesForSlam.Value, SlamRadius = AirSlamRadius.Value, SlamDamage = AirSlamDamage.Value, MaxAirborne = AirMaxAirborne.Value, LandingHitCooldown = AirLandingHitCooldown.Value, ThudMaxTargets = AirThudMaxTargets.Value, SlamMaxTargets = AirSlamMaxTargets.Value, ThermalHeight = AirThermalHeight.Value, RodStrikeDamage = AirRodStrikeDamage.Value, AcidRainSeconds = AirAcidRainSeconds.Value, HailThudFactor = AirHailThudFactor.Value, DropZoneThudFactor = AirDropZoneThudFactor.Value }; } public static EarthTuning Tuning() { return new EarthTuning { CrackDelay = CrackDelay.Value, BurstRadius = BurstRadius.Value, BurstDamageFactor = BurstDamage.Value, SecondBurstDelay = SecondBurstDelay.Value, SecondBurstFactor = SecondBurstDamage.Value, PerEnemyCooldown = PerEnemyCooldown.Value, BurstShield = BurstShield.Value, BurstHitCooldown = BurstHitCooldown.Value, MaxPendingCracks = MaxPendingCracks.Value, BurstMaxTargets = BurstMaxTargets.Value, ShieldPerBurst = ShieldPerBurst.Value, MaxShield = MaxShield.Value, MaxShieldDouble = MaxShieldDouble.Value, ShieldHoldSeconds = ShieldHoldSeconds.Value, ShieldFadeSeconds = ShieldFadeSeconds.Value }; } } internal static class ModLog { private static ManualLogSource? _log; private static StreamWriter? _file; private static readonly HashSet<string> Once = new HashSet<string>(); private static readonly Dictionary<string, float> Throttle = new Dictionary<string, float>(); public const string CleanExit = "clean exit"; public static string FilePath => Path.Combine(Paths.BepInExRootPath, "SpellBrigadeElements.log"); public static string PreviousFilePath => Path.Combine(Paths.BepInExRootPath, "SpellBrigadeElements.prev.log"); public static string? PreviousCrashStep { get; private set; } public static void Init(ManualLogSource log) { //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009d: Expected O, but got Unknown //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Expected O, but got Unknown _log = log; bool flag = default(bool); try { if (File.Exists(FilePath)) { File.Copy(FilePath, PreviousFilePath, overwrite: true); string text = null; string[] array = File.ReadAllLines(FilePath); foreach (string text2 in array) { int num = text2.IndexOf(" STEP ", StringComparison.Ordinal); if (num >= 0) { string text3 = text2; int num2 = num + 7; text = text3.Substring(num2, text3.Length - num2).Trim(); } } if (text != null && text != "clean exit") { PreviousCrashStep = text; } } } catch (Exception ex) { BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(30, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not read the previous "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(FilePath); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message); } log.LogWarning(val); } try { _file = new StreamWriter(new FileStream(FilePath, FileMode.Create, FileAccess.Write, FileShare.ReadWrite)) { AutoFlush = true }; _file.WriteLine($"SpellBrigadeElements {"0.6.49"} log, started {DateTime.Now:yyyy-MM-dd HH:mm:ss}"); if (PreviousCrashStep != null) { _file.WriteLine("Previous session did not exit cleanly; its last step was: " + PreviousCrashStep + " (log kept as SpellBrigadeElements.prev.log)"); } } catch (Exception ex2) { BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(17, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Could not open "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(FilePath); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(": "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex2.Message); } log.LogWarning(val); } } public static void Info(string msg) { ManualLogSource? log = _log; if (log != null) { log.LogInfo((object)msg); } ToFile("INFO ", msg); } public static void Warn(string msg) { ManualLogSource? log = _log; if (log != null) { log.LogWarning((object)msg); } ToFile("WARN ", msg); } public static void Error(string msg) { ManualLogSource? log = _log; if (log != null) { log.LogError((object)msg); } ToFile("ERROR", msg); } public static void Debug(string msg) { ManualLogSource? log = _log; if (log != null) { log.LogDebug((object)msg); } ToFile("DEBUG", msg); } public static void Step(string msg) { ToFile("STEP ", msg); } public static void StepOnce(string key, string msg) { if (Once.Add("step:" + key)) { Step(msg); } } public static void InfoOnce(string key, string msg) { if (Once.Add(key)) { Info(msg); } } public static void WarnOnce(string key, string msg) { if (Once.Add(key)) { Warn(msg); } } public static void ErrorThrottled(string key, Exception ex, float now, float seconds = 10f) { if (!Throttle.TryGetValue(key, out var value) || !(now - value < seconds)) { Throttle[key] = now; Error($"[{key}] {ex.GetType().Name}: {ex.Message}\n{ex.StackTrace}"); } } private static void ToFile(string level, string msg) { if (_file == null) { return; } try { lock (_file) { _file.WriteLine($"{DateTime.Now:HH:mm:ss.fff} {level} {msg}"); } } catch { } } } [BepInPlugin("com.stefanws0.spellbrigadeelements", "SpellBrigadeElements", "0.6.49")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BasePlugin { public const string Guid = "com.stefanws0.spellbrigadeelements"; public const string Name = "SpellBrigadeElements"; public const string Version = "0.6.49"; public static Harmony Harmony { get; private set; } public override void Load() { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown ModLog.Init(((BasePlugin)this).Log); Harmony = new Harmony("com.stefanws0.spellbrigadeelements"); ModLog.Step("Load: config"); ModConfig.Init(((BasePlugin)this).Config); ModLog.Step("Load: registering ElementsRunner"); ((BasePlugin)this).AddComponent<ElementsRunner>(); KitSelfTest.Register(); ModLog.Step("Load: done"); ModLog.Info($"{"SpellBrigadeElements"} {"0.6.49"} loaded. Earth: {(ModConfig.EarthEnabled.Value ? "on" : "off")}, Air: {(ModConfig.AirEnabled.Value ? "on" : "off")}, always unlocked: {(ModConfig.AlwaysUnlocked.Value ? "yes" : "no")}."); } } } namespace SpellBrigadeElements.Game { internal static class AirLift { private sealed class Info { public ulong Owner; public SpellType Spell; public Enemy? Enemy; public FreezeStateHandler? Freeze; public Transform? Visuals; public Vector3 BaseLocal; public bool Raised; public int Pair; public bool Twist; public bool RodUsed; } private static readonly Airborne<Info> Air = new Airborne<Info>(); private static readonly Object FreezeSource = new Object(); private static AirTuning _tuning = new AirTuning(); private static float _nextTuning; private static int _logged; private static int _loggedLandings; private static int _loggedShown; public static int Landing { get; private set; } public static float DamageBonus => _tuning.DamageTakenBonus; public static bool TakesBonus(long healthContainer, float now) { return Air.TakesBonus(healthContainer, now); } public static bool ShowOnly(GameObject go, float strength) { //IL_0082: 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_008f: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_0131: Unknown result type (might be due to invalid IL or missing references) Enemy val = go.GetComponent<Enemy>() ?? go.GetComponentInParent<Enemy>(); object obj; if (val == null) { obj = null; } else { Hitbox hitbox = val.hitbox; obj = ((hitbox != null) ? hitbox.HealthContainer : null); } HealthContainer val2 = (HealthContainer)obj; if ((Object)(object)val == (Object)null || (Object)(object)val2 == (Object)null || val2.CurrentHealth <= 0f) { return false; } long target = ((Il2CppObjectBase)val2).Pointer.ToInt64(); Info info = new Info { Owner = ulong.MaxValue, Enemy = val, Visuals = val.visualsRoot }; Vector3 position = ((Component)val).transform.position; if (Air.Hit(target, position.x, position.z, 1f, isDouble: false, canLift: true, elite: false, Time.time, _tuning, info, (float.IsNaN(strength) || strength <= 0f) ? 1f : Math.Min(1f, strength), noLanding: true) != LiftResult.Lifted) { return false; } if ((Object)(object)info.Visuals != (Object)null) { info.BaseLocal = info.Visuals.localPosition; } if (ModConfig.VerboseLog.Value && _loggedShown++ < 3) { ModLog.Info($"Air: show-only lift of '{val.EnemyType}' (another mod's hit)."); } return true; } public static void OnAirHit(float damage, DamageInfo info, HealthContainer target, bool isDouble) { //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0122: Invalid comparison between Unknown and I4 //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0191: Unknown result type (might be due to invalid IL or missing references) //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a0: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_01f7: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: 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_0114: Expected I4, but got Unknown //IL_029b: 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_02e9: Unknown result type (might be due to invalid IL or missing references) try { PlayerSpellDamageInfo val = ((Il2CppObjectBase)info).TryCast<PlayerSpellDamageInfo>(); if (val == null || (Object)(object)target == (Object)null || target.CurrentHealth <= 0f || (Object)(object)PlayerAccess.Of(((PlayerDamageInfo)val).OwnerClientId, Time.unscaledTime) == (Object)null) { return; } long target2 = ((Il2CppObjectBase)target).Pointer.ToInt64(); float time = Time.time; Info info2 = null; bool flag = false; if (!Air.IsAirborne(target2)) { Enemy val2 = ((Component)target).GetComponent<Enemy>() ?? ((Component)target).GetComponentInParent<Enemy>(); FreezeStateHandler val3 = (((Object)(object)val2 == (Object)null) ? null : ((Component)val2).GetComponentInChildren<FreezeStateHandler>()); flag = (Object)(object)val2 != (Object)null && (Object)(object)val3 != (Object)null && !val3.IsImmune && !val3.alwaysImmune; info2 = new Info { Owner = ((PlayerDamageInfo)val).OwnerClientId, Spell = val.Spell, Enemy = val2, Freeze = val3, Visuals = (((Object)(object)val2 == (Object)null) ? null : val2.visualsRoot), Pair = (int)info.Element }; } else { flag = true; if ((int)info.Element == 111 && Air.TryGet(target2, out Airborne<Info>.State state) && state.Payload != null && !state.Payload.RodUsed && ElementScale.Strength >= 1f) { state.Payload.RodUsed = true; AirPairs.QueueRod(state.Payload.Enemy, damage, ((PlayerDamageInfo)val).OwnerClientId, val.Spell, _tuning); } } Vector3 position = ((Component)target).transform.position; LiftResult liftResult = Air.Hit(target2, position.x, position.z, damage, isDouble, flag, elite: false, time, _tuning, info2, ElementScale.Strength, ElementScale.NoLanding); if (liftResult == LiftResult.Lifted && info2 != null) { FreezeStateHandler? freeze = info2.Freeze; if (freeze != null) { freeze.AddFreezeStack(FreezeSource); } if ((Object)(object)info2.Visuals != (Object)null) { info2.BaseLocal = info2.Visuals.localPosition; } if (NewElements.IsPair(info2.Pair) && ElementScale.Strength >= 1f && Air.TryGet(target2, out Airborne<Info>.State state2)) { info2.Twist = AirPairs.OnLift(info2.Pair, info2.Enemy, state2, _tuning); } } if (ModConfig.VerboseLog.Value && liftResult != LiftResult.Ignored && _logged < 8) { _logged++; string text = (((Object)(object)info2?.Enemy != (Object)null) ? ((object)info2.Enemy.EnemyType/*cast due to .constrained prefix*/).ToString() : ((Object)((Component)target).gameObject).name); ModLog.Info(FormattableString.Invariant(FormattableStringFactory.Create("Air: {0} '{1}' from a {2:0.#} hit ({3}, {4}); {5} in the air.", liftResult, text, damage, isDouble ? "Air + Air" : "Air", val.Spell, Air.Count))); } } catch (Exception ex) { ModLog.ErrorThrottled("air:hit", ex, Time.unscaledTime); } } public static void Update(float now) { if (now >= _nextTuning) { _nextTuning = now + 2f; _tuning = ModConfig.AirTuning(); } AirPairs.Update(); if (Air.Count == 0) { return; } foreach (Airborne<Info>.Landing item in Air.Due(now, _tuning)) { try { Land(item); } catch (Exception ex) { ModLog.ErrorThrottled("air:land", ex, Time.unscaledTime); } } } public static void LateUpdate(float now) { //IL_00a2: 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_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_00da: Unknown result type (might be due to invalid IL or missing references) AirSwirl.Tick(now, Time.deltaTime); if (Air.Count == 0) { return; } List<long> list = null; foreach (Airborne<Info>.State item in Air.All) { Info payload = item.Payload; try { if ((Object)(object)payload?.Enemy == (Object)null || ((Il2CppObjectBase)payload.Enemy).WasCollected || (Object)(object)payload.Visuals == (Object)null || ((Il2CppObjectBase)payload.Visuals).WasCollected) { (list ?? (list = new List<long>())).Add(item.Target); continue; } float num = Airborne<Info>.HeightOf(item, now); payload.Visuals.localPosition = payload.BaseLocal + new Vector3(0f, num, 0f); payload.Raised = true; AirSwirl.Track(item.Target, ((Component)payload.Enemy).transform.position, num, item.Double, now); } catch { (list ?? (list = new List<long>())).Add(item.Target); } } if (list == null) { return; } foreach (long item2 in list) { if (Air.TryGet(item2, out Airborne<Info>.State state)) { Release(state.Payload); } Air.Remove(item2); } } public static void Clear() { foreach (Airborne<Info>.State item in Air.All) { Release(item.Payload); } Air.Clear(); AirSwirl.Clear(); AirPairs.Clear(); } private static void Release(Info? p) { //IL_0060: Unknown result type (might be due to invalid IL or missing references) if (p == null) { return; } try { if ((Object)(object)p.Freeze != (Object)null && !((Il2CppObjectBase)p.Freeze).WasCollected) { p.Freeze.RemoveFreezeStack(FreezeSource); } } catch { } try { if (p.Raised && (Object)(object)p.Visuals != (Object)null && !((Il2CppObjectBase)p.Visuals).WasCollected) { p.Visuals.localPosition = p.BaseLocal; } } catch { } } private static void Land(Airborne<Info>.Landing landing) { //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_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: 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) //IL_0284: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_02a1: Unknown result type (might be due to invalid IL or missing references) //IL_02ea: Unknown result type (might be due to invalid IL or missing references) //IL_02f5: Unknown result type (might be due to invalid IL or missing references) //IL_02ff: Expected O, but got Unknown //IL_02fa: Unknown result type (might be due to invalid IL or missing references) //IL_0301: Expected O, but got Unknown //IL_0311: Unknown result type (might be due to invalid IL or missing references) Airborne<Info>.State state = landing.State; Release(state.Payload); Enemy val = state.Payload?.Enemy; if ((Object)(object)val == (Object)null || ((Il2CppObjectBase)val).WasCollected) { return; } Vector3 position = ((Component)val).transform.position; GameplayPlayerIdentity? obj = PlayerAccess.Of(state.Payload.Owner, Time.unscaledTime); PlayerStats val2 = ((obj != null) ? obj.stats : null); if ((Object)(object)val2 == (Object)null || landing.Damage <= 0f) { return; } List<Enemy> allEnemies = Enemy.AllEnemies; if (allEnemies == null) { return; } float num = landing.Radius * landing.Radius; List<(float, Hitbox, long)> list = new List<(float, Hitbox, long)>(); for (int i = 0; i < allEnemies.Count; i++) { Enemy val3 = allEnemies[i]; if ((Object)(object)val3 == (Object)null || (!landing.Slam && ((Il2CppObjectBase)val3).Pointer == ((Il2CppObjectBase)val).Pointer)) { continue; } Vector3 position2 = ((Component)val3).transform.position; float num2 = position2.x - position.x; float num3 = position2.z - position.z; float num4 = num2 * num2 + num3 * num3; if (!(num4 > num)) { Hitbox hitbox = val3.hitbox; HealthContainer val4 = (((Object)(object)hitbox == (Object)null) ? null : hitbox.HealthContainer); if (!((Object)(object)hitbox == (Object)null) && !((Object)(object)val4 == (Object)null) && !(val4.CurrentHealth <= 0f) && !AirPairs.SkipTarget(state.Payload.Pair, val3)) { list.Add((num4, hitbox, ((Il2CppObjectBase)val4).Pointer.ToInt64())); } } } list.Sort(((float D2, Hitbox Hb, long Key) a, (float D2, Hitbox Hb, long Key) b) => a.D2.CompareTo(b.D2)); int num5 = (landing.Slam ? _tuning.SlamMaxTargets : _tuning.ThudMaxTargets); List<Hitbox> list2 = new List<Hitbox>(); int num6 = 0; float time = Time.time; foreach (var item in list) { if (num5 > 0 && list2.Count >= num5) { break; } if (!Air.TryLandingHit(item.Item3, time, _tuning)) { num6++; } else { list2.Add(item.Item2); } } ElementType element = AirPairs.LandingElement(state.Payload.Pair, state.Payload.Twist); AirPairs.OnLanding(state.Payload.Pair, state.Payload.Twist, position, landing.Radius, time, _tuning); Landing = ((!landing.Slam) ? 1 : 2); try { foreach (Hitbox item2 in list2) { PlayerSpellDamageInfo val5 = new PlayerSpellDamageInfo(state.Payload.Owner, state.Payload.Spell, new IPlayerStats(((Il2CppObjectBase)val2).Pointer)); ((DamageInfo)val5).Damage = landing.Damage; ((DamageInfo)val5).Element = element; ((PlayerDamageInfo)val5).CriticalChance = 0f; item2.Hit((DamageInfo)(object)val5); } } finally { Landing = 0; } if (ModConfig.VerboseLog.Value && _loggedLandings < 6) { _loggedLandings++; ModLog.Info(FormattableString.Invariant(FormattableStringFactory.Create("Air: {0} for {1:0.#} hit {2} enemy(ies) within {3:0.#} ({4} skipped by the overlap cap, {5} in range, max {6}).", landing.Slam ? "slam" : "thud", landing.Damage, list2.Count, landing.Radius, num6, list.Count, num5))); } } } internal static class AirPairs { private sealed class Strike { public Enemy Enemy; public float Damage; public ulong Owner; public SpellType Spell; } private static readonly List<Strike> Strikes = new List<Strike>(); private static int _logs; public static bool IsBurning(Enemy? enemy) { try { object obj2; if (!((Object)(object)enemy == (Object)null)) { ElementEffectHandlers? obj = EarthPairs.Handlers(enemy); obj2 = ((obj != null) ? obj.fireEffectHandler : null); } else { obj2 = null; } FireEffectHandler val = (FireEffectHandler)obj2; return (Object)(object)val != (Object)null && val.numberOfTicks > 0; } catch { return false; } } public static bool IsChilled(Enemy? enemy) { try { object obj2; if (!((Object)(object)enemy == (Object)null)) { ElementEffectHandlers? obj = EarthPairs.Handlers(enemy); obj2 = ((obj != null) ? obj.iceEffectHandler : null); } else { obj2 = null; } IceEffectHandler val = (IceEffectHandler)obj2; return (Object)(object)val != (Object)null && (val.isSlowedDown || val.endFreezeTime > Time.time); } catch { return false; } } public static bool IsCorrupted(Enemy? enemy) { if ((Object)(object)enemy != (Object)null) { return EarthPairs.IsCorrupted(enemy); } return false; } public static bool OnLift<T>(int pair, Enemy? enemy, Airborne<T>.State s, AirTuning t) { switch (pair) { case 110: if (IsBurning(enemy)) { float num = s.LandAt - s.ArcStart; s.Peak *= t.ThermalHeight; s.LandAt = s.ArcStart + num * t.ThermalAirtime; Log("Thermal: burning enemy thrown higher; its landing spreads burn."); return true; } break; case 113: if (IsChilled(enemy)) { s.LandAt += t.HailExtraSeconds; s.LandingDamage *= t.HailThudFactor; Log("Hailstone: chilled enemy frozen mid-air; it lands as hail."); return true; } break; case 114: if (IsCorrupted(enemy)) { s.LandingDamage *= t.DropZoneThudFactor; Log("Drop Zone: corrupted enemy dropped on its old allies."); return true; } break; case 112: return true; } return false; } public static ElementType LandingElement(int pair, bool twist) { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002e: 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_002f: Unknown result type (might be due to invalid IL or missing references) if (!twist) { return (ElementType)0; } return (ElementType)(pair switch { 110 => 1, 112 => 6, 113 => 10, _ => 0, }); } public static bool SkipTarget(int pair, Enemy e) { if (pair == 114) { return IsCorrupted(e); } return false; } public static void OnLanding(int pair, bool twist, Vector3 center, float radius, float now, AirTuning t) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) if (pair == 112 && twist && !(t.AcidRainSeconds <= 0f)) { EarthPairs.AddMud(center, radius, now, new EarthTuning { SinkholeSeconds = t.AcidRainSeconds }); Log("Acid Rain: acid puddle where the enemy landed."); } } public static void QueueRod(Enemy? enemy, float damage, ulong owner, SpellType spell, AirTuning t) { //IL_0056: 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) if (!((Object)(object)enemy == (Object)null) && !(t.RodStrikeDamage <= 0f) && !(damage <= 0f) && Strikes.Count < 30) { Strikes.Add(new Strike { Enemy = enemy, Damage = damage * t.RodStrikeDamage, Owner = owner, Spell = spell }); } } public static void Update() { //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Expected O, but got Unknown if (Strikes.Count == 0) { return; } Strike[] array = Strikes.ToArray(); Strikes.Clear(); Strike[] array2 = array; foreach (Strike strike in array2) { try { GameplayPlayerIdentity? obj = PlayerAccess.Of(strike.Owner, Time.unscaledTime); PlayerStats val = ((obj != null) ? obj.stats : null); if ((Object)(object)val == (Object)null || (Object)(object)strike.Enemy == (Object)null || ((Il2CppObjectBase)strike.Enemy).WasCollected) { continue; } HealthContainer val2 = (((Object)(object)strike.Enemy.hitbox == (Object)null) ? null : strike.Enemy.hitbox.HealthContainer); if (!((Object)(object)val2 == (Object)null) && !(val2.CurrentHealth <= 0f)) { ElementEffectHandlers? obj2 = EarthPairs.Handlers(strike.Enemy); LightningEffectHandler val3 = ((obj2 != null) ? obj2.lightningEffectHandler : null); if (!((Object)(object)val3 == (Object)null)) { PlayerSpellDamageInfo val4 = new PlayerSpellDamageInfo(strike.Owner, strike.Spell, new IPlayerStats(((Il2CppObjectBase)val).Pointer)); ((DamageInfo)val4).Damage = strike.Damage; ((DamageInfo)val4).Element = (ElementType)3; ((PlayerDamageInfo)val4).CriticalChance = 0f; val3.SpawnLightningDoubleStrike(strike.Damage, (DamageInfo)(object)val4); Log(FormattableString.Invariant($"Lightning Rod: double strike for {strike.Damage:0.#} on an airborne enemy.")); } } } catch (Exception ex) { ModLog.ErrorThrottled("air:rod", ex, Time.unscaledTime); } } } public static void Clear() { Strikes.Clear(); } private static void Log(string text) { if (ModConfig.VerboseLog.Value && _logs++ < 12) { ModLog.Info(text); } } } internal static class AirSwirl { private sealed class Funnel { public GameObject Go; public readonly SpriteRenderer[] R = (SpriteRenderer[])(object)new SpriteRenderer[8]; public GameObject? Tornado; public long Key; public bool Active; public float Born; public float LastSeen; public float Height; public float Spin; public Vector3 Ground; public bool Big; } private const int Rings = 8; private const int Cap = 40; private const float FadeIn = 0.12f; private const float FadeOut = 0.3f; private static readonly Color Sage = new Color(0.62f, 0.75f, 0.54f, 1f); private static readonly Color Cream = new Color(0.95f, 0.92f, 0.82f, 1f); private static readonly List<Funnel> Pool = new List<Funnel>(); private static readonly Random Rnd = new Random(); private static GameObject? _root; private static Sprite? _streak; private static bool _broken; public static void Track(long key, Vector3 ground, float height, bool big, float now) { //IL_002e: 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) if (_broken || !ModConfig.AirSwirl.Value) { return; } try { Funnel funnel = Find(key) ?? Take(key, now); if (funnel != null) { funnel.Ground = ground; funnel.Height = height; funnel.LastSeen = now; funnel.Big = big; } } catch (Exception ex) { Broke(ex); } } public static void Tick(float now, float dt) { //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_011a: Unknown result type (might be due to invalid IL or missing references) //IL_01be: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01d0: 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_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f5: Unknown result type (might be due to invalid IL or missing references) //IL_022a: 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_025a: Unknown result type (might be due to invalid IL or missing references) //IL_025f: Unknown result type (might be due to invalid IL or missing references) //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_026b: Unknown result type (might be due to invalid IL or missing references) //IL_0284: Unknown result type (might be due to invalid IL or missing references) if (_broken || Pool.Count == 0) { return; } try { foreach (Funnel item in Pool) { if (!item.Active) { continue; } if ((Object)(object)item.Go == (Object)null) { item.Active = false; continue; } float num = now - item.LastSeen; if (num > 0.3f) { Release(item); continue; } float num2 = Mathf.Clamp01((now - item.Born) / 0.12f) * ((num > 0.05f) ? (1f - num / 0.3f) : 1f); if ((Object)(object)item.Tornado != (Object)null) { float num3 = (ModConfig.AirLiftHeight.Value + 0.6f) * (item.Big ? 1.25f : 1f) * ModConfig.AirTornadoScale.Value / Mathf.Max(0.1f, TornadoArt.NaturalHeight) * (0.3f + 0.7f * num2); Transform transform = item.Tornado.transform; transform.position = item.Ground; transform.localScale = new Vector3(num3, num3, num3); continue; } item.Spin += dt * 720f; float num4 = Mathf.Max(0.35f, item.Height + 0.25f); float num5 = (item.Big ? 1.35f : 1f); for (int i = 0; i < 8; i++) { float num6 = (float)i / 7f; SpriteRenderer obj = item.R[i]; Transform transform2 = ((Component)obj).transform; Vector3 val = new Vector3(Mathf.Sin(now * 7f + (float)i * 0.9f), 0f, Mathf.Cos(now * 6f + (float)i * 1.3f)) * (0.06f * num6); transform2.position = item.Ground + val + Vector3.up * (0.05f + num6 * num4); transform2.rotation = Quaternion.Euler(90f, item.Spin * (1f + 0.15f * (float)i) + (float)i * 47f, 0f); float num7 = (0.5f + 1.1f * num6 * num6) * num5; transform2.localScale = new Vector3(num7, num7, num7); Color color = Color.Lerp(Sage, Cream, num6); color.a = num2 * (0.7f + 0.25f * num6); obj.color = color; } } } catch (Exception ex) { Broke(ex); } } public static void Clear() { foreach (Funnel item in Pool) { Release(item); } } private static Funnel? Find(long key) { foreach (Funnel item in Pool) { if (item.Active && item.Key == key && (Object)(object)item.Go != (Object)null) { return item; } } return null; } private static Funnel? Take(long key, float now) { //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Expected O, but got Unknown //IL_01ff: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Expected O, but got Unknown //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) if (_streak == null) { _streak = BuildStreak(128); } Funnel funnel = null; if ((Object)(object)_root == (Object)null) { _root = new GameObject("SpellBrigadeElements.Air"); Object.DontDestroyOnLoad((Object)(object)_root); } GameObject val = (ModConfig.AirGameTornado.Value ? TornadoArt.Template(_root.transform, now) : null); foreach (Funnel item in Pool) { if (!item.Active && (Object)(object)item.Go != (Object)null && (Object)(object)item.Tornado != (Object)null == ((Object)(object)val != (Object)null)) { funnel = item; break; } } if (funnel == null) { if (Pool.Count >= 40) { return null; } funnel = new Funnel { Go = new GameObject("AirSwirl") }; funnel.Go.transform.SetParent(_root.transform, false); if ((Object)(object)val != (Object)null) { funnel.Tornado = Object.Instantiate<GameObject>(val, funnel.Go.transform, false); funnel.Tornado.SetActive(true); } else { for (int i = 0; i < 8; i++) { GameObject val2 = new GameObject("AirSwirlRing"); val2.transform.SetParent(funnel.Go.transform, false); SpriteRenderer val3 = val2.AddComponent<SpriteRenderer>(); val3.sprite = _streak; ((Renderer)val3).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val3).receiveShadows = false; ((Renderer)val3).sortingOrder = 6; funnel.R[i] = val3; } } Pool.Add(funnel); } funnel.Key = key; funnel.Active = true; funnel.Born = now; funnel.LastSeen = now; funnel.Spin = (float)(Rnd.NextDouble() * 360.0); funnel.Go.SetActive(true); if ((Object)(object)funnel.Tornado != (Object)null) { funnel.Tornado.transform.localScale = Vector3.zero; TornadoArt.Play(funnel.Tornado); } return funnel; } private static void Release(Funnel f) { f.Active = false; if ((Object)(object)f.Go != (Object)null) { f.Go.SetActive(false); } } private static void Broke(Exception ex) { _broken = true; ModLog.Warn($"Air: whirlwind effect failed ({ex.GetType().Name}: {ex.Message}); lifts show without it."); } private static Sprite BuildStreak(int size) { //IL_0004: 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_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)4, false) { wrapMode = (TextureWrapMode)1, filterMode = (FilterMode)1 }; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = ((float)j + 0.5f) / (float)size * 2f - 1f; float num2 = ((float)i + 0.5f) / (float)size * 2f - 1f; float r = Mathf.Sqrt(num * num + num2 * num2); float num3 = Mathf.Atan2(num2, num); float num4 = Streak(r, num3, 0.76f, 0.15f) + 0.75f * Streak(r, num3 + (float)Math.PI, 0.58f, 0.11f); val.SetPixel(j, i, new Color(1f, 1f, 1f, Mathf.Clamp01(num4))); } } val.Apply(false, true); ((Object)val).hideFlags = (HideFlags)32; Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), (float)size); ((Object)obj).hideFlags = (HideFlags)32; return obj; } private static float Streak(float r, float ang, float radius, float thickness) { float num = Mathf.Repeat(ang, (float)Math.PI * 2f) / 4.3982296f; if (num > 1f) { return 0f; } float num2 = radius - 0.08f * num; float num3 = thickness * (1f - 0.75f * num); float num4 = Mathf.Abs(r - num2) / Mathf.Max(0.001f, num3); if (num4 >= 1f) { return 0f; } float num5 = 1f - num4 * num4; float num6 = Mathf.Clamp01(num / 0.08f); return num5 * num6 * (1f - num) * 1.3f; } } internal static class BundleCalls { public unsafe static AssetBundle? LoadFromFile(string path) { fixed (char* ptr = path) { ManagedSpanWrapper val = default(ManagedSpanWrapper); ((ManagedSpanWrapper)(ref val))..ctor((void*)ptr, path.Length); IntPtr intPtr = AssetBundle.LoadFromFile_Internal_Injected(ref val, 0u, 0uL); if (!(intPtr == IntPtr.Zero)) { return Unmarshal.UnmarshalUnityObject<AssetBundle>(intPtr); } return null; } } public unsafe static Object? LoadAsset(AssetBundle bundle, string name, Type type) { IntPtr intPtr = MarshalledUnityObject.MarshalNotNull<AssetBundle>(bundle); if (intPtr == IntPtr.Zero) { return null; } fixed (char* ptr = name) { ManagedSpanWrapper val = default(ManagedSpanWrapper); ((ManagedSpanWrapper)(ref val))..ctor((void*)ptr, name.Length); IntPtr intPtr2 = AssetBundle.LoadAsset_Internal_Injected(intPtr, ref val, type); if (!(intPtr2 == IntPtr.Zero)) { return Unmarshal.UnmarshalUnityObject<Object>(intPtr2); } return null; } } } internal static class CoopGuard { public const string MessageName = "SpellBrigadeElements.Hello"; private const ulong ServerClientId = 0uL; private const float HelloEvery = 3f; private const float CheckEvery = 1f; private static HandleNamedMessageDelegate? _handler; private static IntPtr _registeredOn; private static readonly HashSet<ulong> SaidHello = new HashSet<ulong>(); private static bool? _hostAnswer; private static bool _lastSent = true; private static bool _sentOnce; private static float _nextHello; private static float _nextCheck; private static bool _open = true; private static string _state = "alone"; public static bool Open => _open; public static string State => _state; public static void Tick(float now) { NetworkManager val; try { val = NetworkManager.Singleton; } catch { val = null; } if ((Object)(object)val == (Object)null || !val.IsListening || val.CustomMessagingManager == null) { if (_registeredOn != IntPtr.Zero) { Reset(); } Set(open: true, "alone", null); return; } CustomMessagingManager customMessagingManager = val.CustomMessagingManager; if (_registeredOn != ((Il2CppObjectBase)customMessagingManager).Pointer) { Reset(); if (_handler == null) { _handler = DelegateSupport.ConvertDelegate<HandleNamedMessageDelegate>((Delegate)new Action<ulong, FastBufferReader>(OnReceived)); } customMessagingManager.RegisterNamedMessageHandler("SpellBrigadeElements.Hello", _handler); _registeredOn = ((Il2CppObjectBase)customMessagingManager).Pointer; ModLog.Info($"Co-op: listening for other players' Elements ({(val.IsServer ? "host" : "client")}, client id {val.LocalClientId})."); } if (val.IsServer) { if (now < _nextCheck) { return; } _nextCheck = now + 1f; IReadOnlyList<ulong> readOnlyList = PlayerAccess.ClientIds(now); bool flag = CoopHello.EveryoneHasIt(readOnlyList, val.LocalClientId, SaidHello); if (!_sentOnce || flag != _lastSent) { _sentOnce = true; _lastSent = flag; foreach (ulong item in SaidHello) { Send(customMessagingManager, item, CoopHello.Answer(flag)); } } Set(flag, (readOnlyList.Count > 1) ? "host" : "alone", "Co-op: a player in this run doesn't have the Elements mod (or has another version), so Earth and Air aren't offered. Everyone needs the same version."); } else { if (!_hostAnswer.HasValue && now >= _nextHello) { _nextHello = now + 3f; Send(customMessagingManager, 0uL, "E1;H"); } Set(_hostAnswer == true, "client", (!_hostAnswer.HasValue) ? "Co-op: the host hasn't answered for the Elements mod (yet), so Earth and Air aren't offered. The host needs the same version." : "Co-op: the host says a player in this run doesn't have the Elements mod, so Earth and Air aren't offered."); } } private static void Set(bool open, string state, string? whyClosed) { if ((open != _open || state != _state) && state != "alone") { ModLog.Info(open ? ("Co-op (" + state + "): everyone has Elements; Earth and Air are on.") : (whyClosed ?? "Co-op: Earth and Air are off.")); } _open = open; _state = state; } private static void Reset() { _registeredOn = IntPtr.Zero; SaidHello.Clear(); _hostAnswer = null; _sentOnce = false; _lastSent = true; _nextHello = 0f; _nextCheck = 0f; } private static void Send(CustomMessagingManager cmm, ulong to, string payload) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) try { FastBufferWriter val = default(FastBufferWriter); ((FastBufferWriter)(ref val))..ctor(payload.Length * 2 + 64, (Allocator)2, -1); try { ((FastBufferWriter)(ref val)).WriteValueSafe(payload, false); cmm.SendNamedMessage("SpellBrigadeElements.Hello", to, val, (NetworkDelivery)3); } finally { ((FastBufferWriter)(ref val)).Dispose(); } } catch (Exception ex) { ModLog.ErrorThrottled("coop-send", ex, Time.unscaledTime); } } private static void OnReceived(ulong sender, FastBufferReader reader) { try { string payload = default(string); ((FastBufferReader)(ref reader)).ReadValueSafe(ref payload, false); NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null) { return; } if (singleton.IsServer) { if (CoopHello.IsHello(payload)) { if (SaidHello.Add(sender)) { ModLog.Info($"Co-op: player {sender} has Elements."); } _nextCheck = 0f; Send(singleton.CustomMessagingManager, sender, CoopHello.Answer(CoopHello.EveryoneHasIt(PlayerAccess.ClientIds(Time.unscaledTime), singleton.LocalClientId, SaidHello))); } } else if (sender == 0L) { bool? hostAnswer = CoopHello.ReadAnswer(payload); if (hostAnswer.HasValue) { _hostAnswer = hostAnswer; } } } catch (Exception ex) { ModLog.ErrorThrottled("coop-receive", ex, Time.unscaledTime); } } } internal static class CrackReveal { public readonly record struct Tip(float Angle, float Radius, float Arrive); public sealed class Variant { public Texture2D Sheet; public Tip[] Tips = Array.Empty<Tip>(); } public const int Tiles = 4; private const int Frames = 16; private const int RevealFrames = 12; private const int Cell = 256; private const int Variants = 6; private const int Src = 512; private static Variant[]? _sheets; private static bool _failed; private static readonly Random Rnd = new Random(); private static readonly Color32 Dark = new Color32((byte)46, (byte)27, (byte)14, byte.MaxValue); private static readonly Color32 Ochre = new Color32(byte.MaxValue, (byte)178, (byte)74, byte.MaxValue); private static readonly Color32 Rim = new Color32((byte)226, (byte)196, (byte)140, byte.MaxValue); public const float FormedAt = 0.58f; public static Variant? Random(Texture src) { if (_failed) { return null; } if (_sheets == null) { try { Build(src); } catch (Exception ex) { _failed = true; ModLog.Warn($"Crack reveal: couldn't build the forming crack ({ex.GetType().Name}: {ex.Message}); using the plain game crack."); return null; } } return _sheets[Rnd.Next(_sheets.Length)]; } private static void Build(Texture src) { //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown byte[] src2 = ReadAlpha(src, 512); Variant[] array = new Variant[6]; int num = 0; for (int i = 0; i < 6; i++) { float grit = (float)((double)i * 2.1 + 0.7); float turn = (float)(Rnd.NextDouble() * Math.PI * 2.0); bool mirror = i % 2 == 1; byte[] alpha = Transform(src2, turn, mirror); Color32[] array2 = (Color32[])(object)new Color32[1048576]; for (int j = 0; j < 16; j++) { DrawFrame(alpha, array2, j, grit); } Texture2D val = new Texture2D(1024, 1024, (TextureFormat)4, true); val.SetPixels32(Il2CppStructArray<Color32>.op_Implicit(array2)); ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; val.Apply(true, true); ((Object)val).name = "EarthCrackReveal_" + i; ((Object)val).hideFlags = (HideFlags)32; Tip[] array3 = FindTips(alpha, grit); num += array3.Length; array[i] = new Variant { Sheet = val, Tips = array3 }; } _sheets = array; ModLog.Info($"Crack reveal: built {6} forming-crack sheets from '{((Object)src).name}' ({num} crack tips in all)."); } private static byte[] Transform(byte[] src, float turn, bool mirror) { byte[] array = new byte[65536]; float num = Mathf.Cos(turn); float num2 = Mathf.Sin(turn); float num3 = 2f; for (int i = 0; i < 256; i++) { for (int j = 0; j < 256; j++) { float num4 = ((float)j + 0.5f - 128f) * (float)((!mirror) ? 1 : (-1)); float num5 = (float)i + 0.5f - 128f; float x = (num4 * num - num5 * num2 + 128f) * num3 - 0.5f; float y = (num4 * num2 + num5 * num + 128f) * num3 - 0.5f; array[i * 256 + j] = Sample(src, 512, x, y); } } return array; } private static byte Sample(byte[] a, int n, float x, float y) { if (x < 0f || y < 0f || x > (float)(n - 1) || y > (float)(n - 1)) { return 0; } int num = (int)x; int num2 = (int)y; int num3 = Math.Min(n - 1, num + 1); int num4 = Math.Min(n - 1, num2 + 1); float num5 = x - (float)num; float num6 = y - (float)num2; return (byte)Mathf.Clamp((float)(int)a[num2 * n + num] * (1f - num5) * (1f - num6) + (float)(int)a[num2 * n + num3] * num5 * (1f - num6) + (float)(int)a[num4 * n + num] * (1f - num5) * num6 + (float)(int)a[num4 * n + num3] * num5 * num6, 0f, 255f); } private static float Wobble(float th, float grit) { return 1f + 0.18f * Mathf.Sin(th * 3f + grit) + 0.1f * Mathf.Sin(th * 7f + grit * 2f); } private static Tip[] FindTips(byte[] alpha, float grit) { float[] array = new float[72]; for (int i = 0; i < 72; i++) { float num = (float)i * (float)Math.PI * 2f / 72f; for (float num2 = 0.35f; num2 < 0.97f; num2 += 0.01f) { int num3 = (int)(128f + Mathf.Cos(num) * num2 * 128f); int num4 = (int)(128f + Mathf.Sin(num) * num2 * 128f); if (alpha[num4 * 256 + num3] > 90) { array[i] = num2; } } } List<Tip> list = new List<Tip>(); for (int j = 0; j < 72; j++) { float num5 = array[j]; if (num5 < 0.6f) { continue; } bool flag = true; for (int k = -3; k <= 3 && flag; k++) { if (k != 0 && array[(j + k + 72) % 72] > num5) { flag = false; } } if (!flag) { continue; } if (list.Count > 0) { if (Mathf.Abs(Mathf.DeltaAngle(list[list.Count - 1].Angle * 57.29578f, (float)j * 5f)) < 20f) { continue; } } float num6 = (float)j * (float)Math.PI * 2f / 72f; float num7 = Mathf.Clamp01(num5 / (1.15f * Wobble(num6, grit))); float num8 = 1f - Mathf.Pow(1f - num7, 0.45454544f); list.Add(new Tip(num6, num5, Mathf.Clamp01(num8))); } return list.ToArray(); } private static byte[] ReadAlpha(Texture src, int size) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) RenderTexture temporary = RenderTexture.GetTemporary(size, size, 0, (RenderTextureFormat)0, (RenderTextureReadWrite)2); RenderTexture active = RenderTexture.active; Texture2D val = new Texture2D(size, size, (TextureFormat)4, false); try { Graphics.Blit(src, temporary); RenderTexture.active = temporary; val.ReadPixels(new Rect(0f, 0f, (float)size, (float)size), 0, 0); } finally { RenderTexture.active = active; RenderTexture.ReleaseTemporary(temporary); } Il2CppStructArray<Color32> pixels = val.GetPixels32(); Object.Destroy((Object)(object)val); byte[] array = new byte[size * size]; for (int i = 0; i < array.Length; i++) { array[i] = ((Il2CppArrayBase<Color32>)(object)pixels)[i].a; } return array; } private static float Ease(float x) { x = Mathf.Clamp01(x); return 1f - Mathf.Pow(1f - x, 2.2f); } private static void DrawFrame(byte[] alpha, Color32[] sheet, int f, float grit) { //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) int num = f % 4; int num2 = 3 - f / 4; int num3 = 1024; float num4 = Ease((float)(f + 1) / 12f) * 1.15f; float num5 = Mathf.Clamp01((float)(f - 12 + 1) / 3f); for (int i = 0; i < 256; i++) { for (int j = 0; j < 256; j++) { float num6 = (float)j - 128f; float num7 = (float)i - 128f; float num8 = Mathf.Sqrt(num6 * num6 + num7 * num7) / 128f; float th = Mathf.Atan2(num7, num6); float num9 = num4 * Wobble(th, grit); float num10 = Mathf.Clamp01((num9 - num8) / 0.06f); float num11 = Mathf.Clamp01(1f - Mathf.Abs(num9 - num8) / 0.08f) * (1f - num5); float num12 = (float)(int)alpha[i * 256 + j] / 255f * num10; int num13 = Math.Min(255, j + 1); int num14 = Math.Max(0, i - 1); float num15 = (float)(int)alpha[num14 * 256 + num13] / 255f * num10 * 0.75f; float num16 = (int)Rim.r; float num17 = (int)Rim.g; float num18 = (int)Rim.b; float num19 = num15; float num20 = Mathf.Lerp((float)(int)Dark.r, (float)(int)Ochre.r, num11); float num21 = Mathf.Lerp((float)(int)Dark.g, (float)(int)Ochre.g, num11); float num22 = Mathf.Lerp((float)(int)Dark.b, (float)(int)Ochre.b, num11); num16 = num16 * (1f - num12) + num20 * num12; num17 = num17 * (1f - num12) + num21 * num12; num18 = num18 * (1f - num12) + num22 * num12; num19 = Mathf.Max(num19, num12); sheet[(num2 * 256 + i) * num3 + num * 256 + j] = new Color32((byte)num16, (byte)num17, (byte)num18, (byte)(num19 * 255f)); } } } public static AnimationCurve FrameCurve() { //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_0028: 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_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_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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Expected O, but got Unknown //IL_006d: 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_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0083: 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_008f: 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_0108: Unknown result type (might be due to invalid IL or missing references) AnimationCurve val = new AnimationCurve((Keyframe[])(object)new Keyframe[4] { new Keyframe(0f, 0f), new Keyframe(0.58f, 23f / 32f), new Keyframe(0.73f, 31f / 32f), new Keyframe(1f, 159f / 160f) }); for (int i = 0; i < val.length; i++) { Keyframe val2 = val[i]; Keyframe val3 = ((i > 0) ? val[i - 1] : val2); Keyframe val4 = ((i < val.length - 1) ? val[i + 1] : val2); ((Keyframe)(ref val2)).inTangent = ((i > 0) ? ((((Keyframe)(ref val2)).value - ((Keyframe)(ref val3)).value) / (((Keyframe)(ref val2)).time - ((Keyframe)(ref val3)).time)) : 0f); ((Keyframe)(ref val2)).outTangent = ((i < val.length - 1) ? ((((Keyframe)(ref val4)).value - ((Keyframe)(ref val2)).value) / (((Keyframe)(ref val4)).time - ((Keyframe)(ref val2)).time)) : 0f); val.MoveKey(i, val2); } return val; } } internal static class Dust { private sealed class P { public GameObject Go; public SpriteRenderer R; public bool Puff; public bool Active; public Vector3 Pos; public Vector3 Vel; public float Born; public float Life; public float Size0; public float Size1; public float Alpha; public float Spin; public float Angle; public Color Color; public bool Bounced; public float Ground; } private const int Cap = 220; private const float Gravity = 18f; private static readonly Color Sand = new Color(0.8f, 0.68f, 0.48f, 1f); private static readonly Color Pebble = new Color(0.36f, 0.23f, 0.11f, 1f); private static readonly Color PebbleLight = new Color(0.62f, 0.44f, 0.22f, 1f); private static readonly List<P> Pool = new List<P>(); private static readonly Random Rnd = new Random(); private static Transform? _root; private static Sprite? _puff; private static Sprite? _pebble; private static bool _broken; public static void Burst(Transform root, Vector3 at, float radius) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: 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_00c9: 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_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: 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_01bd: Unknown result type (might be due to invalid IL or missing references) //IL_01c7: Unknown result type (might be due to invalid IL or missing references) //IL_01cc: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_0208: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0212: 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_0272: Unknown result type (might be due to invalid IL or missing references) //IL_027e: 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) if (_broken) { return; } try { _root = root; Vector3 val = default(Vector3); for (int i = 0; i < 9; i++) { float num = (float)((double)i / 9.0 * Math.PI * 2.0 + Rnd.NextDouble() * 0.6); ((Vector3)(ref val))..ctor(Mathf.Cos(num), 0f, Mathf.Sin(num)); P p = Take(puff: true); if (p == null) { break; } p.Pos = at + val * radius * R(0.15f, 0.35f) + Vector3.up * 0.15f; p.Vel = val * radius * R(1.6f, 2.4f) + Vector3.up * R(0.6f, 1.3f); p.Life = R(0.55f, 0.85f); p.Size0 = radius * 0.25f; p.Size1 = radius * R(0.55f, 0.8f); p.Alpha = R(0.45f, 0.65f); p.Color = Sand; } Vector3 val2 = default(Vector3); for (int j = 0; j < 8; j++) { float num2 = (float)(Rnd.NextDouble() * Math.PI * 2.0); ((Vector3)(ref val2))..ctor(Mathf.Cos(num2), 0f, Mathf.Sin(num2)); P p2 = Take(puff: false); if (p2 != null) { p2.Pos = at + val2 * radius * 0.15f + Vector3.up * 0.2f; p2.Vel = val2 * radius * R(1.2f, 2.6f) + Vector3.up * R(4f, 7f); p2.Life = 1.2f; p2.Size0 = (p2.Size1 = R(0.1f, 0.2f) * Mathf.Max(1f, radius / 2.5f)); p2.Alpha = 1f; p2.Color = ((Rnd.Next(3) == 0) ? PebbleLight : Pebble); p2.Spin = R(-720f, 720f); p2.Bounced = false; p2.Ground = at.y; continue; } break; } } catch (Exception ex) { _broken = true; ModLog.Warn($"Dust: live particles failed ({ex.GetType().Name}: {ex.Message}); bursts show without them."); } } public static void Update(float now, float dt) { //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0032: 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_0165: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0191: 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_019c: Unknown result type (might be due to invalid IL or missing references) //IL_01a1: 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_00c5: 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_00d1: 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_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e2: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Unknown result type (might be due to invalid IL or missing references) //IL_0261: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_028f: 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_02a2: Unknown result type (might be due to invalid IL or missing references) //IL_02a7: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_0241: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) if (_broken || Pool.Count == 0) { return; } Camera main = Camera.main; Quaternion val = (((Object)(object)main != (Object)null) ? ((Component)main).transform.rotation : Quaternion.Euler(60f, 0f, 0f)); foreach (P item in Pool) { if (!item.Active) { continue; } if ((Object)(object)item.Go == (Object)null) { item.Active = false; continue; } float num = (now - item.Born) / item.Life; if (num >= 1f) { Release(item); continue; } if (item.Puff) { item.Vel *= Mathf.Exp(-4.5f * dt); item.Pos += item.Vel * dt; float size = Mathf.Lerp(item.Size0, item.Size1, 1f - (1f - num) * (1f - num)); Color color = item.Color; color.a = item.Alpha * ((num < 0.15f) ? (num / 0.15f) : (1f - (num - 0.15f) / 0.85f)); Set(item, size, color, val); continue; } item.Vel += Vector3.down * 18f * dt; item.Pos += item.Vel * dt; if (item.Pos.y < item.Ground + 0.05f && item.Vel.y < 0f) { item.Pos.y = item.Ground + 0.05f; if (!item.Bounced) { item.Vel = new Vector3(item.Vel.x * 0.4f, (0f - item.Vel.y) * 0.3f, item.Vel.z * 0.4f); item.Bounced = true; } else { item.Vel = Vector3.zero; } } item.Angle += item.Spin * dt; Color color2 = item.Color; color2.a = ((num > 0.7f) ? ((1f - num) / 0.3f) : 1f); Set(item, item.Size0, color2, val * Quaternion.Euler(0f, 0f, item.Angle)); } } public static void Clear() { foreach (P item in Pool) { Release(item); } } private static void Set(P p, float size, Color c, Quaternion rot) { //IL_000d: 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_0021: 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) Transform transform = p.Go.transform; transform.position = p.Pos; transform.rotation = rot; transform.localScale = new Vector3(size, size, size); p.R.color = c; } private static void Release(P p) { p.Active = false; if ((Object)(object)p.Go != (Object)null) { p.Go.SetActive(false); } } private static P? Take(bool puff) { //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Expected O, but got Unknown if (_puff == null) { _puff = Build("Puff", 64, Soft); } if (_pebble == null) { _pebble = Build("Pebble", 16, Chunk); } foreach (P item in Pool) { if (!item.Active && item.Puff == puff && !((Object)(object)item.Go == (Object)null)) { return Init(item); } } if (Pool.Count >= 220) { return null; } GameObject val = new GameObject(puff ? "EarthDust" : "EarthPebble"); if ((Object)(object)_root != (Object)null) { val.transform.SetParent(_root, false); } SpriteRenderer val2 = val.AddComponent<SpriteRenderer>(); val2.sprite = (puff ? _puff : _pebble); ((Renderer)val2).shadowCastingMode = (ShadowCastingMode)0; ((Renderer)val2).receiveShadows = false; ((Renderer)val2).sortingOrder = (puff ? 4 : 5); P p = new P { Go = val, R = val2, Puff = puff }; Pool.Add(p); return Init(p); } private static P Init(P p) { p.Active = true; p.Born = Time.time; p.Angle = R(0f, 360f); p.Go.SetActive(true); return p; } private static float R(float a, float b) { return a + (float)Rnd.NextDouble() * (b - a); } private static float Soft(float x, float y) { float num = Mathf.Sqrt(x * x + y * y); float num2 = Mathf.Atan2(y, x); float num3 = 0.85f + 0.12f * Mathf.Sin(num2 * 5f) + 0.05f * Mathf.Sin(num2 * 11f + 1f); float num4 = Mathf.Clamp01(1f - num / num3); return num4 * num4 * (3f - 2f * num4); } private static float Chunk(float x, float y) { float num = Mathf.Atan2(y, x); float num2 = 0.7f + 0.2f * Mathf.Sin(num * 3f + 0.5f); if (!(Mathf.Sqrt(x * x + y * y) < num2)) { return 0f; } return 1f; } private static Sprite Build(string name, int size, Func<float, float, float> alpha) { //IL_0004: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(size, size, (TextureFormat)4, false); ((Object)val).name = "SpellBrigadeElements." + name; ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; for (int i = 0; i < size; i++) { for (int j = 0; j < size; j++) { float num = ((float)j + 0.5f) / (float)size * 2f - 1f; float num2 = ((float)i + 0.5f) / (float)size * 2f - 1f; float num3 = ((name == "Pebble") ? Mathf.Lerp(1.15f, 0.7f, (num2 * -0.5f + num * 0.5f + 1f) / 2f) : 1f); val.SetPixel(j, i, new Color(num3, num3, num3, alpha(num, num2))); } } val.Apply(false, true); ((Object)val).hideFlags = (HideFlags)32; Sprite obj = Sprite.Create(val, new Rect(0f, 0f, (float)size, (float)size), new Vector2(0.5f, 0.5f), (float)size); ((Object)obj).name = ((Object)val).name; ((Object)obj).hideFlags = (HideFlags)32; return obj; } } internal static class EarthBundle { private static bool _tried; private static AssetBundle? _bundle; private static byte[]? _bytes; private static string[] _crackNames = Array.Empty<string>(); private static string[] _burstNames = Array.Empty<string>(); private static Transform? _parent; private static readonly Random Rnd = new Random(); public static bool Ready { get { if ((Object)(object)_bundle != (Object)null && _crackNames.Length != 0) { return _burstNames.Length != 0; } return false; } } public static bool TryLoad(Transform parent) { if (_tried) { return Ready; } _tried = true; _parent = parent; if (!ModConfig.UnityEffects.Value) { ModLog.Info("Effects: Unity effects are off in the config."); return false; } try { using Stream stream = typeof(EarthBundle).Assembly.GetManifestResourceStream("SpellBrigadeElements.Assets.earthvfx.bundle"); if (stream == null) { ModLog.Info("Effects: no Unity effect bundle in this build; using the rendered animations."); return false; } using MemoryStream memoryStream = new MemoryStream(); stream.CopyTo(memoryStream); _bytes = memoryStream.ToArray(); string text = Path.Combine(Paths.CachePath, "SpellBrigadeElements"); Directory.CreateDirectory(text); string text2 = Path.Combine(text, "earthvfx.bundle"); if (!File.Exists(text2) || new FileInfo(text2).Length != _bytes.Length || !SameBytes(text2, _bytes)) { File.WriteAllBytes(text2, _bytes); } ModLog.Step("Effects: AssetBundle.LoadFromFile " + text2); _bundle = BundleCalls.LoadFromFile(text2); if ((Object)(object)_bundle == (Object)null) { throw new InvalidDataException("AssetBundle.LoadFromFile returned null (Unity version mismatch?)"); } ((Object)_bundle).hideFlags = (HideFlags)32; ModLog.Step("Effects: listing bundle assets"); Il2CppStringArray allAssetNames = _bundle.GetAllAssetNames(); List<string> list = new List<string>(); List<string> list2 = new List<string>(); foreach (string item in (Il2CppArrayBase<string>)(object)allAssetNames) { string text3 = Path.GetFileNameWithoutExtension(item).ToLowerInvariant(); if (text3.StartsWith("earthcrack")) { list.Add(item); } else if (text3.StartsWith("earthburst")) { list2.Add(item); } } _crackNames = list.ToArray(); _burstNames = list2.ToArray(); ModLog.Info($"Effects: Unity effect bundle loaded ({_bytes.Length / 1024} KB): {_crackNames.Length} crack and {_burstNames.Length} burst variant(s)."); } catch (Exception value) { _bundle = null; ModLog.Warn($"Effects: Unity effect bundle failed; using the rendered animations. {value}"); } return Ready; } private static bool SameBytes(string file, byte[] bytes) { byte[] array = File.ReadAllBytes(file); if (array.Length != bytes.Length) { return false; } for (int i = 0; i < array.Length; i++) { if (array[i] != bytes[i]) { return false; } } return true; } private static GameObject? Prefab(string[] names) { if ((Object)(object)_bundle == (Object)null || names.Length == 0) { return null; } Object val = BundleCalls.LoadAsset(_bundle, names[Rnd.Next(names.Length)], Il2CppType.Of<GameObject>()); if (!(val == (Object)null)) { return ((Il2CppObjectBase)val).TryCast<GameObject>(); } return null; } public static GameObject? Crack(Vector3 at, float radius, float delay) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) return Spawn(Prefab(_crackNames), at, radius, delay, 1f / Mathf.Max(0.2f, delay), 1.6f * Mathf.Max(0.2f, delay) + 0.6f, crack: true); } public static GameObject? Burst(Vector3 at, float radius) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) return Spawn(Prefab(_burstNames), at, radius, 0f, 1f, 2f, crack: false); } public static void End(GameObject? go) { if ((Object)(object)go != (Object)null) { Object.Destroy((Object)(object)go); } } private static GameObject? Spawn(GameObject? prefab, Vector3 at, float radius, float delay, float speed, float life, bool crack) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)prefab == (Object)null) { return null; } try { GameObject val = SpawnUnsafe(prefab, at, radius, speed, life); if (ModConfig.GameArt.Value) { if (crack) { GameArt.RestyleCrack(val, radius, delay); } else { GameArt.RestyleBurst(val); } } return val; } catch (Exception ex) { ModLog.ErrorThrottled("bundle-spawn", ex, Time.time, 30f); return null; } } private static GameObject SpawnUnsafe(GameObject prefab, Vector3 at, float radius, float speed, float life) { //IL_0011: 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_0036: Unknown result type (might be due to invalid IL or missing references) float num = Random.Range(0f, 360f); GameObject val = Object.Instantiate<GameObject>(prefab, at, Quaternion.Euler(0f, num, 0f), _parent); val.transform.localScale = new Vector3(radius, radius, radius); if (Math.Abs(speed - 1f) > 0.01f) { foreach (ParticleSystem componentsInChild in val.GetComponentsInChildren<ParticleSystem>(true)) { componentsInChild.main.simulationSpeed = speed; } } Object.Destroy((Object)(object)val, life); return val; } } internal static class EarthBursts { private sealed class Info { public ulong Owner; public SpellType Spell; public Visuals.Decal? Decal; public int Pair; } private static readonly CrackSchedule<Info> Schedule = new CrackSchedule<Info>(); private static EarthTuning _tuning = new EarthTuning(); private static float _nextTuning; private static int _loggedCracks; private static int _loggedBursts; private static int _errors; private static bool _bursting; private static int _blockedInBurst; private static readonly List<(Vector3 At, float Radius, Visuals.Decal? Decal, float Due)> Shown = new List<(Vector3, float, Visuals.Decal, float)>(); private static int _loggedShown; public static bool Bursting => _bursting; public static bool ShowOnly(Vector3 at, float radius) { //IL_0024: 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_0081: Unknown result type (might be due to invalid IL or missing references) if (Shown.Count >= 40) { return false; } if (radius <= 0f) { radius = _tuning.BurstRadius; } Visuals.Decal item = Visuals.StartCrack(at, radius, _tuning.CrackDelay); Shown.Add((at, radius, item, Time.time + _tuning.CrackDelay)); if (ModConfig.VerboseLog.Value && _loggedShown++ < 3) { ModLog.Info(FormattableString.Invariant($"Earth: show-only crack at {at} (another mod's hit), bursts in {_tuning.CrackDelay:0.##} s.")); } return true; } private static void UpdateShown(float now) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) for (int num = Shown.Count - 1; num >= 0; num--) { (Vector3, float, Visuals.Decal, float) tuple = Shown[num]; if (!(now < tuple.Item4)) { Shown.RemoveAt(num); try { Visuals.Burst(tuple.Item1, tupl