Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of Mjolnir Senhor do Trovao v1.2.4
BepInEx/plugins/Yoroshiro_Mjolnir/Mjolnir.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn.Configs; using Jotunn.Entities; using Jotunn.Managers; using SoftReferenceableAssets; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Yoroshiro")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Mod de Valheim criado por Yoroshiro.")] [assembly: AssemblyFileVersion("1.2.4.0")] [assembly: AssemblyInformationalVersion("1.2.4")] [assembly: AssemblyProduct("Mjolnir - Senhor do Trovao")] [assembly: AssemblyTitle("Mjolnir")] [assembly: InternalsVisibleTo("Mjolnir.PoseFix")] [assembly: AssemblyVersion("1.2.4.0")] namespace MyValheimMod; internal static class MjolnirAttackTempo { private static Animator tracked; private static readonly TempoFactor factor = new TempoFactor(); internal static void Remove(Animator animator) { if (Object.op_Implicit((Object)(object)animator)) { if (Object.op_Implicit((Object)(object)tracked) && (Object)(object)tracked != (Object)(object)animator) { Restore(); } tracked = animator; animator.speed = factor.Remove(animator.speed); } } internal static void Restore() { if (Object.op_Implicit((Object)(object)tracked)) { tracked.speed = factor.Remove(tracked.speed); } tracked = null; } internal static void Apply(Animator animator, Character owner, float freezeTimer) { MjolnirPlugin active = MjolnirPlugin.Active; if (Object.op_Implicit((Object)(object)animator) && Object.op_Implicit((Object)(object)active) && !((Object)(object)owner != (Object)(object)Player.m_localPlayer)) { bool enabled = owner.InAttack() && freezeTimer <= 0f && active.HasAttackBuff(Player.m_localPlayer); animator.speed = factor.Apply(animator.speed, active.AttackBonus.Value, enabled); } } } [HarmonyPatch(typeof(CharacterAnimEvent), "CustomFixedUpdate")] internal static class AttackTempoUpdate { [HarmonyPriority(800)] private static void Prefix(Character ___m_character, Animator ___m_animator) { if ((Object)(object)___m_character == (Object)(object)Player.m_localPlayer) { MjolnirAttackTempo.Remove(___m_animator); } } [HarmonyPriority(0)] private static void Postfix(Character ___m_character, Animator ___m_animator, float ___m_pauseTimer) { MjolnirAttackTempo.Apply(___m_animator, ___m_character, ___m_pauseTimer); } } [HarmonyPatch(typeof(CharacterAnimEvent), "FreezeFrame")] internal static class AttackTempoFreeze { private static void Prefix(Character ___m_character, Animator ___m_animator) { if ((Object)(object)___m_character == (Object)(object)Player.m_localPlayer) { MjolnirAttackTempo.Remove(___m_animator); } } } public sealed class CatchCue { public bool Fired { get; private set; } public bool TryFire(bool returning, float distance, float speed) { if (Fired || !returning || float.IsNaN(distance) || float.IsInfinity(distance) || float.IsNaN(speed) || float.IsInfinity(speed) || distance < 0f || speed <= 0f) { return false; } if (distance > Math.Max(1f, speed * 0.3f)) { return false; } Fired = true; return true; } } public sealed class ChargedAura : MonoBehaviour { private LineRenderer[] arcs; private float next; private bool visible; private readonly Random random = new Random(); private float Noise() { return (float)random.NextDouble() * 2f - 1f; } private void LateUpdate() { //IL_016a: 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_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ca: 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_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_01eb: 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_01f9: Unknown result type (might be due to invalid IL or missing references) //IL_01fd: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) MjolnirPlugin active = MjolnirPlugin.Active; if (!Object.op_Implicit((Object)(object)active) || active.Storm == null || !active.Storm.AuraReady || !Object.op_Implicit((Object)(object)Player.m_localPlayer) || !((Object)(object)((Component)this).gameObject == (Object)(object)((Component)Player.m_localPlayer).gameObject)) { SetVisible(show: false); visible = false; return; } if (arcs == null) { if (!Object.op_Implicit((Object)(object)MjolnirLightning.ArcMaterial())) { return; } arcs = (LineRenderer[])(object)new LineRenderer[8]; for (int i = 0; i < arcs.Length; i++) { arcs[i] = MjolnirLightning.NewLine(((Component)this).transform, "Mjolnir_ChargedAura", 0.015f); arcs[i].useWorldSpace = false; } } if (!visible) { SetVisible(show: true); visible = true; } if (Time.time < next) { return; } next = Time.time + 0.045f; Vector3 val = default(Vector3); for (int j = 0; j < arcs.Length; j++) { ((Renderer)arcs[j]).enabled = random.NextDouble() > 0.25; float num = (float)random.NextDouble() * MathF.PI * 2f; float num2 = 0.25f + (float)random.NextDouble() * 1.4f; ((Vector3)(ref val))..ctor(Mathf.Cos(num) * 0.38f, num2, Mathf.Sin(num) * 0.32f); Vector3 val2 = val + new Vector3(Noise() * 0.22f, 0.15f + (float)random.NextDouble() * 0.35f, Noise() * 0.22f); for (int k = 0; k < 8; k++) { float num3 = (float)k / 7f; Vector3 val3 = new Vector3(Noise(), Noise(), Noise()) * 0.09f * Mathf.Sin(num3 * MathF.PI); arcs[j].SetPosition(k, Vector3.Lerp(val, val2, num3) + val3); } } } private void SetVisible(bool show) { if (arcs == null) { return; } LineRenderer[] array = arcs; foreach (LineRenderer val in array) { if (Object.op_Implicit((Object)(object)val)) { ((Renderer)val).enabled = show; } } } private void OnDestroy() { if (arcs == null) { return; } LineRenderer[] array = arcs; foreach (LineRenderer val in array) { if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)((Component)val).gameObject); } } } } [HarmonyPatch(typeof(Character), "Damage")] internal static class ChargedJumpFallDamage { private static bool Prefix(Character __instance, HitData __0) { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Invalid comparison between Unknown and I4 MjolnirPlugin active = MjolnirPlugin.Active; if (Object.op_Implicit((Object)(object)active) && active.Storm != null && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && __0 != null && (int)__0.m_hitType == 3) { return !active.Storm.ProtectOwnJumpFall; } return true; } } public sealed class ChargeMeter { private readonly HashSet<int> awarded = new HashSet<int>(); private double percent; public int Kills => (int)Math.Floor(percent * (double)Goal / 100.0 + 1E-06); public float Percent => (float)percent; public bool HasCharge => percent > 1E-05; public int Goal { get; private set; } = 5; public bool Ready => percent >= 99.99999; public float Fraction => (float)(percent / 100.0); public void SetGoal(int goal) { Goal = Math.Max(2, Math.Min(12, goal)); } public void Load(int kills) { LoadPercent((float)kills * 100f / (float)Goal); } public void LoadPercent(float value) { percent = ((float.IsNaN(value) || float.IsInfinity(value)) ? 0f : Math.Max(0f, Math.Min(100f, value))); } public bool AddKill() { if (Ready) { return false; } percent = Math.Min(100.0, percent + 100.0 / (double)Goal); return true; } public bool AwardKill(int creatureId) { if (awarded.Add(creatureId)) { return AddKill(); } return false; } public void BeginSession() { awarded.Clear(); Clear(); } public bool Drain(float dt, float rate) { if (!HasCharge || float.IsNaN(dt) || float.IsInfinity(dt) || dt <= 0f || float.IsNaN(rate) || float.IsInfinity(rate)) { return false; } rate = Math.Max(0.5f, Math.Min(10f, rate)); percent = Math.Max(0.0, percent - (double)dt * (double)rate); if (percent < 1E-05) { percent = 0.0; } return true; } public bool SpendPercent(float cost) { if (float.IsNaN(cost) || float.IsInfinity(cost) || cost <= 0f || cost > 100f || percent + 1E-05 < (double)cost) { return false; } percent = Math.Max(0.0, percent - (double)cost); return true; } public bool SpendOne() { if (!HasCharge) { return false; } percent = Math.Max(0.0, percent - 100.0 / (double)Goal); return true; } public bool Consume() { if (!Ready) { return false; } Clear(); return true; } public void Clear() { percent = 0.0; } } [BepInPlugin("com.seunome.mjolnir", "Mjölnir - Yoroshiro", "1.2.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class MjolnirPlugin : BaseUnityPlugin { internal static MjolnirPlugin Active; internal ConfigEntry<Vector3> GripPosition; internal ConfigEntry<Vector3> GripRotation; internal ConfigEntry<float> GripScale; private AssetBundle bundle; private GameObject model; private Sprite inventoryIcon; private Sprite overchargeIcon; internal MjolnirFlight Flight; internal ConfigEntry<float> ThrowRange; internal ConfigEntry<float> ThrowSpeed; internal ConfigEntry<float> ReturnSpeed; internal ConfigEntry<float> ThrowStamina; internal ConfigEntry<bool> LightningEnabled; internal ConfigEntry<bool> ProtectPlayerBuildings; internal ConfigEntry<float> SprintDrainMultiplier; internal ConfigEntry<float> ImpactShake; private Harmony harmony; internal ConfigEntry<bool> CatchAnimationEnabled; internal ConfigEntry<bool> ThunderImpactEnabled; internal ConfigEntry<float> ThunderVolume; private SoftReference<GameObject> thunderReference; private bool thunderHeld; private AudioClip thunderClip; private AudioMixerGroup thunderMixer; private float nextThrow; internal string ThrowAnimation; internal readonly ThrowRequest Request = new ThrowRequest(); internal ConfigEntry<KeyCode> ThrowKey; internal Attack AnimatedThrowAttack; internal ConfigEntry<float> MovementBonus; internal ConfigEntry<float> AttackBonus; internal ConfigEntry<bool> BuffEnabled; internal ConfigEntry<int> ImpactBolts; private SE_Stats lordOfThunder; internal StormAbility Storm; internal TargetLightning Strike; internal ConfigEntry<float> StrikeCost; internal ConfigEntry<float> StrikeCooldown; internal ConfigEntry<float> StrikeDamage; internal ConfigEntry<float> StrikeRange; internal ConfigEntry<float> StrikeRadius; internal StormFlight Wings; internal StatusEffect Overcharge; internal ConfigEntry<bool> InfiniteOvercharge; internal ConfigEntry<bool> FlightEnabled; internal ConfigEntry<bool> FlightDestruction; internal ConfigEntry<bool> FlightTerrain; internal ConfigEntry<float> FlightSpeed; internal ConfigEntry<float> FlightFastSpeed; internal ConfigEntry<float> FlightSmashDamage; internal ConfigEntry<float> FlightChargeSeconds; internal ConfigEntry<float> FlightDrainPercent; internal ConfigEntry<float> ThrowDamageMultiplier; internal ConfigEntry<float> JumpDamage; internal ConfigEntry<float> JumpRadius; internal ConfigEntry<float> JumpVelocity; internal ConfigEntry<int> ChargeKills; internal ConfigEntry<float> SprintLeapSpeed; internal ConfigEntry<float> LandingStructureDamage; internal ConfigEntry<bool> LandingDamagesStructures; internal ConfigEntry<bool> NordicHud; internal ConfigEntry<float> HudScale; internal ConfigEntry<float> HudVerticalOffset; internal StormMenu MenuPanel; internal Sprite LightningIcon => overchargeIcon; internal GameObject WeaponModel => model; private void Awake() { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_072f: Unknown result type (might be due to invalid IL or missing references) //IL_0739: Expected O, but got Unknown Active = this; GripRotation = ((BaseUnityPlugin)this).Config.Bind<Vector3>("Visual", "Rotation", new Vector3(90f, 0f, 0f), "Rotacao local em graus."); GripPosition = ((BaseUnityPlugin)this).Config.Bind<Vector3>("Visual", "Position", Vector3.zero, "Deslocamento local em metros."); GripScale = ((BaseUnityPlugin)this).Config.Bind<float>("Visual", "Scale", 1f, "Escala do modelo."); string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "mjolnirassets"); if (!File.Exists(text)) { ((BaseUnityPlugin)this).Logger.LogError((object)("Falta o AssetBundle: " + text + ". Gere-o no Unity conforme LEIA-ME.")); return; } bundle = AssetBundle.LoadFromFile(text); if (!Object.op_Implicit((Object)(object)bundle) || !Object.op_Implicit((Object)(object)(model = bundle.LoadAsset<GameObject>("MjolnirVisual")))) { ((BaseUnityPlugin)this).Logger.LogError((object)"Nao foi possivel carregar MjolnirVisual do AssetBundle."); return; } ThrowRange = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "Range", 22f, "Alcance em metros (3 a 60)."); ThrowSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "Speed", 24f, "Velocidade de ida em metros por segundo."); ReturnSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "ReturnSpeed", 32f, "Velocidade de retorno."); ThrowStamina = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "Stamina", 15f, "Custo de vigor por arremesso."); LightningEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "Lightning", true, "Arcos eletricos visuais."); ThrowKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("Controls", "ThrowKey", (KeyCode)103, "Tecla para arremessar com animacao."); BuffEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Buff", "Enabled", true, "Senhor do Trovao enquanto equipado."); MovementBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Buff", "MovementPercent", 5f, "Bonus de movimento, limitado a 10%."); AttackBonus = ((BaseUnityPlugin)this).Config.Bind<float>("Buff", "AttackSpeedPercent", 8f, "Bonus dos ataques normais, limitado a 15%."); ImpactBolts = ((BaseUnityPlugin)this).Config.Bind<int>("Effects", "ImpactBolts", 5, "Quantidade de raios no impacto, de 1 a 8."); CatchAnimationEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Return", "CatchAnimation", true, "Gesto de receber o martelo."); ThunderImpactEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Effects", "ThunderImpact", true, "Impacto visual e sonoro de trovao."); ThunderVolume = ((BaseUnityPlugin)this).Config.Bind<float>("Effects", "ThunderVolume", 0.65f, "Volume do trovao de 0 a 1."); ThrowDamageMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Throw", "DamageMultiplier", 1.4f, "Multiplicador do dano de arremesso."); JumpDamage = ((BaseUnityPlugin)this).Config.Bind<float>("StormJump", "ImpactDamage", 120f, "Dano eletrico central do salto."); JumpRadius = ((BaseUnityPlugin)this).Config.Bind<float>("StormJump", "ImpactRadius", 5.5f, "Raio do impacto do salto em metros."); JumpVelocity = ((BaseUnityPlugin)this).Config.Bind<float>("StormJump", "ChargedVerticalSpeed", 14f, "Impulso do salto cheio, de 9 a 16 m/s."); ChargeKills = ((BaseUnityPlugin)this).Config.Bind<int>("StormJump", "KillsRequired", 5, "Abates diretos para encher o medidor."); NordicHud = ((BaseUnityPlugin)this).Config.Bind<bool>("HUD", "Enabled", true, "Mostrar medidor nordico com o martelo equipado."); HudScale = ((BaseUnityPlugin)this).Config.Bind<float>("HUD", "CompactScale", 0.85f, "Tamanho do HUD compacto."); HudVerticalOffset = ((BaseUnityPlugin)this).Config.Bind<float>("HUD", "VerticalOffset", 0f, "Ajuste vertical abaixo do mapa, em pixels."); SprintLeapSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("StormJump", "SprintForwardSpeed", 16f, "Impulso frontal correndo com Shift."); LandingStructureDamage = ((BaseUnityPlugin)this).Config.Bind<float>("StormJump", "StructureDamage", 100f, "Dano contundente base nas estruturas da aterrissagem."); LandingDamagesStructures = ((BaseUnityPlugin)this).Config.Bind<bool>("StormJump", "DamageStructures", true, "Dano nas estruturas proximas ao aterrissar."); FlightEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Flight", "Enabled", true, "Enable hammer flight. The flight shortcut is editable in the mod menu."); FlightDestruction = ((BaseUnityPlugin)this).Config.Bind<bool>("Flight", "Destruction", true, "Colisoes rapidas danificam objetos e inimigos."); FlightTerrain = ((BaseUnityPlugin)this).Config.Bind<bool>("Flight", "DeformTerrain", false, "PERMANENTE: escava solo nas colisoes e mergulhos."); FlightSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Flight", "Speed", 12f, "Velocidade normal do voo."); FlightFastSpeed = ((BaseUnityPlugin)this).Config.Bind<float>("Flight", "FastSpeed", 32f, "Velocidade com Shift."); FlightSmashDamage = ((BaseUnityPlugin)this).Config.Bind<float>("Flight", "SmashDamage", 1500f, "Dano bruto de colisao destrutiva."); FlightChargeSeconds = ((BaseUnityPlugin)this).Config.Bind<float>("Flight", "SecondsPerCharge", 8f, "Segundos de voo por parte do medidor (3 a 30)."); FlightDrainPercent = ((BaseUnityPlugin)this).Config.Bind<float>("Flight", "PercentPerSecond", 100f / (float)Mathf.Clamp(ChargeKills.Value, 2, 12) / Mathf.Clamp(FlightChargeSeconds.Value, 3f, 30f), "Consumo percentual por segundo (0.5 a 10)."); InfiniteOvercharge = ((BaseUnityPlugin)this).Config.Bind<bool>("Tests", "InfiniteOvercharge", false, "TESTES: manter carga cheia, sem consumo no voo/salto."); ProtectPlayerBuildings = ((BaseUnityPlugin)this).Config.Bind<bool>("Safety", "ProtectPlayerBuildings", true, "Protege construcoes feitas por jogadores contra os poderes do Mjolnir."); SprintDrainMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("Flight", "SprintDrainMultiplier", 1.5f, "Multiplicador do consumo com Shift em movimento (1 a 3)."); ImpactShake = ((BaseUnityPlugin)this).Config.Bind<float>("Effects", "ImpactShake", 0.15f, "Intensidade da camera nos impactos fortes (0 desliga, maximo 0.3)."); StrikeCost = ((BaseUnityPlugin)this).Config.Bind<float>("LightningSkill", "EnergyCostPercent", 30f, "Custo percentual da habilidade Shift+G (10 a 100)."); StrikeCooldown = ((BaseUnityPlugin)this).Config.Bind<float>("LightningSkill", "CooldownSeconds", 8f, "Recarga em segundos, inclusive em energia infinita (2 a 30)."); StrikeDamage = ((BaseUnityPlugin)this).Config.Bind<float>("LightningSkill", "Damage", 90f, "Dano eletrico central (20 a 180)."); StrikeRange = ((BaseUnityPlugin)this).Config.Bind<float>("LightningSkill", "Range", 40f, "Alcance da mira em metros (5 a 60)."); StrikeRadius = ((BaseUnityPlugin)this).Config.Bind<float>("LightningSkill", "Radius", 2.5f, "Raio do impacto (0.5 a 4 metros)."); Strike = new TargetLightning(this); Wings = new StormFlight(this); Storm = new StormAbility(this); MenuPanel = new StormMenu(this, ((BaseUnityPlugin)this).Config); harmony = new Harmony("com.seunome.mjolnir.throw"); harmony.PatchAll(typeof(MjolnirPlugin).Assembly); LoadInventoryIcon(); LoadOverchargeIcon(); PrefabManager.OnVanillaPrefabsAvailable += RegisterMjolnir; } private void LoadInventoryIcon() { //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) string text = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Mjolnir_icon.png"); if (!File.Exists(text)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Icone nao encontrado: " + text + ". Usando icone da arma base.")); return; } Texture2D val = null; try { val = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(val, File.ReadAllBytes(text), false)) { throw new InvalidDataException("PNG invalido."); } ((Object)val).name = "Mjolnir_InventoryTexture"; ((Texture)val).wrapMode = (TextureWrapMode)1; ((Texture)val).filterMode = (FilterMode)1; inventoryIcon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0); ((Object)inventoryIcon).name = "Mjolnir_InventoryIcon"; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Icone do Mjolnir carregado."); } catch (Exception ex) { if (Object.op_Implicit((Object)(object)val)) { Object.Destroy((Object)(object)val); } ((BaseUnityPlugin)this).Logger.LogWarning((object)("Falha no icone; mantendo o original: " + ex.Message)); } } private void LoadOverchargeIcon() { //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) try { string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "Sobrecarga_icon.png"); if (!File.Exists(path)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Falta Sobrecarga_icon.png; usando icone do martelo."); return; } Texture2D val = new Texture2D(2, 2, (TextureFormat)4, false); if (!ImageConversion.LoadImage(val, File.ReadAllBytes(path), false)) { Object.Destroy((Object)(object)val); return; } ((Texture)val).wrapMode = (TextureWrapMode)1; overchargeIcon = Sprite.Create(val, new Rect(0f, 0f, (float)((Texture)val).width, (float)((Texture)val).height), new Vector2(0.5f, 0.5f), 100f, 0u, (SpriteMeshType)0); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Icone Sobrecarga: " + ex.Message)); } } private void RegisterMjolnir() { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Expected O, but got Unknown //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Expected O, but got Unknown //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Expected O, but got Unknown //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_0381: Unknown result type (might be due to invalid IL or missing references) //IL_038b: Expected O, but got Unknown //IL_04a2: Unknown result type (might be due to invalid IL or missing references) //IL_04ac: Expected O, but got Unknown PrefabManager.OnVanillaPrefabsAvailable -= RegisterMjolnir; try { ItemConfig val = new ItemConfig(); val.Name = "Mjölnir"; val.Description = "O martelo do deus do trovão."; val.CraftingStation = "forge"; val.MinStationLevel = 2; val.Amount = 1; val.Requirements = (RequirementConfig[])(object)new RequirementConfig[4] { new RequirementConfig("Iron", 12, 0, true), new RequirementConfig("Wood", 4, 0, true), new RequirementConfig("BlackMetal", 6, 0, true), new RequirementConfig("AncientSeed", 1, 0, true) }; ItemConfig val2 = val; StormBalance.TuneRecipe(val2); CustomItem val3 = new CustomItem("ThorMjolnir1H", "MaceIron", val2); Transform val4 = val3.ItemPrefab.transform.Find("attach"); if (!Object.op_Implicit((Object)(object)val4)) { throw new InvalidOperationException("MaceIron nao contem o ponto attach esperado."); } Renderer[] componentsInChildren = ((Component)val4).GetComponentsInChildren<Renderer>(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } GameObject val5 = Object.Instantiate<GameObject>(model, val4, false); ((Object)val5).name = "MjolnirVisual"; ApplyGrip(val5.transform); val5.AddComponent<MjolnirGrip>(); val5.AddComponent<MjolnirLightning>(); SharedData shared = val3.ItemPrefab.GetComponent<ItemDrop>().m_itemData.m_shared; GameObject prefab = PrefabManager.Instance.GetPrefab("SpearFlint"); ItemDrop val6 = (Object.op_Implicit((Object)(object)prefab) ? prefab.GetComponent<ItemDrop>() : null); Attack val7 = (Object.op_Implicit((Object)(object)val6) ? val6.m_itemData.m_shared.m_secondaryAttack : null); if (val7 == null || string.IsNullOrEmpty(val7.m_attackAnimation)) { ((BaseUnityPlugin)this).Logger.LogError((object)"Animacao SpearFlint indisponivel. Mantendo o item, sem arremesso."); } else { Attack val8 = val7.Clone(); ThrowAnimation = val8.m_attackAnimation; val8.m_attackType = (AttackType)0; val8.m_consumeItem = false; val8.m_attackStamina = 0f; val8.m_attackEitr = 0f; val8.m_attackAdrenaline = 0f; val8.m_attackUseAdrenaline = 0f; val8.m_attackHealth = 0f; val8.m_attackProjectile = null; val8.m_spawnOnTrigger = null; val8.m_spawnOnHit = null; val8.m_attackChainLevels = 0; val8.m_attackRandomAnimations = 0; AnimatedThrowAttack = val8; ((BaseUnityPlugin)this).Logger.LogInfo((object)("Arremesso G: animacao nativa=" + ThrowAnimation)); } lordOfThunder = ScriptableObject.CreateInstance<SE_Stats>(); ((Object)lordOfThunder).name = "SE_Mjolnir_LordOfThunder"; ((StatusEffect)lordOfThunder).m_name = "Senhor do Trovão"; ((StatusEffect)lordOfThunder).m_icon = inventoryIcon; lordOfThunder.m_speedModifier = (BuffEnabled.Value ? (Mathf.Clamp(MovementBonus.Value, 0f, 10f) / 100f) : 0f); ((StatusEffect)lordOfThunder).m_hidden = !BuffEnabled.Value; ((StatusEffect)lordOfThunder).m_tooltip = "+" + Mathf.Clamp(MovementBonus.Value, 0f, 10f) + "% movimento\n+" + Mathf.Clamp(AttackBonus.Value, 0f, 15f) + "% velocidade de ataque\nAtivo enquanto o Mjölnir estiver equipado."; if (ItemManager.Instance.AddStatusEffect(new CustomStatusEffect((StatusEffect)(object)lordOfThunder, false))) { shared.m_equipStatusEffect = (StatusEffect)(object)lordOfThunder; shared.m_movementModifier = 0f; } else { lordOfThunder = null; ((BaseUnityPlugin)this).Logger.LogWarning((object)"Nao foi possivel registrar Senhor do Trovao."); } if (Object.op_Implicit((Object)(object)inventoryIcon)) { shared.m_icons = (Sprite[])(object)new Sprite[1] { inventoryIcon }; } shared.m_attackForce = 60f; shared.m_damages.m_blunt = 55f; shared.m_damages.m_lightning = 20f; ForgeProgression.Configure(shared); if (!ItemManager.Instance.AddItem(val3)) { throw new InvalidOperationException("Jotunn rejeitou o registro do item."); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mjolnir registrado: ThorMjolnir1H | Criado por Yoroshiro"); StatusEffect val9 = ScriptableObject.CreateInstance<StatusEffect>(); ((Object)val9).name = "SE_Mjolnir_Overcharge"; val9.m_name = "Sobrecarga"; val9.m_icon = (Object.op_Implicit((Object)(object)overchargeIcon) ? overchargeIcon : inventoryIcon); val9.m_ttl = 0f; val9.m_tooltip = "Energia do trovão armazenada. O voo consome carga. Com o medidor cheio, segure Espaço para o salto carregado."; if (ItemManager.Instance.AddStatusEffect(new CustomStatusEffect(val9, false))) { Overcharge = val9; } PrepareThunder(); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Falha ao registrar Mjolnir: " + ex)); } } private void PrepareThunder() { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) try { thunderReference = AssetManager.Instance.GetSoftReference<GameObject>("sfx_thunder"); if (!thunderReference.IsValid) { throw new InvalidOperationException("sfx_thunder nao encontrado."); } thunderHeld = true; thunderReference.Load(); GameObject asset = thunderReference.Asset; if (!Object.op_Implicit((Object)(object)asset)) { throw new InvalidOperationException("sfx_thunder nao carregou."); } ZSFX componentInChildren = asset.GetComponentInChildren<ZSFX>(true); if ((Object)(object)componentInChildren != (Object)null && componentInChildren.m_audioClips != null) { AudioClip[] audioClips = componentInChildren.m_audioClips; foreach (AudioClip val in audioClips) { if (Object.op_Implicit((Object)(object)val)) { thunderClip = val; break; } } } AudioSource componentInChildren2 = asset.GetComponentInChildren<AudioSource>(true); if (!Object.op_Implicit((Object)(object)thunderClip) && Object.op_Implicit((Object)(object)componentInChildren2)) { thunderClip = componentInChildren2.clip; } if (Object.op_Implicit((Object)(object)componentInChildren2)) { thunderMixer = componentInChildren2.outputAudioMixerGroup; } if (!Object.op_Implicit((Object)(object)thunderClip)) { throw new InvalidOperationException("Clip de trovao indisponivel."); } ((BaseUnityPlugin)this).Logger.LogInfo((object)("Som de impacto do trovao carregado: " + ((Object)thunderClip).name)); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Som de trovao indisponivel: " + ex.Message)); } } internal void ThunderImpact(Vector3 point, float strength = 1f) { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Expected O, but got Unknown try { if (ThunderImpactEnabled.Value) { MjolnirLightning.ThunderBurst(point, Mathf.Clamp(Mathf.RoundToInt((float)ImpactBolts.Value * strength), 1, 8), strength); if (Object.op_Implicit((Object)(object)thunderClip)) { GameObject val = new GameObject("Mjolnir_ThunderSound"); val.transform.position = point; AudioSource obj = val.AddComponent<AudioSource>(); obj.clip = thunderClip; obj.outputAudioMixerGroup = thunderMixer; obj.spatialBlend = 1f; obj.rolloffMode = (AudioRolloffMode)1; obj.minDistance = 4f; obj.maxDistance = 70f; obj.volume = Mathf.Clamp01(ThunderVolume.Value) * Mathf.Clamp(strength, 0.2f, 1f); obj.Play(); Object.Destroy((Object)val, Mathf.Min(thunderClip.length + 1f, 30f)); } } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Efeito de impacto: " + ex.Message)); } } internal bool ProtectedBuilding(Collider collider) { if (!ProtectPlayerBuildings.Value || !Object.op_Implicit((Object)(object)collider)) { return false; } Piece componentInParent = ((Component)collider).GetComponentInParent<Piece>(); if (Object.op_Implicit((Object)(object)componentInParent)) { return componentInParent.IsPlacedByPlayer(); } return false; } internal void FlightImpact(Vector3 point, Vector3 normal, float speed) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_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_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) StormVfx.MarkContact(point, normal); if (!ThunderImpactEnabled.Value) { return; } float num = FlightPolishRules.ImpactStrength(speed); if (speed < 8f) { MjolnirLightning.Impact(point); return; } ThunderImpact(point, num); if (speed >= 18f) { LandingDust.Spawn(point, normal); } if (Object.op_Implicit((Object)(object)GameCamera.instance) && ImpactShake.Value > 0f) { GameCamera.instance.AddShake(point, 15f, Mathf.Clamp(ImpactShake.Value, 0f, 0.3f) * num, false); } } internal void CatchGesture(Player owner) { if (!CatchAnimationEnabled.Value || !Object.op_Implicit((Object)(object)owner) || ((Character)owner).IsDead()) { return; } try { if (Wings.Active) { ((Component)owner).GetComponent<ThorFlightPose>()?.BeginCatch(); return; } ZSyncAnimation zAnim = ((Character)owner).GetZAnim(); if (Object.op_Implicit((Object)(object)zAnim)) { zAnim.SetTrigger("interact"); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Gesto de retorno: " + ex.Message)); } } internal void RefreshBuff() { float num = (BuffEnabled.Value ? (Mathf.Clamp(MovementBonus.Value, 0f, 10f) / 100f) : 0f); string tooltip = "+" + (num * 100f).ToString("0") + "% movimento\n+" + (BuffEnabled.Value ? Mathf.Clamp(AttackBonus.Value, 0f, 15f) : 0f).ToString("0") + "% velocidade de ataque"; if (Object.op_Implicit((Object)(object)lordOfThunder)) { lordOfThunder.m_speedModifier = num; ((StatusEffect)lordOfThunder).m_hidden = !BuffEnabled.Value; ((StatusEffect)lordOfThunder).m_tooltip = tooltip; } Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer)) { return; } foreach (StatusEffect statusEffect in ((Character)localPlayer).GetSEMan().GetStatusEffects()) { if (((Object)statusEffect).name == "SE_Mjolnir_LordOfThunder") { SE_Stats val = (SE_Stats)(object)((statusEffect is SE_Stats) ? statusEffect : null); if (val != null) { val.m_speedModifier = num; ((StatusEffect)val).m_hidden = !BuffEnabled.Value; ((StatusEffect)val).m_tooltip = tooltip; } } } } internal bool HasAttackBuff(Player owner) { if (Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)lordOfThunder) && BuffEnabled.Value && !((Character)owner).IsDead() && IsMjolnir(((Humanoid)owner).GetCurrentWeapon()) && !Object.op_Implicit((Object)(object)Flight)) { return !Request.Pending; } return false; } internal static bool IsMjolnir(ItemData weapon) { if (weapon != null && Object.op_Implicit((Object)(object)weapon.m_dropPrefab)) { return ((Object)weapon.m_dropPrefab).name == "ThorMjolnir1H"; } return false; } internal bool CanBeginThrow(Player owner, ItemData weapon) { if (Object.op_Implicit((Object)(object)owner) && IsMjolnir(weapon) && !Object.op_Implicit((Object)(object)Flight) && !Request.Pending && !string.IsNullOrEmpty(ThrowAnimation) && Time.time >= nextThrow && !((Character)owner).IsDead() && !((Character)owner).IsTeleporting() && !((Character)owner).InCutscene() && ((Character)owner).CanMove() && !((Character)owner).InAttack() && !((Character)owner).IsDodgeInvincible() && !Storm.Busy && !MenuPanel.Open && (!weapon.m_shared.m_useDurability || weapon.m_durability > 0f)) { return ((Character)owner).HaveStamina(Mathf.Clamp(ThrowStamina.Value, 0f, 100f)); } return false; } internal void ReleaseFromAnimation(Player owner, ItemData weapon) { //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Expected O, but got Unknown if (!Request.Consume(weapon, Time.time) || !Object.op_Implicit((Object)(object)owner) || Object.op_Implicit((Object)(object)Flight) || ((Character)owner).IsDead() || ((Character)owner).IsTeleporting() || ((Humanoid)owner).GetCurrentWeapon() != weapon || (weapon.m_shared.m_useDurability && weapon.m_durability <= 0f)) { return; } float num = Mathf.Clamp(ThrowStamina.Value, 0f, 100f); if (!((Character)owner).HaveStamina(num)) { return; } Transform val = FindEquippedVisual(); if (!Object.op_Implicit((Object)(object)val)) { return; } GameObject val2 = new GameObject("Mjolnir_ReturningHammer"); try { MjolnirFlight mjolnirFlight = val2.AddComponent<MjolnirFlight>(); mjolnirFlight.Initialize(this, owner, weapon, val); Flight = mjolnirFlight; ((Character)owner).UseStamina(num); if (weapon.m_shared.m_useDurability) { weapon.m_durability = Mathf.Max(0f, weapon.m_durability - 1f); } nextThrow = Time.time + 0.8f; } catch (Exception ex) { Object.Destroy((Object)(object)val2); ((BaseUnityPlugin)this).Logger.LogError((object)("Falha no arremesso: " + ex)); } } private void UpdateThrowInput() { //IL_00ab: Unknown result type (might be due to invalid IL or missing references) Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer)) { Request.Cancel(); return; } if (Request.Pending && (((Character)localPlayer).IsDead() || ((Character)localPlayer).IsTeleporting() || ((Humanoid)localPlayer).GetCurrentWeapon() != Request.Weapon)) { Request.Cancel(); } if (Request.Expire(Time.time)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Arremesso cancelado: animacao nao emitiu o evento em 3 segundos."); } if (Strike.Busy || TargetLightning.ChordHeld || MenuPanel.Open || Storm.Busy || !Keybinds.ThrowDown(ThrowKey.Value) || InventoryGui.IsVisible() || Menu.IsVisible() || Console.IsVisible() || TextInput.IsVisible() || (Object.op_Implicit((Object)(object)Chat.instance) && Chat.instance.HasFocus())) { return; } ItemData currentWeapon = ((Humanoid)localPlayer).GetCurrentWeapon(); if (!CanBeginThrow(localPlayer, currentWeapon)) { return; } MjolnirHotkeyScope.Active = true; try { ((Character)localPlayer).StartAttack((Character)null, true); } finally { MjolnirHotkeyScope.Active = false; } } internal void ApplyGrip(Transform target) { //IL_0007: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) target.localPosition = GripPosition.Value; target.localEulerAngles = GripRotation.Value; target.localScale = Vector3.one * GripScale.Value; } private Transform FindEquippedVisual() { if (!Object.op_Implicit((Object)(object)Player.m_localPlayer)) { return null; } Transform[] componentsInChildren = ((Component)Player.m_localPlayer).GetComponentsInChildren<Transform>(); foreach (Transform val in componentsInChildren) { if (((Object)val).name == "MjolnirVisual" && ((Component)val).gameObject.activeInHierarchy) { return val; } } return null; } internal void NudgeGrip(Vector3 worldDelta) { //IL_0023: 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_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) Transform val = FindEquippedVisual(); if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.parent)) { ConfigEntry<Vector3> gripPosition = GripPosition; gripPosition.Value += val.parent.InverseTransformVector(worldDelta); } } private void Update() { if (Storm != null && MenuPanel != null) { if (Keybinds.HudDown((KeyCode)291) && !StormAbility.InterfaceOpen()) { NordicHud.Value = !NordicHud.Value; ((BaseUnityPlugin)this).Config.Save(); } MenuPanel.Update(); Wings.Update(); Storm.Update(); StormBalance.Update(this); Strike.Update(); UpdateThrowInput(); } } private void OnGUI() { Storm?.DrawHud(); MenuPanel?.Draw(); } private void OnDestroy() { PrefabManager.OnVanillaPrefabsAvailable -= RegisterMjolnir; MenuPanel?.Close(); Wings?.Stop(); Storm?.Dispose(); Request.Cancel(); if (Object.op_Implicit((Object)(object)Flight)) { Object.DestroyImmediate((Object)(object)((Component)Flight).gameObject); } MjolnirAttackTempo.Restore(); Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } if (thunderHeld) { thunderReference.Release(); thunderHeld = false; } LandingDust.Release(); MjolnirLightning.ReleaseMaterial(); if ((Object)(object)Active == (Object)(object)this) { Active = null; } } } public class MjolnirGrip : MonoBehaviour { private void LateUpdate() { if (Object.op_Implicit((Object)(object)MjolnirPlugin.Active)) { MjolnirPlugin.Active.ApplyGrip(((Component)this).transform); } } } public sealed class FlightChargeClock { public float Elapsed { get; private set; } public int Advance(float dt, float secondsPerUnit, int available) { if (available <= 0) { Elapsed = 0f; return 0; } if (float.IsNaN(dt) || float.IsInfinity(dt) || dt < 0f) { return 0; } if (float.IsNaN(secondsPerUnit) || float.IsInfinity(secondsPerUnit)) { secondsPerUnit = 8f; } secondsPerUnit = Math.Max(3f, Math.Min(30f, secondsPerUnit)); Elapsed += dt; int num = Math.Min(available, (int)Math.Min(available, Math.Floor(Elapsed / secondsPerUnit))); Elapsed -= (float)num * secondsPerUnit; if (num == available) { Elapsed = 0f; } return num; } public void Reset() { Elapsed = 0f; } } [HarmonyPatch(typeof(ZSyncAnimation), "SetTrigger", new Type[] { typeof(string) })] internal static class FlightJumpGuard { private static bool Prefix(ZSyncAnimation __instance, string __0) { MjolnirPlugin active = MjolnirPlugin.Active; if (Object.op_Implicit((Object)(object)active) && active.Wings != null && active.Wings.Active && Object.op_Implicit((Object)(object)Player.m_localPlayer) && (Object)(object)((Character)Player.m_localPlayer).GetZAnim() == (Object)(object)__instance) { return !(__0 == "jump"); } return true; } } public static class FlightPolishRules { public static float DrainRate(float basic, float multiplier, bool sprint) { if (float.IsNaN(basic) || float.IsInfinity(basic)) { basic = 2.5f; } if (float.IsNaN(multiplier) || float.IsInfinity(multiplier)) { multiplier = 1.5f; } return Math.Min(10f, Math.Max(0.5f, Math.Min(10f, basic)) * (sprint ? Math.Max(1f, Math.Min(3f, multiplier)) : 1f)); } public static float ImpactStrength(float speed) { if (float.IsNaN(speed) || float.IsInfinity(speed)) { return 0.2f; } return 0.2f + 0.8f * Math.Max(0f, Math.Min(1f, (speed - 5f) / 27f)); } } public static class FlightPoseAngles { public static float AscentPitch(float pitch, float weight) { if (float.IsNaN(pitch) || float.IsInfinity(pitch) || float.IsNaN(weight) || float.IsInfinity(weight)) { return 0f; } return pitch * (1f - Math.Max(0f, Math.Min(1f, weight))); } public static float Pitch(float horizontal, float vertical, float forward) { if (float.IsNaN(horizontal) || float.IsNaN(vertical) || float.IsNaN(forward) || float.IsInfinity(horizontal) || float.IsInfinity(vertical) || float.IsInfinity(forward)) { return 0f; } float num = Math.Max(0f, Math.Min(1f, horizontal / 8f)); float num2 = Math.Max(-1f, Math.Min(1f, forward)); float num3 = 68f * num * Math.Max(0f, num2); if (vertical < -3f) { float num4 = Math.Max(0f, Math.Min(1f, (0f - vertical - 3f) / 18f)); num3 += (110f - num3) * num4; } if (num2 < 0f) { num3 = -22f * num * (0f - num2); } return num3; } } public sealed class FlightTap { private float previous = float.NegativeInfinity; public bool Tap(float now) { if (float.IsNaN(now) || float.IsInfinity(now)) { Reset(); return false; } float num = now - previous; previous = now; if (num >= 0.055f && num <= 0.32f) { Reset(); return true; } return false; } public void Reset() { previous = float.NegativeInfinity; } } public static class HudPlacement { public static (float X, float Y) Compute(float width, float height, float mapBottom, float hudWidth, float hudHeight, float offset) { if (float.IsNaN(mapBottom) || float.IsInfinity(mapBottom)) { mapBottom = 220f; } if (float.IsNaN(offset) || float.IsInfinity(offset)) { offset = 0f; } float item = Math.Max(10f, Math.Min(18f, width - hudWidth - 10f)); float item2 = Math.Max(10f, Math.Min(mapBottom + 12f + offset, height - hudHeight - 10f)); return (X: item, Y: item2); } } internal sealed class MjolnirDamageOrigin : IDisposable { [ThreadStatic] internal static int Depth; private bool disposed; internal static MjolnirDamageOrigin Begin() { Depth++; return new MjolnirDamageOrigin(); } public void Dispose() { if (!disposed) { Depth = Math.Max(0, Depth - 1); disposed = true; } } } [HarmonyPatch(typeof(Attack), "DoMeleeAttack")] internal static class MjolnirMeleeSource { private static void Prefix(Humanoid ___m_character, ItemData ___m_weapon, out MjolnirDamageOrigin __state) { __state = (((Object)(object)___m_character == (Object)(object)Player.m_localPlayer && MjolnirPlugin.IsMjolnir(___m_weapon)) ? MjolnirDamageOrigin.Begin() : null); } private static Exception Finalizer(Exception __exception, MjolnirDamageOrigin __state) { __state?.Dispose(); return __exception; } } internal sealed class DamageStamp { internal Player Owner; internal HitData Original; internal Vector3 Point; internal SkillType Skill; internal bool Ranged; internal float Time; } [HarmonyPatch(typeof(Character), "Damage")] internal static class StampMjolnirDamage { private static readonly ConditionalWeakTable<Character, List<DamageStamp>> Hits = new ConditionalWeakTable<Character, List<DamageStamp>>(); private static void Prefix(Character __instance, HitData __0) { //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) if (__0 != null && MjolnirDamageOrigin.Depth > 0 && Object.op_Implicit((Object)(object)Player.m_localPlayer) && !((Object)(object)__0.GetAttacker() != (Object)(object)Player.m_localPlayer)) { List<DamageStamp> value = Hits.GetValue(__instance, (Character _) => new List<DamageStamp>()); value.RemoveAll((DamageStamp s) => Time.time - s.Time > 2f); if (value.Count >= 16) { value.RemoveAt(0); } value.Add(new DamageStamp { Owner = Player.m_localPlayer, Original = __0, Point = __0.m_point, Skill = __0.m_skill, Ranged = __0.m_ranged, Time = Time.time }); } } internal static bool Consume(Character victim, HitData hit) { //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) if (hit == null || !Object.op_Implicit((Object)(object)Player.m_localPlayer) || (Object)(object)hit.GetAttacker() != (Object)(object)Player.m_localPlayer || !Hits.TryGetValue(victim, out var value)) { return false; } value.RemoveAll((DamageStamp s) => Time.time - s.Time > 2f); for (int num = 0; num < value.Count; num++) { DamageStamp damageStamp = value[num]; int num2; if (damageStamp.Original != hit) { if (damageStamp.Skill == hit.m_skill && damageStamp.Ranged == hit.m_ranged) { Vector3 val = damageStamp.Point - hit.m_point; num2 = ((((Vector3)(ref val)).sqrMagnitude < 0.0025f) ? 1 : 0); } else { num2 = 0; } } else { num2 = 1; } bool flag = (byte)num2 != 0; if ((Object)(object)damageStamp.Owner == (Object)(object)Player.m_localPlayer && flag) { value.RemoveAt(num); return true; } } return false; } } [HarmonyPatch(typeof(Character), "ApplyDamage")] internal static class MjolnirKillCharge { private static void Prefix(Character __instance, HitData __0, out bool __state) { __state = __0 != null && Object.op_Implicit((Object)(object)__instance) && !__instance.IsPlayer() && !__instance.IsTamed() && __instance.GetHealth() > 0f && StampMjolnirDamage.Consume(__instance, __0); } private static void Postfix(Character __instance, bool __state) { if (__state && Object.op_Implicit((Object)(object)__instance) && __instance.GetHealth() <= 0f) { MjolnirPlugin.Active?.Storm?.AddKill(__instance); } } } [HarmonyPatch(typeof(Character), "Jump")] internal static class StormJumpInput { private static bool Prefix(Character __instance) { MjolnirPlugin active = MjolnirPlugin.Active; if (Object.op_Implicit((Object)(object)active) && active.Storm != null) { return !active.Storm.InterceptJump(__instance); } return true; } } internal static class LandingDust { private static Material material; private static Texture2D texture; internal static void Spawn(Vector3 point, Vector3 normal) { //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Expected O, but got Unknown //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0123: Unknown result type (might be due to invalid IL or missing references) //IL_0124: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0198: 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_01ce: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) //IL_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_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0236: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0255: Unknown result type (might be due to invalid IL or missing references) //IL_025c: Expected O, but got Unknown //IL_0266: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) //IL_0275: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Unknown result type (might be due to invalid IL or missing references) //IL_028b: 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_02b8: Unknown result type (might be due to invalid IL or missing references) //IL_02bd: Unknown result type (might be due to invalid IL or missing references) //IL_02cb: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: Expected O, but got Unknown //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_00a2: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)material)) { Shader val = Shader.Find("Sprites/Default"); if (!Object.op_Implicit((Object)(object)val)) { return; } texture = new Texture2D(32, 32, (TextureFormat)4, false); Color[] array = (Color[])(object)new Color[1024]; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { float num = Vector2.Distance(new Vector2((float)j, (float)i), new Vector2(15.5f, 15.5f)) / 16f; array[i * 32 + j] = new Color(1f, 1f, 1f, Mathf.Pow(Mathf.Clamp01(1f - num), 1.6f)); } } texture.SetPixels(array); texture.Apply(); material = new Material(val) { mainTexture = (Texture)(object)texture }; } GameObject val2 = new GameObject("Mjolnir_LandingDust"); val2.transform.position = point + normal * 0.12f; val2.transform.rotation = Quaternion.FromToRotation(Vector3.forward, normal); ParticleSystem val3 = val2.AddComponent<ParticleSystem>(); val3.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val3.main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).duration = 0.15f; ((MainModule)(ref main)).startLifetime = new MinMaxCurve(0.35f, 0.85f); ((MainModule)(ref main)).startSpeed = new MinMaxCurve(2f, 5f); ((MainModule)(ref main)).startSize = new MinMaxCurve(0.35f, 0.8f); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(new Color(0.42f, 0.35f, 0.24f, 0.45f)); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(0.65f); ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 64; ShapeModule shape = val3.shape; ((ShapeModule)(ref shape)).enabled = true; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)2; ((ShapeModule)(ref shape)).radius = 0.7f; EmissionModule emission = val3.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1] { new Burst(0f, (short)40) }); ColorOverLifetimeModule colorOverLifetime = val3.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val4 = new Gradient(); val4.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val4); ((Renderer)val2.GetComponent<ParticleSystemRenderer>()).sharedMaterial = material; val3.Play(); Object.Destroy((Object)(object)val2, 1.2f); } internal static void Release() { if (Object.op_Implicit((Object)(object)material)) { Object.Destroy((Object)(object)material); } if (Object.op_Implicit((Object)(object)texture)) { Object.Destroy((Object)(object)texture); } material = null; texture = null; } } [HarmonyPatch(typeof(Character), "Land")] internal static class StormNativeLanding { private static void Postfix(Character __instance) { MjolnirPlugin active = MjolnirPlugin.Active; if (Object.op_Implicit((Object)(object)active) && (Object)(object)__instance == (Object)(object)Player.m_localPlayer) { active.Storm?.NotifyLanding(); } } } public sealed class LandingShockwave : MonoBehaviour { private LineRenderer[] rings; private Vector3 point; private Vector3 normal; private Quaternion plane; private float age; private float radius; internal static void Spawn(Vector3 point, Vector3 normal, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) ImpactVfx.Spawn(point, normal, radius); } private void Update() { //IL_007b: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_00fa: 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_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing references) if (rings == null) { return; } age += Time.deltaTime; float num = Mathf.Clamp01(age / 0.8f); for (int i = 0; i < rings.Length; i++) { LineRenderer val = rings[i]; float num2 = radius * Mathf.Lerp(0.15f, 1f, num) * (1f - (float)i * 0.22f); val.startColor = new Color(0.3f, 0.85f, 1f, 1f - num); val.endColor = val.startColor; for (int j = 0; j < 48; j++) { float num3 = (float)j * MathF.PI * 2f / 48f; float num4 = 1f + 0.035f * Mathf.Sin((float)(j * 13) + Mathf.Floor(age * 20f)); val.SetPosition(j, point + normal * 0.09f + plane * new Vector3(Mathf.Cos(num3) * num2 * num4, 0f, Mathf.Sin(num3) * num2 * num4)); } } } } public static class LightningCastTiming { public const float ReleaseDelay = 0.35f; public static float GestureWeight(float age) { if (float.IsNaN(age) || float.IsInfinity(age) || age < 0f || age >= 0.95f) { return 0f; } float num = ((age < 0.3f) ? Math.Max(0f, Math.Min(1f, age / 0.3f)) : ((age < 0.55f) ? 1f : Math.Max(0f, Math.Min(1f, (0.95f - age) / 0.4f)))); return num * num * (3f - 2f * num); } } public sealed class LightningSkillClock { private float readyAt; public float Duration { get; private set; } public float Remaining(float now) { if (!float.IsNaN(now) && !float.IsInfinity(now)) { return Math.Max(0f, readyAt - now); } return Duration; } public bool Ready(float now) { if (!float.IsNaN(now) && !float.IsInfinity(now)) { return Remaining(now) <= 0f; } return false; } public bool Begin(float now, float duration) { if (!Ready(now) || float.IsNaN(duration) || float.IsInfinity(duration) || duration <= 0f) { return false; } Duration = Math.Max(2f, Math.Min(30f, duration)); readyAt = now + Duration; return true; } } public sealed class LivingLightning : MonoBehaviour { private LineRenderer[] lines; private readonly List<Vector3[]> points = new List<Vector3[]>(); private readonly Random random = new Random(); private float born; private float next; private Light flash; private float brightness; private void Start() { born = Time.time; lines = ((Component)this).GetComponentsInChildren<LineRenderer>(); LineRenderer[] array = lines; foreach (LineRenderer obj in array) { Vector3[] array2 = (Vector3[])(object)new Vector3[obj.positionCount]; obj.GetPositions(array2); points.Add(array2); } flash = ((Component)this).GetComponent<Light>(); if (Object.op_Implicit((Object)(object)flash)) { brightness = flash.intensity; } } private float Noise() { return (float)random.NextDouble() * 2f - 1f; } private void Update() { //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_014c: Unknown result type (might be due to invalid IL or missing references) float num = Time.time - born; float num2 = Mathf.Clamp01(1f - num / 0.36f); if (Object.op_Implicit((Object)(object)flash)) { flash.intensity = brightness * num2 * (0.5f + 0.5f * Mathf.Sin(num * 95f)); } if (Time.time < next) { return; } next = Time.time + 0.035f; for (int i = 0; i < lines.Length; i++) { LineRenderer val = lines[i]; if (Object.op_Implicit((Object)(object)val)) { ((Renderer)val).enabled = random.NextDouble() > 0.18; val.startColor = new Color(1.8f, 3f, 4f, num2); val.endColor = new Color(0.1f, 1f, 3f, num2 * 0.35f); for (int j = 0; j < points[i].Length; j++) { float num3 = (float)j / (float)(points[i].Length - 1); val.SetPosition(j, points[i][j] + new Vector3(Noise(), Noise(), Noise()) * (0.14f * Mathf.Sin(num3 * MathF.PI))); } } } } } internal static class MinimapHudAnchor { private static readonly FieldInfo Map = AccessTools.Field(typeof(Minimap), "m_mapSmall"); private static readonly FieldInfo Root = AccessTools.Field(typeof(Minimap), "m_smallRoot"); private static readonly Vector3[] Corners = (Vector3[])(object)new Vector3[4]; internal static float Bottom() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)Minimap.instance)) { return 220f; } FieldInfo[] array = new FieldInfo[2] { Map, Root }; for (int i = 0; i < array.Length; i++) { object? obj = array[i]?.GetValue(Minimap.instance); GameObject val = (GameObject)((obj is GameObject) ? obj : null); RectTransform val2 = (Object.op_Implicit((Object)(object)val) ? val.GetComponent<RectTransform>() : null); if (Object.op_Implicit((Object)(object)val2)) { Canvas componentInParent = ((Component)val2).GetComponentInParent<Canvas>(); Camera val3 = ((Object.op_Implicit((Object)(object)componentInParent) && (int)componentInParent.renderMode != 0) ? componentInParent.worldCamera : null); val2.GetWorldCorners(Corners); float num = Screen.height; float num2 = 0f; Vector3[] corners = Corners; foreach (Vector3 val4 in corners) { float y = RectTransformUtility.WorldToScreenPoint(val3, val4).y; num = Mathf.Min(num, y); num2 = Mathf.Max(num2, y); } float num3 = num2 - num; if (num3 >= 40f && num3 < (float)Screen.height * 0.65f) { return (float)Screen.height - num; } } } return 220f; } } internal static class NordicHud { private static void Fill(Rect rect, Color color) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) Color color2 = GUI.color; GUI.color = color; GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture); GUI.color = color2; } internal static void Ability(Rect r, Sprite icon, Color tint, string title, string status, string info, float cooldown) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: 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_0179: Unknown result type (might be due to invalid IL or missing references) //IL_0230: Unknown result type (might be due to invalid IL or missing references) //IL_0235: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Expected O, but got Unknown //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_027d: 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_02c1: Unknown result type (might be due to invalid IL or missing references) //IL_02f2: Unknown result type (might be due to invalid IL or missing references) //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_021c: Unknown result type (might be due to invalid IL or missing references) //IL_01bf: Unknown result type (might be due to invalid IL or missing references) //IL_01c4: Unknown result type (might be due to invalid IL or missing references) Fill(r, new Color(0.035f, 0.045f, 0.055f, 0.94f)); Color val = default(Color); ((Color)(ref val))..ctor(0.65f, 0.47f, 0.21f); Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - 2f, ((Rect)(ref r)).width, 2f), val); Rect val2 = default(Rect); ((Rect)(ref val2))..ctor(((Rect)(ref r)).x + 8f, ((Rect)(ref r)).y + 3f, 38f, 38f); Fill(val2, new Color(0.08f, 0.13f, 0.18f)); Color color = GUI.color; GUI.color = tint; if (Object.op_Implicit((Object)(object)icon)) { Rect textureRect = icon.textureRect; ((Rect)(ref textureRect)).x = ((Rect)(ref textureRect)).x / (float)((Texture)icon.texture).width; ((Rect)(ref textureRect)).y = ((Rect)(ref textureRect)).y / (float)((Texture)icon.texture).height; ((Rect)(ref textureRect)).width = ((Rect)(ref textureRect)).width / (float)((Texture)icon.texture).width; ((Rect)(ref textureRect)).height = ((Rect)(ref textureRect)).height / (float)((Texture)icon.texture).height; GUI.DrawTextureWithTexCoords(val2, (Texture)(object)icon.texture, textureRect); } else { for (int i = 0; i < 5; i++) { Fill(new Rect(((Rect)(ref val2)).x + 21f - (float)(i * 3), ((Rect)(ref val2)).y + 3f + (float)(i * 3), 7f, 5f), tint); } for (int j = 0; j < 5; j++) { Fill(new Rect(((Rect)(ref val2)).x + 21f - (float)(j * 3), ((Rect)(ref val2)).y + 18f + (float)(j * 3), 7f, 5f), tint); } } GUI.color = color; if (cooldown > 0f) { Fill(new Rect(((Rect)(ref val2)).x, ((Rect)(ref val2)).y, ((Rect)(ref val2)).width, ((Rect)(ref val2)).height * cooldown), new Color(0f, 0f, 0f, 0.6f)); } GUIStyle val3 = new GUIStyle(GUI.skin.label) { fontSize = 11, fontStyle = (FontStyle)1 }; val3.normal.textColor = val; GUI.Label(new Rect(((Rect)(ref r)).x + 53f, ((Rect)(ref r)).y + 1f, ((Rect)(ref r)).width - 56f, 16f), title, val3); val3.normal.textColor = tint; GUI.Label(new Rect(((Rect)(ref r)).x + 53f, ((Rect)(ref r)).y + 15f, ((Rect)(ref r)).width - 56f, 16f), status, val3); val3.fontSize = 10; val3.fontStyle = (FontStyle)0; val3.normal.textColor = new Color(0.8f, 0.85f, 0.9f); GUI.Label(new Rect(((Rect)(ref r)).x + 53f, ((Rect)(ref r)).y + 29f, ((Rect)(ref r)).width - 56f, 16f), info, val3); } internal static void Draw(Rect r, float fraction, string title, string detail, int segments = 5) { //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_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_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Expected O, but got Unknown //IL_013e: 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_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: 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_021c: Unknown result type (might be due to invalid IL or missing references) //IL_0242: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0290: Unknown result type (might be due to invalid IL or missing references) //IL_02c6: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0325: Unknown result type (might be due to invalid IL or missing references) //IL_032a: Unknown result type (might be due to invalid IL or missing references) //IL_0354: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_0383: Unknown result type (might be due to invalid IL or missing references) //IL_0388: Unknown result type (might be due to invalid IL or missing references) Color color = default(Color); ((Color)(ref color))..ctor(0.65f, 0.47f, 0.21f, 1f); Fill(r, new Color(0.035f, 0.045f, 0.055f, 0.94f)); Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).y, ((Rect)(ref r)).width, 2f), color); Fill(new Rect(((Rect)(ref r)).x, ((Rect)(ref r)).yMax - 2f, ((Rect)(ref r)).width, 2f), color); float[] array = new float[2] { ((Rect)(ref r)).x, ((Rect)(ref r)).xMax - 3f }; foreach (float num in array) { Fill(new Rect(num, ((Rect)(ref r)).y, 3f, 20f), color); Fill(new Rect(num, ((Rect)(ref r)).yMax - 20f, 3f, 20f), color); } GUIStyle val = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 13, fontStyle = (FontStyle)1 }; val.normal.textColor = new Color(0.91f, 0.78f, 0.48f); GUI.Label(new Rect(((Rect)(ref r)).x + 10f, ((Rect)(ref r)).y + 4f, ((Rect)(ref r)).width - 20f, 22f), title, val); float num2 = ((Rect)(ref r)).x + 24f; float num3 = ((Rect)(ref r)).y + 29f; float num4 = ((Rect)(ref r)).width - 48f; Fill(new Rect(num2 - 2f, num3 - 2f, num4 + 4f, 15f), color); Fill(new Rect(num2, num3, num4, 11f), new Color(0.06f, 0.1f, 0.13f)); Fill(new Rect(num2, num3, num4 * Mathf.Clamp01(fraction), 11f), new Color(0.08f, 0.62f, 0.87f)); for (int j = 1; j < segments; j++) { Fill(new Rect(num2 + num4 * (float)j / (float)segments, num3, 2f, 11f), new Color(0.03f, 0.07f, 0.09f)); } val.fontSize = 11; val.fontStyle = (FontStyle)0; val.normal.textColor = new Color(0.8f, 0.9f, 0.94f); GUI.Label(new Rect(((Rect)(ref r)).x + 4f, ((Rect)(ref r)).y + 47f, ((Rect)(ref r)).width - 8f, 22f), detail, val); Fill(new Rect(((Rect)(ref r)).x - 5f, ((Rect)(ref r)).y + 8f, 13f, 3f), color); Fill(new Rect(((Rect)(ref r)).xMax - 8f, ((Rect)(ref r)).y + 8f, 13f, 3f), color); Fill(new Rect(((Rect)(ref r)).x + 8f, ((Rect)(ref r)).y + 11f, 3f, 8f), color); Fill(new Rect(((Rect)(ref r)).xMax - 11f, ((Rect)(ref r)).y + 11f, 3f, 8f), color); } } public static class SprintLeap { public static (float X, float Z) Compute(float vx, float vz, float fx, float fz, bool shift, float requested) { float num = (float)Math.Sqrt(fx * fx + fz * fz); if (!shift || num < 0.001f || float.IsNaN(requested) || float.IsInfinity(requested)) { return (X: vx, Z: vz); } fx /= num; fz /= num; float num2 = vx * fx + vz * fz; if (num2 < 2f) { return (X: vx, Z: vz); } float num3 = Math.Max(10f, Math.Min(18f, requested)); float num4 = Math.Max(0f, num3 - num2); float num5 = vx + fx * num4; float num6 = vz + fz * num4; float num7 = (float)Math.Sqrt(num5 * num5 + num6 * num6); if (num7 > 18f) { num5 *= 18f / num7; num6 *= 18f / num7; } return (X: num5, Z: num6); } } public sealed class StormAbility { private readonly MjolnirPlugin mod; internal readonly ChargeMeter Meter = new ChargeMeter(); private Player owner; private bool holding; private bool airborne; private bool observedAir; private bool bypassJump; private float heldSince; private float flightSince; private float takeoffHeight; private ChargedAura aura; private const string SaveKey = "mjolnir.storm-charge.v1"; internal bool AuraReady { get { if (Valid() && Meter.HasCharge) { return mod.LightningEnabled.Value; } return false; } } internal bool ProtectOwnJumpFall { get { //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)owner)) { return StormFallSafety.Protect(airborne, Time.time - flightSince, takeoffHeight, ((Component)owner).transform.position.y); } return false; } } internal bool Busy { get { if (!holding) { return airborne; } return true; } } internal bool BypassJump => bypassJump; internal StormAbility(MjolnirPlugin plugin) { mod = plugin; } private void BindPlayer() { if ((Object)(object)owner == (Object)(object)Player.m_localPlayer) { return; } RemoveOvercharge(); Cancel(); if (Object.op_Implicit((Object)(object)aura)) { Object.Destroy((Object)(object)aura); } owner = Player.m_localPlayer; Meter.BeginSession(); if (Object.op_Implicit((Object)(object)owner)) { aura = ((Component)owner).gameObject.AddComponent<ChargedAura>(); } Meter.SetGoal(mod.ChargeKills.Value); if (Object.op_Implicit((Object)(object)owner) && owner.m_customData.TryGetValue("mjolnir.storm-charge.v1", out var value)) { int result2; if (value.StartsWith("pct:") && float.TryParse(value.Substring(4), NumberStyles.Float, CultureInfo.InvariantCulture, out var result)) { Meter.LoadPercent(result); } else if (int.TryParse(value, out result2)) { Meter.Load(result2); } } } private void Save() { if (Object.op_Implicit((Object)(object)owner)) { owner.m_customData["mjolnir.storm-charge.v1"] = "pct:" + Meter.Percent.ToString("R", CultureInfo.InvariantCulture); } } internal void DrainFlightCharge(float dt) { if (mod.InfiniteOvercharge.Value) { RefillTestCharge(); return; } int num = Mathf.FloorToInt(Meter.Percent); if (Meter.Drain(dt, mod.Wings.DrainRate)) { if (num != Mathf.FloorToInt(Meter.Percent) || !Meter.HasCharge) { Save(); } SyncOvercharge(); } } internal bool SpendSkillCharge(float cost) { BindPlayer(); if (!Valid()) { return false; } if (mod.InfiniteOvercharge.Value) { return true; } if (!Meter.SpendPercent(cost)) { return false; } Save(); SyncOvercharge(); return true; } internal void RefillTestCharge() { BindPlayer(); if (Object.op_Implicit((Object)(object)owner) && !((Character)owner).IsDead()) { Meter.SetGoal(mod.ChargeKills.Value); if (!Meter.Ready) { Meter.Load(Meter.Goal); Save(); SyncOvercharge(); } } } internal void Persist() { Meter.SetGoal(mod.ChargeKills.Value); Save(); } internal void AddKill(Character victim) { } private void RemoveOvercharge() { if (Object.op_Implicit((Object)(object)owner) && Object.op_Implicit((Object)(object)mod.Overcharge)) { ((Character)owner).GetSEMan().RemoveStatusEffect(mod.Overcharge.NameHash(), true); } } private void SyncOvercharge() { if (!Object.op_Implicit((Object)(object)owner) || !Object.op_Implicit((Object)(object)mod.Overcharge)) { return; } bool flag = Valid() && (Meter.HasCharge || (mod.Wings.Active && Meter.HasCharge)); SEMan sEMan = ((Character)owner).GetSEMan(); int num = mod.Overcharge.NameHash(); if (flag && !sEMan.HaveStatusEffect(num)) { sEMan.AddStatusEffect(num, false, 0, 0f, (short)0); } else if (!flag && sEMan.HaveStatusEffect(num)) { sEMan.RemoveStatusEffect(num, true); } if (!flag) { return; } foreach (StatusEffect statusEffect in sEMan.GetStatusEffects()) { if (((Object)statusEffect).name == ((Object)mod.Overcharge).name) { statusEffect.m_tooltip = HelpText(); } } } internal string HelpText() { return StormBalance.HelpText(this); } private bool Equipped() { if (Object.op_Implicit((Object)(object)owner)) { return MjolnirPlugin.IsMjolnir(((Humanoid)owner).GetCurrentWeapon()); } return false; } private bool Valid() { if (Equipped() && !((Character)owner).IsDead() && !((Character)owner).IsTeleporting() && !((Character)owner).InCutscene() && !((Character)owner).IsSwimming()) { return !((Character)owner).IsAttached(); } return false; } internal static bool InterfaceOpen() { if (!InventoryGui.IsVisible() && !Menu.IsVisible() && !Console.IsVisible() && !TextInput.IsVisible()) { if (Object.op_Implicit((Object)(object)Chat.instance)) { return Chat.instance.HasFocus(); } return false; } return true; } internal bool InterceptJump(Character character) { return FlightOnly.InterceptJump(character); } internal void Update() { BindPlayer(); if (!Object.op_Implicit((Object)(object)owner)) { return; } Meter.SetGoal(mod.ChargeKills.Value); if (mod.InfiniteOvercharge.Value && !((Character)owner).IsDead()) { RefillTestCharge(); } SyncOvercharge(); if (((Character)owner).IsDead()) { Cancel(); if (Meter.HasCharge) { Meter.Clear(); Save(); } } else { Cancel(); } } internal void FlightLanding(bool destructive, float strength = 1f) { BindPlayer(); if (Object.op_Implicit((Object)(object)owner) && !((Character)owner).IsDead()) { Land(destructive, strength); } } internal void NotifyLanding() { if (airborne && Object.op_Implicit((Object)(object)owner) && !((Character)owner).IsDead() && !(Time.time - flightSince < 0.15f)) { airborne = false; Land(); } } private void Land(bool allowStructureDamage = true, float strength = 1f) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0317: 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_0214: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Unknown result type (might be due to invalid IL or missing references) //IL_0227: 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_0232: Unknown result type (might be due to invalid IL or missing references) //IL_0237: Unknown result type (might be due to invalid IL or missing references) //IL_023c: Unknown result type (might be due to invalid IL or missing references) //IL_024b: Unknown result type (might be due to invalid IL or missing references) //IL_0250: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0259: Unknown result type (might be due to invalid IL or missing references) //IL_025b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0265: Unknown result type (might be due to invalid IL or missing references) //IL_026a: Unknown result type (might be due to invalid IL or missing references) //IL_026f: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_0288: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Expected O, but got Unknown Vector3 val = ((Component)owner).transform.position; Vector3 val2 = Vector3.up; int mask = LayerMask.GetMask(new string[4] { "terrain", "piece", "static_solid", "Default" }); RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val + Vector3.up * 0.6f, Vector3.down, ref val3, 2.5f, mask, (QueryTriggerInteraction)1)) { val = ((RaycastHit)(ref val3)).point; val2 = ((RaycastHit)(ref val3)).normal; } mod.ThunderImpact(val, strength); if (mod.ThunderImpactEnabled.Value) { LandingShockwave.Spawn(val, val2, Mathf.Clamp(mod.JumpRadius.Value, 2f, 7f)); if (strength >= 0.6f) { ImpactVfx.SkipLegacyDust(val, val2); } if (Object.op_Implicit((Object)(object)GameCamera.instance) && mod.ImpactShake.Value > 0f) { GameCamera.instance.AddShake(val, 15f, Mathf.Clamp(mod.ImpactShake.Value, 0f, 0.3f) * strength, false); } } float num = Mathf.Clamp(mod.JumpRadius.Value, 2f, 7f); float num2 = Mathf.Clamp(mod.JumpDamage.Value, 20f, 180f); int mask2 = LayerMask.GetMask(new string[4] { "terrain", "piece", "static_solid", "Default" }); foreach (Character item in new List<Character>(Character.GetAllCharacters())) { if (Object.op_Implicit((Object)(object)item) && !((Object)(object)item == (Object)(object)owner) && !item.IsDead() && !item.IsPlayer() && !item.IsTamed() && BaseAI.IsEnemy((Character)(object)owner, item)) { Vector3 centerPoint = item.GetCenterPoint(); float num3 = Vector3.Distance(val, centerPoint); if (!(num3 > num) && !Physics.Linecast(val + Vector3.up * 0.45f, centerPoint, mask2, (QueryTriggerInteraction)1)) { HitData val4 = new HitData { m_point = centerPoint }; Vector3 val5 = centerPoint - val; val4.m_dir = ((Vector3)(ref val5)).normalized; val4.m_pushForce = 35f; val4.m_dodgeable = true; val4.m_blockable = false; val4.m_ranged = true; HitData val6 = val4; float num4 = Mathf.Lerp(1f, 0.5f, num3 / num); val6.m_damage.m_lightning = num2 * num4; val6.m_damage.m_blunt = num2 * 0.25f * num4; val6.SetAttacker((Character)(object)owner); item.Damage(val6); } } } if (allowStructureDamage && mod.LandingDamagesStructures.Value) { DamageStructures(val, num); } StormBalance.Landing(this); } private void DamageStructures(Vector3 origin, float radius) { //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0105: 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_0115: 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_0126: Expected O, but got Unknown HashSet<IDestructible> hashSet = new HashSet<IDestructible>(); int mask = LayerMask.GetMask(new string[5] { "piece", "Default", "Default_small", "static_solid", "vehicle" }); Collider[] array = Physics.OverlapSphere(origin, radius, mask, (QueryTriggerInteraction)1); foreach (Collider val in array) { if (!Object.op_Implicit((Object)(object)val) || Object.op_Implicit((Object)(object)((Component)val).GetComponentInParent<Character>()) || mod.ProtectedBuilding(val) || !Object.op_Implicit((Object)(object)((Component)val).GetComponentInParent<Piece>())) { continue; } IDestructible componentInParent = ((Component)val).GetComponentInParent<IDestructible>(); if (componentInParent != null && !hashSet.Contains(componentInParent)) { Vector3 val2 = val.ClosestPoint(origin + Vector3.up * 0.2f); float num = Vector3.Distance(origin, val2); if (!(num > radius)) { hashSet.Add(componentInParent); HitData val3 = new HitData { m_point = val2 }; Vector3 val4 = val2 - origin; val3.m_dir = ((Vector3)(ref val4)).normalized; val3.m_pushForce = 50f; val3.m_ranged = true; val3.m_hitCollider = val; HitData val5 = val3; val5.m_damage.m_blunt = Mathf.Clamp(mod.LandingStructureDamage.Value, 0f, 200f) * Mathf.Lerp(1f, 0.5f, num / radius); val5.SetAttacker((Character)(object)owner); componentInParent.Damage(val5); } } } } internal void Cancel() { holding = false; airborne = false; observedAir = false; } internal void Dispose() { Cancel(); RemoveOvercharge(); if (Object.op_Implicit((Object)(object)aura)) { Object.Destroy((Object)(object)aura); } aura = null; } internal void DrawHud() { StormBalance.DrawHud(this); } } public static class StormFallSafety { public static bool Protect(bool specialActive, float elapsed, float takeoffY, float landingY) { if (specialActive && !float.IsNaN(elapsed) && !float.IsNaN(takeoffY) && !float.IsNaN(landingY) && !float.IsInfinity(elapsed) && !float.IsInfinity(takeoffY) && !float.IsInfinity(landingY) && elapsed >= 0f && elapsed < 6f) { return landingY >= takeoffY - 1.5f; } return false; } } public sealed class StormFlight { internal readonly MjolnirPlugin mod; private readonly FlightTap taps = new FlightTap(); private readonly Dictionary<int, float> hitTimes = new Dictionary<int, float>(); internal Player owner; internal Rigidbody body; private ThorFlightPose pose; private bool gravity; private CollisionDetectionMode collisionMode; private float started; private float terrainTime; private float nextImpact; internal float DrainRate => LaunchFlight.Rate(this); internal Vector3 Velocity { get { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)body)) { return Vector3.zero; } return body.linearVelocity; } } internal bool EmergencyLanding { get; set; } internal bool Active { get; private set; } internal StormFlight(MjolnirPlugin plugin) { mod = plugin; } internal bool Valid(Player p) { if (Object.op_Implicit((Object)(object)p) && !((Character)p).IsDead() && !((Character)p).IsTeleporting() && !((Character)p).InCutscene() && !((Character)p).IsAttached() && !((Character)p).IsSwimming()) { return MjolnirPlugin.IsMjolnir(((Humanoid)p).GetCurrentWeapon()); } return false; } internal void Update() { LaunchFlight.Update(this); } internal void Start(Player p) { //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_00ea: 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) if (p.InDebugFlyMode() || !mod.Storm.Meter.HasCharge) { return; } body = ((Component)p).GetComponent<Rigidbody>(); if (Object.op_Implicit((Object)(object)body)) { owner = p; gravity = body.useGravity; collisionMode = body.collisionDetectionMode; mod.Storm.Cancel(); pose = ((Component)p).GetComponent<ThorFlightPose>(); if (!Object.op_Implicit((Object)(object)pose)) { pose = ((Component)p).gameObject.AddComponent<ThorFlightPose>(); } Active = true; EmergencyLanding = false; started = Time.time; hitTimes.Clear(); taps.Reset(); body.collisionDetectionMode = (CollisionDetectionMode)2; body.useGravity = false; body.linearVelocity = Vector3.up * 2f; } } internal void Stop() { //IL_0075: Unknown result type (might be due to invalid IL or missing references) LaunchFlight.OnStop(this); if (Active) { Active = false; EmergencyLanding = false; taps.Reset(); mod.Storm.Persist(); if (Object.op_Implicit((Object)(object)pose)) { pose.EndFlight(); } if (Object.op_Implicit((Object)(object)body)) { body.useGravity = gravity; body.collisionDetectionMode = collisionMode; } owner = null; body = null; hitTimes.Clear(); } } internal Vector3 FixedTick(float dt, Rigidbody physicsBody) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0036: 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_0033: Unknown result type (might be due to invalid IL or missing references) try { return Move(dt, physicsBody); } catch (Exception ex) { Debug.LogError((object)("[Mjolnir] Voo interrompido: " + ex)); Stop(); return Vector3.zero; } } private Vector3 Move(float dt, Rigidbody physicsBody) { //IL_0003: Unknown result type (might be due to invalid IL or missing references) return LaunchFlight.Move(this, dt, physicsBody); } internal void Sweep(Vector3 velocity, float dt, float commandedSpeed) { //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01e7: 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_029f: 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_016c: Unknown result type (might be due to invalid IL or missing references) //IL_02bb: Unknown result type (might be due to invalid IL or missing references) //IL_02c2: Unknown result type (might be due to invalid IL or missing references) //IL_02d3: Unknown result type (might be due to invalid IL or missing references) //IL_01b5: Unknown result type (might be due to invalid IL or missing references) //IL_0282: Unknown result type (might be due to invalid IL or missing references) float magnitude = ((Vector3)(ref velocity)).magnitude; int mask = LayerMask.GetMask(new string[9] { "terrain", "piece", "Default", "Default_small", "static_solid", "vehicle", "character", "character_net", "hitbox" }); RaycastHit[] array = Physics.SphereCastAll(((Character)owner).GetCenterPoint(), 0.55f, ((Vector3)(ref velocity)).normalized, magnitude * dt + 0.65f, mask, (QueryTriggerInteraction)1); Array.Sort(array, (RaycastHit a, RaycastHit b) => ((RaycastHit)(ref a)).distance.CompareTo(((RaycastHit)(ref b)).distance)); int num = 0; RaycastHit[] array2 = array; for (int num2 = 0; num2 < array2.Length; num2++) { RaycastHit contact = array2[num2]; if (!Object.op_Implicit((Object)(object)((RaycastHit)(ref contact)).collider) || (Object)(object)((Component)((RaycastHit)(ref contact)).collider).GetComponentInParent<Character>() == (Object)(object)owner) { continue; } bool num3 = ((RaycastHit)(ref contact)).normal.y > 0.35f && (velocity.y < -6f || (EmergencyLanding && velocity.y < -0.5f)) && Time.time - started > 0.4f; if (((RaycastHit)(ref contact)).distance <= magnitude * dt + 0.08f && mod.FlightDestruction.Value && commandedSpeed >= 18f && num++ < 12) { Smash(contact); } if (Object.op_Implicit((Object)(object)((Component)((RaycastHit)(ref contact)).collider).GetComponent<Heightmap>()) && mod.FlightDestruction.Value && mod.FlightTerrain.Value && commandedSpeed >= 18f) { Dig(((RaycastHit)(ref contact)).point); } if (num3) { _ = owner; body.position = ((RaycastHit)(ref contact)).point + Vector3.up * 0.12f; body.linearVelocity = Vector3.zero; bool num4 = !EmergencyLanding && Time.time >= nextImpact; Stop(); if (num4) { nextImpact = Time.time + 2f; mod.Storm.FlightLanding(mod.FlightDestruction.Value, FlightPolishRules.ImpactStrength(magnitude)); if (mod.FlightDestruction.Value && mod.FlightTerrain.Value) { Dig(((RaycastHit)(ref contact)).point); } } break; } if (((RaycastHit)(ref contact)).distance <= magnitude * dt + 0.08f && Vector3.Dot(velocity, ((RaycastHit)(ref contact)).normal) < -0.1f) { mod.FlightImpact(((RaycastHit)(ref contact)).point, ((RaycastHit)(ref contact)).normal, magnitude); body.linearVelocity = Vector3.zero; Stop(); break; } } } internal void CollisionStop(Collision collision) { //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) if (Active && Object.op_Implicit((Object)(object)body) && collision != null && !(Time.time - started < 0.4f) && Object.op_Implicit((Object)(object)collision.collider
BepInEx/plugins/Yoroshiro_Mjolnir/Mjolnir.PoseFix.dll
Decompiled 3 weeks ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Jotunn.Configs; using MagicaCloth2; using UnityEngine; using UnityEngine.Audio; using UnityEngine.Rendering; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Yoroshiro")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.2.4.0")] [assembly: AssemblyInformationalVersion("1.2.4")] [assembly: AssemblyProduct("Mjolnir.PoseFix")] [assembly: AssemblyTitle("Mjolnir.PoseFix")] [assembly: AssemblyVersion("1.2.4.0")] namespace MyValheimMod; public static class TakeoffPoseRules { public static float Blend(float age) { if (float.IsNaN(age) || float.IsInfinity(age)) { return 0f; } float num = Math.Max(0f, Math.Min(1f, age / 0.45f)); return num * num * (3f - 2f * num); } public static float Extension(float initial, float age) { return Math.Min(initial, 0.7071068f) + (0.992f - Math.Min(initial, 0.7071068f)) * Blend(age); } public static float Offset(float initial, float age) { return initial + (((initial < 0f) ? (-0.01f) : 0.01f) - initial) * Blend(age); } } public static class TakeoffLegs { public static float Extension(float initial) { return TakeoffPoseRules.Extension(initial, LaunchFlight.TakeoffAge); } public static float Offset(float initial) { return TakeoffPoseRules.Offset(initial, LaunchFlight.TakeoffAge); } } [DefaultExecutionOrder(12000)] public sealed class CapeMotion : MonoBehaviour { private sealed class Original { internal readonly MagicaCloth C; private readonly ClothUpdateMode mode; private readonly float world; private readonly float local; private readonly float damping; private readonly float wind; private readonly float moving; private readonly float centrifugal; private readonly float stabilization; private readonly float dataWorld; private readonly float dataLocal; private readonly float dataWind; private readonly float dataDamping; private readonly bool hasInertia; private readonly bool hasWind; internal Original(MagicaCloth c) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) C = c; ClothSerializeData serializeData = c.SerializeData; mode = serializeData.updateMode; world = c.worldInertiaProperty; local = c.localInertiaProperty; damping = c.dampingProperty; wind = c.windInfluenceProperty; stabilization = serializeData.stablizationTimeAfterReset; dataDamping = serializeData.damping.value; hasInertia = serializeData.inertiaConstraint != null; hasWind = serializeData.wind != null; if (hasInertia) { dataWorld = serializeData.inertiaConstraint.worldInertia; dataLocal = serializeData.inertiaConstraint.localInertia; centrifugal = serializeData.inertiaConstraint.centrifualAcceleration; } if (hasWind) { dataWind = serializeData.wind.influence; moving = serializeData.wind.movingWind; } } internal void Apply() { //IL_0029: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)C) && C.IsValid()) { ClothSerializeData serializeData = C.SerializeData; serializeData.updateMode = (ClothUpdateMode)0; serializeData.stablizationTimeAfterReset = 0.25f; C.worldInertiaProperty = Mathf.Min(world, 0.05f); C.localInertiaProperty = Mathf.Min(local, 0.05f); C.dampingProperty = Mathf.Max(damping, 0.6f); C.windInfluenceProperty = Mathf.Min(wind, 0.25f); if (hasInertia) { serializeData.inertiaConstraint.worldInertia = C.worldInertiaProperty; serializeData.inertiaConstraint.localInertia = C.localInertiaProperty; serializeData.inertiaConstraint.centrifualAcceleration = 0f; } if (hasWind) { serializeData.wind.influence = C.windInfluenceProperty; serializeData.wind.movingWind = Mathf.Min(moving, 0.1f); } serializeData.damping.value = C.dampingProperty; C.SetParameterChange(); } } internal void Reset() { if (Object.op_Implicit((Object)(object)C) && C.IsValid()) { C.ResetCloth(false); } } internal void Restore() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)C)) { ClothSerializeData serializeData = C.SerializeData; serializeData.updateMode = mode; serializeData.stablizationTimeAfterReset = stabilization; C.worldInertiaProperty = world; C.localInertiaProperty = local; C.dampingProperty = damping; C.windInfluenceProperty = wind; serializeData.damping.value = dataDamping; if (hasInertia) { serializeData.inertiaConstraint.worldInertia = dataWorld; serializeData.inertiaConstraint.localInertia = dataLocal; serializeData.inertiaConstraint.centrifualAcceleration = centrifugal; } if (hasWind) { serializeData.wind.influence = dataWind; serializeData.wind.movingWind = moving; } C.SetParameterChange(); Reset(); } } } private static MjolnirPlugin configured; private static ConfigEntry<bool> enabledCape; private bool requested; private float nextScan; private float activeUntil; private int phase = -1; private int lastCount = -1; private readonly List<Original> originals = new List<Original>(); private static void Init(MjolnirPlugin m) { if (!((Object)(object)configured == (Object)(object)m)) { configured = m; enabledCape = ((BaseUnityPlugin)m).Config.Bind<bool>("Effects", "CapeStabilization", true, "Stabilize the game's MagicaCloth simulation during procedural poses. Keeps the native renderer and restores original cloth settings afterwards."); } } public static void Set(Transform owner, bool active) { if (!Object.op_Implicit((Object)(object)owner)) { return; } CapeMotion capeMotion = ((Component)owner).GetComponent<CapeMotion>(); if (Object.op_Implicit((Object)(object)capeMotion) || active || LaunchFlight.Charging) { if (!Object.op_Implicit((Object)(object)capeMotion)) { capeMotion = ((Component)owner).gameObject.AddComponent<CapeMotion>(); } capeMotion.requested = active; } } public static void DrawSettings() { MjolnirPlugin active = MjolnirPlugin.Active; if (Object.op_Implicit((Object)(object)active)) { Init(active); enabledCape.Value = GUILayout.Toggle(enabledCape.Value, UiText.Text("Estabilizar capa apenas durante o voo"), Array.Empty<GUILayoutOption>()); } } private bool Active() { MjolnirPlugin active = MjolnirPlugin.Active; if (!Object.op_Implicit((Object)(object)active) || !Object.op_Implicit((Object)(object)Player.m_localPlayer) || (Object)(object)((Component)this).transform != (Object)(object)((Component)Player.m_localPlayer).transform || ((Character)Player.m_localPlayer).IsDead()) { return false; } Init(active); if (LaunchFlight.Charging || !enabledCape.Value) { return false; } if (active.Wings.Active || (requested && active.Strike.Busy)) { activeUntil = Time.time + 0.35f; } return Time.time < activeUntil; } private void LateUpdate() { if (!Active()) { Restore(); return; } if (Time.time >= nextScan) { nextScan = Time.time + 0.5f; MagicaCloth[] componentsInChildren = ((Component)this).GetComponentsInChildren<MagicaCloth>(true); MagicaCloth[] array = componentsInChildren; foreach (MagicaCloth c in array) { if (Object.op_Implicit((Object)(object)c) && ((Behaviour)c).enabled && c.IsValid() && !originals.Exists((Original x) => (Object)(object)x.C == (Object)(object)c)) { Original original = new Original(c); originals.Add(original); original.Apply(); original.Reset(); Debug.Log((object)("[Mjolnir] MagicaCloth estabilizado: " + ((Object)c).name)); } } if (lastCount != originals.Count) { lastCount = originals.Count; Debug.Log((object)("[Mjolnir] MagicaCloth detectados: " + componentsInChildren.Length + "; estabilizados: " + lastCount)); } } MjolnirPlugin active = MjolnirPlugin.Active; int num = ((!LaunchFlight.Charging) ? (active.Wings.Active ? 1 : 2) : 0); foreach (Original original2 in originals) { original2.Apply(); if (num != phase) { original2.Reset(); } } phase = num; } private void Restore() { foreach (Original original in originals) { original.Restore(); } originals.Clear(); nextScan = 0f; activeUntil = 0f; phase = -1; lastCount = -1; } private void OnDisable() { Restore(); } private void OnDestroy() { Restore(); } } public static class CapeRules { public static float Drag(float speed) { if (float.IsNaN(speed) || float.IsInfinity(speed)) { return 0f; } return Math.Max(0f, Math.Min(18f, speed * 0.65f)); } public static float Blend(float dt) { if (float.IsNaN(dt) || float.IsInfinity(dt) || dt <= 0f) { return 0f; } return 1f - (float)Math.Exp(-6f * Math.Min(0.1f, dt)); } } public static class ConsecrationSound { private static MjolnirPlugin configured; private static ConfigEntry<float> volume; private static AudioClip clip; private static bool attempted; private static readonly FieldInfo Mixer = AccessTools.Field(typeof(MjolnirPlugin), "thunderMixer"); private static void Init() { //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Expected O, but got Unknown MjolnirPlugin active = MjolnirPlugin.Active; if (Object.op_Implicit((Object)(object)active) && !((Object)(object)configured == (Object)(object)active)) { configured = active; volume = ((BaseUnityPlugin)active).Config.Bind<float>("Consecration", "ActivationSoundVolume", 0.8f, new ConfigDescription("Protective thunder activation sound multiplier. Also follows the mod thunder volume and the game's native thunder mixer. Zero mutes this sound.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1.5f), Array.Empty<object>())); } } private static AudioClip Clip() { if (Object.op_Implicit((Object)(object)clip) || attempted) { return clip; } attempted = true; try { PcmWave pcmWave = PcmWave.Read(File.ReadAllBytes(Path.Combine(Path.GetDirectoryName(typeof(MjolnirPlugin).Assembly.Location), "Consecration_Activate.wav"))); clip = AudioClip.Create("Mjolnir_ProtectiveThunder", pcmWave.Samples.Length / pcmWave.Channels, pcmWave.Channels, pcmWave.Rate, false); clip.SetData(pcmWave.Samples, 0); } catch (Exception ex) { Debug.LogWarning((object)("[Mjolnir] Consecration sound: " + ex.Message)); } return clip; } internal static void Play(Vector3 point) { //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Expected O, but got Unknown Init(); MjolnirPlugin active = MjolnirPlugin.Active; if (!Object.op_Implicit((Object)(object)active) || volume == null) { return; } float num = volume.Value * active.ThunderVolume.Value; if (!float.IsNaN(num) && !float.IsInfinity(num) && !(num <= 0f)) { AudioClip val = Clip(); if (Object.op_Implicit((Object)(object)val)) { GameObject val2 = new GameObject("Mjolnir_ConsecrationSound"); val2.transform.position = point; AudioSource obj = val2.AddComponent<AudioSource>(); obj.playOnAwake = false; obj.clip = val; obj.outputAudioMixerGroup = (AudioMixerGroup)((Mixer == null) ? null : /*isinst with value type is only supported in some contexts*/); obj.spatialBlend = 1f; obj.rolloffMode = (AudioRolloffMode)1; obj.minDistance = 3f; obj.maxDistance = 35f; obj.dopplerLevel = 0f; obj.volume = Mathf.Clamp01(num); obj.Play(); Object.Destroy((Object)val2, val.length + 0.25f); } } } public static void DrawSettings() { Init(); GUILayout.Label(UiText.Text("Volume do som de protecao: ") + volume.Value.ToString(UiText.Text("0.0")), Array.Empty<GUILayoutOption>()); volume.Value = GUILayout.HorizontalSlider(volume.Value, 0f, 1.5f, Array.Empty<GUILayoutOption>()); } public static void Defaults() { Init(); volume.Value = 0.8f; } } public sealed class PcmWave { public readonly int Channels; public readonly int Rate; public readonly float[] Samples; private PcmWave(int channels, int rate, float[] samples) { Channels = channels; Rate = rate; Samples = samples; } public static PcmWave Read(byte[] bytes) { if (bytes == null || bytes.Length < 44 || bytes.Length > 1000000) { throw new InvalidDataException("Invalid WAV size"); } using MemoryStream memoryStream = new MemoryStream(bytes); BinaryReader r = new BinaryReader(memoryStream); try { if (Four() != "RIFF") { throw new InvalidDataException("Not RIFF"); } r.ReadUInt32(); if (Four() != "WAVE") { throw new InvalidDataException("Not WAVE"); } int num = 0; int num2 = 0; int num3 = 0; int num4 = 0; byte[] array = null; while (memoryStream.Position + 8 <= memoryStream.Length) { string text = Four(); uint num5 = r.ReadUInt32(); long num6 = memoryStream.Position + num5; if (num6 > memoryStream.Length) { throw new InvalidDataException("Truncated chunk"); } if (text == "fmt ") { if (num5 < 16) { throw new InvalidDataException("Invalid format"); } num4 = r.ReadUInt16(); num = r.ReadUInt16(); num2 = r.ReadInt32(); r.ReadInt32(); r.ReadUInt16(); num3 = r.ReadUInt16(); } else if (text == "data") { array = r.ReadBytes((int)num5); } memoryStream.Position = num6 + (num5 & 1); } if (num4 != 1 || num3 != 16 || (num != 1 && num != 2) || num2 < 8000 || num2 > 48000 || array == null || array.Length == 0 || array.Length % (num * 2) != 0 || (double)array.Length / (double)(num * 2 * num2) > 5.0) { throw new InvalidDataException("Expected PCM16 WAV up to 5 seconds"); } float[] array2 = new float[array.Length / 2]; for (int i = 0; i < array2.Length; i++) { array2[i] = (float)(short)(array[i * 2] | (array[i * 2 + 1] << 8)) / 32768f; } return new PcmWave(num, num2, array2); } finally { if (r != null) { ((IDisposable)r).Dispose(); } } string Four() { return Encoding.ASCII.GetString(r.ReadBytes(4)); } } } [DefaultExecutionOrder(1000)] public sealed class ConsecrationCast : MonoBehaviour { private Player owner; private MeshRenderer head; private float release; private float expiry; private bool sounded; internal static void Play(Player source) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) MjolnirPlugin active = MjolnirPlugin.Active; Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)active) || !Object.op_Implicit((Object)(object)source) || !Object.op_Implicit((Object)(object)localPlayer)) { return; } Vector3 val = ((Component)source).transform.position - ((Component)localPlayer).transform.position; if (!(((Vector3)(ref val)).sqrMagnitude > 6400f)) { ConsecrationCast component = ((Component)source).GetComponent<ConsecrationCast>(); if (Object.op_Implicit((Object)(object)component)) { Object.Destroy((Object)(object)component); } ConsecrationCast consecrationCast = ((Component)source).gameObject.AddComponent<ConsecrationCast>(); consecrationCast.owner = source; consecrationCast.head = StormTrail.FindHead(((Component)source).transform); consecrationCast.release = Time.time + 0.35f; consecrationCast.expiry = consecrationCast.release + 0.25f; } } private void LateUpdate() { //IL_0091: 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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) MjolnirPlugin active = MjolnirPlugin.Active; if (!Object.op_Implicit((Object)(object)active) || !Object.op_Implicit((Object)(object)owner) || ((Character)owner).IsDead() || ((Character)owner).IsTeleporting() || !MjolnirPlugin.IsMjolnir(((Humanoid)owner).GetCurrentWeapon()) || Time.time > expiry) { Object.Destroy((Object)(object)this); } else { if (Time.time < release) { return; } if (!sounded) { Vector3 point; if (!Object.op_Implicit((Object)(object)head)) { point = ((Character)owner).GetCenterPoint(); } else { Bounds bounds = ((Renderer)head).bounds; point = ((Bounds)(ref bounds)).center; } ConsecrationSound.Play(point); sounded = true; } if (!Object.op_Implicit((Object)(object)head)) { head = StormTrail.FindHead(((Component)owner).transform); } if (Object.op_Implicit((Object)(object)head) && ((Renderer)head).enabled && ((Component)head).gameObject.activeInHierarchy) { if (active.LightningEnabled.Value) { StormVfx.HammerSky(head); } Object.Destroy((Object)(object)this); } } } } [DefaultExecutionOrder(1100)] public sealed class HammerBoltFollow : MonoBehaviour { private StormVfx effect; private MeshRenderer head; internal void Begin(StormVfx fx, MeshRenderer source) { effect = fx; head = source; } private void LateUpdate() { //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_0056: 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) if (!Object.op_Implicit((Object)(object)effect) || !Object.op_Implicit((Object)(object)head) || !((Renderer)head).enabled || !((Component)head).gameObject.activeInHierarchy) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } StormVfx stormVfx = effect; Bounds bounds = ((Renderer)head).bounds; stormVfx.MoveHammerAnchor(((Bounds)(ref bounds)).center); } } public static class Consecration { private sealed class Grant { public Player Source; public float End; public float Reduction; } private const string Rpc = "Yoroshiro_Mjolnir_Consecration_v1"; private static MjolnirPlugin configured; private static ConfigEntry<float> cost; private static ConfigEntry<float> duration; private static ConfigEntry<float> cooldown; private static ConfigEntry<float> reduction; private static Harmony harmony; private static ZRoutedRpc registered; private static Player caster; private static Player recipient; private static float end; private static float nextCast; private static float nextPulse; private static readonly Dictionary<ZDOID, Grant> grants = new Dictionary<ZDOID, Grant>(); public static bool Active { get { if (Object.op_Implicit((Object)(object)caster) && (Object)(object)caster == (Object)(object)Player.m_localPlayer && Time.time < end && !((Character)caster).IsDead() && !((Character)caster).IsTeleporting()) { return MjolnirPlugin.IsMjolnir(((Humanoid)caster).GetCurrentWeapon()); } return false; } } public static float Cost => Bound((cost == null) ? 30f : cost.Value, 10f, 80f, 30f); public static float Cooldown => Bound((cooldown == null) ? 25f : cooldown.Value, 10f, 90f, 25f); public static float Remaining => Mathf.Max(0f, nextCast - Time.time); public static float DurationRemaining { get { if (!Active) { return 0f; } return Mathf.Max(0f, end - Time.time); } } public static string Help => UiText.Text("CONSAGRACAO | ") + Keybinds.ConsecrationLabel + " | " + Cost.ToString("0") + UiText.Text("% de energia | ") + ((duration == null) ? 8f : Bound(duration.Value, 1f, 12f, 8f)).ToString("0") + UiText.Text(" s | Recarga: ") + Cooldown.ToString("0") + UiText.Text(" s. Reducao de dano: ") + ((reduction == null) ? 10f : Bound(reduction.Value, 0f, 20f, 10f)).ToString("0") + UiText.Text("%. Protege voce e aliados em 3 m na ativacao. Aura ofensiva acompanha apenas o portador, sem gasto por pulso. Nao acumula protecao. Regeneracao pausada enquanto ativa."); private static float Bound(float v, float lo, float hi, float fallback) { if (!float.IsNaN(v) && !float.IsInfinity(v)) { return Mathf.Clamp(v, lo, hi); } return fallback; } public static void Prepare(MjolnirPlugin m) { //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Expected O, but got Unknown //IL_021f: 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_0255: 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) if ((Object)(object)configured != (Object)(object)m) { configured = m; cost = ((BaseUnityPlugin)m).Config.Bind<float>("Consecration", "CostPercent", 30f, "Activation cost in percent. No additional cost per pulse."); duration = ((BaseUnityPlugin)m).Config.Bind<float>("Consecration", "DurationSeconds", 8f, "Blessing and damaging aura duration."); cooldown = ((BaseUnityPlugin)m).Config.Bind<float>("Consecration", "CooldownSeconds", 25f, "Cooldown from activation; infinite energy does not bypass this."); reduction = ((BaseUnityPlugin)m).Config.Bind<float>("Consecration", "DamageReductionPercent", 10f, "Damage reduction for wielder and friendly players within 3m at cast. Multiple blessings use the strongest value, never add."); } if (harmony == null) { harmony = new Harmony("com.seunome.mjolnir.consecration"); harmony.Patch((MethodBase)AccessTools.Method(typeof(Character), "RPC_Damage", new Type[2] { typeof(long), typeof(HitData) }, (Type[])null), new HarmonyMethod(typeof(Consecration), "BeforeDamage", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } if (registered != ZRoutedRpc.instance && ZRoutedRpc.instance != null) { registered = ZRoutedRpc.instance; registered.Register<ZDOID, float, float>("Yoroshiro_Mjolnir_Consecration_v1", (Action<long, ZDOID, float, float>)Receive); grants.Clear(); recipient = null; } if ((Object)(object)recipient != (Object)(object)Player.m_localPlayer) { recipient = Player.m_localPlayer; grants.Clear(); end = (nextCast = 0f); caster = null; } List<ZDOID> list = new List<ZDOID>(); foreach (KeyValuePair<ZDOID, Grant> grant in grants) { if (Time.time >= grant.Value.End || !Object.op_Implicit((Object)(object)grant.Value.Source) || ((Character)grant.Value.Source).IsDead() || !MjolnirPlugin.IsMjolnir(((Humanoid)grant.Value.Source).GetCurrentWeapon()) || !Object.op_Implicit((Object)(object)recipient) || ((Character)recipient).IsDead()) { list.Add(grant.Key); } } foreach (ZDOID item in list) { grants.Remove(item); } } private static void Receive(long sender, ZDOID id, float seconds, float percent) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: 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_00e8: Unknown result type (might be due to invalid IL or missing references) Player val = null; foreach (Player allPlayer in Player.GetAllPlayers()) { if (Object.op_Implicit((Object)(object)allPlayer)) { ZDOID zDOID = ((Character)allPlayer).GetZDOID(); if (((ZDOID)(ref zDOID)).Equals(id) && ((Character)allPlayer).GetOwner() == sender) { val = allPlayer; break; } } } if (!Object.op_Implicit((Object)(object)val) || float.IsNaN(seconds) || float.IsInfinity(seconds) || float.IsNaN(percent) || float.IsInfinity(percent)) { return; } if (seconds <= 0f) { grants.Remove(id); } else if (!((Character)val).IsDead() && MjolnirPlugin.IsMjolnir(((Humanoid)val).GetCurrentWeapon())) { ConsecrationCast.Play(val); Player localPlayer = Player.m_localPlayer; if (Object.op_Implicit((Object)(object)localPlayer) && !((Character)localPlayer).IsDead() && (!((Object)(object)localPlayer != (Object)(object)val) || ((!((Character)localPlayer).IsPVPEnabled() || !((Character)val).IsPVPEnabled()) && !(Vector3.Distance(((Character)localPlayer).GetCenterPoint(), ((Character)val).GetCenterPoint()) > 3f)))) { grants[id] = new Grant { Source = val, End = Time.time + Mathf.Clamp(seconds, 1f, 12f), Reduction = Mathf.Clamp(percent, 0f, 20f) * 0.01f }; } } } private static void Broadcast(Player p, float seconds, float percent) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) if (ZRoutedRpc.instance != null) { ZRoutedRpc.instance.InvokeRoutedRPC(0L, "Yoroshiro_Mjolnir_Consecration_v1", new object[3] { ((Character)p).GetZDOID(), seconds, percent }); } else { Receive(((Character)p).GetOwner(), ((Character)p).GetZDOID(), seconds, percent); } } public static void Cancel() { if (Object.op_Implicit((Object)(object)caster)) { Broadcast(caster, 0f, 0f); caster = null; } end = 0f; } public static void Update(MjolnirPlugin m, bool equipped, bool damageEnabled, float radius, float damage) { //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0229: Unknown result type (might be due to invalid IL or missing references) //IL_022e: Unknown result type (might be due to invalid IL or missing references) //IL_0239: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_0262: Unknown result type (might be due to invalid IL or missing references) //IL_0267: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)caster) && (!Active || !equipped)) { Cancel(); } Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer)) { return; } if (Keybinds.ConsecrationDown() && equipped && !m.MenuPanel.Open && !StormAbility.InterfaceOpen() && !m.Strike.Busy && !m.Storm.Busy && !LaunchFlight.Charging && Remaining <= 0f && !Active) { if (!m.InfiniteOvercharge.Value && m.Storm.Meter.Percent < Cost) { MessageHud instance = MessageHud.instance; if (instance != null) { instance.ShowMessage((MessageType)2, UiText.Text("Sobrecarga insuficiente para Consagracao."), 0, (Sprite)null, false, true); } return; } if (!m.InfiniteOvercharge.Value && !m.Storm.Meter.SpendPercent(Cost)) { return; } m.Storm.Persist(); caster = localPlayer; end = Time.time + Bound(duration.Value, 1f, 12f, 8f); nextCast = Time.time + Cooldown; nextPulse = Time.time; Broadcast(localPlayer, end - Time.time, Bound(reduction.Value, 0f, 20f, 10f)); ThorFlightPose component = ((Component)localPlayer).GetComponent<ThorFlightPose>(); if (Object.op_Implicit((Object)(object)component)) { AccessTools.Method(typeof(ThorFlightPose), "BeginLightning", (Type[])null, (Type[])null).Invoke(component, null); } MessageHud instance2 = MessageHud.instance; if (instance2 != null) { instance2.ShowMessage((MessageType)2, UiText.Text("Consagracao: protecao e aura de raios!"), 0, (Sprite)null, false, true); } } if (Active && !(Time.time < nextPulse)) { nextPulse = Time.time + 1f; if (damageEnabled) { StormBalance.Damage(localPlayer, StormBalance.Targets(localPlayer, ((Character)localPlayer).GetCenterPoint(), radius), damage, blunt: false); } if (m.LightningEnabled.Value) { StormVfx.Gather(((Component)localPlayer).transform.position + Vector3.up * 0.2f + ((Component)localPlayer).transform.right * 0.7f, ((Component)localPlayer).transform.position + Vector3.up * 1.6f); } } } public static void BeforeDamage(Character __instance, HitData __1) { Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer) || (Object)(object)__instance != (Object)(object)localPlayer || ((Character)localPlayer).IsDead() || __1 == null) { return; } float num = 0f; foreach (Grant value in grants.Values) { if (Time.time < value.End && Object.op_Implicit((Object)(object)value.Source) && !((Character)value.Source).IsDead() && MjolnirPlugin.IsMjolnir(((Humanoid)value.Source).GetCurrentWeapon())) { num = Mathf.Max(num, value.Reduction); } } if (num > 0f) { __1.ApplyModifier(1f - num); } } private static void Slider(string label, ConfigEntry<float> e, float lo, float hi) { GUILayout.Label(UiText.Text(label) + ": " + e.Value.ToString("0"), Array.Empty<GUILayoutOption>()); e.Value = GUILayout.HorizontalSlider(e.Value, lo, hi, Array.Empty<GUILayoutOption>()); } public static void DrawSettings() { Prepare(MjolnirPlugin.Active); GUILayout.Space(12f); GUILayout.Label(UiText.Text("CONSAGRACAO"), Array.Empty<GUILayoutOption>()); ConsecrationSound.DrawSettings(); GUILayout.Label(Help, Array.Empty<GUILayoutOption>()); Slider(UiText.Text("Custo de ativacao (%)"), cost, 10f, 80f); Slider(UiText.Text("Duracao da Consagracao (s)"), duration, 1f, 12f); Slider(UiText.Text("Recarga da Consagracao (s)"), cooldown, 10f, 90f); Slider(UiText.Text("Reducao de dano (%)"), reduction, 0f, 20f); GUILayout.Label(UiText.Text("Protecao de aliados requer o mod instalado em todos os clientes. Jogadores com PvP ativo entre si nao recebem protecao."), Array.Empty<GUILayoutOption>()); } public static void Defaults() { Prepare(MjolnirPlugin.Active); cost.Value = 30f; duration.Value = 8f; cooldown.Value = 25f; reduction.Value = 10f; ConsecrationSound.Defaults(); } } public static class KeyRules { public static bool LegacyFlight(bool space, bool h, int mask) { if (!space || (mask != 1 && mask != 2)) { if (h) { return mask == 0; } return false; } return true; } public static int Mask(bool shift, bool ctrl, bool alt) { return (int)((shift ? 1u : 0u) | (uint)(ctrl ? 2 : 0)) | (alt ? 4 : 0); } public static bool Match(int needed, int held) { return needed == held; } public static bool Collides(int keyA, int maskA, int keyB, int maskB) { if (keyA == keyB) { return maskA == maskB; } return false; } } public static class Keybinds { public struct RunState { public bool Changed; public bool Value; } private static MjolnirPlugin configured; private static readonly ConfigEntry<KeyboardShortcut>[] keys = new ConfigEntry<KeyboardShortcut>[6]; private static readonly string[] names = new string[6] { "Voo / decolagem", "Arremesso", "Relampago", "Abrir menu", "Mostrar / ocultar HUD", "Consagracao" }; private static int capture = -1; private static string status = ""; private static float quietUntil; private static Harmony harmony; private static readonly FieldInfo Run = AccessTools.Field(typeof(Character), "m_run"); private static readonly MethodInfo SetCrouch = AccessTools.Method(typeof(Player), "SetCrouch", new Type[1] { typeof(bool) }, (Type[])null); public static ConfigEntry<KeyboardShortcut> Flight { get { Init(); return keys[0]; } } public static bool Capturing { get { if (capture >= 0 && Object.op_Implicit((Object)(object)MjolnirPlugin.Active)) { return MjolnirPlugin.Active.MenuPanel.Open; } return false; } } private static bool Suppressed { get { if (!Capturing) { return Time.unscaledTime < quietUntil; } return true; } } private static bool Shift { get { if (!Input.GetKey((KeyCode)304)) { return Input.GetKey((KeyCode)303); } return true; } } private static bool Ctrl { get { if (!Input.GetKey((KeyCode)306)) { return Input.GetKey((KeyCode)305); } return true; } } private static bool Alt { get { if (!Input.GetKey((KeyCode)308)) { return Input.GetKey((KeyCode)307); } return true; } } public static string ConsecrationLabel => Label(5); public static string FlightLabel => Label(0); public static string ThrowLabel => Label(1); public static string StrikeLabel => Label(2); public static string MenuLabel => Label(3); public static string HudLabel => Label(4); public static string FlightMainLabel { get { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) Init(); KeyboardShortcut value = keys[0].Value; return Main(((KeyboardShortcut)(ref value)).MainKey); } } private static void Init() { //IL_0048: 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_007e: 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_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_0114: Unknown result type (might be due to invalid IL or missing references) //IL_0141: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0193: Invalid comparison between Unknown and I4 //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Invalid comparison between Unknown and I4 //IL_01ea: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Expected O, but got Unknown //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0246: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Expected O, but got Unknown //IL_0253: Expected O, but got Unknown //IL_0283: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Expected O, but got Unknown //IL_01bf: Unknown result type (might be due to invalid IL or missing references) MjolnirPlugin active = MjolnirPlugin.Active; if (!Object.op_Implicit((Object)(object)active) || (Object)(object)configured == (Object)(object)active) { return; } configured = active; keys[0] = ((BaseUnityPlugin)active).Config.Bind<KeyboardShortcut>("HammerFlight", "LaunchShortcut", new KeyboardShortcut((KeyCode)102, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), "Hold Shift+F to prepare; release F to launch. Press again in flight to stop. Editable in the mod menu."); keys[1] = ((BaseUnityPlugin)active).Config.Bind<KeyboardShortcut>("Hotkeys", "Throw", new KeyboardShortcut(active.ThrowKey.Value, Array.Empty<KeyCode>()), "Throw/return animation shortcut. Supports Shift, Ctrl and Alt modifiers."); keys[2] = ((BaseUnityPlugin)active).Config.Bind<KeyboardShortcut>("Hotkeys", "Lightning", new KeyboardShortcut((KeyCode)103, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }), "Aimed lightning shortcut."); keys[3] = ((BaseUnityPlugin)active).Config.Bind<KeyboardShortcut>("Hotkeys", "Menu", new KeyboardShortcut((KeyCode)290, Array.Empty<KeyCode>()), "Open/close mod settings."); keys[4] = ((BaseUnityPlugin)active).Config.Bind<KeyboardShortcut>("Hotkeys", "ToggleHud", new KeyboardShortcut((KeyCode)291, Array.Empty<KeyCode>()), "Show/hide the Mjolnir HUD."); keys[5] = ((BaseUnityPlugin)active).Config.Bind<KeyboardShortcut>("Hotkeys", "Consecration", new KeyboardShortcut((KeyCode)104, Array.Empty<KeyCode>()), "Consecrate the hammer: protective blessing and enemy-only lightning aura. Editable in F9."); ConfigEntry<int> val = ((BaseUnityPlugin)active).Config.Bind<int>("Hotkeys", "Revision", 0, "Migrates previous default flight shortcuts to Shift+F once."); if (val.Value < 1) { KeyboardShortcut value = keys[0].Value; int mask = Flags(value); if (KeyRules.LegacyFlight((int)((KeyboardShortcut)(ref value)).MainKey == 32, (int)((KeyboardShortcut)(ref value)).MainKey == 104, mask)) { keys[0].Value = new KeyboardShortcut((KeyCode)102, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }); } val.Value = 1; ((BaseUnityPlugin)active).Config.Save(); } if (harmony == null) { harmony = new Harmony("com.seunome.mjolnir.shortcuts"); harmony.Patch((MethodBase)AccessTools.Method(typeof(Player), "UpdateCrouch", new Type[1] { typeof(float) }, (Type[])null), new HarmonyMethod(typeof(Keybinds), "BeforeCrouch", (Type[])null), new HarmonyMethod(typeof(Keybinds), "AfterCrouch", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)AccessTools.Method(typeof(Player), "StartGuardianPower", Type.EmptyTypes, (Type[])null), new HarmonyMethod(typeof(Keybinds), "GuardianPrefix", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); } } private static int Flags(KeyboardShortcut shortcut) { //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_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Invalid comparison between Unknown and I4 //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Invalid comparison between Unknown and I4 //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Invalid comparison between Unknown and I4 //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Invalid comparison between Unknown and I4 int num = 0; foreach (KeyCode modifier in ((KeyboardShortcut)(ref shortcut)).Modifiers) { if ((int)modifier == 304 || (int)modifier == 303) { num |= 1; } if ((int)modifier == 306 || (int)modifier == 305) { num |= 2; } if ((int)modifier == 308 || (int)modifier == 307) { num |= 4; } } return num; } public static bool ModifiersMatch(KeyboardShortcut shortcut) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) if (!KeyRules.Match(Flags(shortcut), KeyRules.Mask(Shift, Ctrl, Alt))) { return false; } foreach (KeyCode modifier in ((KeyboardShortcut)(ref shortcut)).Modifiers) { if (!Modifier(modifier) && !Input.GetKey(modifier)) { return false; } } return true; } private static bool Modifier(KeyCode k) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Invalid comparison between Unknown and I4 //IL_0008: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Invalid comparison between Unknown and I4 //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Invalid comparison between Unknown and I4 //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Invalid comparison between Unknown and I4 //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Invalid comparison between Unknown and I4 if ((int)k != 304 && (int)k != 303 && (int)k != 306 && (int)k != 305 && (int)k != 308) { return (int)k == 307; } return true; } private static bool Held(int i) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0046: Unknown result type (might be due to invalid IL or missing references) Init(); if (keys[i] != null) { KeyboardShortcut value = keys[i].Value; if ((int)((KeyboardShortcut)(ref value)).MainKey != 0 && ModifiersMatch(keys[i].Value)) { value = keys[i].Value; return Input.GetKey(((KeyboardShortcut)(ref value)).MainKey); } } return false; } private static bool Down(int i) { //IL_001c: 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_0024: 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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) Init(); if (!Suppressed && keys[i] != null) { KeyboardShortcut value = keys[i].Value; if ((int)((KeyboardShortcut)(ref value)).MainKey != 0 && ModifiersMatch(keys[i].Value)) { value = keys[i].Value; return Input.GetKeyDown(((KeyboardShortcut)(ref value)).MainKey); } } return false; } public static bool ConsecrationDown() { return Down(5); } public static bool FlightDown() { return Down(0); } public static bool ThrowDown(KeyCode ignored) { if (Down(1) && !Held(2)) { return !Held(0); } return false; } public static bool StrikeDown(KeyCode ignored) { return Down(2); } public static bool StrikeHeld() { if (!Suppressed) { return Held(2); } return false; } public static bool MenuDown(KeyCode ignored) { if (capture >= 0 && Object.op_Implicit((Object)(object)MjolnirPlugin.Active) && !MjolnirPlugin.Active.MenuPanel.Open) { capture = -1; } return Down(3); } public static bool HudDown(KeyCode ignored) { return Down(4); } private unsafe static string Main(KeyCode k) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Invalid comparison between Unknown and I4 //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Invalid comparison between Unknown and I4 //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Invalid comparison between Unknown and I4 //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Expected I4, but got Unknown if ((int)k == 32) { return UiText.Text("ESP"); } if ((int)k >= 48 && (int)k <= 57) { return (k - 48).ToString(); } return ((object)(*(KeyCode*)(&k))/*cast due to .constrained prefix*/).ToString().ToUpperInvariant(); } private static string Format(KeyboardShortcut shortcut) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) int num = Flags(shortcut); return (((num & 1) != 0) ? UiText.Text("SHIFT+") : UiText.Text("")) + (((num & 2) != 0) ? UiText.Text("CTRL+") : UiText.Text("")) + (((num & 4) != 0) ? UiText.Text("ALT+") : UiText.Text("")) + Main(((KeyboardShortcut)(ref shortcut)).MainKey); } private static string Label(int i) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) Init(); if (keys[i] != null) { return Format(keys[i].Value); } return ""; } public static string HeaderHint() { return ThrowLabel + UiText.Text(": arremesso | ") + HudLabel + UiText.Text(": mostrar/ocultar HUD | ") + MenuLabel + UiText.Text(": fechar"); } public static string HudHint() { return UiText.Text("Exibir HUD do Mjolnir (") + HudLabel + UiText.Text(")"); } public static string StrikeHint() { return UiText.Text("RELAMPAGO NA MIRA | ") + StrikeLabel; } public static void BeforeCrouch(Player __instance, ref RunState __state) { if (Object.op_Implicit((Object)(object)MjolnirPlugin.Active) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer) && LaunchFlight.Charging) { __state.Changed = true; __state.Value = (bool)Run.GetValue(__instance); Run.SetValue(__instance, false); SetCrouch.Invoke(__instance, new object[1] { true }); } } public static void AfterCrouch(Player __instance, RunState __state) { if (__state.Changed && Object.op_Implicit((Object)(object)__instance)) { Run.SetValue(__instance, __state.Value); } } public static bool GuardianPrefix(Player __instance) { if (!Object.op_Implicit((Object)(object)MjolnirPlugin.Active) || (Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return true; } if (Capturing) { return false; } if (!MjolnirPlugin.IsMjolnir(((Humanoid)__instance).GetCurrentWeapon())) { return true; } if (!Held(0) && !Held(1) && !Held(2) && !Held(3) && !Held(4)) { return !Held(5); } return false; } public static void RestoreDefaults() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) Init(); keys[0].Value = new KeyboardShortcut((KeyCode)102, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }); keys[1].Value = new KeyboardShortcut((KeyCode)103, Array.Empty<KeyCode>()); keys[2].Value = new KeyboardShortcut((KeyCode)103, (KeyCode[])(object)new KeyCode[1] { (KeyCode)304 }); keys[3].Value = new KeyboardShortcut((KeyCode)290, Array.Empty<KeyCode>()); keys[4].Value = new KeyboardShortcut((KeyCode)291, Array.Empty<KeyCode>()); keys[5].Value = new KeyboardShortcut((KeyCode)104, Array.Empty<KeyCode>()); capture = -1; ((BaseUnityPlugin)configured).Config.Save(); } public static void DrawSettings() { //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Invalid comparison between Unknown and I4 //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0183: Invalid comparison between Unknown and I4 //IL_01a5: Unknown result type (might be due to invalid IL or missing references) //IL_01b0: Unknown result type (might be due to invalid IL or missing references) //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_0256: Unknown result type (might be due to invalid IL or missing references) //IL_0264: Unknown result type (might be due to invalid IL or missing references) //IL_0269: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_027a: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Expected I4, but got Unknown //IL_0289: Expected I4, but got Unknown //IL_02cb: Unknown result type (might be due to invalid IL or missing references) Init(); if (Capturing) { GUIUtility.keyboardControl = 0; } GUILayout.Space(12f); GUILayout.Label(UiText.Text("ATALHOS PERSONALIZAVEIS"), Array.Empty<GUILayoutOption>()); GUILayout.Label(UiText.Text("Clique em Alterar e pressione a combinacao. Shift, Ctrl e Alt sao aceitos. Escolha teclas livres no jogo e nos outros mods."), Array.Empty<GUILayoutOption>()); for (int i = 0; i < keys.Length; i++) { GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>()); GUILayout.Label(UiText.Text(names[i]), Array.Empty<GUILayoutOption>()); GUILayout.FlexibleSpace(); GUILayout.Label(Format(keys[i].Value), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(150f) }); if (GUILayout.Button(UiText.Text("Alterar"), (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(75f) })) { capture = i; status = UiText.Text("Pressione o novo atalho. Esc cancela."); } GUILayout.EndHorizontal(); } if (GUILayout.Button(UiText.Text("Restaurar atalhos padrao"), Array.Empty<GUILayoutOption>())) { RestoreDefaults(); status = UiText.Text("Atalhos restaurados."); } GUILayout.Label((capture >= 0) ? (UiText.Text(names[capture]) + UiText.Text(": ") + status) : status, Array.Empty<GUILayoutOption>()); if (capture < 0) { return; } Event current = Event.current; if ((int)current.type != 4) { return; } if ((int)current.keyCode == 27) { capture = -1; status = UiText.Text(""); current.Use(); } else { if ((int)current.keyCode == 0 || Modifier(current.keyCode)) { return; } List<KeyCode> list = new List<KeyCode>(); if (current.shift || Shift) { list.Add((KeyCode)304); } if (current.control || Ctrl) { list.Add((KeyCode)306); } if (current.alt || Alt) { list.Add((KeyCode)308); } KeyboardShortcut val = default(KeyboardShortcut); ((KeyboardShortcut)(ref val))..ctor(current.keyCode, list.ToArray()); bool flag = false; for (int j = 0; j < keys.Length; j++) { if (j != capture) { KeyCode mainKey = ((KeyboardShortcut)(ref val)).MainKey; int maskA = Flags(val); KeyboardShortcut value = keys[j].Value; if (KeyRules.Collides((int)mainKey, maskA, (int)((KeyboardShortcut)(ref value)).MainKey, Flags(keys[j].Value))) { flag = true; } } } if (flag) { status = UiText.Text("Esse atalho ja esta em uso por outra acao do Mjolnir."); } else { keys[capture].Value = val; ((BaseUnityPlugin)configured).Config.Save(); capture = -1; status = UiText.Text("Atalho salvo."); quietUntil = Time.unscaledTime + 0.2f; } current.Use(); } } } public sealed class StormCharge : MonoBehaviour { private MjolnirPlugin mod; private MeshRenderer head; private float next; private Random random; public void Begin(MjolnirPlugin m) { mod = m; head = StormTrail.FindHead(((Component)this).transform); random = new Random(Time.frameCount + 17); } private void LateUpdate() { //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_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)mod) || !mod.LightningEnabled.Value || (!LaunchFlight.Charging && !mod.Strike.Casting)) { Object.Destroy((Object)(object)this); } else if (!Object.op_Implicit((Object)(object)mod.Flight) && Object.op_Implicit((Object)(object)head) && ((Renderer)head).enabled && !(Time.time < next)) { next = Time.time + (StormVfx.Full ? 0.09f : 0.16f); Bounds bounds = ((Renderer)head).bounds; Vector3 center = ((Bounds)(ref bounds)).center; Vector3 val = new Vector3((float)random.NextDouble() * 2f - 1f, (float)random.NextDouble() * 2f - 1f, (float)random.NextDouble() * 2f - 1f); Vector3 normalized = ((Vector3)(ref val)).normalized; StormVfx.Gather(center + normalized * 0.55f, center); } } } public sealed class StormVfx : MonoBehaviour { private sealed class Arc { internal LineRenderer Glow; internal LineRenderer Core; internal Vector3[] Shape; internal Vector3[] Points; internal float Delay; internal float Width; internal bool Ground; internal Vector3 Right; internal Vector3 Forward; } private static MjolnirPlugin configured; private static ConfigEntry<int> quality; private static ConfigEntry<float> intensity; private static ConfigEntry<bool> trails; private static int live; private static int serial; private static int lights; private static Material soft; private static float lastImpact = -10f; private static Vector3 lastPoint; private static Vector3 contactPoint; private static Vector3 contactNormal; private static int contactFrame = -1; private readonly List<Arc> arcs = new List<Arc>(); private Random random; private Light flash; private bool ownsLight; private float born; private float next; private float gain = 1f; private int tick; internal static bool Full { get { if (quality != null) { return quality.Value == 1; } return false; } } internal static float Power { get { if (intensity != null) { return VfxRules.Intensity(intensity.Value); } return 1f; } } internal static bool TrailEnabled { get { if (trails != null) { return trails.Value; } return false; } } private static void Init(MjolnirPlugin m) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Expected O, but got Unknown if (!((Object)(object)configured == (Object)(object)m)) { configured = m; quality = ((BaseUnityPlugin)m).Config.Bind<int>("Visuals", "Detail", 1, new ConfigDescription("0: light VFX; 1: full branching lightning, sparks and dust.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 1), Array.Empty<object>())); intensity = ((BaseUnityPlugin)m).Config.Bind<float>("Visuals", "Intensity", 1f, "Visual brightness and size only; no effect on damage."); trails = ((BaseUnityPlugin)m).Config.Bind<bool>("Visuals", "HammerTrails", true, "Short energy trails during flight and hammer throws."); } } public static void Tick(MjolnirPlugin m) { Init(m); if (!m.LightningEnabled.Value || !Object.op_Implicit((Object)(object)MjolnirLightning.ArcMaterial())) { return; } Player localPlayer = Player.m_localPlayer; if (!Object.op_Implicit((Object)(object)localPlayer) || ((Character)localPlayer).IsDead()) { return; } if ((LaunchFlight.Charging || m.Strike.Casting) && !Object.op_Implicit((Object)(object)((Component)localPlayer).GetComponent<StormCharge>())) { ((Component)localPlayer).gameObject.AddComponent<StormCharge>().Begin(m); } if (trails.Value) { if (m.Wings.Active && !Object.op_Implicit((Object)(object)((Component)localPlayer).GetComponent<StormTrail>())) { ((Component)localPlayer).gameObject.AddComponent<StormTrail>().Begin(m, thrown: false); } if (Object.op_Implicit((Object)(object)m.Flight) && !Object.op_Implicit((Object)(object)((Component)m.Flight).GetComponent<StormTrail>())) { ((Component)m.Flight).gameObject.AddComponent<StormTrail>().Begin(m, thrown: true); } } } public static void MarkContact(Vector3 point, Vector3 normal) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) contactPoint = point; contactNormal = normal; contactFrame = Time.frameCount; } private static StormVfx Make(Vector3 point) { //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_003b: Unknown result type (might be due to invalid IL or missing references) MjolnirPlugin active = MjolnirPlugin.Active; if (!Object.op_Implicit((Object)(object)active) || live >= 8 || !Object.op_Implicit((Object)(object)MjolnirLightning.ArcMaterial())) { return null; } Init(active); GameObject val = new GameObject("Mjolnir_StormDischarge"); val.transform.position = point; StormVfx stormVfx = val.AddComponent<StormVfx>(); stormVfx.random = new Random(++serial * 397 + Time.frameCount); stormVfx.born = Time.time; live++; Object.Destroy((Object)(object)val, 1.05f); return stormVfx; } public static void Impact(Vector3 point, Vector3 normal, float radius) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) SpawnImpact(point, normal, radius, 1f); } private static void SpawnImpact(Vector3 point, Vector3 normal, float radius, float strength) { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (Time.time - lastImpact < 0.1f) { Vector3 val = point - lastPoint; if (((Vector3)(ref val)).sqrMagnitude < 1f) { return; } } lastImpact = Time.time; lastPoint = point; StormVfx stormVfx = Make(point); if (Object.op_Implicit((Object)(object)stormVfx)) { stormVfx.GroundBurst(normal, Mathf.Clamp(radius, 0.6f, 6f), strength); } } public static void Burst(Vector3 point, int count, float strength) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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) Vector3 up; if (contactFrame == Time.frameCount) { Vector3 val = contactPoint - point; if (((Vector3)(ref val)).sqrMagnitude < 1f) { up = contactNormal; goto IL_0032; } } up = Vector3.up; goto IL_0032; IL_0032: Vector3 normal = up; SpawnImpact(point, normal, Mathf.Clamp((float)count * 0.5f, 2f, 4.5f), Mathf.Clamp(strength, 0.25f, 1.3f)); } public static void SmallImpact(Vector3 point) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0001: Unknown result type (might be due to invalid IL or missing references) SpawnImpact(point, Vector3.up, 0.9f, 0.35f); } public static void Sky(Vector3 target) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) SkyAt(target, null); } internal static void HammerSky(MeshRenderer head) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)head)) { Bounds bounds = ((Renderer)head).bounds; SkyAt(((Bounds)(ref bounds)).center, head); } } private static void SkyAt(Vector3 target, MeshRenderer head) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003a: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) StormVfx stormVfx = Make(target); if (Object.op_Implicit((Object)(object)stormVfx)) { if (Object.op_Implicit((Object)(object)head)) { ((Component)stormVfx).gameObject.AddComponent<HammerBoltFollow>().Begin(stormVfx, head); } Vector3 a = target + Vector3.up * 20f; Vector3[] array = stormVfx.Path(a, target, 25, 1.15f); stormVfx.Add(array, 0.055f, ground: false, 0f); int num = (Full ? 5 : 2); for (int i = 0; i < num; i++) { int num2 = 4 + i * 3; Vector3 val = array[num2]; Vector3 b = val + new Vector3(stormVfx.Noise() * 3f, -2f - stormVfx.Unit() * 3f, stormVfx.Noise() * 3f); stormVfx.Add(stormVfx.Path(val, b, 11, 0.4f), 0.017f, ground: false, 0.025f); } stormVfx.Flash(2.2f, 9f); stormVfx.Particles(target, Vector3.up, dust: false, Full ? 22 : 10); } } internal void MoveHammerAnchor(Vector3 target) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) Vector3 val = target - ((Component)this).transform.position; if (((Vector3)(ref val)).sqrMagnitude > 16f) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } ((Component)this).transform.position = target; foreach (Arc arc in arcs) { for (int i = 0; i < arc.Shape.Length; i++) { ref Vector3 reference = ref arc.Shape[i]; reference += val; ref Vector3 reference2 = ref arc.Points[i]; reference2 += val; } if (((Renderer)arc.Core).enabled) { arc.Glow.SetPositions(arc.Points); arc.Core.SetPositions(arc.Points); } } } internal static void Gather(Vector3 a, Vector3 b) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0013: 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_0033: Unknown result type (might be due to invalid IL or missing references) StormVfx stormVfx = Make(b); if (Object.op_Implicit((Object)(object)stormVfx)) { stormVfx.Add(stormVfx.Path(a, b, 9, 0.12f), 0.014f, ground: false, 0f); Object.Destroy((Object)(object)((Component)stormVfx).gameObject, 0.26f); } } private float Unit() { return (float)random.NextDouble(); } private float Noise() { return Unit() * 2f - 1f; } private Vector3[] Path(Vector3 a, Vector3 b, int count, float jagged) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) Vector3[] array = (Vector3[])(object)new Vector3[count]; for (int i = 0; i < count; i++) { float num = (float)i / (float)(count - 1); array[i] = Vector3.Lerp(a, b, num) + new Vector3(Noise(), Noise() * 0.3f, Noise()) * (jagged * Mathf.Sin(num * MathF.PI)); } return array; } private Vector3 Surface(Vector3 p, Vector3 n) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_005a: Unknown result type (might be due to invalid IL or missing references) //IL_005f: Unknown result type (might be due to invalid IL or missing references) int mask = LayerMask.GetMask(new string[4] { "terrain", "piece", "static_solid", "Default" }); RaycastHit val = default(RaycastHit); if (!Physics.Raycast(p + n * 1.3f, -n, ref val, 3.5f, mask, (QueryTriggerInteraction)1)) { return p + n * 0.045f; } return ((RaycastHit)(ref val)).point + ((RaycastHit)(ref val)).normal * 0.045f; } private void GroundBurst(Vector3 normal, float radius, float strength) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0051: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0085: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_023f: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_024a: Unknown result type (might be due to invalid IL or missing references) //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_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f9: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012b: Unknown result type (might be due to invalid IL or missing references) //IL_0130: Unknown result type (might be due to invalid IL or missing references) //IL_0158: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Unknown result type (might be due to invalid IL or missing references) //IL_0180: Unknown result type (might be due to invalid IL or missing references) //IL_0182: Unknown result type (might be due to invalid IL or missing references) //IL_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_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0195: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_0292: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_0298: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: 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_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Unknown result type (might be due to invalid IL or missing references) //IL_01de: Unknown result type (might be due to invalid IL or missing references) //IL_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: Unknown result type (might be due to invalid IL or missing references) //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f3: Unknown result type (might be due to invalid IL or missing references) //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) gain = strength; if (((Vector3)(ref normal)).sqrMagnitude < 0.2f) { normal = Vector3.up; } ((Vector3)(ref normal)).Normalize(); Vector3 val = Vector3.Cross(normal, Vector3.forward); if (((Vector3)(ref val)).sqrMagnitude < 0.1f) { val = Vector3.right; } ((Vector3)(ref val)).Normalize(); Vector3 val2 = Vector3.Cross(val, normal); int num = (Full ? 7 : 4); for (int i = 0; i < num; i++) { float num2 = ((float)i + Unit() * 0.6f) * MathF.PI * 2f / (float)num; Vector3 val3 = val * Mathf.Cos(num2) + val2 * Mathf.Sin(num2); float num3 = radius * (0.55f + Unit() * 0.45f); Vector3[] array = (Vector3[])(object)new Vector3[13]; for (int j = 0; j < array.Length; j++) { float num4 = (float)j / (float)(array.Length - 1); array[j] = Surface(((Component)this).transform.position + val3 * (0.08f + num3 * num4) + Vector3.Cross(normal, val3) * (Noise() * 0.22f * Mathf.Sin(num4 * MathF.PI)), normal); } Add(array, 0.036f, ground: true, Unit() * 0.035f, normal); if (Full && i % 2 == 0) { Vector3[] array2 = (Vector3[])(object)new Vector3[7]; Vector3 val4 = array[6]; Vector3 val5 = val4 + val3 * 0.65f + Vector3.Cross(normal, val3) * (0.4f + Unit() * 0.5f); for (int k = 0; k < 7; k++) { array2[k] = Surface(Vector3.Lerp(val4, val5, (float)k / 6f) + val * Noise() * 0.1f, normal); } Add(array2, 0.015f, ground: true, 0.035f, normal); } } Flash(1.7f, 6f); Particles(Surface(((Component)this).transform.position, normal), normal, dust: false, Mathf.Max(6, Mathf.RoundToInt((float)(Full ? 28 : 12) * Mathf.Clamp(strength, 0.3f, 1f)))); if (Full && strength > 0.6f) { Particles(Surface(((Component)this).transform.position, normal), normal, dust: true, 9); } } private void Add(Vector3[] points, float width, bool ground, float delay, Vector3 normal = default(Vector3)) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a6: Unknown result type (might be due to invalid IL or missing references) //IL_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00f3: 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_0091: 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) LineRenderer val = MjolnirLightning.NewLine(((Component)this).transform, "StormGlow", width * 2.5f); LineRenderer val2 = MjolnirLightning.NewLine(((Component)this).transform, "StormCore", width * 0.48f); int positionCount = (val2.positionCount = points.Length); val.positionCount = positionCount; bool useWorldSpace = (val2.useWorldSpace = true); val.useWorldSpace = useWorldSpace; val.SetPositions(points); val2.SetPositions(points); useWorldSpace = (((Renderer)val2).enabled = false); ((Renderer)val).enabled = useWorldSpace; Vector3 val3 = Vector3.Cross(normal, Vector3.forward); if (((Vector3)(ref val3)).sqrMagnitude < 0.1f) { val3 = Vector3.right; } ((Vector3)(ref val3)).Normalize(); Vector3 forward = Vector3.Cross(val3, normal); arcs.Add(new Arc { Glow = val, Core = val2, Shape = points, Points = (Vector3[])(object)new Vector3[points.Length], Delay = delay, Width = width, Ground = ground, Right = val3, Forward = forward }); } private void Flash(float value, float range) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) if (lights < 2) { flash = ((Component)this).gameObject.AddComponent<Light>(); flash.type = (LightType)2; flash.color = new Color(0.55f, 0.8f, 1f); flash.range = range; flash.intensity = value * Power * gain; flash.shadows = (LightShadows)0; ownsLight = true; lights++; } } internal static Material Soft() { //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Expected O, but got Unknown //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Expected O, but got Unknown //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) if (Object.op_Implicit((Object)(object)soft)) { return soft; } Shader val = Shader.Find("Sprites/Default"); if (!Object.op_Implicit((Object)(object)val)) { return null; } Texture2D val2 = new Texture2D(32, 32, (TextureFormat)4, false); Color32[] array = (Color32[])(object)new Color32[1024]; for (int i = 0; i < 32; i++) { for (int j = 0; j < 32; j++) { Vector2 val3 = new Vector2(((float)j - 15.5f) / 15.5f, ((float)i - 15.5f) / 15.5f); float magnitude = ((Vector2)(ref val3)).magnitude; array[i * 32 + j] = new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, (byte)(255f * Mathf.Pow(Mathf.Clamp01(1f - magnitude), 2f))); } } val2.SetPixels32(array); val2.Apply(false, true); soft = new Material(val) { mainTexture = (Texture)(object)val2, name = "Mjolnir_SoftSpark" }; return soft; } private void Particles(Vector3 p, Vector3 n, bool dust, int amount) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Expected O, but got Unknown //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) //IL_005e: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) //IL_015d: Unknown result type (might be due to invalid IL or missing references) //IL_0142: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_017d: Unknown result type (might be due to invalid IL or missing references) //IL_0188: Unknown result type (might be due to invalid IL or missing references) //IL_018d: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: 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_01e8: Unknown result type (might be due to invalid IL or missing references) //IL_01ed: 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_01fe: Expected O, but got Unknown //IL_0208: 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_0217: Unknown result type (might be due to invalid IL or missing references) //IL_021e: 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) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: 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_026d: Unknown result type (might be due to invalid IL or missing references) //IL_0278: Unknown result type (might be due to invalid IL or missing references) //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_02c5: Unknown result type (might be due to invalid IL or missing references) Material val = Soft(); if (Object.op_Implicit((Object)(object)val)) { GameObject val2 = new GameObject(dust ? "StormDust" : "StormSparks"); val2.transform.SetParent(((Component)this).transform, false); val2.transform.position = p + n * 0.1f; val2.transform.rotation = Quaternion.FromToRotation(Vector3.forward, n); ParticleSystem val3 = val2.AddComponent<ParticleSystem>(); val3.Stop(true, (ParticleSystemStopBehavior)0); MainModule main = val3.main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).duration = 0.1f; ((MainModule)(ref main)).maxParticles = amount; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).startLifetime = (dust ? new MinMaxCurve(0.4f, 0.8f) : new MinMaxCurve(0.12f, 0.36f)); ((MainModule)(ref main)).startSpeed = (dust ? new MinMaxCurve(0.2f, 0.8f) : new MinMaxCurve(3f, 8f)); ((MainModule)(ref main)).startSize = (dust ? new MinMaxCurve(0.2f, 0.5f) : new MinMaxCurve(0.035f, 0.065f)); ((MainModule)(ref main)).startColor = MinMaxGradient.op_Implicit(dust ? new Color(0.35f, 0.4f, 0.45f, 0.25f) : new Color(0.6f, 0.9f, 1f, 0.9f)); ((MainModule)(ref main)).gravityModifier = MinMaxCurve.op_Implicit(dust ? 0.1f : 1.1f); EmissionModule emission = val3.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(0f); ((EmissionModule)(ref emission)).SetBursts((Burst[])(object)new Burst[1] { new Burst(0f, (short)amount) }); ShapeModule shape = val3.shape; ((ShapeModule)(ref shape)).shapeType = (ParticleSystemShapeType)2; ((ShapeModule)(ref shape)).radius = (dust ? 0.8f : 0.15f); ColorOverLifetimeModule colorOverLifetime = val3.colorOverLifetime; ((ColorOverLifetimeModule)(ref colorOverLifetime)).enabled = true; Gradient val4 = new Gradient(); val4.SetKeys((GradientColorKey[])(object)new GradientColorKey[2] { new GradientColorKey(Color.white, 0f), new GradientColorKey(Color.white, 1f) }, (GradientAlphaKey[])(object)new GradientAlphaKey[2] { new GradientAlphaKey(1f, 0f), new GradientAlphaKey(0f, 1f) }); ((ColorOverLifetimeModule)(ref colorOverLifetime)).color = MinMaxGradient.op_Implicit(val4); SizeOverLifetimeModule sizeOverLifetime = val3.sizeOverLifetime; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).enabled = true; ((SizeOverLifetimeModule)(ref sizeOverLifetime)).size = new MinMaxCurve(1f, dust ? AnimationCurve.Linear(0f, 0.6f, 1f, 1.8f) : AnimationCurve.Linear(0f, 1f, 1f, 0f)); ParticleSystemRenderer component = val2.GetComponent<ParticleSystemRenderer>(); ((Renderer)component).sharedMaterial = val; if (!dust) { component.renderMode = (ParticleSystemRenderMode)1; component.lengthScale = 3f; component.velocityScale = 0.08f; } val3.Play(); } } private void Update() { //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_0231: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018a: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_01a8: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_01cf: 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) float num = Time.time - born; if (Object.op_Implicit((Object)(object)flash)) { flash.intensity = Mathf.Max(0f, 2f * Power * gain * (1f - num / 0.14f)); } if (Time.time < next) { return; } next = Time.time + (Full ? 0.04f : 0.065f); tick++; foreach (Arc arc in arcs) { float num2 = VfxRules.Fade(num - arc.Delay, arc.Ground ? 0.45f : 0.28f) * Power * gain; bool flag = num2 > 0.015f; LineRenderer core = arc.Core; bool enabled = (((Renderer)arc.Glow).enabled = flag); ((Renderer)core).enabled = enabled; if (flag) { for (int i = 0; i < arc.Points.Length; i++) { float num3 = (float)i / (float)(arc.Points.Length - 1); arc.Points[i] = arc.Shape[i] + (Vector3)(arc.Ground ? (arc.Right * Mathf.Sin((float)(i * 13 + tick * 3)) + arc.Forward * Mathf.Sin((float)(i * 9 + tick * 5))) : new Vector3(Mathf.Sin((float)(i * 13 + tick * 3)), 0f, Mathf.Sin((float)(i * 9 + tick * 5)))) * ((arc.Ground ? 0.018f : 0.1f) * Mathf.Sin(num3 * MathF.PI)); } arc.Glow.SetPositions(arc.Points); arc.Core.SetPositions(arc.Points); arc.Glow.startColor = new Color(0.12f, 0.48f, 1f, num2 * 0.45f); arc.Glow.endColor = new Color(0.08f, 0.25f, 0.8f, num2 * 0.06f); arc.Core.startColor = new Color(1.4f, 1.8f, 2.2f, num2); arc.Core.endColor = new Color(0.5f, 0.85f, 1f, num2 * 0.28f); } } } private void OnDestroy() { live = Mathf.Max(0, live - 1); if (ownsLight) { lights = Mathf.Max(0, lights - 1); } } public static void DrawSettings() { MjolnirPlugin active = MjolnirPlugin.Active; if (Object.op_Implicit((Object)(object)active)) { Init(active); GUILayout.Space(12f); GUILayout.Label(UiText.Text("EFEITOS DE TEMPESTADE"), Array.Empty<GUILayoutOption>()); quality.Value = GUILayout.Toolbar(quality.Value, new string[2] { UiText.Text("Leve"), UiText.Text("Completo") }, Array.Empty<GUILayoutOption>()); GUILayout.Label(UiText.Text("Intensidade visual: ") + intensity.Value.ToString(UiText.Text("0.0")), Array.Empty<GUILayoutOption>()); intensity.Value = GUILayout.HorizontalSlider(VfxRules.Intensity(intensity.Value), 0.4f, 1.6f, Array.Empty<GUILayoutOption>()); trails.Value = GUILayout.Toggle(trails.Value, UiText.Text("Rastro de energia no voo e arremesso"), Array.Empty<GUILayoutOption>()); GUILayout.Label(UiText.Text("Ajusta somente os efeitos; dano e recargas permanecem iguais."), Array.Empty<GUILayoutOption>()); } } } public sealed class StormTrail : MonoBehaviour { private MjolnirPlugin mod; private bool projectile; private LineRenderer glow; private LineRenderer core; private MeshRenderer source; private readonly List<Vector3> points = new List<Vector3>(10); private float next; private Vector3 previous; private bool hadPoint; public void Begin(MjolnirPlugin m, bool thrown) { mod = m; projectile = thrown; source = FindHead(((Component)this).transform); glow = MjolnirLightning.NewLine(((Component)this).transform, "HammerWakeGlow", 0.055f); core = MjolnirLightning.NewLine(((Component)this).transform, "HammerWakeCore", 0.012f); LineRenderer obj = glow; bool useWorldSpace = (core.useWorldSpace = true); obj.useWorldSpace = useWorldSpace; Hide(); } internal static MeshRenderer FindHead(Transform owner) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_0069: Unknown result type (might be due to invalid IL or missing references) Transform val = null; Transform[] componentsInChildren = ((Component)owner).GetComponentsInChildren<Transform>(true); foreach (Transform val2 in componentsInChildren) { if (((Object)val2).name == "MjolnirVisual") { val = val2; break; } } MeshRenderer result = null; if (Object.op_Implicit((Object)(object)val)) { float num = -1f; MeshRenderer[] componentsInChildren2 = ((Component)val).GetComponentsInChildren<MeshRenderer>(true); foreach (MeshRenderer val3 in componentsInChildren2) { Bounds bounds = ((Renderer)val3).bounds; Vector3 size = ((Bounds)(ref bounds)).size; float sqrMagnitude = ((Vector3)(ref size)).sqrMagnitude; if (sqrMagnitude > num) { num = sqrMagnitude; result = val3; } } } return result; } private void Hide() { points.Clear(); hadPoint = false; if (Object.op_Implicit((Object)(object)glow)) { ((Renderer)glow).enabled = false; } if (Object.op_Implicit((Object)(object)core)) { ((Renderer)core).enabled = false; } } private void LateUpdate() { //IL_0164: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Unknown result type (might be due to invalid IL or missing references) //IL_0148: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_0157: Unknown result type (might be due to invalid IL or missing references) //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_0179: Unknown result type (might be due to invalid IL or missing references) //IL_017e: Unknown result type (might be due to invalid IL or missing references) //IL_0187: Unknown result type (might be due to invalid IL or missing references) //IL_0189: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b1: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_0205: Unknown result type (might be due to invalid IL or missing references) //IL_02d2: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Unknown result type (might be due to invalid IL or missing references) //IL_038f: Unknown result type (might be due to invalid IL or missing references) //IL_03b3: Unknown result type (might be due to invalid IL or missing references) //IL_03d7: Unknown result type (might be due to invalid IL or missing references) if (!Object.op_Implicit((Object)(object)mod) || !StormVfx.TrailEnabled || !mod.LightningEnabled.Value) { Hide(); return; } Player localPlayer = Player.m_localPlayer; bool num; if (!projectile) { if (Object.op_Implicit((Object)(object)localPlayer) && (Object)(object)((Component)localPlayer).gameObject == (Object)(object)((Component)this).gameObject && mod.Wings.Active && !mod.Wings.EmergencyLanding) { num = !Object.op_Implicit((Object)(object)mod.Flight); goto IL_00c2; } } else if (Object.op_Implicit((Object)(object)mod.Flight)) { num = (Object)(object)((Component)mod.Flight).gameObject == (Object)(object)((Component)this).gameObject; goto IL_00c2; } goto IL_00d4; IL_00d4: Hide(); if (projectile || !mod.Wings.Active) { Object.Destroy((Object)(object)this); } return; IL_00c2: if (num && Object.op_Implicit((Object)(object)localPlayer) && !((Character)localPlayer).IsDead()) { if (Time.time < next) { return; } next = Time.time + 0.025f; ? val; if (!Object.op_Implicit((Object)(object)source) || !((Renderer)source).enabled) { val = (projectile ? ((Component)this).transform.position : (((Character)localPlayer).GetCenterPoint() + ((Component)localPlayer).transform.forward * 0.65f)); } else { Bounds bounds = ((Renderer)source).bounds; val = ((Bounds)(ref bounds)).center; } Vector3 val2 = (Vector3)val; if (hadPoint && VfxRules.Teleport(Vector3.Distance(val2, previous))) { Hide(); } float num2 = (hadPoint ? (Vector3.Distance(val2, previous) / 0.025f) : 0f); previous = val2; hadPoint = true; if (num2 < 4f) { if (points.Count > 0) { points.RemoveAt(points.Count - 1); } } else { points.Insert(0, val2); if (points.Count > (StormVfx.Full ? 9 : 6)) { points.RemoveAt(points.Count - 1); } } if (points.Count < 2) { if (Object.op_Implicit((Object)(object)glow)) { ((Renderer)glow).enabled = false; } if (Object.op_Implicit((Object)(object)core)) { ((Renderer)core).enabled = false; } return; } LineRenderer obj = glow; bool enabled = (((Renderer)core).enabled = true); ((Renderer)obj).enabled = enabled; LineRenderer obj2 = glow; int positionCount = (core.positionCount = points.Count); obj2.positionCount = positionCount; for (int i = 0; i < points.Count; i++) { glow.SetPosition(i, points[i]); core.SetPosition(i, points[i]); } glow.startWidth = 0.055f * StormVfx.Power; glow.endWidth = 0f; core.startWidth = 0.013f; core.endWidth = 0f; glow.startColor = new Color(0.12f, 0.5f, 1f, 0.38f); glow.endColor = new Color(0.05f, 0.15f, 0.6f, 0f); core.startColor = new Color(1.2f, 1.7f, 2f, 0.85f); core.endColor = new Color(0.3f, 0.6f, 1f, 0f); return; } goto IL_00d4; } private void OnDestroy() { if (Object.op_Implicit((Object)(object)glow)) { Object.Destroy((Object)(object)((Component)glow).gameObject); } if (Object.op_Implicit((Object)(object)core)) { Object.Destroy((Object)(object)((Component)core).gameObject); } } } public static class VfxRules { public static float Fade(float age, float life) { if (float.IsNaN(age) || float.IsInfinity(age) || life <= 0f || age < 0f) { return 0f; } float num = Math.Max(0f, Math.Min(1f, age / life)); return Math.Min(1f, num / 0.08f) * (float)Math.Pow(1f - num, 1.399999976158142); } public static float Intensity(float value) { if (float.IsNaN(value) || float.IsInfinity(value)) { return 1f; } return Math.Max(0.4f, Math.Min(1.6f, value)); } public static bool Teleport(float distance) { if (!(distance > 12f) && !float.IsNaN(distance)) { return float.IsInfinity(distance); } return true; } } public static class UiText { [Serializable] public class Entry { public string original; public string translation; } [Serializable] public class Catalog { public Entry[] entries; } private static ConfigEntry<string> language; private static MjolnirPlugin configured; private static string loaded; private static readonly Dictionary<string, string> words = new Dictionary<string, string>(StringComparer.Ordinal); private static void Init() { //IL_0064: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Expected O, but got Unknown MjolnirPlugin active = MjolnirPlugin.Active; if (Object.op_Implicit((Object)(object)active) && !((Object)(object)configured == (Object)(object)active)) { configured = active; language = ((BaseUnityPlugin)active).Config.Bind<string>("General", "Language", "Auto", new ConfigDescriptio