using System; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; 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 Microsoft.CodeAnalysis; using UnityEngine; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")] [assembly: AssemblyCompany("Metalbound")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("0.20.3.0")] [assembly: AssemblyInformationalVersion("0.20.3")] [assembly: AssemblyProduct("Metalbound")] [assembly: AssemblyTitle("Metalbound")] [assembly: AssemblyVersion("0.20.3.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace Metalbound { [BepInPlugin("com.keeto.valheim.metalbound", "Metalbound", "0.20.3")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { private enum MetalType { Iron, Steel, Pewter, Tin, Copper, Combined } private enum AllomancerType { Unawakened, IronMisting, SteelMisting, PewterMisting, TinMisting, CopperMisting, Mistborn } private enum CoinshotAmmoType { Coin, BronzeNail, IronNail } [HarmonyPatch(typeof(Player), "PlayerAttackInput")] private static class PlayerAttackInputPatch { private static bool Prefix(Player __instance) { return !ShouldBlockVanillaAttacks(__instance); } } [HarmonyPatch(typeof(Character), "UpdateGroundContact")] private static class LandingRollGroundContactPatch { private static void Prefix(Character __instance) { if (!((Object)(object)Instance == (Object)null) && !((Object)(object)__instance != (Object)(object)Player.m_localPlayer) && !(GroundContactField == null) && (bool)GroundContactField.GetValue(__instance)) { Instance.ActivateBufferedLandingRoll(Player.m_localPlayer); } } } [HarmonyPatch(typeof(Player), "ConsumeItem")] private static class ConsumeTincturePatch { private static bool Prefix(Player __instance, ItemData item, ref bool __result) { if (IsLerasium(item) && (Object)(object)Instance != (Object)null && (Object)(object)__instance == (Object)(object)Player.m_localPlayer) { Instance.EnsureAllomancerTypeLoaded(__instance); if (Instance.allomancerType == AllomancerType.Mistborn) { ShowCenterMessage("You are already Mistborn."); __result = false; return false; } return true; } MetalType? consumableMetal = GetConsumableMetal(item); if (!consumableMetal.HasValue || (Object)(object)Instance == (Object)null || (Object)(object)__instance != (Object)(object)Player.m_localPlayer) { return true; } Instance.EnsureAllomancerTypeLoaded(__instance); if (consumableMetal.Value != MetalType.Combined && !Instance.HasMetalAccess(consumableMetal.Value)) { ShowCenterMessage(consumableMetal.Value.ToString() + " is not one of your Allomantic metals."); __result = false; return false; } if (consumableMetal.Value == MetalType.Combined && Instance.allomancerType == AllomancerType.Unawakened) { ShowCenterMessage("You have not awakened Allomancy."); __result = false; return false; } Instance.EnsureReserveLoaded(__instance); if (!((consumableMetal.Value == MetalType.Combined) ? Instance.AllReservesFull() : (Instance.GetReserve(consumableMetal.Value) >= Instance.maximumReserve.Value - 0.01f))) { return true; } ShowCenterMessage((consumableMetal.Value == MetalType.Combined) ? "All metal reserves are already full." : (consumableMetal.Value.ToString() + " reserve is already full.")); __result = false; return false; } private static void Postfix(Player __instance, ItemData item, bool __result) { if (__result && IsLerasium(item) && (Object)(object)Instance != (Object)null && (Object)(object)__instance == (Object)(object)Player.m_localPlayer) { Instance.BeginLerasiumAscension(__instance); return; } MetalType? consumableMetal = GetConsumableMetal(item); if (__result && consumableMetal.HasValue && (Object)(object)Instance != (Object)null && (Object)(object)__instance == (Object)(object)Player.m_localPlayer) { Instance.EnsureReserveLoaded(__instance); Instance.RestoreReserve(consumableMetal.Value); } } } [HarmonyPatch(typeof(Player), "OnDeath")] private static class AllomanticDeathPatch { private static void Prefix(Player __instance) { if ((Object)(object)Instance != (Object)null && (Object)(object)__instance == (Object)(object)Player.m_localPlayer) { Instance.HandleAllomanticDeath(__instance); } } } [HarmonyPatch(typeof(Container), "AddDefaultItems")] private static class LerasiumChestLootPatch { private static void Postfix(Container __instance) { if ((Object)(object)Instance == (Object)null || (Object)(object)ObjectDB.instance == (Object)null || Random.value > Instance.lerasiumChestChance.Value) { return; } string text = ((Object)__instance).name.ToLowerInvariant(); if (!text.Contains("chest") && !text.Contains("treasure")) { return; } ZNetView component = ((Component)__instance).GetComponent(); if (!((Object)(object)component != (Object)null) || !component.IsValid() || component.IsOwner()) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("MetalboundLerasiumNugget"); Inventory inventory = __instance.GetInventory(); if ((Object)(object)itemPrefab != (Object)null && inventory != null && inventory.AddItem(itemPrefab, 1)) { ((BaseUnityPlugin)Instance).Logger.LogInfo((object)("Added a Lerasium Bead to " + ((Object)__instance).name + ".")); } } } } [HarmonyPatch(typeof(Player), "GetRunSpeedFactor")] private static class PewterRunSpeedPatch { private static void Postfix(Player __instance, ref float __result) { if ((Object)(object)Instance != (Object)null && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && Instance.IsPewterActive()) { __result *= 1f + Instance.pewterRunSpeedBonus.Value * Instance.GetPewterBonusMultiplier(); } } } [HarmonyPatch(typeof(Player), "GetStealthFactor")] private static class CoppercloudStealthPatch { private static void Postfix(Player __instance, ref float __result) { if ((Object)(object)Instance != (Object)null && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && Instance.IsCopperActive()) { __result *= Instance.GetCopperVisibilityMultiplier(); } } } [HarmonyPatch(typeof(Player), "GetJogSpeedFactor")] private static class PewterJogSpeedPatch { private static void Postfix(Player __instance, ref float __result) { if ((Object)(object)Instance != (Object)null && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && Instance.IsPewterActive()) { __result *= 1f + Instance.pewterRunSpeedBonus.Value * Instance.GetPewterBonusMultiplier(); } } } [HarmonyPatch(typeof(Player), "UseStamina")] private static class PewterStaminaPatch { private static void Prefix(Player __instance, ref float v) { if ((Object)(object)Instance != (Object)null && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && Instance.IsPewterActive()) { float num = Mathf.Clamp(Instance.pewterStaminaReduction.Value * Instance.GetPewterBonusMultiplier(), 0f, 0.9f); v *= 1f - num; } } } [HarmonyPatch(typeof(Player), "GetMaxCarryWeight")] private static class PewterCarryWeightPatch { private static void Postfix(Player __instance, ref float __result) { if ((Object)(object)Instance != (Object)null && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && Instance.IsPewterActive()) { __result += Instance.pewterCarryWeightBonus.Value * Instance.GetPewterBonusMultiplier(); } } } [HarmonyPatch(typeof(Character), "Jump")] private static class PewterJumpPatch { private static void Prefix(Character __instance, ref float ___m_jumpForce, out float __state) { __state = ___m_jumpForce; if ((Object)(object)Instance != (Object)null && (Object)(object)__instance == (Object)(object)Player.m_localPlayer && Instance.IsPewterActive()) { ___m_jumpForce *= 1f + Instance.pewterJumpBonus.Value * Instance.GetPewterBonusMultiplier(); } } private static void Postfix(ref float ___m_jumpForce, float __state) { ___m_jumpForce = __state; } } [HarmonyPatch(typeof(Character), "Damage")] private static class PewterPhysicalDamagePatch { private static void Prefix(Character __instance, HitData hit) { //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Invalid comparison between Unknown and I4 if ((Object)(object)Instance == (Object)null || hit == null) { return; } Character attacker = hit.GetAttacker(); bool flag = (Object)(object)__instance == (Object)(object)Player.m_localPlayer && Instance.IsPewterActive() && (int)hit.m_hitType == 3 && hit.m_damage.m_damage > 0f; Instance.ApplyLandingRollDamageReduction(__instance, hit); if (flag) { float num = Mathf.Clamp(Instance.pewterFallDamageReduction.Value * Instance.GetPewterBonusMultiplier(), 0f, 0.95f); hit.m_damage.m_damage *= 1f - num; } if ((Object)(object)attacker == (Object)(object)Player.m_localPlayer && Instance.IsPewterActive()) { ScalePhysicalDamage(hit, 1f + Instance.pewterMeleeDamageBonus.Value * Instance.GetPewterBonusMultiplier()); } if ((Object)(object)__instance == (Object)(object)Player.m_localPlayer && Instance.IsPewterActive()) { float num2 = Mathf.Clamp(Instance.pewterPoisonResistance.Value * Instance.GetPewterBonusMultiplier(), 0f, 0.95f); hit.m_damage.m_poison *= 1f - num2; if (!flag) { float num3 = Mathf.Clamp(Instance.pewterPhysicalResistance.Value * Instance.GetPewterBonusMultiplier(), 0f, 0.9f); ScalePhysicalDamage(hit, 1f - num3); } float num4 = Mathf.Clamp(Instance.pewterKnockbackResistance.Value * Instance.GetPewterBonusMultiplier(), 0f, 0.95f); hit.m_pushForce *= 1f - num4; } } } public const string PluginGuid = "com.keeto.valheim.metalbound"; public const string PluginName = "Metalbound"; public const string PluginVersion = "0.20.3"; private const string ReserveDataKey = "com.keeto.valheim.metalbound.reserve"; private const string TincturePrefabName = "MetalboundTincture"; private const string IronVialPrefabName = "MetalboundIronVial"; private const string SteelVialPrefabName = "MetalboundSteelVial"; private const string PewterVialPrefabName = "MetalboundPewterVial"; private const string TinVialPrefabName = "MetalboundTinVial"; private const string CopperVialPrefabName = "MetalboundCopperVial"; private const string LerasiumPrefabName = "MetalboundLerasiumNugget"; private const string AllomancerTypeDataKey = "com.keeto.valheim.metalbound.allomancer_type"; private const string LerasiumPendingDataKey = "com.keeto.valheim.metalbound.lerasium_pending"; private const string LerasiumRespawnMessageDataKey = "com.keeto.valheim.metalbound.lerasium_respawn_message"; private const string IronReserveDataKey = "com.keeto.valheim.metalbound.reserve.iron"; private const string SteelReserveDataKey = "com.keeto.valheim.metalbound.reserve.steel"; private const string PewterReserveDataKey = "com.keeto.valheim.metalbound.reserve.pewter"; private const string TinReserveDataKey = "com.keeto.valheim.metalbound.reserve.tin"; private const string CopperReserveDataKey = "com.keeto.valheim.metalbound.reserve.copper"; private static readonly FieldInfo MaxAirAltitudeField = typeof(Character).GetField("m_maxAirAltitude", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly MethodInfo DodgeMethod = typeof(Player).GetMethod("Dodge", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic, null, new Type[1] { typeof(Vector3) }, null); private static readonly FieldInfo GroundContactField = typeof(Character).GetField("m_groundContact", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static readonly string[] DefaultMetalTokens = new string[11] { "copper", "tin", "bronze", "iron", "silver", "black metal", "blackmetal", "flametal", "metal", "chain", "coin" }; private ConfigEntry modeKey; private ConfigEntry pushKey; private ConfigEntry pullKey; private ConfigEntry throwCoinKey; private ConfigEntry coinshotKey; private ConfigEntry refillReserveKey; private ConfigEntry metalWheelKey; private ConfigEntry tinFocusKey; private ConfigEntry flareKey; private ConfigEntry targetRange; private ConfigEntry acceleration; private ConfigEntry maximumSpeed; private ConfigEntry coinThrowSpeed; private ConfigEntry coinshotSpeed; private ConfigEntry coinshotDamage; private ConfigEntry bronzeNailDamage; private ConfigEntry ironNailDamage; private ConfigEntry coinshotLifetime; private ConfigEntry coinshotCooldown; private ConfigEntry maximumReserve; private ConfigEntry startingReserve; private ConfigEntry metalSightDrain; private ConfigEntry lockedTargetDrain; private ConfigEntry pushPullDrain; private ConfigEntry coinshotReserveCost; private ConfigEntry pewterDrain; private ConfigEntry tinDrain; private ConfigEntry copperDrain; private ConfigEntry copperVisibilityMultiplier; private ConfigEntry tinVisionRange; private ConfigEntry tinVisionIntensity; private ConfigEntry tinEnemySenseRange; private ConfigEntry tinEnemySenseLimit; private ConfigEntry tinEnemyGlowScale; private ConfigEntry tinFocusZoom; private ConfigEntry tinProjectileSenseRange; private ConfigEntry flarePowerMultiplier; private ConfigEntry flarePewterMultiplier; private ConfigEntry flareTinMultiplier; private ConfigEntry flareDrainMultiplier; private ConfigEntry pewterRunSpeedBonus; private ConfigEntry pewterJumpBonus; private ConfigEntry pewterStaminaReduction; private ConfigEntry pewterMeleeDamageBonus; private ConfigEntry pewterPhysicalResistance; private ConfigEntry pewterCarryWeightBonus; private ConfigEntry pewterKnockbackResistance; private ConfigEntry pewterFallDamageReduction; private ConfigEntry pewterPoisonResistance; private ConfigEntry showReserveBar; private ConfigEntry soundsEnabled; private ConfigEntry soundVolume; private ConfigEntry windEffectEnabled; private ConfigEntry windEffectIntensity; private ConfigEntry looseCoinFlightSpeed; private ConfigEntry coinBraceDistance; private ConfigEntry safeDescentSpeed; private ConfigEntry fallProtectionGrace; private ConfigEntry landingRollGroundWindow; private ConfigEntry landingRollInputBuffer; private ConfigEntry landingRollFullReductionHeight; private ConfigEntry landingRollBaseReduction; private ConfigEntry landingRollStepDistance; private ConfigEntry landingRollStepReduction; private ConfigEntry landingRollMinimumReduction; private ConfigEntry mistingChanceOnDeath; private ConfigEntry lerasiumChestChance; private ConfigEntry targetingConeDegrees; private ConfigEntry maximumVisibleLines; private ConfigEntry lineChestOffset; private ConfigEntry extraMetalTokens; private LineRenderer anchorLine; private readonly List ambientLines = new List(); private readonly List sensedTinEnemies = new List(); private readonly List sensedIncomingProjectiles = new List(); private Material lineMaterial; private ParticleSystem windParticles; private Material windMaterial; private Transform currentAnchor; private Transform lockedAnchor; private bool wasPushHeld; private bool wasPullHeld; private float lastUpwardAssistTime = float.NegativeInfinity; private float ironReserve; private float steelReserve; private float pewterReserve; private float tinReserve; private float copperReserve; private float lastReserveSaveTime; private float lastEmptyMessageTime = float.NegativeInfinity; private float lastCoinshotTime = float.NegativeInfinity; private bool landingRollArmed; private float landingRollExpiresAt = float.NegativeInfinity; private float armedLandingRollReduction; private bool landingRollRequested; private float landingRollRequestExpiresAt = float.NegativeInfinity; private Player reserveOwner; private Player allomancerOwner; private Player awakeningMessageOwner; private float awakeningMessageReadyTime = float.PositiveInfinity; private AllomancerType allomancerType; private bool reserveDirty; private bool steelBurning = true; private bool ironBurning = true; private bool pewterBurning; private bool tinBurning; private bool copperBurning; private GameObject tinVisionObject; private GameObject tinDemisterObject; private StatusEffect tinFinderEffect; private bool tinFinderAdded; private Camera tinFocusCamera; private float tinFocusBaseFov; private bool tinFocusActive; private CoinshotAmmoType selectedCoinshotAmmo; private bool metalWheelWasHeld; private Texture2D metalWheelTexture; private Texture2D tinSenseGlowTexture; private Vector2 metalWheelSelector; private readonly HashSet missingSoundPrefabs = new HashSet(); private Harmony harmony; internal static Plugin Instance { get; private set; } private void Awake() { //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_007f: 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_00d7: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d7: Expected O, but got Unknown //IL_020b: Unknown result type (might be due to invalid IL or missing references) //IL_0215: Expected O, but got Unknown //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Expected O, but got Unknown //IL_0287: Unknown result type (might be due to invalid IL or missing references) //IL_0291: Expected O, but got Unknown //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Expected O, but got Unknown //IL_0303: Unknown result type (might be due to invalid IL or missing references) //IL_030d: Expected O, but got Unknown //IL_0341: Unknown result type (might be due to invalid IL or missing references) //IL_034b: Expected O, but got Unknown //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Expected O, but got Unknown //IL_03bd: Unknown result type (might be due to invalid IL or missing references) //IL_03c7: Expected O, but got Unknown //IL_03fb: Unknown result type (might be due to invalid IL or missing references) //IL_0405: Expected O, but got Unknown //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Expected O, but got Unknown //IL_0477: Unknown result type (might be due to invalid IL or missing references) //IL_0481: Expected O, but got Unknown //IL_04b5: Unknown result type (might be due to invalid IL or missing references) //IL_04bf: Expected O, but got Unknown //IL_04e9: Unknown result type (might be due to invalid IL or missing references) //IL_04f3: Expected O, but got Unknown //IL_0527: Unknown result type (might be due to invalid IL or missing references) //IL_0531: Expected O, but got Unknown //IL_0565: Unknown result type (might be due to invalid IL or missing references) //IL_056f: Expected O, but got Unknown //IL_05a3: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Expected O, but got Unknown //IL_05e1: Unknown result type (might be due to invalid IL or missing references) //IL_05eb: Expected O, but got Unknown //IL_061f: Unknown result type (might be due to invalid IL or missing references) //IL_0629: Expected O, but got Unknown //IL_065d: Unknown result type (might be due to invalid IL or missing references) //IL_0667: Expected O, but got Unknown //IL_069b: Unknown result type (might be due to invalid IL or missing references) //IL_06a5: Expected O, but got Unknown //IL_06d9: Unknown result type (might be due to invalid IL or missing references) //IL_06e3: Expected O, but got Unknown //IL_0717: Unknown result type (might be due to invalid IL or missing references) //IL_0721: Expected O, but got Unknown //IL_0755: Unknown result type (might be due to invalid IL or missing references) //IL_075f: Expected O, but got Unknown //IL_0793: Unknown result type (might be due to invalid IL or missing references) //IL_079d: Expected O, but got Unknown //IL_07d1: Unknown result type (might be due to invalid IL or missing references) //IL_07db: Expected O, but got Unknown //IL_080f: Unknown result type (might be due to invalid IL or missing references) //IL_0819: Expected O, but got Unknown //IL_084d: Unknown result type (might be due to invalid IL or missing references) //IL_0857: Expected O, but got Unknown //IL_088b: Unknown result type (might be due to invalid IL or missing references) //IL_0895: Expected O, but got Unknown //IL_08c9: Unknown result type (might be due to invalid IL or missing references) //IL_08d3: Expected O, but got Unknown //IL_0949: Unknown result type (might be due to invalid IL or missing references) //IL_0953: Expected O, but got Unknown //IL_09a8: Unknown result type (might be due to invalid IL or missing references) //IL_09b2: Expected O, but got Unknown //IL_09e6: Unknown result type (might be due to invalid IL or missing references) //IL_09f0: Expected O, but got Unknown //IL_0a24: Unknown result type (might be due to invalid IL or missing references) //IL_0a2e: Expected O, but got Unknown //IL_0a62: Unknown result type (might be due to invalid IL or missing references) //IL_0a6c: Expected O, but got Unknown //IL_0aa0: Unknown result type (might be due to invalid IL or missing references) //IL_0aaa: Expected O, but got Unknown //IL_0ade: Unknown result type (might be due to invalid IL or missing references) //IL_0ae8: Expected O, but got Unknown //IL_0b1c: Unknown result type (might be due to invalid IL or missing references) //IL_0b26: Expected O, but got Unknown //IL_0b5a: Unknown result type (might be due to invalid IL or missing references) //IL_0b64: Expected O, but got Unknown //IL_0b98: Unknown result type (might be due to invalid IL or missing references) //IL_0ba2: Expected O, but got Unknown //IL_0bd6: Unknown result type (might be due to invalid IL or missing references) //IL_0be0: Expected O, but got Unknown //IL_0c14: Unknown result type (might be due to invalid IL or missing references) //IL_0c1e: Expected O, but got Unknown //IL_0c52: Unknown result type (might be due to invalid IL or missing references) //IL_0c5c: Expected O, but got Unknown //IL_0c90: Unknown result type (might be due to invalid IL or missing references) //IL_0c9a: Expected O, but got Unknown //IL_0cce: Unknown result type (might be due to invalid IL or missing references) //IL_0cd8: Expected O, but got Unknown //IL_0d0c: Unknown result type (might be due to invalid IL or missing references) //IL_0d16: Expected O, but got Unknown //IL_0d4a: Unknown result type (might be due to invalid IL or missing references) //IL_0d54: Expected O, but got Unknown //IL_0d88: Unknown result type (might be due to invalid IL or missing references) //IL_0d92: Expected O, but got Unknown //IL_0dc6: Unknown result type (might be due to invalid IL or missing references) //IL_0dd0: Expected O, but got Unknown //IL_0e04: Unknown result type (might be due to invalid IL or missing references) //IL_0e0e: Expected O, but got Unknown //IL_0e42: Unknown result type (might be due to invalid IL or missing references) //IL_0e4c: Expected O, but got Unknown //IL_0e80: Unknown result type (might be due to invalid IL or missing references) //IL_0e8a: Expected O, but got Unknown //IL_0ebe: Unknown result type (might be due to invalid IL or missing references) //IL_0ec8: Expected O, but got Unknown //IL_0efc: Unknown result type (might be due to invalid IL or missing references) //IL_0f06: Expected O, but got Unknown //IL_0f3a: Unknown result type (might be due to invalid IL or missing references) //IL_0f44: Expected O, but got Unknown //IL_0f78: Unknown result type (might be due to invalid IL or missing references) //IL_0f82: Expected O, but got Unknown //IL_0faf: Unknown result type (might be due to invalid IL or missing references) //IL_0fb9: Expected O, but got Unknown //IL_0fed: Unknown result type (might be due to invalid IL or missing references) //IL_0ff7: Expected O, but got Unknown Instance = this; modeKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "Allomancy mode", new KeyboardShortcut((KeyCode)308, Array.Empty()), "Hold this key to reveal and use metal anchors."); pushKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "Push", new KeyboardShortcut((KeyCode)323, Array.Empty()), "Push away from the selected metal anchor while Allomancy mode is held."); pullKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "Pull", new KeyboardShortcut((KeyCode)324, Array.Empty()), "Pull toward the selected metal anchor while Allomancy mode is held."); throwCoinKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "Throw coin", new KeyboardShortcut((KeyCode)103, Array.Empty()), "Throw one coin as a temporary metal anchor."); coinshotKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "Coinshot", new KeyboardShortcut((KeyCode)114, Array.Empty()), "While Allomancy mode is held, fire one selected ammunition item as a damaging projectile."); refillReserveKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "Refill metal reserve", new KeyboardShortcut((KeyCode)118, Array.Empty()), "Consume one Allomantic Tincture from inventory to refill all accessible reserves."); metalWheelKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "Metal wheel", new KeyboardShortcut((KeyCode)113, Array.Empty()), "Hold to open the wheel, then click an unlocked metal to toggle it."); tinFocusKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "Tin focus", new KeyboardShortcut((KeyCode)122, Array.Empty()), "Hold while burning Tin to focus and zoom your vision."); flareKey = ((BaseUnityPlugin)this).Config.Bind("Controls", "Flare metals", new KeyboardShortcut((KeyCode)301, Array.Empty()), "Hold to flare every currently burning accessible metal."); maximumReserve = ((BaseUnityPlugin)this).Config.Bind("Reserve", "Maximum reserve (base)", 120f, new ConfigDescription("Maximum amount of metal reserve.", (AcceptableValueBase)(object)new AcceptableValueRange(10f, 1000f), Array.Empty())); startingReserve = ((BaseUnityPlugin)this).Config.Bind("Reserve", "Starting reserve (new characters)", 120f, new ConfigDescription("Reserve given the first time Metalbound stores data on a character.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1000f), Array.Empty())); metalSightDrain = ((BaseUnityPlugin)this).Config.Bind("Reserve", "Metal sight drain per second", 0.25f, new ConfigDescription("Reserve burned per second while metal lines are active.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); lockedTargetDrain = ((BaseUnityPlugin)this).Config.Bind("Reserve", "Locked target drain per second", 0.1f, new ConfigDescription("Additional reserve burned per second while an anchor is locked.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); pushPullDrain = ((BaseUnityPlugin)this).Config.Bind("Reserve", "Push pull drain per second", 4f, new ConfigDescription("Reserve burned per second while Push or Pull applies force.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); coinshotReserveCost = ((BaseUnityPlugin)this).Config.Bind("Reserve", "Coinshot reserve cost", 6f, new ConfigDescription("Reserve burned by each Coinshot in addition to its ammunition.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1000f), Array.Empty())); pewterDrain = ((BaseUnityPlugin)this).Config.Bind("Pewter", "Reserve drain per second", 1.5f, new ConfigDescription("Pewter reserve burned continuously while Pewter is active.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); tinDrain = ((BaseUnityPlugin)this).Config.Bind("Tin", "Reserve drain per second", 0.25f, new ConfigDescription("Tin reserve burned continuously while enhanced senses are active.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); copperDrain = ((BaseUnityPlugin)this).Config.Bind("Copper", "Reserve drain per second", 0.4f, new ConfigDescription("Copper reserve burned continuously while the Coppercloud is active.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); copperVisibilityMultiplier = ((BaseUnityPlugin)this).Config.Bind("Copper", "Enemy visibility multiplier", 0.35f, new ConfigDescription("Multiplier applied to enemy detection visibility while burning Copper.", (AcceptableValueBase)(object)new AcceptableValueRange(0.05f, 1f), Array.Empty())); tinVisionRange = ((BaseUnityPlugin)this).Config.Bind("Tin", "Vision range", 18f, new ConfigDescription("Range of the local low-light vision effect while burning Tin.", (AcceptableValueBase)(object)new AcceptableValueRange(2f, 40f), Array.Empty())); tinVisionIntensity = ((BaseUnityPlugin)this).Config.Bind("Tin", "Vision intensity", 0.8f, new ConfigDescription("Brightness of the local low-light vision effect while burning Tin.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 3f), Array.Empty())); tinEnemySenseRange = ((BaseUnityPlugin)this).Config.Bind("Tin", "Enemy sense range", 30f, new ConfigDescription("Range at which burning Tin reveals nearby hostile creatures.", (AcceptableValueBase)(object)new AcceptableValueRange(5f, 80f), Array.Empty())); tinEnemySenseLimit = ((BaseUnityPlugin)this).Config.Bind("Tin", "Enemy sense limit", 12, new ConfigDescription("Maximum nearby hostile creatures shown by Tin senses.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 40), Array.Empty())); tinEnemyGlowScale = ((BaseUnityPlugin)this).Config.Bind("Tin", "Enemy glow scale", 1.6f, new ConfigDescription("Size multiplier for Tin's through-wall enemy sensory glows.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 4f), Array.Empty())); tinFocusZoom = ((BaseUnityPlugin)this).Config.Bind("Tin", "Focus zoom", 0.55f, new ConfigDescription("Field-of-view multiplier while holding Tin Focus.", (AcceptableValueBase)(object)new AcceptableValueRange(0.25f, 0.95f), Array.Empty())); tinProjectileSenseRange = ((BaseUnityPlugin)this).Config.Bind("Tin", "Projectile sense range", 25f, new ConfigDescription("Range at which burning Tin warns about incoming projectiles.", (AcceptableValueBase)(object)new AcceptableValueRange(5f, 80f), Array.Empty())); flarePowerMultiplier = ((BaseUnityPlugin)this).Config.Bind("Flaring", "Iron and Steel force multiplier", 1.6f, new ConfigDescription("Push and Pull force multiplier while flaring.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 4f), Array.Empty())); flarePewterMultiplier = ((BaseUnityPlugin)this).Config.Bind("Flaring", "Pewter bonus multiplier", 1.75f, new ConfigDescription("Multiplier applied to Pewter bonuses while flaring.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 4f), Array.Empty())); flareTinMultiplier = ((BaseUnityPlugin)this).Config.Bind("Flaring", "Tin senses multiplier", 1.5f, new ConfigDescription("Multiplier applied to Tin vision and awareness ranges while flaring.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 4f), Array.Empty())); flareDrainMultiplier = ((BaseUnityPlugin)this).Config.Bind("Flaring", "Reserve drain multiplier", 3.5f, new ConfigDescription("Multiplier applied to reserve consumption while flaring.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 10f), Array.Empty())); pewterRunSpeedBonus = ((BaseUnityPlugin)this).Config.Bind("Pewter", "Run speed bonus", 0.3f, new ConfigDescription("Fractional run and jog speed bonus while burning Pewter.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); pewterJumpBonus = ((BaseUnityPlugin)this).Config.Bind("Pewter", "Jump height bonus", 0.15f, new ConfigDescription("Fractional jump-force bonus while burning Pewter.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); pewterStaminaReduction = ((BaseUnityPlugin)this).Config.Bind("Pewter", "Stamina use reduction", 0.2f, new ConfigDescription("Fractional reduction to stamina costs while burning Pewter.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 0.9f), Array.Empty())); pewterMeleeDamageBonus = ((BaseUnityPlugin)this).Config.Bind("Pewter", "Physical damage bonus", 0.15f, new ConfigDescription("Fractional bonus to physical damage dealt while burning Pewter.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 2f), Array.Empty())); pewterPhysicalResistance = ((BaseUnityPlugin)this).Config.Bind("Pewter", "Physical damage resistance", 0.15f, new ConfigDescription("Fraction of incoming physical damage prevented while burning Pewter.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 0.9f), Array.Empty())); pewterCarryWeightBonus = ((BaseUnityPlugin)this).Config.Bind("Pewter", "Carry weight bonus", 75f, new ConfigDescription("Additional carry weight while burning Pewter.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1000f), Array.Empty())); pewterKnockbackResistance = ((BaseUnityPlugin)this).Config.Bind("Pewter", "Knockback resistance", 0.3f, new ConfigDescription("Fraction of incoming knockback prevented while burning Pewter.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 0.9f), Array.Empty())); pewterFallDamageReduction = ((BaseUnityPlugin)this).Config.Bind("Pewter", "Fall damage reduction", 0.65f, new ConfigDescription("Fraction of fall damage prevented while burning Pewter.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); pewterPoisonResistance = ((BaseUnityPlugin)this).Config.Bind("Pewter", "Poison damage resistance", 0.75f, new ConfigDescription("Fraction of poison damage prevented while burning Pewter.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 0.95f), Array.Empty())); showReserveBar = ((BaseUnityPlugin)this).Config.Bind("Reserve", "Show reserve bar", true, "Show the reserve bar while Metalbound mode is active or the reserve is not full."); soundsEnabled = ((BaseUnityPlugin)this).Config.Bind("Audio", "Enable sounds", true, "Play Metalbound feedback using referenced vanilla Valheim sound prefabs."); soundVolume = ((BaseUnityPlugin)this).Config.Bind("Audio", "Sound volume", 0.55f, new ConfigDescription("Volume multiplier applied to Metalbound sound cues.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); windEffectEnabled = ((BaseUnityPlugin)this).Config.Bind("Visuals", "Enable movement wind", true, "Show wind streaks while Push or Pull moves the player."); windEffectIntensity = ((BaseUnityPlugin)this).Config.Bind("Visuals", "Movement wind intensity", 0.1014084f, new ConfigDescription("Density of the Push/Pull wind streaks.", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 3f), Array.Empty())); targetRange = ((BaseUnityPlugin)this).Config.Bind("Movement", "Target range", 40f, new ConfigDescription("Maximum metal-anchor range in metres.", (AcceptableValueBase)(object)new AcceptableValueRange(5f, 100f), Array.Empty())); acceleration = ((BaseUnityPlugin)this).Config.Bind("Movement", "Acceleration", 28f, new ConfigDescription("Push/pull acceleration.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 100f), Array.Empty())); maximumSpeed = ((BaseUnityPlugin)this).Config.Bind("Movement", "Maximum speed", 24f, new ConfigDescription("Velocity cap while using Allomancy.", (AcceptableValueBase)(object)new AcceptableValueRange(5f, 60f), Array.Empty())); coinThrowSpeed = ((BaseUnityPlugin)this).Config.Bind("Movement", "Coin throw speed", 18f, new ConfigDescription("Initial speed of a thrown coin.", (AcceptableValueBase)(object)new AcceptableValueRange(3f, 40f), Array.Empty())); coinshotSpeed = ((BaseUnityPlugin)this).Config.Bind("Combat", "Coinshot speed", 80f, new ConfigDescription("Initial speed of a fired coin projectile.", (AcceptableValueBase)(object)new AcceptableValueRange(10f, 200f), Array.Empty())); coinshotDamage = ((BaseUnityPlugin)this).Config.Bind("Combat", "Coinshot damage", 10f, new ConfigDescription("Piercing damage dealt by a coin projectile.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 100f), Array.Empty())); bronzeNailDamage = ((BaseUnityPlugin)this).Config.Bind("Combat", "Bronze nail damage", 18f, new ConfigDescription("Piercing damage dealt by a Bronze Nail projectile.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 200f), Array.Empty())); ironNailDamage = ((BaseUnityPlugin)this).Config.Bind("Combat", "Iron nail damage", 28f, new ConfigDescription("Piercing damage dealt by an Iron Nail projectile.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 200f), Array.Empty())); coinshotLifetime = ((BaseUnityPlugin)this).Config.Bind("Combat", "Coinshot flight time", 4f, new ConfigDescription("Seconds a coin flies straight before becoming a normal dropped coin.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 10f), Array.Empty())); coinshotCooldown = ((BaseUnityPlugin)this).Config.Bind("Combat", "Coinshot cooldown", 0.5f, new ConfigDescription("Minimum seconds between successful Coin or Nail shots.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 5f), Array.Empty())); looseCoinFlightSpeed = ((BaseUnityPlugin)this).Config.Bind("Movement", "Loose coin flight speed", 32f, new ConfigDescription("Straight-line speed applied to an unbraced coin while Pushing or Pulling.", (AcceptableValueBase)(object)new AcceptableValueRange(5f, 100f), Array.Empty())); coinBraceDistance = ((BaseUnityPlugin)this).Config.Bind("Movement", "Coin brace distance", 0.35f, new ConfigDescription("Distance behind a coin checked for terrain or a solid brace.", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 1f), Array.Empty())); safeDescentSpeed = ((BaseUnityPlugin)this).Config.Bind("Movement", "Safe descent speed", 8f, new ConfigDescription("Maximum downward speed at which an upward Allomantic assist cancels accumulated fall height.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 20f), Array.Empty())); fallProtectionGrace = ((BaseUnityPlugin)this).Config.Bind("Movement", "Fall protection grace", 0.4f, new ConfigDescription("Seconds after an upward push or pull in which controlled descent can cancel fall height.", (AcceptableValueBase)(object)new AcceptableValueRange(0.05f, 1.5f), Array.Empty())); landingRollGroundWindow = ((BaseUnityPlugin)this).Config.Bind("Movement", "Landing roll ground window", 1.1f, new ConfigDescription("Maximum ground distance at which Space can arm a landing roll.", (AcceptableValueBase)(object)new AcceptableValueRange(0.5f, 4f), Array.Empty())); landingRollInputBuffer = ((BaseUnityPlugin)this).Config.Bind("Movement", "Landing roll input buffer", 0.6f, new ConfigDescription("Seconds a valid airborne Space press waits for the imminent landing.", (AcceptableValueBase)(object)new AcceptableValueRange(0.1f, 1.5f), Array.Empty())); landingRollFullReductionHeight = ((BaseUnityPlugin)this).Config.Bind("Movement", "Landing roll full tier height", 10f, new ConfigDescription("Fall distance receiving the strongest landing-roll reduction.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 30f), Array.Empty())); landingRollBaseReduction = ((BaseUnityPlugin)this).Config.Bind("Movement", "Landing roll base reduction", 0.5f, new ConfigDescription("Fall-damage reduction at or below the full-tier height.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); landingRollStepDistance = ((BaseUnityPlugin)this).Config.Bind("Movement", "Landing roll tier distance", 6f, new ConfigDescription("Additional fall distance required to lower reduction by one tier.", (AcceptableValueBase)(object)new AcceptableValueRange(1f, 20f), Array.Empty())); landingRollStepReduction = ((BaseUnityPlugin)this).Config.Bind("Movement", "Landing roll reduction per tier", 0.1f, new ConfigDescription("Reduction lost for each distance tier above the full tier.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 0.5f), Array.Empty())); landingRollMinimumReduction = ((BaseUnityPlugin)this).Config.Bind("Movement", "Landing roll minimum reduction", 0.3f, new ConfigDescription("Minimum fall-damage reduction from any successful landing roll.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); mistingChanceOnDeath = ((BaseUnityPlugin)this).Config.Bind("Progression", "Misting chance on death", 0.08f, new ConfigDescription("Chance that an Unawakened character becomes a random Misting on death.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); lerasiumChestChance = ((BaseUnityPlugin)this).Config.Bind("Progression", "Lerasium chest chance", 0.03f, new ConfigDescription("Chance that a newly generated world chest contains one Lerasium Bead.", (AcceptableValueBase)(object)new AcceptableValueRange(0f, 1f), Array.Empty())); targetingConeDegrees = ((BaseUnityPlugin)this).Config.Bind("Targeting", "Aim cone", 18f, new ConfigDescription("Maximum angle away from the centre of the camera.", (AcceptableValueBase)(object)new AcceptableValueRange(2f, 60f), Array.Empty())); maximumVisibleLines = ((BaseUnityPlugin)this).Config.Bind("Targeting", "Maximum visible lines", 64, new ConfigDescription("Maximum faint metal-source lines rendered at once.", (AcceptableValueBase)(object)new AcceptableValueRange(1, 256), Array.Empty())); lineChestOffset = ((BaseUnityPlugin)this).Config.Bind("Targeting", "Line chest offset", 0.45f, new ConfigDescription("Vertical offset from the character center used as the blue-line origin.", (AcceptableValueBase)(object)new AcceptableValueRange(-0.5f, 1.5f), Array.Empty())); extraMetalTokens = ((BaseUnityPlugin)this).Config.Bind("Targeting", "Additional metal names", string.Empty, "Comma-separated material or prefab-name fragments treated as metal."); PrefabManager.OnVanillaPrefabsAvailable += AddMetallicTincture; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Metalbound 0.20.3 loaded"); harmony = Harmony.CreateAndPatchAll(typeof(Plugin).Assembly, "com.keeto.valheim.metalbound"); if (MaxAirAltitudeField == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Fall-height field was not found; controlled-descent protection is unavailable."); } if (DodgeMethod == null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Native dodge method was not found; Allomantic landing rolls are unavailable."); } } private void AddMetallicTincture() { //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_0010: 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) //IL_0026: 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_0035: Expected O, but got Unknown //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) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Expected O, but got Unknown //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_0145: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015b: 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_016a: Expected O, but got Unknown //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: Unknown result type (might be due to invalid IL or missing references) //IL_019f: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: 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_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c5: Expected O, but got Unknown //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_01fd: 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_0213: 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_0223: Expected O, but got Unknown //IL_027f: Unknown result type (might be due to invalid IL or missing references) //IL_0286: Expected O, but got Unknown ItemConfig val = new ItemConfig { Name = "Iron Vial", Description = "A prepared metal vial that completely replenishes Iron reserve.", CraftingStation = "piece_cauldron", MinStationLevel = 1, Amount = 5 }; val.AddRequirement("Iron", 2, 0); val.AddRequirement("Honey", 2, 0); RegisterMetalConsumable("MetalboundIronVial", val); ItemConfig val2 = new ItemConfig { Name = "Steel Vial", Description = "A prepared alloy vial that completely replenishes Steel reserve.", CraftingStation = "piece_cauldron", MinStationLevel = 1, Amount = 5 }; val2.AddRequirement("Iron", 2, 0); val2.AddRequirement("Coal", 2, 0); val2.AddRequirement("Honey", 2, 0); RegisterMetalConsumable("MetalboundSteelVial", val2); ItemConfig val3 = new ItemConfig { Name = "Pewter Vial", Description = "A tin-silver alloy vial that completely replenishes Pewter reserve.", CraftingStation = "piece_cauldron", MinStationLevel = 1, Amount = 5 }; val3.AddRequirement("Tin", 4, 0); val3.AddRequirement("Silver", 1, 0); val3.AddRequirement("Coal", 1, 0); val3.AddRequirement("Honey", 2, 0); RegisterMetalConsumable("MetalboundPewterVial", val3); ItemConfig val4 = new ItemConfig { Name = "Tin Vial", Description = "A prepared metal vial that completely replenishes Tin reserve.", CraftingStation = "piece_cauldron", MinStationLevel = 1, Amount = 5 }; val4.AddRequirement("Tin", 2, 0); val4.AddRequirement("Honey", 2, 0); RegisterMetalConsumable("MetalboundTinVial", val4); ItemConfig val5 = new ItemConfig { Name = "Copper Vial", Description = "A prepared metal vial that completely replenishes Copper reserve.", CraftingStation = "piece_cauldron", MinStationLevel = 1, Amount = 5 }; val5.AddRequirement("Copper", 2, 0); val5.AddRequirement("Honey", 2, 0); RegisterMetalConsumable("MetalboundCopperVial", val5); ItemConfig val6 = new ItemConfig { Name = "Allomantic Tincture", Description = "A combined tincture that completely replenishes every metal reserve.", CraftingStation = "piece_cauldron", MinStationLevel = 1, Amount = 1 }; val6.AddRequirement("MetalboundIronVial", 1, 0); val6.AddRequirement("MetalboundSteelVial", 1, 0); val6.AddRequirement("MetalboundPewterVial", 1, 0); val6.AddRequirement("MetalboundTinVial", 1, 0); val6.AddRequirement("MetalboundCopperVial", 1, 0); RegisterMetalConsumable("MetalboundTincture", val6); CustomItem val7 = new CustomItem("MetalboundLerasiumNugget", "MeadTasty"); PrepareMetalConsumable(val7); val7.ItemDrop.m_itemData.m_shared.m_name = "Lerasium Bead"; val7.ItemDrop.m_itemData.m_shared.m_description = "Something stirs within, yet you are cautious. This bead is life altering."; val7.ItemDrop.m_itemData.m_shared.m_maxStackSize = 10; ItemManager.Instance.AddItem(val7); PrefabManager.OnVanillaPrefabsAvailable -= AddMetallicTincture; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Registered metal vials, the combined Allomantic Tincture, and Lerasium Bead."); } private static void PrepareMetalConsumable(CustomItem item) { SharedData shared = item.ItemDrop.m_itemData.m_shared; shared.m_consumeStatusEffect = null; shared.m_food = 0f; shared.m_foodStamina = 0f; shared.m_foodEitr = 0f; shared.m_foodBurnTime = 0f; shared.m_foodRegen = 0f; shared.m_maxStackSize = 20; shared.m_weight = 0.3f; } private static void RegisterMetalConsumable(string prefabName, ItemConfig config) { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_000d: Expected O, but got Unknown CustomItem val = new CustomItem(prefabName, "MeadTasty", config); PrepareMetalConsumable(val); ItemManager.Instance.AddItem(val); } private void Update() { //IL_0149: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0211: 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_0273: Unknown result type (might be due to invalid IL or missing references) //IL_0329: 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) Player localPlayer = Player.m_localPlayer; if ((Object)(object)localPlayer == (Object)null || ((Object)(object)Chat.instance != (Object)null && Chat.instance.HasFocus()) || ((Object)(object)Console.instance != (Object)null && Console.IsVisible())) { CloseMetalWheelIfNeeded(); HideAnchorLine(); return; } EnsureAllomancerTypeLoaded(localPlayer); TryShowAwakeningMessage(localPlayer); EnsureReserveLoaded(localPlayer); ironReserve = Mathf.Clamp(ironReserve, 0f, maximumReserve.Value); steelReserve = Mathf.Clamp(steelReserve, 0f, maximumReserve.Value); pewterReserve = Mathf.Clamp(pewterReserve, 0f, maximumReserve.Value); tinReserve = Mathf.Clamp(tinReserve, 0f, maximumReserve.Value); copperReserve = Mathf.Clamp(copperReserve, 0f, maximumReserve.Value); bool num = UpdateMetalWheel(localPlayer); UpdatePewterBurn(localPlayer); UpdateTinBurn(localPlayer); UpdateCopperBurn(); if (num) { currentAnchor = null; lockedAnchor = null; wasPushHeld = false; wasPullHeld = false; HideAnchorLine(); return; } if (IsShortcutDown(refillReserveKey.Value)) { RefillReserve(localPlayer); } PersistReserveIfNeeded(); if (IsShortcutDown(throwCoinKey.Value)) { ThrowCoin(localPlayer); } UpdateLandingRoll(localPlayer); UpdateControlledDescent(localPlayer); if (!IsShortcutHeld(modeKey.Value)) { currentAnchor = null; lockedAnchor = null; wasPushHeld = false; wasPullHeld = false; HideAnchorLine(); return; } if (!TryConsumeSightReserve(metalSightDrain.Value * Time.deltaTime * GetFlareDrainMultiplier())) { currentAnchor = null; lockedAnchor = null; wasPushHeld = false; wasPullHeld = false; HideAnchorLine(); ShowCenterMessage("Burn Iron or Steel with available reserve to see metal lines."); return; } if (IsShortcutDown(coinshotKey.Value)) { if (!HasMetalAccess(MetalType.Steel)) { ShowCenterMessage("Steel is not one of your Allomantic metals."); } else if (steelBurning) { FireCoinshot(localPlayer); } else { ShowCenterMessage("Burn Steel to fire a Coinshot."); } } currentAnchor = FindBestAnchor(localPlayer, out var visibleAnchors); bool flag = IsShortcutHeld(pushKey.Value); bool flag2 = IsShortcutHeld(pullKey.Value); if (flag && !wasPushHeld && !HasMetalAccess(MetalType.Steel)) { ShowCenterMessage("Steel is not one of your Allomantic metals."); } else if (flag && !wasPushHeld && !steelBurning) { ShowCenterMessage("Burn Steel to Push."); } if (flag2 && !wasPullHeld && !HasMetalAccess(MetalType.Iron)) { ShowCenterMessage("Iron is not one of your Allomantic metals."); } else if (flag2 && !wasPullHeld && !ironBurning) { ShowCenterMessage("Burn Iron to Pull."); } if (flag && !wasPushHeld) { lockedAnchor = currentAnchor; if ((Object)(object)lockedAnchor != (Object)null) { PlaySound("sfx_metal_blocked", lockedAnchor.position); } } else if (flag2 && !wasPullHeld) { lockedAnchor = currentAnchor; if ((Object)(object)lockedAnchor != (Object)null) { PlaySound("sfx_metal_blocked", lockedAnchor.position); } } if (!flag && !flag2) { lockedAnchor = null; } if ((Object)(object)lockedAnchor != (Object)null && !IsAnchorInRange(localPlayer, lockedAnchor)) { lockedAnchor = null; } if ((Object)(object)lockedAnchor != (Object)null) { if (flag && steelBurning && HasMetalAccess(MetalType.Steel)) { TryConsumeReserve(MetalType.Steel, lockedTargetDrain.Value * Time.deltaTime * GetFlareDrainMultiplier()); } else if (flag2 && ironBurning && HasMetalAccess(MetalType.Iron)) { TryConsumeReserve(MetalType.Iron, lockedTargetDrain.Value * Time.deltaTime * GetFlareDrainMultiplier()); } } Transform selectedAnchor = (((Object)(object)lockedAnchor != (Object)null) ? lockedAnchor : currentAnchor); DrawAnchorLines(localPlayer, visibleAnchors, selectedAnchor); if ((Object)(object)lockedAnchor != (Object)null) { if (flag && steelBurning && HasMetalAccess(MetalType.Steel)) { if (TryConsumeReserve(MetalType.Steel, pushPullDrain.Value * Time.deltaTime * GetFlareDrainMultiplier())) { ApplyForce(localPlayer, lockedAnchor, push: true); } else { NotifyReserveEmpty(MetalType.Steel); } } else if (flag2 && ironBurning && HasMetalAccess(MetalType.Iron)) { if (TryConsumeReserve(MetalType.Iron, pushPullDrain.Value * Time.deltaTime * GetFlareDrainMultiplier())) { ApplyForce(localPlayer, lockedAnchor, push: false); } else { NotifyReserveEmpty(MetalType.Iron); } } } wasPushHeld = flag; wasPullHeld = flag2; } private bool IsMetalWheelOpen() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (metalWheelKey != null) { return IsShortcutHeld(metalWheelKey.Value); } return false; } private void LateUpdate() { if (IsMetalWheelOpen()) { Cursor.lockState = (CursorLockMode)1; Cursor.visible = false; } UpdateTinFocus(); } private void UpdateTinFocus() { //IL_0032: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if (tinBurning && HasMetalAccess(MetalType.Tin) && tinReserve > 0.0001f && tinFocusKey != null && IsShortcutHeld(tinFocusKey.Value) && (Object)(object)main != (Object)null && ((Object)(object)Chat.instance == (Object)null || !Chat.instance.HasFocus()) && ((Object)(object)Console.instance == (Object)null || !Console.IsVisible())) { if (!tinFocusActive || (Object)(object)tinFocusCamera != (Object)(object)main) { tinFocusCamera = main; tinFocusBaseFov = main.fieldOfView; tinFocusActive = true; } float num = tinFocusZoom.Value / GetTinSenseMultiplier(); float num2 = Mathf.Clamp(tinFocusBaseFov * num, 15f, tinFocusBaseFov); main.fieldOfView = Mathf.Lerp(main.fieldOfView, num2, 10f * Time.unscaledDeltaTime); } else if (tinFocusActive) { if ((Object)(object)tinFocusCamera != (Object)null) { tinFocusCamera.fieldOfView = tinFocusBaseFov; } tinFocusCamera = null; tinFocusActive = false; } } private void UpdatePewterBurn(Player player) { if (!HasMetalAccess(MetalType.Pewter)) { pewterBurning = false; } else if (pewterBurning && !TryConsumeReserve(MetalType.Pewter, pewterDrain.Value * Time.deltaTime * GetFlareDrainMultiplier())) { pewterBurning = false; NotifyReserveEmpty(MetalType.Pewter); } } private void UpdateTinBurn(Player player) { if (!HasMetalAccess(MetalType.Tin)) { tinBurning = false; } if (tinBurning && !TryConsumeReserve(MetalType.Tin, tinDrain.Value * Time.deltaTime * GetFlareDrainMultiplier())) { tinBurning = false; NotifyReserveEmpty(MetalType.Tin); } if (tinBurning) { EnsureTinEffects(player); UpdateTinEnemySense(player); } else { RemoveTinEffects(player); HideTinSenseLines(); } } private void UpdateCopperBurn() { if (!HasMetalAccess(MetalType.Copper)) { copperBurning = false; } if (copperBurning && !TryConsumeReserve(MetalType.Copper, copperDrain.Value * Time.deltaTime * GetFlareDrainMultiplier())) { copperBurning = false; NotifyReserveEmpty(MetalType.Copper); } } private void UpdateTinEnemySense(Player player) { //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b8: Unknown result type (might be due to invalid IL or missing references) //IL_013c: 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_0152: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_0176: 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_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Unknown result type (might be due to invalid IL or missing references) sensedTinEnemies.Clear(); sensedIncomingProjectiles.Clear(); float tinSenseMultiplier = GetTinSenseMultiplier(); float num = tinEnemySenseRange.Value * tinSenseMultiplier; float num2 = tinProjectileSenseRange.Value * tinSenseMultiplier; float num3 = Mathf.Max(num, num2); Collider[] array = Physics.OverlapSphere(((Character)player).GetCenterPoint(), num3, -1, (QueryTriggerInteraction)1); HashSet hashSet = new HashSet(); HashSet hashSet2 = new HashSet(); List list = new List(); Collider[] array2 = array; foreach (Collider val in array2) { Character val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponentInParent() : null); if ((Object)(object)val2 != (Object)null && (Object)(object)val2 != (Object)(object)player && !val2.IsDead() && Vector3.Distance(((Character)player).GetCenterPoint(), val2.GetCenterPoint()) <= num && hashSet.Add(val2) && BaseAI.IsEnemy((Character)(object)player, val2)) { list.Add(val2); } Projectile val3 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponentInParent() : null); if ((Object)(object)val3 == (Object)null || !hashSet2.Add(val3)) { continue; } Rigidbody val4 = ((Component)val3).GetComponent(); if ((Object)(object)val4 == (Object)null) { val4 = ((Component)val3).GetComponentInChildren(); } if ((Object)(object)val4 == (Object)null) { continue; } Vector3 linearVelocity = val4.linearVelocity; if (((Vector3)(ref linearVelocity)).sqrMagnitude < 9f) { continue; } Vector3 val5 = ((Character)player).GetCenterPoint() - ((Component)val3).transform.position; if (!(((Vector3)(ref val5)).magnitude > num2)) { linearVelocity = val4.linearVelocity; if (!(Vector3.Dot(((Vector3)(ref linearVelocity)).normalized, ((Vector3)(ref val5)).normalized) < 0.72f)) { sensedIncomingProjectiles.Add(((Component)val3).transform); } } } Vector3 origin = ((Character)player).GetCenterPoint() + Vector3.up * lineChestOffset.Value; list.Sort((Character left, Character right) => Vector3.SqrMagnitude(((Component)left).transform.position - origin).CompareTo(Vector3.SqrMagnitude(((Component)right).transform.position - origin))); int num4 = Mathf.Min(list.Count, tinEnemySenseLimit.Value); for (int num5 = 0; num5 < num4; num5++) { sensedTinEnemies.Add(list[num5]); } } private void HideTinSenseLines() { sensedTinEnemies.Clear(); sensedIncomingProjectiles.Clear(); } private void EnsureTinEffects(Player player) { //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Expected O, but got Unknown //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_015e: Expected O, but got Unknown //IL_0180: 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) if ((Object)(object)tinVisionObject == (Object)null) { tinVisionObject = new GameObject("MetalboundTinVision"); tinVisionObject.transform.SetParent(((Component)player).transform, false); tinVisionObject.transform.localPosition = Vector3.up * 1.6f; Light obj = tinVisionObject.AddComponent(); obj.type = (LightType)2; obj.color = new Color(0.68f, 0.82f, 1f); obj.range = tinVisionRange.Value * GetTinSenseMultiplier(); obj.intensity = tinVisionIntensity.Value * GetTinSenseMultiplier(); obj.shadows = (LightShadows)0; } else { Light component = tinVisionObject.GetComponent(); if ((Object)(object)component != (Object)null) { component.range = tinVisionRange.Value * GetTinSenseMultiplier(); component.intensity = tinVisionIntensity.Value * GetTinSenseMultiplier(); } } if ((Object)(object)tinDemisterObject == (Object)null && (Object)(object)ZNetScene.instance != (Object)null) { GameObject prefab = ZNetScene.instance.GetPrefab("Demister"); Demister val = (((Object)(object)prefab != (Object)null) ? prefab.GetComponentInChildren(true) : null); if ((Object)(object)val != (Object)null) { tinDemisterObject = new GameObject("MetalboundTinDemister"); tinDemisterObject.transform.SetParent(((Component)player).transform, false); tinDemisterObject.transform.localPosition = Vector3.up * 1.2f; Demister val2 = tinDemisterObject.AddComponent(); JsonUtility.FromJsonOverwrite(JsonUtility.ToJson((object)val), (object)val2); } } if ((Object)(object)tinFinderEffect == (Object)null && (Object)(object)ObjectDB.instance != (Object)null) { GameObject itemPrefab = ObjectDB.instance.GetItemPrefab("Wishbone"); ItemDrop val3 = (((Object)(object)itemPrefab != (Object)null) ? itemPrefab.GetComponent() : null); StatusEffect val4 = (((Object)(object)val3 != (Object)null) ? val3.m_itemData.m_shared.m_equipStatusEffect : null); if ((Object)(object)val4 != (Object)null) { tinFinderEffect = Object.Instantiate(val4); ((Object)tinFinderEffect).name = "SE_MetalboundTinFinder"; tinFinderEffect.m_name = "Tin Senses"; } } if (!tinFinderAdded && (Object)(object)tinFinderEffect != (Object)null) { tinFinderAdded = InvokeAddStatusEffect(((Character)player).GetSEMan(), tinFinderEffect); } } private void RemoveTinEffects(Player player) { if ((Object)(object)tinVisionObject != (Object)null) { Object.Destroy((Object)(object)tinVisionObject); tinVisionObject = null; } if ((Object)(object)tinDemisterObject != (Object)null) { Object.Destroy((Object)(object)tinDemisterObject); tinDemisterObject = null; } if (tinFinderAdded && (Object)(object)tinFinderEffect != (Object)null && (Object)(object)player != (Object)null) { InvokeRemoveStatusEffect(((Character)player).GetSEMan(), GetStableHashCode(((Object)tinFinderEffect).name)); tinFinderAdded = false; } } private static bool InvokeAddStatusEffect(SEMan manager, StatusEffect effect) { if (manager == null || (Object)(object)effect == (Object)null) { return false; } MethodInfo[] methods = typeof(SEMan).GetMethods(BindingFlags.Instance | BindingFlags.Public); foreach (MethodInfo methodInfo in methods) { ParameterInfo[] parameters = methodInfo.GetParameters(); if (!(methodInfo.Name != "AddStatusEffect") && parameters.Length != 0 && !(parameters[0].ParameterType != typeof(StatusEffect))) { object[] array = BuildDefaultArguments(parameters); array[0] = effect; methodInfo.Invoke(manager, array); return true; } } return false; } private static void InvokeRemoveStatusEffect(SEMan manager, int nameHash) { if (manager == null) { return; } MethodInfo[] methods = typeof(SEMan).GetMethods(BindingFlags.Instance | BindingFlags.Public); foreach (MethodInfo methodInfo in methods) { ParameterInfo[] parameters = methodInfo.GetParameters(); if (!(methodInfo.Name != "RemoveStatusEffect") && parameters.Length != 0 && !(parameters[0].ParameterType != typeof(int))) { object[] array = BuildDefaultArguments(parameters); array[0] = nameHash; methodInfo.Invoke(manager, array); break; } } } private static object[] BuildDefaultArguments(ParameterInfo[] parameters) { object[] array = new object[parameters.Length]; for (int i = 0; i < parameters.Length; i++) { if (parameters[i].HasDefaultValue) { array[i] = parameters[i].DefaultValue; continue; } Type parameterType = parameters[i].ParameterType; array[i] = (parameterType.IsValueType ? Activator.CreateInstance(parameterType) : null); } return array; } private static int GetStableHashCode(string value) { int num = 5381; int num2 = num; for (int i = 0; i < value.Length && value[i] != 0; i += 2) { num = ((num << 5) + num) ^ value[i]; if (i == value.Length - 1 || value[i + 1] == '\0') { break; } num2 = ((num2 << 5) + num2) ^ value[i + 1]; } return num + num2 * 1566083941; } private bool UpdateMetalWheel(Player player) { //IL_0006: 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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00c5: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0185: 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_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_01b7: 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_01cc: 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_01e1: 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_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_014d: Unknown result type (might be due to invalid IL or missing references) bool flag = IsShortcutHeld(metalWheelKey.Value); if (flag) { if (!metalWheelWasHeld) { metalWheelSelector = Vector2.zero; } metalWheelSelector += new Vector2(Input.GetAxisRaw("Mouse X"), 0f - Input.GetAxisRaw("Mouse Y")) * 12f; metalWheelSelector = Vector2.ClampMagnitude(metalWheelSelector, 184f); if (Input.GetMouseButtonDown(0)) { Vector2 val = new Vector2((float)Screen.width * 0.5f, (float)Screen.height * 0.5f) + metalWheelSelector; GetMetalWheelOptionRects(out var ironRect, out var steelRect, out var pewterRect, out var tinRect, out var copperRect); GetAmmoWheelOptionRects(out var coinRect, out var bronzeNailRect, out var ironNailRect); if (((Rect)(ref ironRect)).Contains(val)) { ToggleMetalBurn(MetalType.Iron); } else if (((Rect)(ref steelRect)).Contains(val)) { ToggleMetalBurn(MetalType.Steel); } else if (((Rect)(ref pewterRect)).Contains(val)) { ToggleMetalBurn(MetalType.Pewter); } else if (((Rect)(ref tinRect)).Contains(val)) { ToggleMetalBurn(MetalType.Tin); } else if (((Rect)(ref copperRect)).Contains(val)) { ToggleMetalBurn(MetalType.Copper); } else if (((Rect)(ref coinRect)).Contains(val)) { SelectCoinshotAmmo(CoinshotAmmoType.Coin); } else if (((Rect)(ref bronzeNailRect)).Contains(val)) { SelectCoinshotAmmo(CoinshotAmmoType.BronzeNail); } else if (((Rect)(ref ironNailRect)).Contains(val)) { SelectCoinshotAmmo(CoinshotAmmoType.IronNail); } } if (Input.GetMouseButtonDown(1)) { Vector2 val2 = new Vector2((float)Screen.width * 0.5f, (float)Screen.height * 0.5f) + metalWheelSelector; GetMetalWheelOptionRects(out var ironRect2, out var steelRect2, out var pewterRect2, out var tinRect2, out var copperRect2); if (((Rect)(ref ironRect2)).Contains(val2)) { TryRefillAccessibleReserve(player, MetalType.Iron); } else if (((Rect)(ref steelRect2)).Contains(val2)) { TryRefillAccessibleReserve(player, MetalType.Steel); } else if (((Rect)(ref pewterRect2)).Contains(val2)) { TryRefillAccessibleReserve(player, MetalType.Pewter); } else if (((Rect)(ref tinRect2)).Contains(val2)) { TryRefillAccessibleReserve(player, MetalType.Tin); } else if (((Rect)(ref copperRect2)).Contains(val2)) { TryRefillAccessibleReserve(player, MetalType.Copper); } } } else if (metalWheelWasHeld) { CloseMetalWheelIfNeeded(); } metalWheelWasHeld = flag; return flag; } private void ToggleMetalBurn(MetalType metal) { if (!HasMetalAccess(metal)) { ShowCenterMessage(metal.ToString() + " is locked for " + GetAllomancerTitle(allomancerType) + "."); return; } switch (metal) { case MetalType.Iron: ironBurning = !ironBurning; ShowCenterMessage("Iron " + (ironBurning ? "burning" : "off")); break; case MetalType.Steel: steelBurning = !steelBurning; ShowCenterMessage("Steel " + (steelBurning ? "burning" : "off")); break; case MetalType.Pewter: if (!pewterBurning && pewterReserve <= 0.0001f) { NotifyReserveEmpty(MetalType.Pewter); break; } pewterBurning = !pewterBurning; ShowCenterMessage("Pewter " + (pewterBurning ? "burning" : "off")); break; case MetalType.Tin: if (!tinBurning && tinReserve <= 0.0001f) { NotifyReserveEmpty(MetalType.Tin); break; } tinBurning = !tinBurning; ShowCenterMessage("Tin " + (tinBurning ? "burning" : "off")); break; default: if (!copperBurning && copperReserve <= 0.0001f) { NotifyReserveEmpty(MetalType.Copper); break; } copperBurning = !copperBurning; ShowCenterMessage("Copper " + (copperBurning ? "burning" : "off")); break; } } private void SelectCoinshotAmmo(CoinshotAmmoType ammoType) { selectedCoinshotAmmo = ammoType; ShowCenterMessage(GetCoinshotAmmoDisplayName(ammoType) + " selected."); } private void TryRefillAccessibleReserve(Player player, MetalType metal) { if (!HasMetalAccess(metal)) { ShowCenterMessage(metal.ToString() + " is locked for " + GetAllomancerTitle(allomancerType) + "."); } else { RefillSingleReserve(player, metal); } } private void CloseMetalWheelIfNeeded() { //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) if (metalWheelWasHeld) { metalWheelWasHeld = false; metalWheelSelector = Vector2.zero; } } private static void GetMetalWheelOptionRects(out Rect ironRect, out Rect steelRect, out Rect pewterRect, out Rect tinRect, out Rect copperRect) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: 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_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //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) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)Screen.width * 0.5f, (float)Screen.height * 0.5f); ironRect = new Rect(val.x - 157f, val.y - 69f, 86f, 64f); steelRect = new Rect(val.x + 71f, val.y - 69f, 86f, 64f); pewterRect = new Rect(val.x + 27f, val.y + 65f, 86f, 64f); tinRect = new Rect(val.x - 43f, val.y - 152f, 86f, 64f); copperRect = new Rect(val.x - 113f, val.y + 65f, 86f, 64f); } private static void GetAmmoWheelOptionRects(out Rect coinRect, out Rect bronzeNailRect, out Rect ironNailRect) { //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: Unknown result type (might be due to invalid IL or missing references) Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)Screen.width * 0.5f, (float)Screen.height * 0.5f); coinRect = new Rect(val.x - 126f, val.y + 145f, 80f, 52f); bronzeNailRect = new Rect(val.x - 40f, val.y + 145f, 80f, 52f); ironNailRect = new Rect(val.x + 46f, val.y + 145f, 80f, 52f); } private bool IsAnchorInRange(Player player, Transform anchor) { //IL_000c: 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) if ((Object)(object)anchor == (Object)null) { return false; } float num = Vector3.Distance(((Character)player).GetCenterPoint(), anchor.position); if (num >= 0.5f) { return num <= targetRange.Value; } return false; } private Transform FindBestAnchor(Player player, out List visibleAnchors) { //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_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_00a0: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) visibleAnchors = new List(); Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return null; } Vector3 origin = ((Character)player).GetCenterPoint(); Vector3 forward = ((Component)main).transform.forward; Collider[] array = Physics.OverlapSphere(origin, targetRange.Value); HashSet hashSet = new HashSet(); Transform result = null; float num = float.MaxValue; Collider[] array2 = array; foreach (Collider collider in array2) { Transform metalAnchor = GetMetalAnchor(collider); if ((Object)(object)metalAnchor == (Object)null || !hashSet.Add(((Object)((Component)metalAnchor).gameObject).GetInstanceID())) { continue; } Vector3 val = metalAnchor.position - origin; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude < 0.75f || magnitude > targetRange.Value) { continue; } visibleAnchors.Add(metalAnchor); float num2 = Vector3.Angle(forward, val); if (!(num2 > targetingConeDegrees.Value)) { float num3 = num2 * 4f + magnitude * 0.15f; if (num3 < num) { num = num3; result = metalAnchor; } } } visibleAnchors.Sort((Transform left, Transform right) => Vector3.SqrMagnitude(left.position - origin).CompareTo(Vector3.SqrMagnitude(right.position - origin))); return result; } private static bool IsShortcutHeld(KeyboardShortcut shortcut) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if ((int)((KeyboardShortcut)(ref shortcut)).MainKey == 0 || !Input.GetKey(((KeyboardShortcut)(ref shortcut)).MainKey)) { return false; } foreach (KeyCode modifier in ((KeyboardShortcut)(ref shortcut)).Modifiers) { if (!Input.GetKey(modifier)) { return false; } } return true; } internal static bool ShouldBlockVanillaAttacks(Player player) { //IL_0024: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)Instance != (Object)null && (Object)(object)player == (Object)(object)Player.m_localPlayer) { if (!IsShortcutHeld(Instance.modeKey.Value)) { return Instance.IsMetalWheelOpen(); } return true; } return false; } private static bool IsShortcutDown(KeyboardShortcut shortcut) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) if ((int)((KeyboardShortcut)(ref shortcut)).MainKey == 0 || !Input.GetKeyDown(((KeyboardShortcut)(ref shortcut)).MainKey)) { return false; } foreach (KeyCode modifier in ((KeyboardShortcut)(ref shortcut)).Modifiers) { if (!Input.GetKey(modifier)) { return false; } } return true; } private void ThrowCoin(Player player) { //IL_007e: 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_0087: Unknown result type (might be due to invalid IL or missing references) //IL_008c: Unknown result type (might be due to invalid IL or missing references) //IL_008e: Unknown result type (might be due to invalid IL or missing references) //IL_0093: 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_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_00a8: 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_0127: 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_012c: 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_013c: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) Inventory inventory = ((Humanoid)player).GetInventory(); if (inventory == null || !inventory.HaveItem("$item_coins", true)) { ShowCenterMessage("You need a coin to throw."); } else { if ((Object)(object)ZNetScene.instance == (Object)null) { return; } GameObject prefab = ZNetScene.instance.GetPrefab("Coins"); Camera main = Camera.main; if ((Object)(object)prefab == (Object)null || (Object)(object)main == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find the vanilla Coins prefab or main camera."); return; } inventory.RemoveItem("$item_coins", 1, -1, true); Vector3 forward = ((Component)main).transform.forward; Vector3 normalized = ((Vector3)(ref forward)).normalized; Vector3 val = ((Character)player).GetEyePoint() + normalized * 0.8f; GameObject val2 = Object.Instantiate(prefab, val, Random.rotation); PlaySound("sfx_coins_placed", val); ItemDrop component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_itemData.m_stack = 1; } Rigidbody val3 = val2.GetComponent(); if ((Object)(object)val3 == (Object)null) { val3 = val2.GetComponentInChildren(); } if ((Object)(object)val3 != (Object)null) { Rigidbody component2 = ((Component)player).GetComponent(); Vector3 val4 = (((Object)(object)component2 != (Object)null) ? component2.linearVelocity : Vector3.zero); val3.linearVelocity = normalized * coinThrowSpeed.Value + val4; val3.angularVelocity = Random.onUnitSphere * 18f; ((Component)val3).gameObject.AddComponent().Configure(normalized, stickOnAnySurface: false); } } } private void FireCoinshot(Player player) { //IL_0113: 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_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_0124: Unknown result type (might be due to invalid IL or missing references) //IL_0129: 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_0135: Unknown result type (might be due to invalid IL or missing references) //IL_013a: Unknown result type (might be due to invalid IL or missing references) //IL_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0152: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01e0: Unknown result type (might be due to invalid IL or missing references) //IL_01fc: Unknown result type (might be due to invalid IL or missing references) //IL_0209: Unknown result type (might be due to invalid IL or missing references) //IL_020e: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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_0226: 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_0265: Unknown result type (might be due to invalid IL or missing references) if (Time.time - lastCoinshotTime < coinshotCooldown.Value) { return; } Inventory inventory = ((Humanoid)player).GetInventory(); string coinshotAmmoItemName = GetCoinshotAmmoItemName(selectedCoinshotAmmo); string coinshotAmmoDisplayName = GetCoinshotAmmoDisplayName(selectedCoinshotAmmo); if (inventory == null || !inventory.HaveItem(coinshotAmmoItemName, true)) { ShowCenterMessage("You need " + GetCoinshotAmmoArticle(selectedCoinshotAmmo) + " " + coinshotAmmoDisplayName + " to fire."); } else { if ((Object)(object)ZNetScene.instance == (Object)null) { return; } string coinshotAmmoPrefabName = GetCoinshotAmmoPrefabName(selectedCoinshotAmmo); GameObject prefab = ZNetScene.instance.GetPrefab(coinshotAmmoPrefabName); Camera main = Camera.main; if ((Object)(object)prefab == (Object)null || (Object)(object)main == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not find the vanilla " + coinshotAmmoPrefabName + " prefab or main camera.")); return; } if (!TryConsumeReserve(MetalType.Steel, coinshotReserveCost.Value * GetFlareDrainMultiplier())) { NotifyReserveEmpty(MetalType.Steel); return; } inventory.RemoveItem(coinshotAmmoItemName, 1, -1, true); Vector3 forward = ((Component)main).transform.forward; Vector3 normalized = ((Vector3)(ref forward)).normalized; Vector3 val = ((Character)player).GetEyePoint() + normalized * 1.1f; GameObject val2 = Object.Instantiate(prefab, val, Random.rotation); PlaySound("sfx_arbalest_fire", val); ItemDrop component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { component.m_itemData.m_stack = 1; } Rigidbody val3 = val2.GetComponent(); if ((Object)(object)val3 == (Object)null) { val3 = val2.GetComponentInChildren(); } if ((Object)(object)val3 == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("The spawned " + coinshotAmmoDisplayName + " has no Rigidbody.")); return; } Rigidbody component2 = ((Component)player).GetComponent(); Vector3 val4 = (((Object)(object)component2 != (Object)null) ? component2.linearVelocity : Vector3.zero); val3.collisionDetectionMode = (CollisionDetectionMode)2; val3.interpolation = (RigidbodyInterpolation)1; val3.useGravity = false; val3.linearVelocity = normalized * coinshotSpeed.Value + val4; val3.angularVelocity = Random.onUnitSphere * 30f; ((Component)val3).gameObject.AddComponent().Configure(normalized, selectedCoinshotAmmo != CoinshotAmmoType.Coin); ((Component)val3).gameObject.AddComponent().Configure(player, GetCoinshotAmmoDamage(selectedCoinshotAmmo), normalized, coinshotSpeed.Value, coinshotLifetime.Value); lastCoinshotTime = Time.time; } } private float GetCoinshotAmmoDamage(CoinshotAmmoType ammoType) { return ammoType switch { CoinshotAmmoType.BronzeNail => bronzeNailDamage.Value, CoinshotAmmoType.IronNail => ironNailDamage.Value, _ => coinshotDamage.Value, }; } private static string GetCoinshotAmmoPrefabName(CoinshotAmmoType ammoType) { return ammoType switch { CoinshotAmmoType.BronzeNail => "BronzeNails", CoinshotAmmoType.IronNail => "IronNails", _ => "Coins", }; } private static string GetCoinshotAmmoItemName(CoinshotAmmoType ammoType) { return ammoType switch { CoinshotAmmoType.BronzeNail => "$item_bronzenails", CoinshotAmmoType.IronNail => "$item_ironnails", _ => "$item_coins", }; } private static string GetCoinshotAmmoDisplayName(CoinshotAmmoType ammoType) { return ammoType switch { CoinshotAmmoType.BronzeNail => "Bronze Nail", CoinshotAmmoType.IronNail => "Iron Nail", _ => "Coin", }; } private static string GetCoinshotAmmoArticle(CoinshotAmmoType ammoType) { if (ammoType != CoinshotAmmoType.IronNail) { return "a"; } return "an"; } private static void ShowCenterMessage(string message) { if ((Object)(object)MessageHud.instance != (Object)null) { MessageHud.instance.ShowMessage((MessageType)2, message, 0, (Sprite)null, false); } } private void PlaySound(string prefabName, Vector3 position, float cueVolume = 1f) { //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) if (soundsEnabled == null || !soundsEnabled.Value || soundVolume.Value <= 0f || (Object)(object)ZNetScene.instance == (Object)null) { return; } GameObject prefab = ZNetScene.instance.GetPrefab(prefabName); if ((Object)(object)prefab == (Object)null) { if (missingSoundPrefabs.Add(prefabName)) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Sound prefab not found: " + prefabName)); } return; } GameObject val = Object.Instantiate(prefab, position, Quaternion.identity); float num = Mathf.Clamp01(soundVolume.Value * cueVolume); AudioSource[] componentsInChildren = val.GetComponentsInChildren(true); foreach (AudioSource obj in componentsInChildren) { obj.volume *= num; } Object.Destroy((Object)(object)val, 10f); } private void EnsureReserveLoaded(Player player) { if (!((Object)(object)reserveOwner == (Object)(object)player)) { if ((Object)(object)reserveOwner != (Object)null) { PersistReserve(); } reserveOwner = player; float value; float num = (TryLoadReserve(player, "com.keeto.valheim.metalbound.reserve", out value) ? value : Mathf.Clamp(startingReserve.Value, 0f, maximumReserve.Value)); bool flag = TryLoadReserve(player, "com.keeto.valheim.metalbound.reserve.iron", out ironReserve); bool flag2 = TryLoadReserve(player, "com.keeto.valheim.metalbound.reserve.steel", out steelReserve); bool flag3 = TryLoadReserve(player, "com.keeto.valheim.metalbound.reserve.pewter", out pewterReserve); bool flag4 = TryLoadReserve(player, "com.keeto.valheim.metalbound.reserve.tin", out tinReserve); bool flag5 = TryLoadReserve(player, "com.keeto.valheim.metalbound.reserve.copper", out copperReserve); if (!flag) { ironReserve = num; } if (!flag2) { steelReserve = num; } if (!flag3) { pewterReserve = num; } if (!flag4) { tinReserve = num; } if (!flag5) { copperReserve = num; } ironReserve = Mathf.Clamp(ironReserve, 0f, maximumReserve.Value); steelReserve = Mathf.Clamp(steelReserve, 0f, maximumReserve.Value); pewterReserve = Mathf.Clamp(pewterReserve, 0f, maximumReserve.Value); tinReserve = Mathf.Clamp(tinReserve, 0f, maximumReserve.Value); copperReserve = Mathf.Clamp(copperReserve, 0f, maximumReserve.Value); reserveDirty = !flag || !flag2 || !flag3 || !flag4 || !flag5; if (reserveDirty) { PersistReserve(); } } } private void EnsureAllomancerTypeLoaded(Player player) { if (!((Object)(object)allomancerOwner == (Object)(object)player)) { allomancerOwner = player; if (player.m_customData.TryGetValue("com.keeto.valheim.metalbound.allomancer_type", out var value) && Enum.TryParse(value, ignoreCase: true, out var result)) { allomancerType = result; return; } bool flag = player.m_customData.ContainsKey("com.keeto.valheim.metalbound.reserve.iron") || player.m_customData.ContainsKey("com.keeto.valheim.metalbound.reserve.steel") || player.m_customData.ContainsKey("com.keeto.valheim.metalbound.reserve.pewter") || player.m_customData.ContainsKey("com.keeto.valheim.metalbound.reserve.tin") || player.m_customData.ContainsKey("com.keeto.valheim.metalbound.reserve.copper") || player.m_customData.ContainsKey("com.keeto.valheim.metalbound.reserve"); SetAllomancerType(player, flag ? AllomancerType.Mistborn : AllomancerType.Unawakened); } } private void SetAllomancerType(Player player, AllomancerType type) { allomancerOwner = player; allomancerType = type; player.m_customData["com.keeto.valheim.metalbound.allomancer_type"] = type.ToString(); } private bool HasMetalAccess(MetalType metal) { if (allomancerType == AllomancerType.Mistborn) { return true; } if ((metal != MetalType.Iron || allomancerType != AllomancerType.IronMisting) && (metal != MetalType.Steel || allomancerType != AllomancerType.SteelMisting) && (metal != MetalType.Pewter || allomancerType != AllomancerType.PewterMisting) && (metal != MetalType.Tin || allomancerType != AllomancerType.TinMisting)) { if (metal == MetalType.Copper) { return allomancerType == AllomancerType.CopperMisting; } return false; } return true; } private static string GetAllomancerTitle(AllomancerType type) { return type switch { AllomancerType.IronMisting => "Iron Misting (Lurcher)", AllomancerType.SteelMisting => "Steel Misting (Coinshot)", AllomancerType.PewterMisting => "Pewter Misting (Pewterarm)", AllomancerType.TinMisting => "Tin Misting (Tineye)", AllomancerType.CopperMisting => "Copper Misting (Smoker)", AllomancerType.Mistborn => "Mistborn", _ => "Unawakened", }; } private static bool TryLoadReserve(Player player, string key, out float value) { value = 0f; if (player.m_customData.TryGetValue(key, out var value2)) { return float.TryParse(value2, NumberStyles.Float, CultureInfo.InvariantCulture, out value); } return false; } private float GetReserve(MetalType metal) { return metal switch { MetalType.Iron => ironReserve, MetalType.Steel => steelReserve, MetalType.Pewter => pewterReserve, MetalType.Tin => tinReserve, _ => copperReserve, }; } private void SetReserve(MetalType metal, float value) { value = Mathf.Clamp(value, 0f, maximumReserve.Value); switch (metal) { case MetalType.Iron: ironReserve = value; break; case MetalType.Steel: steelReserve = value; break; case MetalType.Pewter: pewterReserve = value; break; case MetalType.Tin: tinReserve = value; break; case MetalType.Copper: copperReserve = value; break; } reserveDirty = true; } private bool TryConsumeReserve(MetalType metal, float amount) { if (amount <= 0f) { return true; } float reserve = GetReserve(metal); if (reserve + 0.0001f < amount) { return false; } SetReserve(metal, reserve - amount); return true; } private bool TryConsumeSightReserve(float amount) { bool flag = ironBurning && HasMetalAccess(MetalType.Iron); bool flag2 = steelBurning && HasMetalAccess(MetalType.Steel); int num = (flag ? 1 : 0) + (flag2 ? 1 : 0); if (num == 0) { return false; } float num2 = amount / (float)num; if ((flag && ironReserve + 0.0001f < num2) || (flag2 && steelReserve + 0.0001f < num2)) { return false; } if (flag) { SetReserve(MetalType.Iron, ironReserve - num2); } if (flag2) { SetReserve(MetalType.Steel, steelReserve - num2); } return true; } private bool IsPewterActive() { if (pewterBurning && HasMetalAccess(MetalType.Pewter) && pewterReserve > 0.0001f) { return (Object)(object)reserveOwner == (Object)(object)Player.m_localPlayer; } return false; } private bool IsCopperActive() { if (copperBurning && HasMetalAccess(MetalType.Copper) && copperReserve > 0.0001f) { return (Object)(object)reserveOwner == (Object)(object)Player.m_localPlayer; } return false; } private float GetCopperVisibilityMultiplier() { float num = copperVisibilityMultiplier.Value; if (IsFlaring()) { num /= flarePowerMultiplier.Value; } return Mathf.Clamp(num, 0.05f, 1f); } private bool IsFlaring() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) if (flareKey == null || !IsShortcutHeld(flareKey.Value) || (Object)(object)Player.m_localPlayer == (Object)null) { return false; } if ((!ironBurning || !HasMetalAccess(MetalType.Iron) || !(ironReserve > 0.0001f)) && (!steelBurning || !HasMetalAccess(MetalType.Steel) || !(steelReserve > 0.0001f)) && (!pewterBurning || !HasMetalAccess(MetalType.Pewter) || !(pewterReserve > 0.0001f)) && (!tinBurning || !HasMetalAccess(MetalType.Tin) || !(tinReserve > 0.0001f))) { if (copperBurning && HasMetalAccess(MetalType.Copper)) { return copperReserve > 0.0001f; } return false; } return true; } private float GetFlareDrainMultiplier() { if (!IsFlaring()) { return 1f; } return flareDrainMultiplier.Value; } private float GetPewterBonusMultiplier() { if (!IsFlaring()) { return 1f; } return flarePewterMultiplier.Value; } private float GetTinSenseMultiplier() { if (!IsFlaring()) { return 1f; } return flareTinMultiplier.Value; } private void RefillReserve(Player player) { //IL_0052: Unknown result type (might be due to invalid IL or missing references) if (allomancerType == AllomancerType.Unawakened) { ShowCenterMessage("You have not awakened Allomancy."); return; } if (AllReservesFull()) { ShowCenterMessage("All metal reserves are already full."); return; } Inventory inventory = ((Humanoid)player).GetInventory(); ItemData val = FindTincture(inventory); if (val == null) { ShowCenterMessage("You need an Allomantic Tincture to refill every reserve."); return; } inventory.RemoveItem(val, 1); PlaySound("sfx_drink", ((Character)player).GetCenterPoint()); RestoreReserve(MetalType.Combined); } private void RefillSingleReserve(Player player, MetalType metal) { //IL_007b: Unknown result type (might be due to invalid IL or missing references) if (GetReserve(metal) >= maximumReserve.Value - 0.01f) { ShowCenterMessage(metal.ToString() + " reserve is already full."); return; } Inventory inventory = ((Humanoid)player).GetInventory(); ItemData val = FindConsumable(inventory, metal); if (val == null) { ShowCenterMessage("You need a " + metal.ToString() + " Vial."); return; } inventory.RemoveItem(val, 1); PlaySound("sfx_drink", ((Character)player).GetCenterPoint()); RestoreReserve(metal); } private static ItemData FindTincture(Inventory inventory) { if (inventory == null) { return null; } foreach (ItemData allItem in inventory.GetAllItems()) { if (GetConsumableMetal(allItem) == MetalType.Combined) { return allItem; } } return null; } private static ItemData FindConsumable(Inventory inventory, MetalType metal) { if (inventory == null) { return null; } foreach (ItemData allItem in inventory.GetAllItems()) { if (GetConsumableMetal(allItem) == metal) { return allItem; } } return null; } private static MetalType? GetConsumableMetal(ItemData item) { if (item == null || (Object)(object)item.m_dropPrefab == (Object)null) { return null; } string name = ((Object)item.m_dropPrefab).name; if (name.StartsWith("MetalboundIronVial", StringComparison.Ordinal)) { return MetalType.Iron; } if (name.StartsWith("MetalboundSteelVial", StringComparison.Ordinal)) { return MetalType.Steel; } if (name.StartsWith("MetalboundPewterVial", StringComparison.Ordinal)) { return MetalType.Pewter; } if (name.StartsWith("MetalboundTinVial", StringComparison.Ordinal)) { return MetalType.Tin; } if (name.StartsWith("MetalboundCopperVial", StringComparison.Ordinal)) { return MetalType.Copper; } if (name.StartsWith("MetalboundTincture", StringComparison.Ordinal)) { return MetalType.Combined; } return null; } private static bool IsLerasium(ItemData item) { if (item != null && (Object)(object)item.m_dropPrefab != (Object)null) { return ((Object)item.m_dropPrefab).name.StartsWith("MetalboundLerasiumNugget", StringComparison.Ordinal); } return false; } private void BeginLerasiumAscension(Player player) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Expected O, but got Unknown //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0056: Unknown result type (might be due to invalid IL or missing references) EnsureAllomancerTypeLoaded(player); player.m_customData["com.keeto.valheim.metalbound.lerasium_pending"] = "true"; ShowCenterMessage("Lerasium burns through your body..."); HitData val = new HitData(); val.m_damage.m_damage = 1000000f; val.m_hitType = (HitType)14; val.m_point = ((Character)player).GetCenterPoint(); val.m_dir = Vector3.down; ((Character)player).Damage(val); } private void HandleAllomanticDeath(Player player) { EnsureAllomancerTypeLoaded(player); if (player.m_customData.ContainsKey("com.keeto.valheim.metalbound.lerasium_pending")) { player.m_customData.Remove("com.keeto.valheim.metalbound.lerasium_pending"); player.m_customData["com.keeto.valheim.metalbound.lerasium_respawn_message"] = "mistborn"; SetAllomancerType(player, AllomancerType.Mistborn); ironBurning = true; steelBurning = true; } else if (allomancerType == AllomancerType.Unawakened && !(Random.value > mistingChanceOnDeath.Value)) { SetAllomancerType(player, Random.Range(0, 5) switch { 3 => AllomancerType.TinMisting, 2 => AllomancerType.PewterMisting, 1 => AllomancerType.SteelMisting, 0 => AllomancerType.IronMisting, _ => AllomancerType.CopperMisting, }); player.m_customData["com.keeto.valheim.metalbound.lerasium_respawn_message"] = "misting"; } } private void TryShowAwakeningMessage(Player player) { if (!((Object)(object)player == (Object)null) && !((Character)player).IsDead() && !((Object)(object)MessageHud.instance == (Object)null) && player.m_customData.TryGetValue("com.keeto.valheim.metalbound.lerasium_respawn_message", out var value)) { if ((Object)(object)awakeningMessageOwner != (Object)(object)player) { awakeningMessageOwner = player; awakeningMessageReadyTime = Time.unscaledTime + 2.5f; } else if (!(Time.unscaledTime < awakeningMessageReadyTime)) { string text = (string.Equals(value, "misting", StringComparison.OrdinalIgnoreCase) ? "You feel something burning inside you." : "You feel your whole body burn with power!"); MessageHud.instance.ShowMessage((MessageType)2, text, 0, (Sprite)null, false); player.m_customData.Remove("com.keeto.valheim.metalbound.lerasium_respawn_message"); awakeningMessageOwner = null; awakeningMessageReadyTime = float.PositiveInfinity; } } } private bool AllReservesFull() { if (ironReserve >= maximumReserve.Value - 0.01f && steelReserve >= maximumReserve.Value - 0.01f && pewterReserve >= maximumReserve.Value - 0.01f && tinReserve >= maximumReserve.Value - 0.01f) { return copperReserve >= maximumReserve.Value - 0.01f; } return false; } private void RestoreReserve(MetalType metal) { if (metal == MetalType.Combined) { SetReserve(MetalType.Iron, maximumReserve.Value); SetReserve(MetalType.Steel, maximumReserve.Value); SetReserve(MetalType.Pewter, maximumReserve.Value); SetReserve(MetalType.Tin, maximumReserve.Value); SetReserve(MetalType.Copper, maximumReserve.Value); ShowCenterMessage("All metal reserves completely replenished."); } else { SetReserve(metal, maximumReserve.Value); ShowCenterMessage(metal.ToString() + " reserve completely replenished."); } PersistReserve(); } private void NotifyReserveEmpty(MetalType metal) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) if (!(Time.time - lastEmptyMessageTime < 1.5f)) { lastEmptyMessageTime = Time.time; if ((Object)(object)reserveOwner != (Object)null) { PlaySound("sfx_gui_button", ((Character)reserveOwner).GetCenterPoint(), 0.65f); } ShowCenterMessage(metal.ToString() + " reserve empty — use its vial or an Allomantic Tincture."); } } private void PersistReserveIfNeeded() { if (reserveDirty && Time.time - lastReserveSaveTime >= 0.5f) { PersistReserve(); } } private void PersistReserve() { if (!((Object)(object)reserveOwner == (Object)null)) { reserveOwner.m_customData["com.keeto.valheim.metalbound.reserve.iron"] = ironReserve.ToString("R", CultureInfo.InvariantCulture); reserveOwner.m_customData["com.keeto.valheim.metalbound.reserve.steel"] = steelReserve.ToString("R", CultureInfo.InvariantCulture); reserveOwner.m_customData["com.keeto.valheim.metalbound.reserve.pewter"] = pewterReserve.ToString("R", CultureInfo.InvariantCulture); reserveOwner.m_customData["com.keeto.valheim.metalbound.reserve.tin"] = tinReserve.ToString("R", CultureInfo.InvariantCulture); reserveOwner.m_customData["com.keeto.valheim.metalbound.reserve.copper"] = copperReserve.ToString("R", CultureInfo.InvariantCulture); reserveDirty = false; lastReserveSaveTime = Time.time; } } private Transform GetMetalAnchor(Collider collider) { Piece componentInParent = ((Component)collider).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null && (RequirementsContainMetal(componentInParent.m_resources) || ContainsMetalToken(((Object)componentInParent).name))) { return ((Component)componentInParent).transform; } ItemDrop componentInParent2 = ((Component)collider).GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null && (ContainsMetalToken(((Object)componentInParent2).name) || ContainsMetalToken(componentInParent2.m_itemData?.m_shared?.m_name))) { return ((Component)componentInParent2).transform; } Transform root = ((Component)collider).transform.root; if (!ContainsMetalToken(((Object)root).name)) { return null; } return root; } private bool RequirementsContainMetal(Requirement[] requirements) { if (requirements == null) { return false; } for (int i = 0; i < requirements.Length; i++) { ItemDrop val = requirements[i]?.m_resItem; if ((Object)(object)val != (Object)null && (ContainsMetalToken(((Object)val).name) || ContainsMetalToken(val.m_itemData?.m_shared?.m_name))) { return true; } } return false; } private bool ContainsMetalToken(string value) { if (string.IsNullOrEmpty(value)) { return false; } string text = value.ToLowerInvariant(); string[] defaultMetalTokens = DefaultMetalTokens; foreach (string value2 in defaultMetalTokens) { if (text.Contains(value2)) { return true; } } defaultMetalTokens = extraMetalTokens.Value.Split(new char[1] { ',' }); for (int i = 0; i < defaultMetalTokens.Length; i++) { string text2 = defaultMetalTokens[i].Trim().ToLowerInvariant(); if (text2.Length > 0 && text.Contains(text2)) { return true; } } return false; } private void ApplyForce(Player player, Transform anchor, bool push) { //IL_0012: 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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_005d: 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) //IL_006f: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: 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_00b4: 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_00c7: Unknown result type (might be due to invalid IL or missing references) Rigidbody component = ((Component)player).GetComponent(); if ((Object)(object)component == (Object)null) { return; } Vector3 val = ((Character)player).GetCenterPoint() - anchor.position; Vector3 val2 = ((Vector3)(ref val)).normalized; if (!push) { val2 = -val2; } if (!TryMoveLooseAmmunition(player, anchor, push)) { float num = (IsFlaring() ? flarePowerMultiplier.Value : 1f); component.AddForce(val2 * acceleration.Value * num, (ForceMode)5); if (val2.y > 0.15f) { lastUpwardAssistTime = Time.time; } val = component.linearVelocity; if (((Vector3)(ref val)).magnitude > maximumSpeed.Value) { val = component.linearVelocity; component.linearVelocity = ((Vector3)(ref val)).normalized * maximumSpeed.Value; } EmitMovementWind(player, component, val2); } } private void EmitMovementWind(Player player, Rigidbody body, Vector3 forceDirection) { //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007a: 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_0114: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0127: Unknown result type (might be due to invalid IL or missing references) //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0138: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: 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_01d9: Unknown result type (might be due to invalid IL or missing references) //IL_01e1: Unknown result type (might be due to invalid IL or missing references) if (windEffectEnabled != null && windEffectEnabled.Value) { EnsureWindEffect(); Vector3 linearVelocity = body.linearVelocity; float magnitude = ((Vector3)(ref linearVelocity)).magnitude; float num = Mathf.InverseLerp(1.5f, maximumSpeed.Value, magnitude); Vector3 normalized; if (!(magnitude > 1.5f)) { normalized = ((Vector3)(ref forceDirection)).normalized; } else { linearVelocity = body.linearVelocity; normalized = ((Vector3)(ref linearVelocity)).normalized; } Vector3 val = normalized; Vector3 val2 = ((Character)player).GetCenterPoint() + Vector3.up * lineChestOffset.Value; int num2 = Mathf.Clamp(Mathf.RoundToInt(Mathf.Lerp(1f, 6f, num) * windEffectIntensity.Value), 1, 12); float num3 = Mathf.Lerp(5f, 18f, num); float num4 = Mathf.Lerp(0.018f, 0.035f, num); float num5 = Mathf.Lerp(0.035f, 0.075f, num); float num6 = Mathf.Lerp(0.1f, 0.24f, num); float num7 = Mathf.Lerp(0.22f, 0.55f, num); for (int i = 0; i < num2; i++) { EmitParams val3 = default(EmitParams); ((EmitParams)(ref val3)).position = val2 + Random.insideUnitSphere * 0.32f; ((EmitParams)(ref val3)).velocity = -val * Random.Range(num3 * 0.8f, num3 * 1.2f) + body.linearVelocity * 0.15f; ((EmitParams)(ref val3)).startLifetime = Random.Range(Mathf.Lerp(0.12f, 0.22f, num), Mathf.Lerp(0.2f, 0.38f, num)); ((EmitParams)(ref val3)).startSize = Random.Range(num4, num5); ((EmitParams)(ref val3)).startColor = Color32.op_Implicit(new Color(0.72f, 0.9f, 1f, Random.Range(num6, num7))); EmitParams val4 = val3; windParticles.Emit(val4, 1); } } } private void EnsureWindEffect() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0032: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_0063: 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_0085: 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) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown if (!((Object)(object)windParticles != (Object)null)) { GameObject val = new GameObject("MetalboundMovementWind"); Object.DontDestroyOnLoad((Object)(object)val); windParticles = val.AddComponent(); MainModule main = windParticles.main; ((MainModule)(ref main)).loop = false; ((MainModule)(ref main)).playOnAwake = false; ((MainModule)(ref main)).simulationSpace = (ParticleSystemSimulationSpace)1; ((MainModule)(ref main)).maxParticles = 180; ((MainModule)(ref main)).startSpeed = MinMaxCurve.op_Implicit(0f); ((MainModule)(ref main)).startLifetime = MinMaxCurve.op_Implicit(0.25f); ((MainModule)(ref main)).startSize = MinMaxCurve.op_Implicit(0.04f); EmissionModule emission = windParticles.emission; ((EmissionModule)(ref emission)).enabled = false; ShapeModule shape = windParticles.shape; ((ShapeModule)(ref shape)).enabled = false; ParticleSystemRenderer component = val.GetComponent(); component.renderMode = (ParticleSystemRenderMode)1; component.lengthScale = 4f; component.velocityScale = 0.12f; windMaterial = new Material(Shader.Find("Sprites/Default")); ((Renderer)component).sharedMaterial = windMaterial; windParticles.Play(); } } private bool TryMoveLooseAmmunition(Player player, Transform anchor, bool push) { //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_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_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_008a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0087: Unknown result type (might be due to invalid IL or missing references) //IL_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: Unknown result type (might be due to invalid IL or missing references) ItemDrop component = ((Component)anchor).GetComponent(); if ((Object)(object)component == (Object)null || !IsCoinshotAmmunitionPrefab(((Object)component).name)) { return false; } DownwardAnchorSettler componentInChildren = ((Component)anchor).GetComponentInChildren(); if ((Object)(object)componentInChildren != (Object)null && componentInChildren.IsSettled) { return false; } Rigidbody val = ((Component)anchor).GetComponent(); if ((Object)(object)val == (Object)null) { val = ((Component)anchor).GetComponentInChildren(); } if ((Object)(object)val == (Object)null || val.isKinematic) { return false; } Vector3 val2 = anchor.position - ((Character)player).GetCenterPoint(); Vector3 val3 = ((Vector3)(ref val2)).normalized; if (!push) { val3 = -val3; } if (IsAmmunitionBraced(anchor, val3)) { return false; } ZNetView val4 = ((Component)anchor).GetComponent(); if ((Object)(object)val4 == (Object)null) { val4 = ((Component)anchor).GetComponentInChildren(); } if ((Object)(object)val4 != (Object)null && val4.IsValid() && !val4.IsOwner()) { val4.ClaimOwnership(); } val.WakeUp(); val.collisionDetectionMode = (CollisionDetectionMode)2; val.interpolation = (RigidbodyInterpolation)1; val.linearVelocity = val3 * looseCoinFlightSpeed.Value; return true; } private static bool IsCoinshotAmmunitionPrefab(string prefabName) { if (string.IsNullOrEmpty(prefabName)) { return false; } string text = prefabName.ToLowerInvariant(); if (!text.Contains("coin") && !text.Contains("bronzenails")) { return text.Contains("ironnails"); } return true; } private bool IsAmmunitionBraced(Transform coin, Vector3 forceDirection) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0021: 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_0037: 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_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0086: Unknown result type (might be due to invalid IL or missing references) Collider component = ((Component)coin).GetComponent(); Vector3 val; Bounds bounds; if (!((Object)(object)component != (Object)null)) { val = coin.position; } else { bounds = component.bounds; val = ((Bounds)(ref bounds)).center; } float num; if (!((Object)(object)component != (Object)null)) { num = 0.05f; } else { bounds = component.bounds; Vector3 extents = ((Bounds)(ref bounds)).extents; num = Mathf.Clamp(((Vector3)(ref extents)).magnitude * 0.25f, 0.03f, 0.12f); } float num2 = num; RaycastHit[] array = Physics.SphereCastAll(val, num2, forceDirection, coinBraceDistance.Value, -1, (QueryTriggerInteraction)1); for (int i = 0; i < array.Length; i++) { RaycastHit val2 = array[i]; if (!((Object)(object)((RaycastHit)(ref val2)).collider == (Object)null) && !((Component)((RaycastHit)(ref val2)).collider).transform.IsChildOf(coin) && !((Object)(object)((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent() != (Object)null)) { return true; } } return false; } private void UpdateControlledDescent(Player player) { //IL_0038: 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) if (!(MaxAirAltitudeField == null) && !(Time.time - lastUpwardAssistTime > fallProtectionGrace.Value)) { Rigidbody component = ((Component)player).GetComponent(); if (!((Object)(object)component == (Object)null) && !(component.linearVelocity.y < 0f - safeDescentSpeed.Value)) { MaxAirAltitudeField.SetValue(player, ((Component)player).transform.position.y); } } } private void UpdateLandingRoll(Player player) { //IL_0061: 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_00ae: Unknown result type (might be due to invalid IL or missing references) if (landingRollArmed && Time.time > landingRollExpiresAt) { landingRollArmed = false; } if (landingRollRequested && Time.time > landingRollRequestExpiresAt) { landingRollRequested = false; } if (MaxAirAltitudeField == null || DodgeMethod == null || allomancerType == AllomancerType.Unawakened) { return; } if (IsShortcutHeld(modeKey.Value) && Input.GetKeyDown((KeyCode)32)) { Rigidbody component = ((Component)player).GetComponent(); if ((Object)(object)component != (Object)null && component.linearVelocity.y < -0.5f && (float)MaxAirAltitudeField.GetValue(player) - ((Component)player).transform.position.y > 0.5f) { landingRollRequested = true; landingRollRequestExpiresAt = Time.time + landingRollInputBuffer.Value; } } if (landingRollRequested && IsGroundWithinLandingRollWindow(player)) { ActivateBufferedLandingRoll(player); } } private void ActivateBufferedLandingRoll(Player player) { //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) if (landingRollRequested && !(Time.time > landingRollRequestExpiresAt) && !(DodgeMethod == null)) { float fallDistance = (float)MaxAirAltitudeField.GetValue(player) - ((Component)player).transform.position.y; Vector3 val = ((Character)player).GetMoveDir(); val.y = 0f; if (((Vector3)(ref val)).sqrMagnitude < 0.01f) { Camera main = Camera.main; val = (((Object)(object)main != (Object)null) ? ((Component)main).transform.forward : ((Component)player).transform.forward); val.y = 0f; } ((Vector3)(ref val)).Normalize(); DodgeMethod.Invoke(player, new object[1] { val }); landingRollRequested = false; landingRollArmed = true; armedLandingRollReduction = CalculateLandingRollReduction(fallDistance); landingRollExpiresAt = Time.time + 0.9f; } } private float CalculateLandingRollReduction(float fallDistance) { float num = Mathf.Max(0f, fallDistance - landingRollFullReductionHeight.Value); int num2 = ((!(num <= 0f)) ? Mathf.CeilToInt(num / landingRollStepDistance.Value) : 0); return Mathf.Clamp(landingRollBaseReduction.Value - (float)num2 * landingRollStepReduction.Value, landingRollMinimumReduction.Value, 1f); } private bool IsGroundWithinLandingRollWindow(Player player) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0068: 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) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_0076: 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_007e: 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_0094: 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_009b: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) Vector3 val = ((Component)player).transform.position + Vector3.up * 0.25f; Vector3 val2 = ((Component)player).transform.right * 0.28f; Vector3 val3 = ((Component)player).transform.forward * 0.28f; Vector3[] array = (Vector3[])(object)new Vector3[5] { Vector3.zero, val2, -val2, val3, -val3 }; foreach (Vector3 val4 in array) { RaycastHit[] array2 = Physics.SphereCastAll(val + val4, 0.18f, Vector3.down, landingRollGroundWindow.Value + 0.25f, -1, (QueryTriggerInteraction)1); for (int j = 0; j < array2.Length; j++) { RaycastHit val5 = array2[j]; if (!((Object)(object)((RaycastHit)(ref val5)).collider == (Object)null) && !((Component)((RaycastHit)(ref val5)).collider).transform.IsChildOf(((Component)player).transform)) { return true; } } } return false; } private void ApplyLandingRollDamageReduction(Character victim, HitData hit) { //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Invalid comparison between Unknown and I4 if (landingRollArmed && !(Time.time > landingRollExpiresAt) && !((Object)(object)victim != (Object)(object)Player.m_localPlayer) && (int)hit.m_hitType == 3 && !(hit.m_damage.m_damage <= 0f)) { hit.m_damage.m_damage *= 1f - armedLandingRollReduction; landingRollArmed = false; landingRollRequested = false; landingRollExpiresAt = float.NegativeInfinity; armedLandingRollReduction = 0f; } } private void DrawAnchorLines(Player player, List anchors, Transform selectedAnchor) { //IL_0045: 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_0087: 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_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0097: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: 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) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0207: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0154: 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_018b: Unknown result type (might be due to invalid IL or missing references) EnsureAnchorLine(); bool flag = IsFlaring(); anchorLine.startColor = (flag ? new Color(0.35f, 0.8f, 1f, 1f) : new Color(0.2f, 0.65f, 1f, 0.9f)); anchorLine.endColor = (flag ? new Color(0.55f, 0.9f, 1f, 0.42f) : new Color(0.4f, 0.8f, 1f, 0.25f)); Vector3 val = ((Character)player).GetCenterPoint() + Vector3.up * lineChestOffset.Value; int num = 0; foreach (Transform anchor in anchors) { if (!((Object)(object)anchor == (Object)null) && !((Object)(object)anchor == (Object)(object)selectedAnchor) && num < maximumVisibleLines.Value) { LineRenderer obj = EnsureAmbientLine(num++); obj.startColor = (flag ? new Color(0.3f, 0.72f, 1f, 0.28f) : new Color(0.2f, 0.65f, 1f, 0.16f)); obj.endColor = (flag ? new Color(0.5f, 0.88f, 1f, 0.09f) : new Color(0.4f, 0.8f, 1f, 0.04f)); ((Renderer)obj).enabled = true; obj.SetPosition(0, val); obj.SetPosition(1, anchor.position); } } for (int i = num; i < ambientLines.Count; i++) { ((Renderer)ambientLines[i]).enabled = false; } if ((Object)(object)selectedAnchor == (Object)null) { ((Renderer)anchorLine).enabled = false; return; } ((Renderer)anchorLine).enabled = true; anchorLine.SetPosition(0, val); anchorLine.SetPosition(1, selectedAnchor.position); } private void EnsureAnchorLine() { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Expected O, but got Unknown //IL_0072: 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_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown if (!((Object)(object)anchorLine != (Object)null)) { GameObject val = new GameObject("MetalboundAnchorLine"); Object.DontDestroyOnLoad((Object)(object)val); anchorLine = val.AddComponent(); anchorLine.positionCount = 2; anchorLine.startWidth = 0.025f; anchorLine.endWidth = 0.01f; anchorLine.startColor = new Color(0.2f, 0.65f, 1f, 0.9f); anchorLine.endColor = new Color(0.4f, 0.8f, 1f, 0.25f); lineMaterial = new Material(Shader.Find("Sprites/Default")); ((Renderer)anchorLine).sharedMaterial = lineMaterial; ((Renderer)anchorLine).enabled = false; } } private LineRenderer EnsureAmbientLine(int index) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Expected O, but got Unknown //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) EnsureAnchorLine(); while (ambientLines.Count <= index) { GameObject val = new GameObject("MetalboundAmbientLine"); Object.DontDestroyOnLoad((Object)val); LineRenderer val2 = val.AddComponent(); val2.positionCount = 2; val2.startWidth = 0.008f; val2.endWidth = 0.004f; val2.startColor = new Color(0.2f, 0.65f, 1f, 0.16f); val2.endColor = new Color(0.4f, 0.8f, 1f, 0.04f); ((Renderer)val2).sharedMaterial = lineMaterial; ((Renderer)val2).enabled = false; ambientLines.Add(val2); } return ambientLines[index]; } private void HideAnchorLine() { if ((Object)(object)anchorLine != (Object)null) { ((Renderer)anchorLine).enabled = false; } foreach (LineRenderer ambientLine in ambientLines) { if ((Object)(object)ambientLine != (Object)null) { ((Renderer)ambientLine).enabled = false; } } } private void OnGUI() { //IL_0090: 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_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_010b: 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_0162: 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_01b9: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) DrawMetalWheel(); DrawBurningMetalIndicators(); DrawTinAwarenessIndicators(); if (showReserveBar != null && showReserveBar.Value && !((Object)(object)reserveOwner == (Object)null) && !((Object)(object)Player.m_localPlayer != (Object)(object)reserveOwner)) { float num = ((float)Screen.width - 260f) * 0.5f; float num2 = (float)Screen.height - 118f; bool flag = IsMetalWheelOpen(); if (HasMetalAccess(MetalType.Copper) && (flag || copperBurning)) { DrawReserveBar(new Rect(num, num2, 260f, 16f), "COPPER", copperReserve, new Color(0.82f, 0.42f, 0.18f, 0.95f)); num2 -= 20f; } if (HasMetalAccess(MetalType.Tin) && (flag || tinBurning)) { DrawReserveBar(new Rect(num, num2, 260f, 16f), "TIN", tinReserve, new Color(0.72f, 0.88f, 0.98f, 0.95f)); num2 -= 20f; } if (HasMetalAccess(MetalType.Pewter) && (flag || pewterBurning)) { DrawReserveBar(new Rect(num, num2, 260f, 16f), "PEWTER", pewterReserve, new Color(0.72f, 0.65f, 0.95f, 0.95f)); num2 -= 20f; } if (HasMetalAccess(MetalType.Steel) && (flag || steelBurning)) { DrawReserveBar(new Rect(num, num2, 260f, 16f), "STEEL", steelReserve, new Color(0.25f, 0.78f, 1f, 0.95f)); num2 -= 20f; } if (HasMetalAccess(MetalType.Iron) && (flag || ironBurning)) { DrawReserveBar(new Rect(num, num2, 260f, 16f), "IRON", ironReserve, new Color(0.25f, 0.55f, 1f, 0.95f)); } } } private void DrawReserveBar(Rect background, string name, float reserve, Color fillColor) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Unknown result type (might be due to invalid IL or missing references) //IL_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_00f2: Expected O, but got Unknown //IL_00f8: 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_0154: Unknown result type (might be due to invalid IL or missing references) float num = ((maximumReserve.Value > 0f) ? Mathf.Clamp01(reserve / maximumReserve.Value) : 0f); Color color = GUI.color; GUI.color = new Color(0.02f, 0.03f, 0.04f, 0.85f); GUI.DrawTexture(background, (Texture)(object)Texture2D.whiteTexture); GUI.color = (Color)((num <= 0.2f) ? new Color(0.9f, 0.25f, 0.15f, 0.95f) : fillColor); GUI.DrawTexture(new Rect(((Rect)(ref background)).x + 2f, ((Rect)(ref background)).y + 2f, (((Rect)(ref background)).width - 4f) * num, ((Rect)(ref background)).height - 4f), (Texture)(object)Texture2D.whiteTexture); GUI.color = Color.white; GUIStyle val = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontStyle = (FontStyle)1 }; val.normal.textColor = Color.white; GUI.Label(background, name + " " + Mathf.CeilToInt(reserve) + " / " + Mathf.RoundToInt(maximumReserve.Value), val); GUI.color = color; } private void DrawMetalWheel() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: Unknown result type (might be due to invalid IL or missing references) //IL_00be: 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_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: 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_0108: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0139: 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) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_016e: 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_018c: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01aa: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: 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: Expected O, but got Unknown //IL_0203: 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_0217: Unknown result type (might be due to invalid IL or missing references) //IL_0223: 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_024a: Unknown result type (might be due to invalid IL or missing references) if (metalWheelKey != null && IsShortcutHeld(metalWheelKey.Value)) { EnsureMetalWheelTexture(); Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor((float)Screen.width * 0.5f, (float)Screen.height * 0.5f); Rect val2 = new Rect(val.x - 205f, val.y - 205f, 410f, 410f); Color color = GUI.color; GUI.color = new Color(0.015f, 0.025f, 0.04f, 0.88f); GUI.DrawTexture(val2, (Texture)(object)metalWheelTexture); GetMetalWheelOptionRects(out var ironRect, out var steelRect, out var pewterRect, out var tinRect, out var copperRect); GetAmmoWheelOptionRects(out var coinRect, out var bronzeNailRect, out var ironNailRect); Vector2 val3 = val + metalWheelSelector; DrawTetheredSelector(val, val3); DrawMetalWheelOption(ironRect, "IRON", ironBurning, ((Rect)(ref ironRect)).Contains(val3), HasMetalAccess(MetalType.Iron)); DrawMetalWheelOption(steelRect, "STEEL", steelBurning, ((Rect)(ref steelRect)).Contains(val3), HasMetalAccess(MetalType.Steel)); DrawMetalWheelOption(pewterRect, "PEWTER", pewterBurning, ((Rect)(ref pewterRect)).Contains(val3), HasMetalAccess(MetalType.Pewter)); DrawMetalWheelOption(tinRect, "TIN", tinBurning, ((Rect)(ref tinRect)).Contains(val3), HasMetalAccess(MetalType.Tin)); DrawMetalWheelOption(copperRect, "COPPER", copperBurning, ((Rect)(ref copperRect)).Contains(val3), HasMetalAccess(MetalType.Copper)); DrawAmmoWheelOption(coinRect, "COIN", selectedCoinshotAmmo == CoinshotAmmoType.Coin, ((Rect)(ref coinRect)).Contains(val3)); DrawAmmoWheelOption(bronzeNailRect, "BRONZE\nNAIL", selectedCoinshotAmmo == CoinshotAmmoType.BronzeNail, ((Rect)(ref bronzeNailRect)).Contains(val3)); DrawAmmoWheelOption(ironNailRect, "IRON\nNAIL", selectedCoinshotAmmo == CoinshotAmmoType.IronNail, ((Rect)(ref ironNailRect)).Contains(val3)); GUIStyle val4 = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontSize = 13 }; val4.normal.textColor = new Color(0.75f, 0.85f, 0.95f, 1f); GUI.color = Color.white; GUI.Label(new Rect(val.x - 200f, val.y + 202f, 400f, 42f), "Left-click: toggle metal or select ammo\nRight-click a metal: consume its vial", val4); GUI.color = color; } } private static void DrawTetheredSelector(Vector2 center, Vector2 mouse) { //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_0002: 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_0008: Unknown result type (might be due to invalid IL or missing references) //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0019: 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_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: 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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0054: 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_007e: 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_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00b9: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: 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_0108: 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_011e: Unknown result type (might be due to invalid IL or missing references) //IL_0134: 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) Vector2 val = mouse - center; Vector2 val2 = center + Vector2.ClampMagnitude(val, 184f); float num = Vector2.Distance(center, val2); float num2 = Mathf.Atan2(val2.y - center.y, val2.x - center.x) * 57.29578f; Matrix4x4 matrix = GUI.matrix; Color color = GUI.color; GUIUtility.RotateAroundPivot(num2, center); GUI.color = new Color(0.3f, 0.75f, 1f, 0.8f); GUI.DrawTexture(new Rect(center.x, center.y - 1.5f, num, 3f), (Texture)(object)Texture2D.whiteTexture); GUI.matrix = matrix; GUI.color = new Color(0.45f, 0.85f, 1f, 1f); GUI.DrawTexture(new Rect(val2.x - 8f, val2.y - 8f, 16f, 16f), (Texture)(object)Texture2D.whiteTexture); GUI.color = new Color(0.02f, 0.05f, 0.08f, 1f); GUI.DrawTexture(new Rect(val2.x - 4f, val2.y - 4f, 8f, 8f), (Texture)(object)Texture2D.whiteTexture); GUI.color = color; } private static void DrawMetalWheelOption(Rect rect, string metalName, bool burning, bool selected, bool unlocked) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_00c4: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00de: 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_00ec: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Expected O, but got Unknown //IL_00fb: 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_010f: 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_0084: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; if (selected) { GUI.color = new Color(0.55f, 0.9f, 1f, 1f); GUI.DrawTexture(new Rect(((Rect)(ref rect)).x - 4f, ((Rect)(ref rect)).y - 4f, ((Rect)(ref rect)).width + 8f, ((Rect)(ref rect)).height + 8f), (Texture)(object)Texture2D.whiteTexture); } GUI.color = ((!unlocked) ? new Color(0.015f, 0.018f, 0.025f, 0.96f) : (burning ? new Color(0.12f, 0.62f, 1f, 0.98f) : new Color(0.025f, 0.035f, 0.05f, 0.92f))); GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture); GUIStyle val = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontStyle = (FontStyle)1, fontSize = 16 }; val.normal.textColor = Color.white; GUI.color = Color.white; GUI.Label(rect, metalName + "\n" + ((!unlocked) ? "LOCKED" : (burning ? "BURNING" : "OFF")), val); GUI.color = color; } private static void DrawAmmoWheelOption(Rect rect, string ammoName, bool active, bool hovered) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0080: 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_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_00c6: 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_00d6: Expected O, but got Unknown //IL_00dc: 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_00f0: Unknown result type (might be due to invalid IL or missing references) Color color = GUI.color; if (hovered) { GUI.color = new Color(0.55f, 0.9f, 1f, 1f); GUI.DrawTexture(new Rect(((Rect)(ref rect)).x - 3f, ((Rect)(ref rect)).y - 3f, ((Rect)(ref rect)).width + 6f, ((Rect)(ref rect)).height + 6f), (Texture)(object)Texture2D.whiteTexture); } GUI.color = (active ? new Color(0.7f, 0.42f, 0.12f, 0.98f) : new Color(0.035f, 0.04f, 0.055f, 0.94f)); GUI.DrawTexture(rect, (Texture)(object)Texture2D.whiteTexture); GUIStyle val = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontStyle = (FontStyle)1, fontSize = 12 }; val.normal.textColor = Color.white; GUI.color = Color.white; GUI.Label(rect, ammoName + (active ? "\nSELECTED" : string.Empty), val); GUI.color = color; } private void DrawBurningMetalIndicators() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: 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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0063: Expected O, but got Unknown //IL_007d: 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_0028: Unknown result type (might be due to invalid IL or missing references) if (modeKey != null && metalWheelKey != null && (IsShortcutHeld(modeKey.Value) || IsShortcutHeld(metalWheelKey.Value) || IsFlaring())) { GUIStyle val = new GUIStyle(GUI.skin.label) { alignment = (TextAnchor)4, fontStyle = (FontStyle)1, fontSize = 12 }; val.normal.textColor = new Color(0.55f, 0.82f, 1f, 1f); GUI.Label(new Rect(((float)Screen.width - 860f) * 0.5f, (float)Screen.height - 94f, 860f, 22f), (IsFlaring() ? "FLARING " : string.Empty) + GetAllomancerTitle(allomancerType) + " IRON " + (ironBurning ? "ON" : "OFF") + " STEEL " + (steelBurning ? "ON" : "OFF") + " PEWTER " + (pewterBurning ? "ON" : "OFF") + " TIN " + (tinBurning ? "ON" : "OFF") + " COPPER " + (copperBurning ? "ON" : "OFF") + " AMMO " + GetCoinshotAmmoDisplayName(selectedCoinshotAmmo).ToUpperInvariant(), val); } } private void DrawTinAwarenessIndicators() { //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) if (!tinBurning || (Object)(object)Camera.main == (Object)null) { return; } foreach (Character sensedTinEnemy in sensedTinEnemies) { if ((Object)(object)sensedTinEnemy != (Object)null) { DrawTinEnemyGlow(sensedTinEnemy.GetCenterPoint()); } } foreach (Transform sensedIncomingProjectile in sensedIncomingProjectiles) { if ((Object)(object)sensedIncomingProjectile != (Object)null) { DrawTinDirectionMarker(sensedIncomingProjectile.position, urgent: true, offscreenOnly: false); } } } private void DrawTinEnemyGlow(Vector3 worldPosition) { //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: 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_0047: 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_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_008c: 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_00d6: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_0186: 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_01eb: Unknown result type (might be due to invalid IL or missing references) //IL_0210: 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_022a: Unknown result type (might be due to invalid IL or missing references) //IL_023e: 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_0061: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_016e: 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_0183: 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_00f2: Unknown result type (might be due to invalid IL or missing references) //IL_0289: Unknown result type (might be due to invalid IL or missing references) //IL_0299: Unknown result type (might be due to invalid IL or missing references) //IL_02ad: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; Player localPlayer = Player.m_localPlayer; if ((Object)(object)main == (Object)null || (Object)(object)localPlayer == (Object)null) { return; } EnsureTinSenseGlowTexture(); Vector3 val = main.WorldToViewportPoint(worldPosition); bool flag = val.z > 0f && val.x >= 0f && val.x <= 1f && val.y >= 0f && val.y <= 1f; Vector2 val2 = default(Vector2); if (flag) { ((Vector2)(ref val2))..ctor(val.x * (float)Screen.width, (1f - val.y) * (float)Screen.height); } else { Vector3 val3 = ((Component)main).transform.InverseTransformPoint(worldPosition); Vector2 val4 = default(Vector2); ((Vector2)(ref val4))..ctor(val3.x, 0f - val3.y); if (val3.z < 0f) { val4 = -val4; } if (((Vector2)(ref val4)).sqrMagnitude < 0.001f) { val4 = Vector2.up; } ((Vector2)(ref val4)).Normalize(); Vector2 val5 = new Vector2((float)Screen.width * 0.5f, (float)Screen.height * 0.5f); float num = ((float)Screen.width * 0.5f - 38f) / Mathf.Max(Mathf.Abs(val4.x), 0.001f); float num2 = ((float)Screen.height * 0.5f - 38f) / Mathf.Max(Mathf.Abs(val4.y), 0.001f); val2 = val5 + val4 * Mathf.Min(num, num2); } float num3 = Mathf.Clamp01(Vector3.Distance(((Character)localPlayer).GetCenterPoint(), worldPosition) / (tinEnemySenseRange.Value * GetTinSenseMultiplier())); float num4 = 0.72f + 0.28f * Mathf.Sin(Time.unscaledTime * 4f); float num5 = Mathf.Lerp(68f, 34f, num3) * num4 * tinEnemyGlowScale.Value; Color color = GUI.color; GUI.color = new Color(1f, 0.72f, 0.18f, Mathf.Lerp(0.72f, 0.38f, num3)); GUI.DrawTexture(new Rect(val2.x - num5 * 0.5f, val2.y - num5 * 0.5f, num5, num5), (Texture)(object)tinSenseGlowTexture); GUI.color = new Color(1f, 0.9f, 0.45f, 0.95f); float num6 = (flag ? 12f : 16f) * tinEnemyGlowScale.Value; GUI.DrawTexture(new Rect(val2.x - num6 * 0.5f, val2.y - num6 * 0.5f, num6, num6), (Texture)(object)tinSenseGlowTexture); GUI.color = color; } private void EnsureTinSenseGlowTexture() { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Expected O, but got Unknown //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: 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) if ((Object)(object)tinSenseGlowTexture != (Object)null) { return; } tinSenseGlowTexture = new Texture2D(64, 64, (TextureFormat)4, false); ((Object)tinSenseGlowTexture).name = "MetalboundTinSenseGlow"; ((Texture)tinSenseGlowTexture).wrapMode = (TextureWrapMode)1; Color[] array = (Color[])(object)new Color[4096]; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(31.5f, 31.5f); float num = 32f; for (int i = 0; i < 64; i++) { for (int j = 0; j < 64; j++) { float num2 = Vector2.Distance(new Vector2((float)j, (float)i), val) / num; float num3 = Mathf.Pow(Mathf.Clamp01(1f - num2), 2f); array[i * 64 + j] = new Color(1f, 1f, 1f, num3); } } tinSenseGlowTexture.SetPixels(array); tinSenseGlowTexture.Apply(false, true); } private static void DrawTinDirectionMarker(Vector3 worldPosition, bool urgent, bool offscreenOnly) { //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_0018: 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_0032: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0087: 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_0094: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: 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_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: 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_00ab: 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_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: 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_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01a9: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) //IL_01db: Unknown result type (might be due to invalid IL or missing references) //IL_01ef: Unknown result type (might be due to invalid IL or missing references) Camera main = Camera.main; if ((Object)(object)main == (Object)null) { return; } Vector3 val = main.WorldToViewportPoint(worldPosition); bool flag = val.z > 0f && val.x >= 0f && val.x <= 1f && val.y >= 0f && val.y <= 1f; if (!(offscreenOnly && flag)) { Vector3 val2 = ((Component)main).transform.InverseTransformPoint(worldPosition); Vector2 val3 = default(Vector2); ((Vector2)(ref val3))..ctor(val2.x, 0f - val2.y); if (val2.z < 0f) { val3 = -val3; } if (((Vector2)(ref val3)).sqrMagnitude < 0.001f) { val3 = Vector2.up; } ((Vector2)(ref val3)).Normalize(); Vector2 val4 = new Vector2((float)Screen.width * 0.5f, (float)Screen.height * 0.5f); float num = ((float)Screen.width * 0.5f - 34f) / Mathf.Max(Mathf.Abs(val3.x), 0.001f); float num2 = ((float)Screen.height * 0.5f - 34f) / Mathf.Max(Mathf.Abs(val3.y), 0.001f); Vector2 val5 = val4 + val3 * Mathf.Min(num, num2); float num3 = (urgent ? 20f : 14f); float num4 = (urgent ? (0.65f + 0.35f * Mathf.Sin(Time.unscaledTime * 10f)) : 1f); Color color = GUI.color; Matrix4x4 matrix = GUI.matrix; GUIUtility.RotateAroundPivot(45f, val5); GUI.color = (urgent ? new Color(1f, 0.18f, 0.08f, num4) : new Color(1f, 0.78f, 0.24f, 0.9f)); GUI.DrawTexture(new Rect(val5.x - num3 * 0.5f, val5.y - num3 * 0.5f, num3, num3), (Texture)(object)Texture2D.whiteTexture); GUI.matrix = matrix; GUI.color = color; } } private void EnsureMetalWheelTexture() { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Expected O, but got Unknown //IL_0072: 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_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) if ((Object)(object)metalWheelTexture != (Object)null) { return; } metalWheelTexture = new Texture2D(128, 128, (TextureFormat)4, false); ((Object)metalWheelTexture).name = "MetalboundMetalWheel"; ((Texture)metalWheelTexture).wrapMode = (TextureWrapMode)1; Color[] array = (Color[])(object)new Color[16384]; Vector2 val = default(Vector2); ((Vector2)(ref val))..ctor(63.5f, 63.5f); float num = 64f; for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { float num2 = Vector2.Distance(new Vector2((float)j, (float)i), val); float num3 = Mathf.Clamp01(num - num2); array[i * 128 + j] = new Color(1f, 1f, 1f, num3); } } metalWheelTexture.SetPixels(array); metalWheelTexture.Apply(false, true); } private void OnDestroy() { CloseMetalWheelIfNeeded(); RemoveTinEffects(Player.m_localPlayer); PersistReserve(); PrefabManager.OnVanillaPrefabsAvailable -= AddMetallicTincture; Harmony obj = harmony; if (obj != null) { obj.UnpatchSelf(); } Instance = null; if ((Object)(object)anchorLine != (Object)null) { Object.Destroy((Object)(object)((Component)anchorLine).gameObject); } foreach (LineRenderer ambientLine in ambientLines) { if ((Object)(object)ambientLine != (Object)null) { Object.Destroy((Object)(object)((Component)ambientLine).gameObject); } } if ((Object)(object)lineMaterial != (Object)null) { Object.Destroy((Object)(object)lineMaterial); } if ((Object)(object)windParticles != (Object)null) { Object.Destroy((Object)(object)((Component)windParticles).gameObject); } if ((Object)(object)windMaterial != (Object)null) { Object.Destroy((Object)(object)windMaterial); } if ((Object)(object)metalWheelTexture != (Object)null) { Object.Destroy((Object)(object)metalWheelTexture); } if ((Object)(object)tinSenseGlowTexture != (Object)null) { Object.Destroy((Object)(object)tinSenseGlowTexture); } if ((Object)(object)tinFinderEffect != (Object)null) { Object.Destroy((Object)(object)tinFinderEffect); } } private static void ScalePhysicalDamage(HitData hit, float multiplier) { hit.m_damage.m_blunt *= multiplier; hit.m_damage.m_slash *= multiplier; hit.m_damage.m_pierce *= multiplier; hit.m_damage.m_chop *= multiplier; hit.m_damage.m_pickaxe *= multiplier; } } public sealed class DownwardAnchorSettler : MonoBehaviour { private Rigidbody body; private bool canSettle; private bool stickToAnySurface; private bool settled; private Vector3 launchDirection; public bool IsSettled => settled; public void Configure(Vector3 direction, bool stickOnAnySurface) { //IL_000f: 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) body = ((Component)this).GetComponent(); launchDirection = ((Vector3)(ref direction)).normalized; stickToAnySurface = stickOnAnySurface; canSettle = stickToAnySurface || launchDirection.y <= -0.55f; } private void OnCollisionEnter(Collision collision) { //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_005d: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) if (!canSettle || settled || (Object)(object)body == (Object)null || collision == null || (Object)(object)(((Object)(object)collision.collider != (Object)null) ? ((Component)collision.collider).GetComponentInParent() : null) != (Object)null) { return; } int num = 0; while (num < collision.contactCount) { if (!stickToAnySurface) { ContactPoint contact = collision.GetContact(num); if (Vector3.Dot(((ContactPoint)(ref contact)).normal, Vector3.up) < 0.5f) { num++; continue; } } Settle(); break; } } public void TrySettleAtImpact(Collider collider, Vector3 point) { //IL_003c: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) if (stickToAnySurface && !settled && !((Object)(object)body == (Object)null) && !((Object)(object)collider == (Object)null) && !((Object)(object)((Component)collider).GetComponentInParent() != (Object)null)) { body.position = point - launchDirection * 0.04f; Settle(); } } private void Settle() { //IL_000d: 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) settled = true; body.linearVelocity = Vector3.zero; body.angularVelocity = Vector3.zero; body.constraints = (RigidbodyConstraints)126; body.Sleep(); } } public sealed class CoinshotProjectile : MonoBehaviour { private Player owner; private float damage; private float armedAt; private float expiresAt; private bool spent; private Vector3 flightDirection; private Vector3 lastPosition; private float flightSpeed; private Rigidbody body; public void Configure(Player projectileOwner, float projectileDamage, Vector3 direction, float speed, float lifetime) { //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Unknown result type (might be due to invalid IL or missing references) //IL_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) owner = projectileOwner; damage = projectileDamage; armedAt = Time.time + 0.1f; expiresAt = Time.time + lifetime; flightDirection = ((Vector3)(ref direction)).normalized; flightSpeed = speed; lastPosition = ((Component)this).transform.position; body = ((Component)this).GetComponent(); } private void FixedUpdate() { //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: 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_005f: 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_003d: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: 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_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c6: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) if (spent) { return; } if (Time.time >= expiresAt) { EndFlight(); return; } if ((Object)(object)body != (Object)null) { body.linearVelocity = flightDirection * flightSpeed; } Vector3 position = ((Component)this).transform.position; Vector3 val = position - lastPosition; float magnitude = ((Vector3)(ref val)).magnitude; if (magnitude > 0.001f) { RaycastHit[] array = Physics.SphereCastAll(lastPosition, 0.08f, val / magnitude, magnitude + 0.12f, -1, (QueryTriggerInteraction)1); Array.Sort(array, (RaycastHit left, RaycastHit right) => ((RaycastHit)(ref left)).distance.CompareTo(((RaycastHit)(ref right)).distance)); RaycastHit[] array2 = array; for (int num = 0; num < array2.Length; num++) { RaycastHit val2 = array2[num]; if (!((Object)(object)((RaycastHit)(ref val2)).collider == (Object)null) && !((Object)(object)((RaycastHit)(ref val2)).collider.attachedRigidbody == (Object)(object)body) && !((Object)(object)((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent() == (Object)(object)owner)) { Impact(((RaycastHit)(ref val2)).collider, ((RaycastHit)(ref val2)).point); break; } } } lastPosition = position; } private void OnCollisionEnter(Collision collision) { //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_005d: 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_0062: 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) if (!spent && !(Time.time < armedAt) && !((Object)(object)collision.collider == (Object)null) && !((Object)(object)((Component)collision.collider).GetComponentInParent() == (Object)(object)owner)) { Vector3 val; if (collision.contactCount <= 0) { val = ((Component)this).transform.position; } else { ContactPoint contact = collision.GetContact(0); val = ((ContactPoint)(ref contact)).point; } Vector3 point = val; Impact(collision.collider, point); } } private void Impact(Collider collider, Vector3 point) { //IL_002b: 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_004e: Expected O, but got Unknown //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_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) if (!spent && !((Object)(object)collider == (Object)null)) { spent = true; DownwardAnchorSettler component = ((Component)this).GetComponent(); if ((Object)(object)component != (Object)null) { component.TrySettleAtImpact(collider, point); } IDestructible componentInParent = ((Component)collider).GetComponentInParent(); if (componentInParent != null && damage > 0f) { HitData val = new HitData(); val.m_damage.m_pierce = damage; val.m_point = point; val.m_dir = flightDirection; val.SetAttacker((Character)(object)owner); componentInParent.Damage(val); } EndFlight(); } } private void EndFlight() { //IL_0034: 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) spent = true; if ((Object)(object)body != (Object)null) { body.useGravity = true; body.collisionDetectionMode = (CollisionDetectionMode)0; Rigidbody obj = body; obj.linearVelocity *= 0.15f; } Object.Destroy((Object)(object)this); } } }