using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Globalization; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Text; using BepInEx; using BepInEx.Configuration; using HarmonyLib; using Microsoft.CodeAnalysis; using MyceliumNetworking; using UnityEngine; using UnityEngine.InputSystem; using UnityEngine.InputSystem.Controls; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyVersion("0.0.0.0")] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace FedMjolnir { public enum UltBinding { Mouse5, Mouse4, MiddleMouse, Q, E, R, F, G, T, V, C, X, Z, B, LeftShift, LeftCtrl, LeftAlt, Space } [BepInPlugin("fed.straftat.mjolnir", "Mjolnir", "1.15.4")] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class MjolnirPlugin : BaseUnityPlugin { [HarmonyPatch] private static class MjolnirOffhandPickupGuard { private static IEnumerable TargetMethods() { Type type = AccessTools.TypeByName("PlayerPickup"); if (type == null) { return Enumerable.Empty(); } return (from m in type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic) where m.Name == "LeftHandPickup" select m).Cast(); } [HarmonyPrefix] private static bool Prefix() { if (!((Object)(object)Instance == (Object)null)) { return !Instance.IsHoldingMjolnir(); } return true; } } [HarmonyPatch] private static class MyceliumSteamStartupGuard { private static MethodBase TargetMethod() { Type type = AccessTools.TypeByName("MyceliumNetworking.PersistentGameObject"); if (!(type != null)) { return null; } return AccessTools.Method(type, "Update", (Type[])null, (Type[])null); } [HarmonyPrefix] private static bool Prefix() { return IsSteamClientReady(); } } [HarmonyPatch(typeof(SpawnerManager), "PopulateAllWeapons")] private static class RegisterPatch { [HarmonyPostfix] private static void Postfix() { Instance?.TryBuildWeapon(); } } [HarmonyPatch(typeof(SpawnerManager), "GetRandomSpawnableWeapon")] private static class RandomWeaponPickerPatch { [HarmonyPostfix] private static void Postfix(ref GameObject __result) { MjolnirPlugin instance = Instance; if (!((Object)(object)instance == (Object)null) && instance.ShouldSubstituteMjolnir()) { GameObject mjolnirPrefab = instance.GetMjolnirPrefab(); if ((Object)(object)mjolnirPrefab != (Object)null) { __result = mjolnirPrefab; } } } } [HarmonyPatch(typeof(WeaponRandomizationMenu), "PopulateMenu")] private static class WeaponMenuPatch { [HarmonyPostfix] private static void Postfix(WeaponRandomizationMenu __instance) { Instance?.TryAddMjolnirMenuRow(__instance); } } internal static MjolnirPlugin Instance; internal const uint MOD_ID = 2817742601u; internal const string WeaponName = "Mjolnir"; internal const BindingFlags BF = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic; private Harmony _harmony; private GameObject _prefab; private bool _building; private bool _fishnetRegistered; private bool _myceliumRegistered; private AudioClip _swing; private AudioClip _smash; private AudioClip _thunder; private AudioClip _flight; private AudioClip _hum; private ConfigEntry _smashRadius; private ConfigEntry _smashDamage; private ConfigEntry _smashKnockback; private ConfigEntry _smashCooldown; private ConfigEntry _flightForce; private ConfigEntry _flightCooldown; private ConfigEntry _ultRadius; private ConfigEntry _ultDamage; private ConfigEntry _ultKnockback; private ConfigEntry _ultCooldown; private ConfigEntry _ultBinding; private ConfigEntry _friendlySelfKnockback; private ConfigEntry _f8TestSpawn; internal ConfigEntry SpawnEnabled; internal ConfigEntry SpawnWeight; private GameObject _customMenuRow; private readonly Dictionary _nextSmash = new Dictionary(); private readonly Dictionary _nextFlight = new Dictionary(); private readonly Dictionary _nextUlt = new Dictionary(); private float _localNextFlightInput; private float _localNextUltInput; private float _netSmashRadius = 4.5f; private float _netSmashDamage = 2.75f; private float _netSmashKnockback = 125f; private float _netSmashCooldown = 2.2f; private float _netFlightForce = 65f; private float _netFlightCooldown = 1f; private float _netUltRadius = 8.5f; private float _netUltDamage = 3.5f; private float _netUltKnockback = 165f; private float _netUltCooldown = 30f; private bool _lastHostState; private float _nextSettingsBroadcast; private int _lastSettingsHash = int.MinValue; private float _nextLocalRefresh; internal float NativeRandomizerTotalWeight = 100f; internal bool GlobalRandomizerEnabled = true; private float _nextGlobalRandomizerRead; private float _nextOffhandEnforce; private readonly Dictionary _playerHealthCache = new Dictionary(); private float _nextPlayerHealthCacheRefresh; private ulong _localSteamId; private FirstPersonController _localFpc; private GameObject _localHeld; private Camera _localCamera; private float _rememberedNormalFov = -1f; private bool _presetHooksInstalled; private void Awake() { //IL_02c5: Unknown result type (might be due to invalid IL or missing references) //IL_02cf: Expected O, but got Unknown Instance = this; _smashRadius = ((BaseUnityPlugin)this).Config.Bind("01 - Smash", "Radius", 4.5f, "HOST ONLY. AoE radius."); _smashDamage = ((BaseUnityPlugin)this).Config.Bind("01 - Smash", "CenterDamage", 2.75f, "HOST ONLY. Damage at the center. Direct hammer/head impact adds a small bonus."); _smashKnockback = ((BaseUnityPlugin)this).Config.Bind("01 - Smash", "Knockback", 125f, "HOST ONLY. Radial player knockback."); _smashCooldown = ((BaseUnityPlugin)this).Config.Bind("01 - Smash", "CooldownSeconds", 2.2f, "HOST ONLY."); _flightForce = ((BaseUnityPlugin)this).Config.Bind("02 - Flight", "LaunchForce", 65f, "HOST ONLY. Upward launch strength."); _flightCooldown = ((BaseUnityPlugin)this).Config.Bind("02 - Flight", "CooldownSeconds", 1f, "HOST ONLY."); _friendlySelfKnockback = ((BaseUnityPlugin)this).Config.Bind("02 - Flight", "SmashBoostsHolder", true, "Deprecated compatibility option. Mjolnir never damages or launches its holder."); _ultRadius = ((BaseUnityPlugin)this).Config.Bind("04 - ULT", "Radius", 8.5f, "HOST ONLY. M5 lightning-storm radius."); _ultDamage = ((BaseUnityPlugin)this).Config.Bind("04 - ULT", "CenterDamage", 3.5f, "HOST ONLY. ULT center damage."); _ultKnockback = ((BaseUnityPlugin)this).Config.Bind("04 - ULT", "Knockback", 165f, "HOST ONLY. ULT radial knockback."); _ultCooldown = ((BaseUnityPlugin)this).Config.Bind("04 - ULT", "CooldownSeconds", 30f, "HOST ONLY."); _ultBinding = ((BaseUnityPlugin)this).Config.Bind("00 - Client Controls", "ULT Binding", UltBinding.Mouse5, "CLIENT SIDE ONLY. Choose the button/key used for Mjolnir's ULT. Each player can use a different binding."); _f8TestSpawn = ((BaseUnityPlugin)this).Config.Bind("99 - Testing", "HostF8SpawnsMjolnir", true, "HOST ONLY. F8 spawns Mjolnir in front of the host for testing."); SpawnEnabled = ((BaseUnityPlugin)this).Config.Bind("03 - Weapon Selection", "EnabledInRandomPool", true, "Internal fallback; default Weapon Customization row is user-facing."); SpawnWeight = ((BaseUnityPlugin)this).Config.Bind("03 - Weapon Selection", "SpawnWeight", 100f, "Backing value for Mjolnir's normal Weapon Customization weight (0-100)."); LoadRuntimeSettingsFromLocalConfig(); HideGameplayConfigFromSettingsMenu(); string path = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? Paths.PluginPath, "assets"); _swing = WavLoader.Load(Path.Combine(path, "mjolnir_swing.wav")); _smash = WavLoader.Load(Path.Combine(path, "mjolnir_smash.wav")); _thunder = WavLoader.Load(Path.Combine(path, "mjolnir_thunder.wav")); _flight = WavLoader.Load(Path.Combine(path, "mjolnir_flight.wav")); _hum = WavLoader.Load(Path.Combine(path, "mjolnir_hum.wav")); _harmony = new Harmony("fed.straftat.mjolnir"); _harmony.PatchAll(); SceneManager.sceneLoaded += OnSceneLoadedResetCooldowns; ((MonoBehaviour)this).StartCoroutine(RegisterMycelium()); ((MonoBehaviour)this).StartCoroutine(WaitForWeaponTable()); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mjolnir 1.15.4 loaded. Client-side configurable ULT binding active."); } private void OnDestroy() { try { SceneManager.sceneLoaded -= OnSceneLoadedResetCooldowns; } catch { } try { Harmony harmony = _harmony; if (harmony != null) { harmony.UnpatchSelf(); } } catch { } try { if (_myceliumRegistered) { MyceliumNetwork.DeregisterNetworkObject((object)this, 2817742601u, 0); } } catch { } if ((Object)(object)_prefab != (Object)null) { Object.Destroy((Object)(object)_prefab); } if (Instance == this) { Instance = null; } } internal static bool IsSteamClientReady() { try { Type type = FindType("SteamManager"); if (type != null && GetStatic(type, "Initialized", "initialized", "IsInitialized", "isInitialized") is bool result) { return result; } MethodInfo methodInfo = FindType("Steamworks.SteamUser")?.GetMethod("GetSteamID", BindingFlags.Static | BindingFlags.Public); if (methodInfo == null) { return false; } object obj = methodInfo.Invoke(null, null); if (obj == null) { return false; } object member = GetMember(obj, "m_SteamID", "Value", "value"); if (member != null && ulong.TryParse(Convert.ToString(member), out var result2)) { return result2 != 0; } ulong result3; return ulong.TryParse(Convert.ToString(obj), out result3) && result3 != 0; } catch { return false; } } private IEnumerator RegisterMycelium() { for (int i = 0; i < 120; i++) { if (IsSteamClientReady()) { break; } yield return (object)new WaitForSecondsRealtime(0.1f); } if (!IsSteamClientReady()) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Steamworks was not ready after 12 seconds; Mjolnir networking will keep retrying safely."); } for (int i = 0; i < 160; i++) { if (_myceliumRegistered) { break; } if (!IsSteamClientReady()) { yield return (object)new WaitForSecondsRealtime(0.1f); continue; } try { MyceliumNetwork.RegisterNetworkObject((object)this, 2817742601u, 0); _myceliumRegistered = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mjolnir Mycelium networking registered after Steamworks became ready."); } catch (Exception ex) { if (i == 0 || i % 25 == 0) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Mjolnir waiting for Mycelium/Steam readiness: " + ex.Message)); } } if (!_myceliumRegistered) { yield return (object)new WaitForSecondsRealtime(0.15f); } } } private void HideGameplayConfigFromSettingsMenu() { object[] array = new object[14] { _smashRadius, _smashDamage, _smashKnockback, _smashCooldown, _flightForce, _flightCooldown, _friendlySelfKnockback, _ultRadius, _ultDamage, _ultKnockback, _ultCooldown, _f8TestSpawn, SpawnEnabled, SpawnWeight }; foreach (object obj in array) { if (obj == null) { continue; } try { object obj2 = obj.GetType().GetProperty("Description", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(obj); if (obj2 == null) { continue; } Type type = Type.GetType("System.ComponentModel.BrowsableAttribute, System"); if (!(type == null)) { object obj3 = Activator.CreateInstance(type, new object[1] { false }); PropertyInfo property = obj2.GetType().GetProperty("Tags", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite) { object[] first = (property.GetValue(obj2) as object[]) ?? Array.Empty(); property.SetValue(obj2, first.Concat(new object[1] { obj3 }).ToArray()); } } } catch { } } } private void LoadRuntimeSettingsFromLocalConfig() { _netSmashRadius = _smashRadius.Value; _netSmashDamage = _smashDamage.Value; _netSmashKnockback = _smashKnockback.Value; _netSmashCooldown = _smashCooldown.Value; _netFlightForce = _flightForce.Value; _netFlightCooldown = _flightCooldown.Value; _netUltRadius = _ultRadius.Value; _netUltDamage = _ultDamage.Value; _netUltKnockback = _ultKnockback.Value; _netUltCooldown = _ultCooldown.Value; } private void UpdateHostSettingsSync() { bool flag = IsHost(); if (flag) { LoadRuntimeSettingsFromLocalConfig(); int num = ComputeRuntimeSettingsHash(); bool flag2 = num != _lastSettingsHash; bool flag3 = Time.unscaledTime >= _nextSettingsBroadcast; if (!_lastHostState || flag2 || flag3) { _lastSettingsHash = num; _nextSettingsBroadcast = Time.unscaledTime + 10f; BroadcastHostSettings(); } } _lastHostState = flag; } private int ComputeRuntimeSettingsHash() { return (((((((((17 * 31 + _netSmashRadius.GetHashCode()) * 31 + _netSmashDamage.GetHashCode()) * 31 + _netSmashKnockback.GetHashCode()) * 31 + _netSmashCooldown.GetHashCode()) * 31 + _netFlightForce.GetHashCode()) * 31 + _netFlightCooldown.GetHashCode()) * 31 + _netUltRadius.GetHashCode()) * 31 + _netUltDamage.GetHashCode()) * 31 + _netUltKnockback.GetHashCode()) * 31 + _netUltCooldown.GetHashCode(); } private void BroadcastHostSettings() { if (!_myceliumRegistered || !IsHost()) { return; } string text = string.Join("|", _netSmashRadius.ToString("R", CultureInfo.InvariantCulture), _netSmashDamage.ToString("R", CultureInfo.InvariantCulture), _netSmashKnockback.ToString("R", CultureInfo.InvariantCulture), _netSmashCooldown.ToString("R", CultureInfo.InvariantCulture), _netFlightForce.ToString("R", CultureInfo.InvariantCulture), _netFlightCooldown.ToString("R", CultureInfo.InvariantCulture), _netUltRadius.ToString("R", CultureInfo.InvariantCulture), _netUltDamage.ToString("R", CultureInfo.InvariantCulture), _netUltKnockback.ToString("R", CultureInfo.InvariantCulture), _netUltCooldown.ToString("R", CultureInfo.InvariantCulture)); HostSettingsSync(text); try { MyceliumNetwork.RPC(2817742601u, "HostSettingsSync", (ReliableType)1, new object[1] { text }); } catch { } } [CustomRPC] public void HostSettingsSync(string payload) { try { string[] array = payload.Split('|'); if (array.Length == 10) { _netSmashRadius = float.Parse(array[0], CultureInfo.InvariantCulture); _netSmashDamage = float.Parse(array[1], CultureInfo.InvariantCulture); _netSmashKnockback = float.Parse(array[2], CultureInfo.InvariantCulture); _netSmashCooldown = float.Parse(array[3], CultureInfo.InvariantCulture); _netFlightForce = float.Parse(array[4], CultureInfo.InvariantCulture); _netFlightCooldown = float.Parse(array[5], CultureInfo.InvariantCulture); _netUltRadius = float.Parse(array[6], CultureInfo.InvariantCulture); _netUltDamage = float.Parse(array[7], CultureInfo.InvariantCulture); _netUltKnockback = float.Parse(array[8], CultureInfo.InvariantCulture); _netUltCooldown = float.Parse(array[9], CultureInfo.InvariantCulture); } } catch { } } private IEnumerator WaitForWeaponTable() { for (int i = 0; i < 120; i++) { if (!((Object)(object)_prefab == (Object)null)) { break; } TryBuildWeapon(); if ((Object)(object)_prefab == (Object)null) { yield return (object)new WaitForSecondsRealtime(0.25f); } } if ((Object)(object)_prefab == (Object)null) { ((BaseUnityPlugin)this).Logger.LogError((object)"Mjolnir could not find a safe vanilla melee shell."); } } private void Update() { if (Time.unscaledTime >= _nextLocalRefresh) { _nextLocalRefresh = Time.unscaledTime + 0.1f; RefreshLocalHolder(); } UpdateHostSettingsSync(); if (Time.unscaledTime >= _nextGlobalRandomizerRead) { _nextGlobalRandomizerRead = Time.unscaledTime + 0.2f; GlobalRandomizerEnabled = ReadGlobalRandomizerEnabled(); } if (IsHoldingMjolnir()) { SuppressAimAndZoom(); if (Time.unscaledTime >= _nextOffhandEnforce) { _nextOffhandEnforce = Time.unscaledTime + 0.1f; EnforceMjolnirOffhandLock(); } Mouse current = Mouse.current; if (current != null && current.leftButton.wasPressedThisFrame) { LocalSmash(); } if (current != null && current.rightButton.wasPressedThisFrame) { LocalFlight(); } if (UltBindingPressedThisFrame()) { LocalUltimate(); } } if (_f8TestSpawn.Value && IsHost()) { Keyboard current2 = Keyboard.current; if (current2 != null && ((ButtonControl)current2.f8Key).wasPressedThisFrame) { SpawnTestMjolnir(); } } } private void LateUpdate() { if (IsHoldingMjolnir()) { SuppressAimAndZoom(); } } internal void TryBuildWeapon() { if ((Object)(object)_prefab != (Object)null || _building) { return; } _building = true; try { try { SpawnerManager.PopulateAllWeapons(); } catch { } GameObject val = FindSafeMeleeShell(); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Mjolnir: no melee shell found yet. " + DescribeWeaponSources())); return; } _prefab = CreateSafeInactiveClone(val); if ((Object)(object)_prefab == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Mjolnir safe-clone failed for " + ((Object)val).name + ".")); return; } ((Object)_prefab).name = "Mjolnir"; _prefab.SetActive(false); Object.DontDestroyOnLoad((Object)(object)_prefab); Renderer[] componentsInChildren = _prefab.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren.Length; i++) { componentsInChildren[i].enabled = false; } AudioSource[] componentsInChildren2 = _prefab.GetComponentsInChildren(true); for (int i = 0; i < componentsInChildren2.Length; i++) { componentsInChildren2[i].mute = true; } ItemBehaviour val2 = _prefab.GetComponent() ?? _prefab.GetComponentInChildren(true); if ((Object)(object)val2 != (Object)null) { val2.weaponName = "Mjolnir"; val2.aimWeapon = false; val2.aimFOV = 75f; } MjolnirBehaviour mjolnirBehaviour = _prefab.AddComponent(); mjolnirBehaviour.Plugin = this; mjolnirBehaviour.SwingClip = _swing; mjolnirBehaviour.SmashClip = _smash; mjolnirBehaviour.ThunderClip = _thunder; mjolnirBehaviour.FlightClip = _flight; mjolnirBehaviour.HumClip = _hum; BuildHammerVisual(mjolnirBehaviour); ApplyMjolnirIdentity(_prefab); ApplySpawnMetadata(_prefab); ((MonoBehaviour)this).StartCoroutine(RegisterFishnetWhenReady()); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Mjolnir registered using melee shell: " + ((Object)val).name)); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Mjolnir build failed: " + ex)); if ((Object)(object)_prefab != (Object)null) { Object.Destroy((Object)(object)_prefab); _prefab = null; } } finally { _building = false; } } private void ApplyMjolnirIdentity(GameObject go) { if ((Object)(object)go == (Object)null) { return; } ((Object)go).name = "Mjolnir"; Component[] componentsInChildren = go.GetComponentsInChildren(true); foreach (Component val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { SetStringMember(val, "weaponName", "Mjolnir"); SetStringMember(val, "displayName", "Mjolnir"); SetStringMember(val, "itemName", "Mjolnir"); SetStringMember(val, "weaponDisplayName", "Mjolnir"); } } } private void ConfigureTwoHandedMetadata(GameObject go) { if ((Object)(object)go == (Object)null) { return; } Component[] componentsInChildren = go.GetComponentsInChildren(true); foreach (Component val in componentsInChildren) { if ((Object)(object)val == (Object)null) { continue; } Type type = ((object)val).GetType(); FieldInfo[] fields = type.GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { try { string text = fieldInfo.Name.ToLowerInvariant(); if (fieldInfo.FieldType.IsEnum && !fieldInfo.IsInitOnly && (text.Contains("hand") || fieldInfo.FieldType.Name.ToLowerInvariant().Contains("hand"))) { string text2 = Enum.GetNames(fieldInfo.FieldType).FirstOrDefault((string x) => x.Equals("TwoHanded", StringComparison.OrdinalIgnoreCase)) ?? Enum.GetNames(fieldInfo.FieldType).FirstOrDefault((string x) => x.Equals("DoubleHanded", StringComparison.OrdinalIgnoreCase)); if (text2 != null) { fieldInfo.SetValue(val, Enum.Parse(fieldInfo.FieldType, text2)); } } else if (fieldInfo.FieldType == typeof(bool) && !fieldInfo.IsInitOnly) { if (text.Contains("twohand") || text.Contains("doublehand")) { fieldInfo.SetValue(val, true); } else if (text.Contains("singlehand")) { fieldInfo.SetValue(val, false); } } } catch { } } PropertyInfo[] properties = type.GetProperties(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (PropertyInfo propertyInfo in properties) { if (!propertyInfo.CanWrite) { continue; } try { string text3 = propertyInfo.Name.ToLowerInvariant(); if (propertyInfo.PropertyType.IsEnum && (text3.Contains("hand") || propertyInfo.PropertyType.Name.ToLowerInvariant().Contains("hand"))) { string text4 = Enum.GetNames(propertyInfo.PropertyType).FirstOrDefault((string x) => x.Equals("TwoHanded", StringComparison.OrdinalIgnoreCase)) ?? Enum.GetNames(propertyInfo.PropertyType).FirstOrDefault((string x) => x.Equals("DoubleHanded", StringComparison.OrdinalIgnoreCase)); if (text4 != null) { propertyInfo.SetValue(val, Enum.Parse(propertyInfo.PropertyType, text4)); } } else if (propertyInfo.PropertyType == typeof(bool)) { if (text3.Contains("twohand") || text3.Contains("doublehand")) { propertyInfo.SetValue(val, true); } else if (text3.Contains("singlehand")) { propertyInfo.SetValue(val, false); } } } catch { } } } } private void ApplySpawnMetadata(GameObject go) { if ((Object)(object)go == (Object)null) { return; } Component[] componentsInChildren = go.GetComponentsInChildren(true); foreach (Component val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { SetBoolMember(val, "isSpawnable", value: true); SetFloatMemberIfPresent(val, "spawnChance", 1f); SetFloatMemberIfPresent(val, "weightedSpawnChance", 1f); } } } private void SetStringMember(object obj, string name, string value) { if (obj == null) { return; } Type type = obj.GetType(); try { FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.FieldType == typeof(string) && !field.IsInitOnly) { field.SetValue(obj, value); return; } PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite && property.PropertyType == typeof(string)) { property.SetValue(obj, value); } } catch { } } private void SetBoolMember(object obj, string name, bool value) { if (obj == null) { return; } Type type = obj.GetType(); try { FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.FieldType == typeof(bool) && !field.IsInitOnly) { field.SetValue(obj, value); return; } PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite && property.PropertyType == typeof(bool)) { property.SetValue(obj, value); } } catch { } } private void SetFloatMemberIfPresent(object obj, string name, float value) { if (obj == null) { return; } Type type = obj.GetType(); try { FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && !field.IsInitOnly) { if (field.FieldType == typeof(float)) { field.SetValue(obj, value); } else if (field.FieldType == typeof(double)) { field.SetValue(obj, (double)value); } } PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite) { if (property.PropertyType == typeof(float)) { property.SetValue(obj, value); } else if (property.PropertyType == typeof(double)) { property.SetValue(obj, (double)value); } } } catch { } } private void InstallWeaponPresetHooks() { } private static void PresetSystemPostfix() { try { Instance?.InjectIntoWeaponPresetSystem(); } catch { } } private void InjectIntoWeaponPresetSystem() { } private void InjectPrefabIntoMembers(object obj, Type t) { FieldInfo[] fields = t.GetFields(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); foreach (FieldInfo fieldInfo in fields) { bool isStatic = fieldInfo.IsStatic; if ((obj == null && !isStatic) || (obj != null && isStatic) || !fieldInfo.Name.ToLowerInvariant().Contains("weapon")) { continue; } try { object value = fieldInfo.GetValue(obj); if (fieldInfo.FieldType == typeof(GameObject[])) { GameObject[] array = (value as GameObject[]) ?? Array.Empty(); if (!array.Contains(_prefab)) { fieldInfo.SetValue(obj, array.Concat((IEnumerable)(object)new GameObject[1] { _prefab }).ToArray()); } } else if (value is IList list) { Type type = value.GetType(); if ((type.IsGenericType ? type.GetGenericArguments().FirstOrDefault() : null) == typeof(GameObject) && !list.Contains(_prefab)) { list.Add(_prefab); } } else if (value is IDictionary dictionary) { Type type2 = value.GetType(); Type[] array2 = (type2.IsGenericType ? type2.GetGenericArguments() : Type.EmptyTypes); if (array2.Length == 2 && array2[0] == typeof(string) && array2[1] == typeof(GameObject)) { dictionary["Mjolnir"] = _prefab; } } } catch { } } } private void SuppressAimAndZoom() { if ((Object)(object)_localFpc == (Object)null) { return; } if ((Object)(object)_localHeld != (Object)null) { ItemBehaviour val = _localHeld.GetComponent() ?? _localHeld.GetComponentInChildren(true); if ((Object)(object)val != (Object)null) { val.aimWeapon = false; val.aimFOV = 75f; val.weaponName = "Mjolnir"; } } SetBoolMember(_localFpc, "isAiming", value: false); SetBoolMember(_localFpc, "isScopeAiming", value: false); SetBoolMember(_localFpc, "aimWeapon", value: false); SetBoolMember(_localFpc, "canScopeAim", value: false); SetBoolMember(_localFpc, "isZooming", value: false); try { if ((Object)(object)_localFpc.playerCameraHolder != (Object)null) { _localCamera = _localFpc.playerCameraHolder.GetComponentInChildren(true); } if ((Object)(object)_localCamera == (Object)null) { _localCamera = Camera.main; } if ((Object)(object)_localCamera != (Object)null) { if (_rememberedNormalFov < 1f) { _rememberedNormalFov = ReadFloatMember(_localFpc, "normalFovValue", ReadFloatMember(_localFpc, "defaultFOV", _localCamera.fieldOfView)); } if (_rememberedNormalFov > 1f && Math.Abs(_localCamera.fieldOfView - _rememberedNormalFov) > 0.05f) { _localCamera.fieldOfView = _rememberedNormalFov; } } } catch { } } private float ReadFloatMember(object obj, string name, float fallback) { if (obj == null) { return fallback; } try { Type type = obj.GetType(); FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return Convert.ToSingle(field.GetValue(obj), CultureInfo.InvariantCulture); } PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanRead) { return Convert.ToSingle(property.GetValue(obj), CultureInfo.InvariantCulture); } } catch { } return fallback; } private ulong GetSteamIdForPlayerHealth(PlayerHealth target) { if ((Object)(object)target == (Object)null) { return 0uL; } try { if (!(GetStatic(FindType("ClientInstance"), "playerInstances", "PlayerInstances") is IDictionary dictionary)) { return 0uL; } foreach (DictionaryEntry item in dictionary) { object value = item.Value; ulong steamId = GetSteamId(value); if (steamId != 0L) { if (GetMember(value, "PlayerHealth", "playerHealth") == target) { return steamId; } Component val = (Component)((value is Component) ? value : null); if (val != null && (Object)(object)val.GetComponentInChildren(true) == (Object)(object)target) { return steamId; } object member = GetMember(GetMember(value, "PlayerManager", "playerManager"), "SpawnedObject", "spawnedObject", "PlayerObject", "playerObject"); object obj = ((member is GameObject) ? member : null); if (obj == null) { object obj2 = ((member is Component) ? member : null); obj = ((obj2 != null) ? ((Component)obj2).gameObject : null); } GameObject val2 = (GameObject)obj; if ((Object)(object)val2 != (Object)null && ((Object)(object)val2.GetComponentInChildren(true) == (Object)(object)target || ((Component)target).transform.IsChildOf(val2.transform) || val2.transform.IsChildOf(((Component)target).transform.root))) { return steamId; } } } } catch { } return 0uL; } private GameObject CreateSafeInactiveClone(GameObject source) { if ((Object)(object)source == (Object)null) { return null; } bool active = false; try { active = source.activeSelf; } catch { } GameObject val = null; try { source.SetActive(false); val = Object.Instantiate(source); val.SetActive(false); StripUnsafeCloneComponents(val); ((BaseUnityPlugin)this).Logger.LogInfo((object)("Created inactive Mjolnir shell clone from " + ((Object)source).name + " and stripped unsafe presentation components before activation.")); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogError((object)("Safe inactive clone failed: " + ex)); if ((Object)(object)val != (Object)null) { Object.Destroy((Object)(object)val); } val = null; } finally { try { source.SetActive(active); } catch { } } return val; } private void StripUnsafeCloneComponents(GameObject clone) { if ((Object)(object)clone == (Object)null) { return; } MonoBehaviour[] array = clone.GetComponentsInChildren(true).ToArray(); foreach (MonoBehaviour val in array) { if (!((Object)(object)val == (Object)null)) { string name = ((object)val).GetType().Name; string text = name.ToLowerInvariant(); bool num = name == "SetEffectVolume" || text.Contains("effectvolume") || text.Contains("networkaudiosource") || text.Contains("networkaudioclips") || text.Contains("scope") || text.Contains("zoom") || text.Contains("aimweapon"); bool flag = val is ItemBehaviour || val is Weapon || val is MeleeWeapon || text.Contains("networkobject") || text.Contains("networkbehaviour") || text.Contains("pickup") || text.Contains("player"); if (num && !flag) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Stripping clone component before activation: " + name)); Object.DestroyImmediate((Object)(object)val); } } } AudioSource[] componentsInChildren = clone.GetComponentsInChildren(true); foreach (AudioSource val2 in componentsInChildren) { if ((Object)(object)val2 != (Object)null) { Object.DestroyImmediate((Object)(object)val2); } } } private bool ReadGlobalRandomizerEnabled() { try { SpawnerManager val = ((IEnumerable)Resources.FindObjectsOfTypeAll()).FirstOrDefault((Func)delegate(SpawnerManager x) { //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) if ((Object)(object)x != (Object)null && (Object)(object)((Component)x).gameObject != (Object)null) { Scene scene = ((Component)x).gameObject.scene; return ((Scene)(ref scene)).IsValid(); } return false; }); if ((Object)(object)val == (Object)null) { return true; } MethodInfo methodInfo = ((object)val).GetType().GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo m) => m.Name == "sync___get_value_randomiseWeapons" && m.GetParameters().Length == 0); if (methodInfo != null && methodInfo.Invoke(val, null) is bool result) { return result; } if (GetMember(val, "randomiseWeapons", "syncVar___randomiseWeapons") is bool result2) { return result2; } } catch { } return true; } internal GameObject GetMjolnirPrefab() { return _prefab; } internal bool ShouldSubstituteMjolnir() { if ((Object)(object)_prefab == (Object)null || SpawnEnabled == null || SpawnWeight == null || !SpawnEnabled.Value || !GlobalRandomizerEnabled) { return false; } float num = Mathf.Clamp(SpawnWeight.Value, 0f, 100f); if (num <= 0f) { return false; } float num2 = Mathf.Max(num, NativeRandomizerTotalWeight); return Random.value < num / num2; } internal void TryAddMjolnirMenuRow(WeaponRandomizationMenu menu) { if ((Object)(object)menu == (Object)null || (Object)(object)_customMenuRow != (Object)null) { return; } try { Component val = ((IEnumerable)((Component)menu).GetComponentsInChildren(true)).FirstOrDefault((Func)((Component c) => (Object)(object)c != (Object)null && ((object)c).GetType().Name == "WeaponRow")); if ((Object)(object)val == (Object)null) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Mjolnir menu row: no vanilla WeaponRow was found after PopulateMenu."); return; } GameObject gameObject = val.gameObject; Transform parent = gameObject.transform.parent; _customMenuRow = Object.Instantiate(gameObject, parent); ((Object)_customMenuRow).name = "WeaponRow_Mjolnir"; _customMenuRow.SetActive(true); Component val2 = ((IEnumerable)_customMenuRow.GetComponents()).FirstOrDefault((Func)((Component c) => (Object)(object)c != (Object)null && ((object)c).GetType().Name == "WeaponRow")); if ((Object)(object)val2 != (Object)null) { Object.DestroyImmediate((Object)(object)val2); } Component val3 = null; Component val4 = null; Component[] componentsInChildren = _customMenuRow.GetComponentsInChildren(true); foreach (Component val5 in componentsInChildren) { if (!((Object)(object)val5 == (Object)null)) { string name = ((object)val5).GetType().Name; if (name == "Toggle" && (Object)(object)val3 == (Object)null) { val3 = val5; ClearUnityEvent(val5, "onValueChanged"); } else if (name == "Slider" && (Object)(object)val4 == (Object)null) { val4 = val5; ClearUnityEvent(val5, "onValueChanged"); } } } RenameRowText(_customMenuRow, "Mjolnir"); MjolnirMenuRowBinding mjolnirMenuRowBinding = _customMenuRow.AddComponent(); mjolnirMenuRowBinding.Plugin = this; mjolnirMenuRowBinding.Toggle = val3; mjolnirMenuRowBinding.Slider = val4; mjolnirMenuRowBinding.Initialize(); SortMjolnirRowAlphabetically(parent, _customMenuRow); ((BaseUnityPlugin)this).Logger.LogInfo((object)"Added Mjolnir to default Weapon Customization in alphabetical position."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not add isolated Mjolnir menu row: " + ex.Message)); } } private void SortMjolnirRowAlphabetically(Transform parent, GameObject mjRow) { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown if ((Object)(object)parent == (Object)null || (Object)(object)mjRow == (Object)null) { return; } List> list = new List>(); foreach (Transform item in parent) { Transform val = item; if (!((Object)(object)val == (Object)null) && !((Object)(object)((Component)val).gameObject == (Object)(object)mjRow)) { string text = ReadBestRowLabel(((Component)val).gameObject); if (!string.IsNullOrWhiteSpace(text)) { list.Add(Tuple.Create(val, text.Trim())); } } } int num = parent.childCount - 1; for (int i = 0; i < list.Count; i++) { if (string.Compare("Mjolnir", list[i].Item2, StringComparison.OrdinalIgnoreCase) < 0) { num = list[i].Item1.GetSiblingIndex(); break; } } mjRow.transform.SetSiblingIndex(Mathf.Clamp(num, 0, parent.childCount - 1)); } private string ReadBestRowLabel(GameObject row) { if ((Object)(object)row == (Object)null) { return ""; } string result = ""; int num = int.MinValue; Component[] componentsInChildren = row.GetComponentsInChildren(true); foreach (Component val in componentsInChildren) { if ((Object)(object)val == (Object)null) { continue; } PropertyInfo property = ((object)val).GetType().GetProperty("text", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property == null || !property.CanRead || property.PropertyType != typeof(string)) { continue; } try { string text = ((string)property.GetValue(val)) ?? ""; int num2 = 0; if (text.Length >= 2 && text.Length <= 30) { num2 += 20; } if (text.Any(char.IsLetter)) { num2 += 40; } if (text.Contains("%")) { num2 -= 60; } if (text.All((char ch) => char.IsDigit(ch) || ch == '.' || ch == '%' || char.IsWhiteSpace(ch))) { num2 -= 80; } if (num2 > num) { num = num2; result = text; } } catch { } } return result; } private void ClearUnityEvent(Component component, string propertyName) { try { object obj = ((object)component).GetType().GetProperty(propertyName, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.GetValue(component); (obj?.GetType().GetMethod("RemoveAllListeners", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic))?.Invoke(obj, null); } catch { } } private void RenameRowText(GameObject row, string name) { if ((Object)(object)row == (Object)null) { return; } Component val = null; int num = int.MinValue; Component[] componentsInChildren = row.GetComponentsInChildren(true); foreach (Component val2 in componentsInChildren) { if ((Object)(object)val2 == (Object)null) { continue; } PropertyInfo property = ((object)val2).GetType().GetProperty("text", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property == null || !property.CanRead || !property.CanWrite || property.PropertyType != typeof(string)) { continue; } try { string text = ((string)property.GetValue(val2)) ?? ""; int num2 = 0; if (text.Length >= 2 && text.Length <= 40) { num2 += 20; } if (text.Any(char.IsLetter)) { num2 += 30; } if (text.Contains("%")) { num2 -= 50; } if (text.All((char ch) => char.IsDigit(ch) || ch == '.' || ch == '%')) { num2 -= 60; } if (num2 > num) { num = num2; val = val2; } } catch { } } if (!((Object)(object)val != (Object)null)) { return; } try { ((object)val).GetType().GetProperty("text", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic)?.SetValue(val, name); } catch { } } internal static float GetFloatProperty(Component c, string name, float fallback) { if ((Object)(object)c == (Object)null) { return fallback; } try { PropertyInfo property = ((object)c).GetType().GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanRead) { return Convert.ToSingle(property.GetValue(c), CultureInfo.InvariantCulture); } } catch { } return fallback; } internal static void SetFloatProperty(Component c, string name, float value) { if ((Object)(object)c == (Object)null) { return; } try { PropertyInfo property = ((object)c).GetType().GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite) { property.SetValue(c, value); } } catch { } } internal static bool GetBoolProperty(Component c, string name, bool fallback) { if ((Object)(object)c == (Object)null) { return fallback; } try { PropertyInfo property = ((object)c).GetType().GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanRead) { return Convert.ToBoolean(property.GetValue(c)); } } catch { } return fallback; } internal static void SetBoolProperty(Component c, string name, bool value) { if ((Object)(object)c == (Object)null) { return; } try { PropertyInfo property = ((object)c).GetType().GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite) { property.SetValue(c, value); } } catch { } } private GameObject FindSafeMeleeShell() { List list = new List(); try { if (SpawnerManager.NameToWeaponDict != null) { list.AddRange(SpawnerManager.NameToWeaponDict.Values.Where((GameObject x) => (Object)(object)x != (Object)null)); } } catch { } try { if (SpawnerManager.AllWeapons != null) { list.AddRange(SpawnerManager.AllWeapons.Where((GameObject x) => (Object)(object)x != (Object)null)); } } catch { } try { GameObject[] array = Resources.LoadAll("RandomWeapons"); if (array != null) { list.AddRange(array.Where((GameObject x) => (Object)(object)x != (Object)null)); } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("RandomWeapons resource scan failed: " + ex.Message)); } list = list.Distinct().ToList(); if (list.Count == 0) { return null; } GameObject val = null; int num = int.MinValue; foreach (GameObject item in list) { if ((Object)(object)item == (Object)null) { continue; } int num2 = 0; string text = (((Object)item).name ?? "").ToLowerInvariant(); try { if ((Object)(object)(item.GetComponent() ?? item.GetComponentInChildren(true)) != (Object)null) { num2 += 1000; } } catch { } try { if ((Object)(object)(item.GetComponent() ?? item.GetComponentInChildren(true)) != (Object)null) { num2 += 100; } } catch { } if (text.Contains("bat")) { num2 += 90; } if (text.Contains("katana")) { num2 += 90; } if (text.Contains("sword")) { num2 += 80; } if (text.Contains("knife")) { num2 += 80; } if (text.Contains("cleaver")) { num2 += 80; } if (text.Contains("couperet")) { num2 += 80; } if (text.Contains("hammer")) { num2 += 100; } if (text.Contains("axe")) { num2 += 80; } if (text.Contains("mace")) { num2 += 80; } if (text.Contains("melee")) { num2 += 75; } if (text.Contains("pistol") || text.Contains("rifle") || text.Contains("shotgun") || text.Contains("smg") || text.Contains("launcher") || text.Contains("grenade") || text.Contains("mine") || text.Contains("bomb")) { num2 -= 700; } try { Component[] componentsInChildren = item.GetComponentsInChildren(true); foreach (Component val2 in componentsInChildren) { if (!((Object)(object)val2 == (Object)null)) { string text2 = ((object)val2).GetType().Name.ToLowerInvariant(); if (text2 == "meleeweapon") { num2 += 500; } if (text2.Contains("scope") || text2.Contains("gun") || text2.Contains("firearm") || text2.Contains("projectile") || text2.Contains("launcher")) { num2 -= 250; } } } } catch { } if (num2 > num) { num = num2; val = item; } } if ((Object)(object)val != (Object)null && num >= 500) { ((BaseUnityPlugin)this).Logger.LogInfo((object)("Mjolnir shell selected: " + ((Object)val).name + " (score " + num + ")")); return val; } ((BaseUnityPlugin)this).Logger.LogWarning((object)("Best Mjolnir shell candidate was " + (((Object)(object)val != (Object)null) ? ((Object)val).name : "") + " with insufficient score " + num + ".")); return null; } private string DescribeWeaponSources() { try { List list = new List(); int num = ((SpawnerManager.NameToWeaponDict != null) ? SpawnerManager.NameToWeaponDict.Count : 0); string text = ((SpawnerManager.NameToWeaponDict != null) ? string.Join(", ", SpawnerManager.NameToWeaponDict.Keys.Take(20)) : ""); list.Add("NameToWeaponDict=" + num + " [" + text + "]"); int num2 = ((SpawnerManager.AllWeapons != null) ? SpawnerManager.AllWeapons.Length : 0); string text2 = ((SpawnerManager.AllWeapons != null) ? string.Join(", ", from x in SpawnerManager.AllWeapons.Where((GameObject x) => (Object)(object)x != (Object)null).Take(20) select ((Object)x).name) : ""); list.Add("AllWeapons=" + num2 + " [" + text2 + "]"); GameObject[] array = null; try { array = Resources.LoadAll("RandomWeapons"); } catch { } int num3 = ((array != null) ? array.Length : 0); string text3 = ((array != null) ? string.Join(", ", from x in array.Where((GameObject x) => (Object)(object)x != (Object)null).Take(30) select ((Object)x).name) : ""); list.Add("Resources/RandomWeapons=" + num3 + " [" + text3 + "]"); return string.Join(" | ", list); } catch (Exception ex) { return "weapon-source diagnostics failed: " + ex.Message; } } private void BuildHammerVisual(MjolnirBehaviour behaviour) { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Expected O, but got Unknown //IL_0028: 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_0057: 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_0075: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_009b: 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_00e1: Expected O, but got Unknown //IL_0101: 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_0147: Expected O, but got Unknown //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_01d5: Unknown result type (might be due to invalid IL or missing references) //IL_01f4: Unknown result type (might be due to invalid IL or missing references) //IL_027e: Unknown result type (might be due to invalid IL or missing references) //IL_029d: Unknown result type (might be due to invalid IL or missing references) //IL_0338: Unknown result type (might be due to invalid IL or missing references) //IL_0357: Unknown result type (might be due to invalid IL or missing references) //IL_03bf: Unknown result type (might be due to invalid IL or missing references) //IL_03de: Unknown result type (might be due to invalid IL or missing references) //IL_03fd: Unknown result type (might be due to invalid IL or missing references) //IL_0487: Unknown result type (might be due to invalid IL or missing references) //IL_04a6: Unknown result type (might be due to invalid IL or missing references) //IL_04c5: Unknown result type (might be due to invalid IL or missing references) //IL_054e: Unknown result type (might be due to invalid IL or missing references) //IL_056d: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject("Mjolnir_SwingPivot"); val.transform.SetParent(_prefab.transform, false); val.transform.localPosition = Vector3.zero; val.transform.localRotation = Quaternion.Euler(-90f, 0f, 90f); val.transform.localScale = Vector3.one * 0.54f; Material val2 = new Material(Shader.Find("Standard")); ((Object)val2).name = "Weathered Uru"; val2.color = new Color(0.68f, 0.69f, 0.71f, 1f); val2.SetFloat("_Metallic", 0.82f); val2.SetFloat("_Glossiness", 0.24f); val2.mainTexture = (Texture)(object)CreateBrushedMetalTexture(); Material val3 = new Material(Shader.Find("Standard")); ((Object)val3).name = "Uru Edge"; val3.color = new Color(0.58f, 0.59f, 0.61f, 1f); val3.SetFloat("_Metallic", 0.86f); val3.SetFloat("_Glossiness", 0.22f); val3.mainTexture = (Texture)(object)CreateBrushedMetalTexture(); Material val4 = new Material(Shader.Find("Standard")); ((Object)val4).name = "Aged Leather"; val4.color = new Color(0.33f, 0.12f, 0.045f, 1f); val4.SetFloat("_Metallic", 0f); val4.SetFloat("_Glossiness", 0.12f); val4.mainTexture = (Texture)(object)CreateLeatherTexture(); GameObject obj = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)obj).name = "Mjolnir_Uru_Head"; obj.transform.SetParent(val.transform, false); obj.transform.localPosition = new Vector3(0f, 0f, 0.62f); obj.transform.localScale = new Vector3(0.92f, 0.42f, 0.34f); Collider component = obj.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } obj.GetComponent().sharedMaterial = val2; float[] array = new float[2] { -0.5f, 0.5f }; foreach (float num in array) { GameObject obj2 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)obj2).name = "Mjolnir_EndCap"; obj2.transform.SetParent(val.transform, false); obj2.transform.localPosition = new Vector3(num, 0f, 0.62f); obj2.transform.localScale = new Vector3(0.11f, 0.36f, 0.29f); Collider component2 = obj2.GetComponent(); if ((Object)(object)component2 != (Object)null) { Object.Destroy((Object)(object)component2); } obj2.GetComponent().sharedMaterial = val3; } array = new float[2] { 0.795f, 0.445f }; foreach (float num2 in array) { GameObject obj3 = GameObject.CreatePrimitive((PrimitiveType)3); ((Object)obj3).name = "Mjolnir_HeadBand"; obj3.transform.SetParent(val.transform, false); obj3.transform.localPosition = new Vector3(0f, 0f, num2); obj3.transform.localScale = new Vector3(0.72f, 0.43f, 0.035f); Collider component3 = obj3.GetComponent(); if ((Object)(object)component3 != (Object)null) { Object.Destroy((Object)(object)component3); } obj3.GetComponent().sharedMaterial = val3; } GameObject obj4 = GameObject.CreatePrimitive((PrimitiveType)2); ((Object)obj4).name = "Mjolnir_Leather_Handle"; obj4.transform.SetParent(val.transform, false); obj4.transform.localPosition = Vector3.zero; obj4.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); obj4.transform.localScale = new Vector3(0.082f, 0.48f, 0.082f); Collider component4 = obj4.GetComponent(); if ((Object)(object)component4 != (Object)null) { Object.Destroy((Object)(object)component4); } obj4.GetComponent().sharedMaterial = val4; array = new float[2] { 0.48f, -0.48f }; foreach (float num3 in array) { GameObject obj5 = GameObject.CreatePrimitive((PrimitiveType)2); ((Object)obj5).name = "Mjolnir_Collar"; obj5.transform.SetParent(val.transform, false); obj5.transform.localPosition = new Vector3(0f, 0f, num3); obj5.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); obj5.transform.localScale = new Vector3(0.105f, 0.055f, 0.105f); Collider component5 = obj5.GetComponent(); if ((Object)(object)component5 != (Object)null) { Object.Destroy((Object)(object)component5); } obj5.GetComponent().sharedMaterial = val3; } for (int j = 0; j < 6; j++) { GameObject obj6 = GameObject.CreatePrimitive((PrimitiveType)2); ((Object)obj6).name = "Mjolnir_GripRing"; obj6.transform.SetParent(val.transform, false); obj6.transform.localPosition = new Vector3(0f, 0f, 0.32f - (float)j * 0.13f); obj6.transform.localRotation = Quaternion.Euler(90f, 0f, 0f); obj6.transform.localScale = new Vector3(0.09f, 0.012f, 0.09f); Collider component6 = obj6.GetComponent(); if ((Object)(object)component6 != (Object)null) { Object.Destroy((Object)(object)component6); } obj6.GetComponent().sharedMaterial = val2; } AudioSource val5 = _prefab.AddComponent(); val5.playOnAwake = false; val5.spatialBlend = 1f; val5.volume = 0.95f; val5.minDistance = 1f; val5.maxDistance = 65f; behaviour.Visual = val.transform; behaviour.Audio = val5; MonoBehaviour[] componentsInChildren = _prefab.GetComponentsInChildren(true); foreach (MonoBehaviour val6 in componentsInChildren) { if (!((Object)(object)val6 == (Object)null) && !((Object)(object)val6 == (Object)(object)behaviour) && !(val6 is ItemBehaviour)) { string text = ((object)val6).GetType().Name.ToLowerInvariant(); if (text.Contains("aim") || text.Contains("scope") || text.Contains("zoom") || text.Contains("ads")) { ((Behaviour)val6).enabled = false; } } } } private Texture2D CreateBrushedMetalTexture() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(128, 128, (TextureFormat)3, true); ((Object)val).name = "Mjolnir_Brushed_Uru_Texture"; ((Texture)val).wrapMode = (TextureWrapMode)0; ((Texture)val).filterMode = (FilterMode)1; Random random = new Random(91731); for (int i = 0; i < 128; i++) { float num = (float)(random.NextDouble() * 0.1 - 0.05); for (int j = 0; j < 128; j++) { float num2 = (float)(random.NextDouble() * 0.09 - 0.045); float num3 = Mathf.Sin((float)j * 0.34f + (float)i * 0.035f) * 0.025f; float num4 = Mathf.Clamp01(0.78f + num + num2 + num3); val.SetPixel(j, i, new Color(num4 * 0.95f, num4 * 0.97f, num4, 1f)); } } val.Apply(true, false); return val; } private Texture2D CreateLeatherTexture() { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown //IL_00ae: Unknown result type (might be due to invalid IL or missing references) Texture2D val = new Texture2D(128, 128, (TextureFormat)3, true); ((Object)val).name = "Mjolnir_Aged_Leather_Texture"; ((Texture)val).wrapMode = (TextureWrapMode)0; ((Texture)val).filterMode = (FilterMode)1; Random random = new Random(41377); for (int i = 0; i < 128; i++) { for (int j = 0; j < 128; j++) { float num = (float)(random.NextDouble() * 0.18 - 0.09); float num2 = Mathf.Sin((float)i * 0.42f + (float)j * 0.035f) * 0.035f; float num3 = Mathf.Clamp01(0.34f + num + num2); val.SetPixel(j, i, new Color(num3 * 0.72f, num3 * 0.27f, num3 * 0.1f, 1f)); } } val.Apply(true, false); return val; } private IEnumerator RegisterFishnetWhenReady() { for (int i = 0; i < 100; i++) { if (_fishnetRegistered) { break; } bool flag = false; bool flag2 = false; try { if ((Object)(object)_prefab == (Object)null) { flag2 = true; } else { object obj = GetStatic(FindType("FishNet.InstanceFinder"), "NetworkManager"); if (obj == null) { flag = true; } else { object member = GetMember(obj, "SpawnablePrefabs"); Type type = FindType("FishNet.Object.NetworkObject"); Component nob = ((type == null) ? null : _prefab.GetComponent(type)); if (member == null || (Object)(object)nob == (Object)null) { flag = true; } else { TrySetMember(nob, "PrefabId", (ushort)0); TrySetMember(nob, "SpawnableCollectionId", (ushort)0); MethodInfo methodInfo = member.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo m) => m.Name == "AddObject" && m.GetParameters().Length >= 1 && m.GetParameters()[0].ParameterType.IsAssignableFrom(((object)nob).GetType())); if (methodInfo != null) { ParameterInfo[] parameters = methodInfo.GetParameters(); object[] array = new object[parameters.Length]; array[0] = nob; for (int num = 1; num < parameters.Length; num++) { array[num] = (parameters[num].HasDefaultValue ? parameters[num].DefaultValue : (parameters[num].ParameterType.IsValueType ? Activator.CreateInstance(parameters[num].ParameterType) : null)); } methodInfo.Invoke(member, array); _fishnetRegistered = true; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mjolnir registered with FishNet spawnable prefab collection."); } else { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Could not find FishNet AddObject method; will retry."); flag = true; } } } } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("FishNet registration retry: " + ex.Message)); flag = true; } if (flag2) { yield break; } if (!_fishnetRegistered) { yield return (object)new WaitForSecondsRealtime(flag ? 0.25f : 0.1f); } } if (!_fishnetRegistered) { ((BaseUnityPlugin)this).Logger.LogWarning((object)"Mjolnir FishNet registration timed out."); } } private void RefreshLocalHolder() { try { _localSteamId = GetOwnSteamId(); object member = GetMember(GetStatic(typeof(Settings), "Instance"), "localPlayer", "LocalPlayer"); _localFpc = (FirstPersonController)((member is FirstPersonController) ? member : null); if ((Object)(object)_localFpc == (Object)null) { Component val = (Component)((member is Component) ? member : null); if (val != null) { _localFpc = val.GetComponent(); } } if ((Object)(object)_localFpc == (Object)null) { _localHeld = null; return; } object member2 = GetMember(_localFpc, "playerPickupScript", "PlayerPickupScript"); object obj = GetMember(member2, "objInHand", "ObjInHand"); if (obj == null) { MethodInfo methodInfo = member2?.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo m) => m.Name.Contains("sync___get_value_objInHand") && m.GetParameters().Length == 0); if (methodInfo != null) { obj = methodInfo.Invoke(member2, null); } } GameObject val2 = (GameObject)((obj is GameObject) ? obj : null); if (val2 != null) { _localHeld = val2; return; } Component val3 = (Component)((obj is Component) ? obj : null); if (val3 != null) { _localHeld = val3.gameObject; } else { _localHeld = null; } } catch { _localHeld = null; } } private void EnforceMjolnirOffhandLock() { if ((Object)(object)_localFpc == (Object)null) { return; } try { object member = GetMember(_localFpc, "playerPickupScript", "PlayerPickupScript"); if (member == null) { return; } bool flag = GetMember(member, "objInLeftHand", "ObjInLeftHand", "syncVar___objInLeftHand") != null; if (GetMember(member, "hasObjectInLeftHand", "syncVar___hasObjectInLeftHand") is bool flag2) { flag = flag || flag2; } if (flag) { member.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo m) => m.Name == "LeftHandDrop" && m.GetParameters().Length == 0)?.Invoke(member, null); } } catch { } } private bool IsHoldingMjolnir() { if ((Object)(object)_localHeld == (Object)null) { return false; } if (!((Object)(object)_localHeld.GetComponentInParent() != (Object)null)) { return (Object)(object)_localHeld.GetComponentInChildren(true) != (Object)null; } return true; } private void LocalSmash() { //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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) (_localHeld.GetComponentInParent() ?? _localHeld.GetComponentInChildren(true))?.PlaySwing(); if ((Object)(object)_localFpc != (Object)null) { PlayWorldSound(((Component)_localFpc).transform.position, _thunder, 0.72f); } Vector3 val = FindSmashPoint(); Vector3 val2 = (((Object)(object)_localFpc != (Object)null) ? ((Component)_localFpc).transform.position : Vector3.zero); string text = string.Join("|", _localSteamId.ToString(), val.x.ToString("R", CultureInfo.InvariantCulture), val.y.ToString("R", CultureInfo.InvariantCulture), val.z.ToString("R", CultureInfo.InvariantCulture), val2.x.ToString("R", CultureInfo.InvariantCulture), val2.y.ToString("R", CultureInfo.InvariantCulture), val2.z.ToString("R", CultureInfo.InvariantCulture)); if (IsHost()) { SmashRequest(text); return; } try { MyceliumNetwork.RPC(2817742601u, "SmashRequest", (ReliableType)1, new object[1] { text }); } catch { } } private Vector3 FindSmashPoint() { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_0051: 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_006b: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_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_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0088: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Unknown result type (might be due to invalid IL or missing references) //IL_0092: Unknown result type (might be due to invalid IL or missing references) //IL_0065: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b0: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bf: Unknown result type (might be due to invalid IL or missing references) //IL_00a9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_localFpc == (Object)null) { return Vector3.zero; } Transform obj = (((Object)(object)_localFpc.playerCameraHolder != (Object)null) ? _localFpc.playerCameraHolder.transform : ((Component)_localFpc).transform); Vector3 position = obj.position; Vector3 forward = obj.forward; RaycastHit val = default(RaycastHit); if (Physics.Raycast(position, forward, ref val, 4f, -1, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val)).point; } Vector3 val2 = position + forward * 2.35f; RaycastHit val3 = default(RaycastHit); if (Physics.Raycast(val2 + Vector3.up * 1.5f, Vector3.down, ref val3, 4f, -1, (QueryTriggerInteraction)1)) { return ((RaycastHit)(ref val3)).point; } return val2 - Vector3.up * 0.8f; } private void LocalFlight() { //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a8: Unknown result type (might be due to invalid IL or missing references) if (_localSteamId == 0L || (Object)(object)_localFpc == (Object)null) { return; } float unscaledTime = Time.unscaledTime; if (unscaledTime < _localNextFlightInput) { return; } _localNextFlightInput = unscaledTime + Mathf.Clamp(_netFlightCooldown, 0.5f, 15f); Vector3 forward = GetForward(_localFpc); float force = Mathf.Clamp(_netFlightForce, 20f, 240f); ((MonoBehaviour)this).StartCoroutine(ApplyMjolnirFlightImpulse(forward, forward, force)); (_localHeld.GetComponentInParent() ?? _localHeld.GetComponentInChildren(true))?.PlayFlight(); CreateFlightFx(((Component)_localFpc).transform.position); string text = _localSteamId.ToString(); if (IsHost()) { FlightRequest(text); return; } try { MyceliumNetwork.RPC(2817742601u, "FlightRequest", (ReliableType)1, new object[1] { text }); } catch { } } private void ResetRoundCooldowns() { _nextUlt.Clear(); _localNextUltInput = 0f; _nextSmash.Clear(); _nextFlight.Clear(); _localNextFlightInput = 0f; ((BaseUnityPlugin)this).Logger.LogInfo((object)"Mjolnir round cooldowns reset."); } private void OnSceneLoadedResetCooldowns(Scene scene, LoadSceneMode mode) { ResetRoundCooldowns(); } private bool UltBindingPressedThisFrame() { if (_ultBinding == null) { return false; } Mouse current = Mouse.current; Keyboard current2 = Keyboard.current; switch (_ultBinding.Value) { case UltBinding.Mouse5: if (current != null) { return current.forwardButton.wasPressedThisFrame; } return false; case UltBinding.Mouse4: if (current != null) { return current.backButton.wasPressedThisFrame; } return false; case UltBinding.MiddleMouse: if (current != null) { return current.middleButton.wasPressedThisFrame; } return false; case UltBinding.Q: if (current2 != null) { return ((ButtonControl)current2.qKey).wasPressedThisFrame; } return false; case UltBinding.E: if (current2 != null) { return ((ButtonControl)current2.eKey).wasPressedThisFrame; } return false; case UltBinding.R: if (current2 != null) { return ((ButtonControl)current2.rKey).wasPressedThisFrame; } return false; case UltBinding.F: if (current2 != null) { return ((ButtonControl)current2.fKey).wasPressedThisFrame; } return false; case UltBinding.G: if (current2 != null) { return ((ButtonControl)current2.gKey).wasPressedThisFrame; } return false; case UltBinding.T: if (current2 != null) { return ((ButtonControl)current2.tKey).wasPressedThisFrame; } return false; case UltBinding.V: if (current2 != null) { return ((ButtonControl)current2.vKey).wasPressedThisFrame; } return false; case UltBinding.C: if (current2 != null) { return ((ButtonControl)current2.cKey).wasPressedThisFrame; } return false; case UltBinding.X: if (current2 != null) { return ((ButtonControl)current2.xKey).wasPressedThisFrame; } return false; case UltBinding.Z: if (current2 != null) { return ((ButtonControl)current2.zKey).wasPressedThisFrame; } return false; case UltBinding.B: if (current2 != null) { return ((ButtonControl)current2.bKey).wasPressedThisFrame; } return false; case UltBinding.LeftShift: if (current2 != null) { return ((ButtonControl)current2.leftShiftKey).wasPressedThisFrame; } return false; case UltBinding.LeftCtrl: if (current2 != null) { return ((ButtonControl)current2.leftCtrlKey).wasPressedThisFrame; } return false; case UltBinding.LeftAlt: if (current2 != null) { return ((ButtonControl)current2.leftAltKey).wasPressedThisFrame; } return false; case UltBinding.Space: if (current2 != null) { return ((ButtonControl)current2.spaceKey).wasPressedThisFrame; } return false; default: return false; } } private void LocalUltimate() { //IL_004f: 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_0056: Unknown result type (might be due to invalid IL or missing references) if (_localSteamId == 0L || (Object)(object)_localFpc == (Object)null) { return; } float unscaledTime = Time.unscaledTime; if (unscaledTime < _localNextUltInput) { return; } _localNextUltInput = unscaledTime + Mathf.Clamp(_netUltCooldown, 3f, 30f); Vector3 position = ((Component)_localFpc).transform.position; PlayWorldSound(position, _thunder, 1f); string text = string.Join("|", _localSteamId.ToString(), position.x.ToString("R", CultureInfo.InvariantCulture), position.y.ToString("R", CultureInfo.InvariantCulture), position.z.ToString("R", CultureInfo.InvariantCulture)); if (IsHost()) { UltimateRequest(text); return; } try { MyceliumNetwork.RPC(2817742601u, "UltimateRequest", (ReliableType)1, new object[1] { text }); } catch { } } [CustomRPC] public void UltimateRequest(string payload) { //IL_00e0: 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) if (!IsHost()) { return; } try { string[] array = payload.Split('|'); if (array.Length != 4) { return; } ulong num = ulong.Parse(array[0]); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(float.Parse(array[1], CultureInfo.InvariantCulture), float.Parse(array[2], CultureInfo.InvariantCulture), float.Parse(array[3], CultureInfo.InvariantCulture)); float unscaledTime = Time.unscaledTime; if (_nextUlt.TryGetValue(num, out var value) && unscaledTime < value) { return; } _nextUlt[num] = unscaledTime + Mathf.Clamp(_netUltCooldown, 3f, 30f); float radius = Mathf.Clamp(_netUltRadius, 3f, 14f); float centerDamage = Mathf.Clamp(_netUltDamage, 0f, 20f); float knock = Mathf.Clamp(_netUltKnockback, 0f, 300f); ApplyAreaEffect(num, val, radius, centerDamage, knock, val); string text = string.Join("|", num.ToString(), val.x.ToString("R", CultureInfo.InvariantCulture), val.y.ToString("R", CultureInfo.InvariantCulture), val.z.ToString("R", CultureInfo.InvariantCulture), radius.ToString("R", CultureInfo.InvariantCulture), knock.ToString("R", CultureInfo.InvariantCulture)); UltimateFx(text); try { MyceliumNetwork.RPC(2817742601u, "UltimateFx", (ReliableType)1, new object[1] { text }); } catch { } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("UltimateRequest failed: " + ex.Message)); } } [CustomRPC] public void SmashRequest(string payload) { //IL_00cc: 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) if (!IsHost()) { return; } try { string[] array = payload.Split('|'); if (array.Length != 7) { return; } ulong num = ulong.Parse(array[0]); Vector3 point = default(Vector3); ((Vector3)(ref point))..ctor(float.Parse(array[1], CultureInfo.InvariantCulture), float.Parse(array[2], CultureInfo.InvariantCulture), float.Parse(array[3], CultureInfo.InvariantCulture)); Vector3 ownerPos = default(Vector3); ((Vector3)(ref ownerPos))..ctor(float.Parse(array[4], CultureInfo.InvariantCulture), float.Parse(array[5], CultureInfo.InvariantCulture), float.Parse(array[6], CultureInfo.InvariantCulture)); float unscaledTime = Time.unscaledTime; if (_nextSmash.TryGetValue(num, out var value) && unscaledTime < value) { return; } _nextSmash[num] = unscaledTime + Mathf.Clamp(_netSmashCooldown, 0.4f, 10f); ApplySmashAuthoritative(num, ownerPos, point); string text = string.Join("|", num.ToString(), point.x.ToString("R", CultureInfo.InvariantCulture), point.y.ToString("R", CultureInfo.InvariantCulture), point.z.ToString("R", CultureInfo.InvariantCulture), Mathf.Clamp(_netSmashRadius, 1.5f, 9f).ToString("R", CultureInfo.InvariantCulture), Mathf.Clamp(_netSmashKnockback, 0f, 260f).ToString("R", CultureInfo.InvariantCulture)); SmashFx(text); try { MyceliumNetwork.RPC(2817742601u, "SmashFx", (ReliableType)1, new object[1] { text }); } catch { } } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("SmashRequest failed: " + ex.Message)); } } [CustomRPC] public void FlightRequest(string payload) { if (!IsHost() || !ulong.TryParse(payload, out var result)) { return; } float unscaledTime = Time.unscaledTime; if (_nextFlight.TryGetValue(result, out var value) && unscaledTime < value) { return; } _nextFlight[result] = unscaledTime + Mathf.Clamp(_netFlightCooldown, 0.5f, 15f); string text = result + "|" + Mathf.Clamp(_netFlightForce, 20f, 240f).ToString("R", CultureInfo.InvariantCulture); FlightApprove(text); try { MyceliumNetwork.RPC(2817742601u, "FlightApprove", (ReliableType)1, new object[1] { text }); } catch { } } [CustomRPC] public void FlightApprove(string payload) { } private IEnumerator ApplyMjolnirFlightImpulse(Vector3 dir, Vector3 look, float force) { //IL_000e: 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) if ((Object)(object)_localFpc == (Object)null) { yield break; } Vector3 launchDir = ((Vector3)(ref look)).normalized; if (Mathf.Abs(launchDir.y) < 0.16f) { Vector3 val = launchDir + Vector3.up * 0.16f; launchDir = ((Vector3)(ref val)).normalized; } ForceAirborneState(_localFpc); _localFpc.CustomAddForce(launchDir, force); for (int i = 0; i < 3; i++) { yield return (object)new WaitForFixedUpdate(); if ((Object)(object)_localFpc == (Object)null) { break; } ForceAirborneState(_localFpc); _localFpc.CustomAddForce(launchDir, force * i switch { 1 => 0.24f, 0 => 0.38f, _ => 0.14f, }); if (look.y < -0.22f) { AddMoveDirectionAssist(_localFpc, launchDir * force * 0.013f); ApplyDiveTranslationAssist(_localFpc, launchDir, force); } } } private void ApplyDiveTranslationAssist(FirstPersonController fpc, Vector3 dir, float force) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_004a: Unknown result type (might be due to invalid IL or missing references) //IL_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) if ((Object)(object)fpc == (Object)null || dir.y >= -0.15f) { return; } try { CharacterController component = ((Component)fpc).GetComponent(); if ((Object)(object)component != (Object)null && ((Collider)component).enabled) { float num = Mathf.Clamp(force * 0.00065f, 0.035f, 0.11f); component.Move(((Vector3)(ref dir)).normalized * num); } } catch { } } private void WriteDirectMovementVelocity(FirstPersonController fpc, Vector3 velocity) { //IL_012c: Unknown result type (might be due to invalid IL or missing references) //IL_0119: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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) if ((Object)(object)fpc == (Object)null) { return; } bool flag = false; string[] array = new string[4] { "moveDirection", "playerVelocity", "velocity", "_velocity" }; foreach (string text in array) { try { FieldInfo field = ((object)fpc).GetType().GetField(text, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (!(field != null) || !(field.FieldType == typeof(Vector3)) || field.IsInitOnly) { goto IL_0098; } field.SetValue(fpc, velocity); flag = true; if (!(text == "moveDirection")) { goto IL_0098; } goto end_IL_003e; IL_0098: PropertyInfo property = ((object)fpc).GetType().GetProperty(text, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite && property.PropertyType == typeof(Vector3)) { property.SetValue(fpc, velocity); flag = true; if (!(text == "moveDirection")) { continue; } break; } continue; end_IL_003e:; } catch { continue; } break; } try { Rigidbody component = ((Component)fpc).GetComponent(); if ((Object)(object)component != (Object)null) { component.velocity = velocity; flag = true; } } catch { } if (!flag) { fpc.CustomAddForce(((Vector3)(ref velocity)).normalized, ((Vector3)(ref velocity)).magnitude * 7f); } } private void ForceAirborneState(FirstPersonController fpc) { if ((Object)(object)fpc == (Object)null) { return; } string[] array = new string[4] { "isGrounded", "grounded", "onGround", "isOnGround" }; foreach (string name in array) { try { FieldInfo field = ((object)fpc).GetType().GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.FieldType == typeof(bool) && !field.IsInitOnly) { field.SetValue(fpc, false); } PropertyInfo property = ((object)fpc).GetType().GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite && property.PropertyType == typeof(bool)) { property.SetValue(fpc, false); } } catch { } } } private void AddMoveDirectionAssist(FirstPersonController fpc, Vector3 delta) { //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_0083: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e8: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)fpc == (Object)null) { return; } string[] array = new string[4] { "moveDirection", "velocity", "playerVelocity", "_velocity" }; foreach (string name in array) { try { FieldInfo field = ((object)fpc).GetType().GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && field.FieldType == typeof(Vector3) && !field.IsInitOnly) { Vector3 val = (Vector3)field.GetValue(fpc); field.SetValue(fpc, val + delta); break; } PropertyInfo property = ((object)fpc).GetType().GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanRead && property.CanWrite && property.PropertyType == typeof(Vector3)) { Vector3 val2 = (Vector3)property.GetValue(fpc); property.SetValue(fpc, val2 + delta); break; } } catch { } } } private void ApplySmashAuthoritative(ulong ownerSid, Vector3 ownerPos, Vector3 point) { //IL_0044: 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) float radius = Mathf.Clamp(_netSmashRadius, 1.5f, 9f); float centerDamage = Mathf.Clamp(_netSmashDamage, 0f, 8f); float knock = Mathf.Clamp(_netSmashKnockback, 0f, 260f); ApplyAreaEffect(ownerSid, point, radius, centerDamage, knock, ownerPos); } private void ApplyAreaEffect(ulong ownerSid, Vector3 point, float radius, float centerDamage, float knock) { //IL_0002: 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) ApplyAreaEffect(ownerSid, point, radius, centerDamage, knock, Vector3.zero); } private void ApplyAreaEffect(ulong ownerSid, Vector3 point, float radius, float centerDamage, float knock, Vector3 ownerPos) { //IL_0002: 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_011f: 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_0125: Unknown result type (might be due to invalid IL or missing references) //IL_012a: Unknown result type (might be due to invalid IL or missing references) //IL_019b: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02c8: Unknown result type (might be due to invalid IL or missing references) //IL_02c9: Unknown result type (might be due to invalid IL or missing references) //IL_02ce: Unknown result type (might be due to invalid IL or missing references) //IL_02e7: Unknown result type (might be due to invalid IL or missing references) //IL_02ec: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0300: Unknown result type (might be due to invalid IL or missing references) //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_0324: Unknown result type (might be due to invalid IL or missing references) PlayerHealth val = ResolveSmashOwner(ownerSid, ownerPos); Transform val2 = (((Object)(object)val != (Object)null) ? ((Component)val).transform.root : null); Transform val3 = (((Object)(object)val != (Object)null && (Object)(object)val.controller != (Object)null) ? ((Component)val.controller).transform : null); Collider[] source = Physics.OverlapSphere(point, radius); bool flag = false; foreach (PlayerHealth item in (from c in source select ((Component)c).GetComponentInParent() into x where (Object)(object)x != (Object)null select x).Distinct()) { if (item.sync___get_value_isKilled()) { continue; } ulong steamIdForPlayerHealth = GetSteamIdForPlayerHealth(item); if ((Object)(object)item == (Object)(object)val || steamIdForPlayerHealth == ownerSid || ((Object)(object)val2 != (Object)null && (Object)(object)((Component)item).transform.root == (Object)(object)val2) || (Object)(object)item.controller == (Object)null) { continue; } Vector3 val4 = ((Component)item.controller).transform.position - point; float num = Mathf.Clamp(((Vector3)(ref val4)).magnitude, 0f, radius); float num2 = 0.35f + 0.65f * (1f - num / radius); if (centerDamage > 0f) { float num3 = centerDamage * num2; if (num <= 1.1f) { num3 += 0.45f * (1f - Mathf.Clamp01(num / 1.1f)); } if (num <= 1.35f && IsHeadImpact(item, point)) { num3 += 0.75f; } item.RemoveHealth(num3); if ((Object)(object)val3 != (Object)null) { try { item.SetKiller(val3); } catch { } } } flag = true; } if (flag) { SendHitmarker(ownerSid); } foreach (Rigidbody item2 in (from c in source select c.attachedRigidbody into r where (Object)(object)r != (Object)null select r).Distinct()) { if ((Object)(object)val2 != (Object)null && ((Component)item2).transform.IsChildOf(val2)) { continue; } PlayerHealth componentInParent = ((Component)item2).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { ulong steamIdForPlayerHealth2 = GetSteamIdForPlayerHealth(componentInParent); if ((Object)(object)componentInParent == (Object)(object)val || steamIdForPlayerHealth2 == ownerSid || ((Object)(object)val2 != (Object)null && (Object)(object)((Component)componentInParent).transform.root == (Object)(object)val2)) { continue; } } Vector3 val5 = item2.worldCenterOfMass - point; float num4 = Mathf.Max(0.5f, ((Vector3)(ref val5)).magnitude); Vector3 val6 = ((Vector3)(ref val5)).normalized + Vector3.up * 0.25f; item2.AddForce(((Vector3)(ref val6)).normalized * (knock * 0.75f / Mathf.Max(1f, num4 * 0.3f)), (ForceMode)1); } } private bool IsHeadImpact(PlayerHealth ph, Vector3 impactPoint) { //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0095: 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) if ((Object)(object)ph == (Object)null) { return false; } try { Collider[] componentsInChildren = ((Component)ph).GetComponentsInChildren(true); foreach (Collider val in componentsInChildren) { if (!((Object)(object)val == (Object)null)) { string text = (((Object)val).name ?? "").ToLowerInvariant(); string text2 = (((Object)(object)((Component)val).transform.parent != (Object)null) ? (((Object)((Component)val).transform.parent).name ?? "").ToLowerInvariant() : ""); if ((text.Contains("head") || text2.Contains("head")) && Vector3.Distance(val.ClosestPoint(impactPoint), impactPoint) <= 0.42f) { return true; } } } Transform[] componentsInChildren2 = ((Component)ph).GetComponentsInChildren(true); foreach (Transform val2 in componentsInChildren2) { if (!((Object)(object)val2 == (Object)null) && (((Object)val2).name ?? "").ToLowerInvariant().Contains("head") && Vector3.Distance(val2.position, impactPoint) <= 0.52f) { return true; } } } catch { } return false; } private PlayerHealth ResolveSmashOwner(ulong ownerSid, Vector3 ownerPos) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) PlayerHealth playerHealthForSteamId = GetPlayerHealthForSteamId(ownerSid); if ((Object)(object)playerHealthForSteamId != (Object)null) { return playerHealthForSteamId; } PlayerHealth result = null; float num = float.MaxValue; PlayerHealth[] array = Resources.FindObjectsOfTypeAll(); foreach (PlayerHealth val in array) { if ((Object)(object)val == (Object)null || (Object)(object)val.controller == (Object)null || (Object)(object)((Component)val).gameObject == (Object)null) { continue; } Scene scene = ((Component)val).gameObject.scene; if (((Scene)(ref scene)).IsValid()) { Vector3 val2 = ((Component)val.controller).transform.position - ownerPos; float sqrMagnitude = ((Vector3)(ref val2)).sqrMagnitude; if (sqrMagnitude < num) { num = sqrMagnitude; result = val; } } } if (!(num <= 9f)) { return null; } return result; } private void SendPlayerKnockback(ulong victimSid, Vector3 victimPos, Vector3 dir, float force) { string text = string.Join("|", victimSid.ToString(), victimPos.x.ToString("R", CultureInfo.InvariantCulture), victimPos.y.ToString("R", CultureInfo.InvariantCulture), victimPos.z.ToString("R", CultureInfo.InvariantCulture), dir.x.ToString("R", CultureInfo.InvariantCulture), dir.y.ToString("R", CultureInfo.InvariantCulture), dir.z.ToString("R", CultureInfo.InvariantCulture), force.ToString("R", CultureInfo.InvariantCulture)); KnockbackApprove(text); try { MyceliumNetwork.RPC(2817742601u, "KnockbackApprove", (ReliableType)1, new object[1] { text }); } catch { } } [CustomRPC] public void KnockbackApprove(string payload) { //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_007c: 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_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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) try { string[] array = payload.Split('|'); if (array.Length != 8) { return; } ulong num = ulong.Parse(array[0]); Vector3 val = default(Vector3); ((Vector3)(ref val))..ctor(float.Parse(array[1], CultureInfo.InvariantCulture), float.Parse(array[2], CultureInfo.InvariantCulture), float.Parse(array[3], CultureInfo.InvariantCulture)); Vector3 val2 = new Vector3(float.Parse(array[4], CultureInfo.InvariantCulture), float.Parse(array[5], CultureInfo.InvariantCulture), float.Parse(array[6], CultureInfo.InvariantCulture)); Vector3 normalized = ((Vector3)(ref val2)).normalized; float num2 = float.Parse(array[7], CultureInfo.InvariantCulture); RefreshLocalHolder(); if (!((Object)(object)_localFpc == (Object)null)) { ulong ownSteamId = GetOwnSteamId(); float num3 = Vector3.Distance(((Component)_localFpc).transform.position, val); if ((num != 0L && ownSteamId == num) || num3 < 1.75f) { _localFpc.CustomAddForce(normalized, num2); ((MonoBehaviour)this).StartCoroutine(ReinforceReceivedKnockback(normalized, num2)); } } } catch { } } private IEnumerator ReinforceReceivedKnockback(Vector3 dir, float force) { //IL_000e: 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) yield return (object)new WaitForFixedUpdate(); if ((Object)(object)_localFpc != (Object)null) { _localFpc.CustomAddForce(dir, force * 0.22f); } } private void SendHitmarker(ulong attackerSid) { string text = attackerSid.ToString(); HitmarkerApprove(text); try { MyceliumNetwork.RPC(2817742601u, "HitmarkerApprove", (ReliableType)1, new object[1] { text }); } catch { } } [CustomRPC] public void HitmarkerApprove(string payload) { if (ulong.TryParse(payload, out var result) && GetOwnSteamId() == result) { ((MonoBehaviour)this).StartCoroutine(ShowHitmarker()); } } private IEnumerator ShowHitmarker() { Camera val = null; try { RefreshLocalHolder(); if ((Object)(object)_localFpc != (Object)null && (Object)(object)_localFpc.playerCameraHolder != (Object)null) { val = _localFpc.playerCameraHolder.GetComponentInChildren(true); } if ((Object)(object)val == (Object)null) { val = Camera.main; } } catch { } if (!((Object)(object)val == (Object)null)) { GameObject root = new GameObject("Mjolnir_AOE_Hitmarker"); root.transform.SetParent(((Component)val).transform, false); root.transform.localPosition = new Vector3(0f, 0f, 0.55f); root.transform.localRotation = Quaternion.identity; Material val2 = new Material(Shader.Find("Sprites/Default") ?? Shader.Find("Standard")); val2.color = Color.white; Vector3[] array = (Vector3[])(object)new Vector3[8] { new Vector3(-0.03f, 0.03f, 0f), new Vector3(-0.01f, 0.01f, 0f), new Vector3(0.03f, 0.03f, 0f), new Vector3(0.01f, 0.01f, 0f), new Vector3(-0.03f, -0.03f, 0f), new Vector3(-0.01f, -0.01f, 0f), new Vector3(0.03f, -0.03f, 0f), new Vector3(0.01f, -0.01f, 0f) }; for (int i = 0; i < 4; i++) { GameObject val3 = new GameObject("HitmarkerStroke"); val3.transform.SetParent(root.transform, false); LineRenderer obj2 = val3.AddComponent(); obj2.useWorldSpace = false; obj2.positionCount = 2; obj2.startWidth = 0.0045f; obj2.endWidth = 0.0045f; ((Renderer)obj2).sharedMaterial = val2; obj2.SetPosition(0, array[i * 2]); obj2.SetPosition(1, array[i * 2 + 1]); } yield return (object)new WaitForSecondsRealtime(0.12f); if ((Object)(object)root != (Object)null) { Object.Destroy((Object)(object)root); } } } [CustomRPC] public void SmashFx(string payload) { //IL_0068: 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) try { string[] array = payload.Split('|'); if (array.Length == 6) { ulong ownerSid = ulong.Parse(array[0]); Vector3 point = default(Vector3); ((Vector3)(ref point))..ctor(float.Parse(array[1], CultureInfo.InvariantCulture), float.Parse(array[2], CultureInfo.InvariantCulture), float.Parse(array[3], CultureInfo.InvariantCulture)); float radius = float.Parse(array[4], CultureInfo.InvariantCulture); float knock = float.Parse(array[5], CultureInfo.InvariantCulture); ((MonoBehaviour)this).StartCoroutine(LightningFx(point)); ApplyLocalAoeKnockback(ownerSid, point, radius, knock); } } catch { } } private void ApplyLocalAoeKnockback(ulong ownerSid, Vector3 point, float radius, float knock) { //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_0035: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_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_0087: 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_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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009f: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: 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_00b1: Unknown result type (might be due to invalid IL or missing references) RefreshLocalHolder(); if ((Object)(object)_localFpc == (Object)null) { return; } ulong ownSteamId = GetOwnSteamId(); if (ownSteamId == 0L || ownSteamId != ownerSid) { Vector3 position = ((Component)_localFpc).transform.position; float num = Vector3.Distance(position, point); if (!(num > radius)) { float num2 = 0.35f + 0.65f * (1f - Mathf.Clamp01(num / Mathf.Max(0.01f, radius))); Vector3 val = position - point; Vector3 val2 = ((((Vector3)(ref val)).sqrMagnitude > 0.01f) ? ((Vector3)(ref val)).normalized : Vector3.up); Vector3 val3 = val2 + Vector3.up * 0.4f; val2 = ((Vector3)(ref val3)).normalized; ((MonoBehaviour)this).StartCoroutine(ApplyLocalSmashKnockback(val2, knock * num2)); } } } private IEnumerator ApplyLocalSmashKnockback(Vector3 dir, float force) { //IL_000e: 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) if (!((Object)(object)_localFpc == (Object)null)) { ForceAirborneState(_localFpc); _localFpc.CustomAddForce(dir, force); yield return (object)new WaitForFixedUpdate(); if (!((Object)(object)_localFpc == (Object)null)) { ForceAirborneState(_localFpc); _localFpc.CustomAddForce(dir, force * 0.28f); } } } private IEnumerator LightningFx(Vector3 point) { //IL_000e: 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) PlayWorldSound(point, _smash, 1f); PlayWorldSound(point + Vector3.up * 3f, _thunder, 1f); Material val = new Material(Shader.Find("Sprites/Default") ?? Shader.Find("Standard")); val.color = new Color(0.64f, 0.92f, 1f, 1f); List objects = new List(); for (int i = 0; i < 3; i++) { GameObject val2 = new GameObject((i == 0) ? "Mjolnir_PrimaryBolt" : "Mjolnir_BranchBolt"); objects.Add(val2); LineRenderer val3 = val2.AddComponent(); val3.useWorldSpace = true; val3.positionCount = ((i == 0) ? 10 : 6); val3.startWidth = ((i == 0) ? 0.19f : 0.052f); val3.endWidth = ((i == 0) ? 0.045f : 0.01f); ((Renderer)val3).sharedMaterial = val; Vector3 val4 = point + Vector3.up * ((i == 0) ? 23f : Random.Range(9f, 16f)) + new Vector3(Random.Range(-2.4f, 2.4f), 0f, Random.Range(-2.4f, 2.4f)); for (int j = 0; j < val3.positionCount; j++) { float num = (float)j / (float)(val3.positionCount - 1); Vector3 val5 = Vector3.Lerp(val4, point, num); if (j > 0 && j < val3.positionCount - 1) { val5 += new Vector3(Random.Range(-0.72f, 0.72f), Random.Range(-0.16f, 0.16f), Random.Range(-0.72f, 0.72f)) * (1f - num * 0.45f); } val3.SetPosition(j, val5); } } GameObject val6 = new GameObject("Mjolnir_ImpactFlash"); objects.Add(val6); val6.transform.position = point + Vector3.up * 0.2f; Light light = val6.AddComponent(); light.type = (LightType)2; light.color = new Color(0.32f, 0.7f, 1f, 1f); light.range = 12f; light.intensity = 8f; GameObject val7 = new GameObject("Mjolnir_ShockRing"); objects.Add(val7); LineRenderer rr = val7.AddComponent(); rr.useWorldSpace = true; rr.loop = true; rr.positionCount = 32; rr.startWidth = 0.075f; rr.endWidth = 0.075f; ((Renderer)rr).sharedMaterial = val; for (int frame = 0; frame < 6; frame++) { float num2 = 0.45f + (float)frame * 0.54f; for (int k = 0; k < 32; k++) { float num3 = (float)k / 32f * MathF.PI * 2f; rr.SetPosition(k, point + new Vector3(Mathf.Cos(num3) * num2, 0.055f, Mathf.Sin(num3) * num2)); } light.intensity = Mathf.Lerp(8f, 0.35f, (float)frame / 5f); yield return (object)new WaitForSecondsRealtime(0.032f); } foreach (GameObject item in objects) { if ((Object)(object)item != (Object)null) { Object.Destroy((Object)(object)item); } } } [CustomRPC] public void UltimateFx(string payload) { //IL_0068: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) try { string[] array = payload.Split('|'); if (array.Length == 6) { ulong ownerSid = ulong.Parse(array[0]); Vector3 point = default(Vector3); ((Vector3)(ref point))..ctor(float.Parse(array[1], CultureInfo.InvariantCulture), float.Parse(array[2], CultureInfo.InvariantCulture), float.Parse(array[3], CultureInfo.InvariantCulture)); float radius = float.Parse(array[4], CultureInfo.InvariantCulture); float knock = float.Parse(array[5], CultureInfo.InvariantCulture); ApplyLocalAoeKnockback(ownerSid, point, radius, knock); ((MonoBehaviour)this).StartCoroutine(UltimateStormFx(point, radius)); } } catch { } } private IEnumerator UltimateStormFx(Vector3 point, float radius) { //IL_000e: 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) PlayWorldSound(point, _thunder, 1f); ((MonoBehaviour)this).StartCoroutine(LightningFx(point)); for (int wave = 0; wave < 3; wave++) { for (int i = 0; i < 6; i++) { float num = (float)i / 6f * MathF.PI * 2f + (float)wave * 0.52f; float num2 = radius * (0.24f + 0.27f * (float)wave); Vector3 point2 = point + new Vector3(Mathf.Cos(num) * num2, 0f, Mathf.Sin(num) * num2); ((MonoBehaviour)this).StartCoroutine(LightningFx(point2)); } yield return (object)new WaitForSecondsRealtime(0.17f); } } private void CreateFlightFx(Vector3 pos) { //IL_0001: 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_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_0045: Unknown result type (might be due to invalid IL or missing references) //IL_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007f: Expected O, but got Unknown //IL_0094: 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) PlayWorldSound(pos, _flight, 0.9f); for (int i = 0; i < 8; i++) { GameObject obj = GameObject.CreatePrimitive((PrimitiveType)0); obj.transform.position = pos + Random.insideUnitSphere * 0.55f; obj.transform.localScale = Vector3.one * 0.08f; Collider component = obj.GetComponent(); if ((Object)(object)component != (Object)null) { Object.Destroy((Object)(object)component); } Material val = new Material(Shader.Find("Standard")); val.color = new Color(0.25f, 0.7f, 1f, 1f); val.EnableKeyword("_EMISSION"); val.SetColor("_EmissionColor", new Color(0.1f, 1f, 3f, 1f)); obj.GetComponent().sharedMaterial = val; Object.Destroy((Object)(object)obj, 0.18f); } } private void PlayWorldSound(Vector3 pos, AudioClip clip, float volume) { //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_001a: 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_006b: Expected O, but got Unknown if (!((Object)(object)clip == (Object)null)) { GameObject val = new GameObject("MjolnirAudio"); val.transform.position = pos; AudioSource obj = val.AddComponent(); obj.spatialBlend = 1f; obj.minDistance = 1f; obj.maxDistance = 70f; obj.volume = volume; obj.clip = clip; obj.Play(); Object.Destroy((Object)val, clip.length + 0.2f); } } private PlayerHealth GetPlayerHealthForSteamId(ulong sid) { if (sid == 0L) { return null; } if (Time.unscaledTime >= _nextPlayerHealthCacheRefresh) { _nextPlayerHealthCacheRefresh = Time.unscaledTime + 1f; _playerHealthCache.Clear(); try { if (GetStatic(FindType("ClientInstance"), "playerInstances", "PlayerInstances") is IDictionary dictionary) { foreach (DictionaryEntry item in dictionary) { object value = item.Value; ulong steamId = GetSteamId(value); if (steamId == 0L || _playerHealthCache.ContainsKey(steamId)) { continue; } object member = GetMember(value, "PlayerHealth", "playerHealth"); PlayerHealth val = (PlayerHealth)((member is PlayerHealth) ? member : null); if ((Object)(object)val == (Object)null) { Component val2 = (Component)((value is Component) ? value : null); if (val2 != null) { val = val2.GetComponentInChildren(true); } } if ((Object)(object)val == (Object)null) { object member2 = GetMember(GetMember(value, "PlayerManager", "playerManager"), "SpawnedObject", "spawnedObject", "PlayerObject", "playerObject"); object obj = ((member2 is GameObject) ? member2 : null); if (obj == null) { object obj2 = ((member2 is Component) ? member2 : null); obj = ((obj2 != null) ? ((Component)obj2).gameObject : null); } GameObject val3 = (GameObject)obj; if ((Object)(object)val3 != (Object)null) { val = val3.GetComponentInChildren(true); } } if ((Object)(object)val != (Object)null) { _playerHealthCache[steamId] = val; } } } } catch { } } if (!_playerHealthCache.TryGetValue(sid, out var value2)) { return null; } return value2; } private static Vector3 GetForward(FirstPersonController fpc) { //IL_0009: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) //IL_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0074: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)fpc == (Object)null) { return Vector3.forward; } try { if ((Object)(object)fpc.playerCameraHolder != (Object)null) { Vector3 forward = fpc.playerCameraHolder.transform.forward; if (((Vector3)(ref forward)).sqrMagnitude > 0.0001f) { return ((Vector3)(ref forward)).normalized; } } } catch { } Vector3 forward2 = ((Component)fpc).transform.forward; if (!(((Vector3)(ref forward2)).sqrMagnitude > 0.0001f)) { return Vector3.forward; } return ((Vector3)(ref forward2)).normalized; } private void SpawnTestMjolnir() { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_004b: 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_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_0090: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)_prefab == (Object)null || (Object)(object)_localFpc == (Object)null || !IsHost()) { return; } try { Vector3 val = _localFpc.playerCameraHolder.transform.position + GetForward(_localFpc) * 1.5f; val.y -= 0.4f; GameObject val2 = Object.Instantiate(_prefab, val, Quaternion.identity); val2.SetActive(true); ItemBehaviour component = val2.GetComponent(); if ((Object)(object)component != (Object)null) { component.DispenserDrop(Vector3.zero); } Rigidbody component2 = val2.GetComponent(); if ((Object)(object)component2 != (Object)null) { component2.isKinematic = false; } object obj = GetStatic(FindType("FishNet.InstanceFinder"), "ServerManager"); MethodInfo methodInfo = obj?.GetType().GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic).FirstOrDefault((MethodInfo m) => m.Name == "Spawn" && m.GetParameters().Length >= 1 && m.GetParameters()[0].ParameterType == typeof(GameObject)); if (methodInfo != null) { methodInfo.Invoke(obj, MakeArgs(methodInfo, new object[1] { val2 })); } ((BaseUnityPlugin)this).Logger.LogInfo((object)"F8 test-spawned Mjolnir."); } catch (Exception ex) { ((BaseUnityPlugin)this).Logger.LogWarning((object)("F8 spawn failed: " + ex.Message)); } } private bool IsHost() { try { return MyceliumNetwork.InLobby && MyceliumNetwork.IsHost; } catch { return false; } } private ulong GetOwnSteamId() { try { object obj = (FindType("Steamworks.SteamUser")?.GetMethod("GetSteamID", BindingFlags.Static | BindingFlags.Public))?.Invoke(null, null); if (obj == null) { return 0uL; } object member = GetMember(obj, "m_SteamID", "Value", "value"); if (member != null && ulong.TryParse(Convert.ToString(member), out var result)) { return result; } if (ulong.TryParse(Convert.ToString(obj), out var result2)) { return result2; } } catch { } return 0uL; } private ulong GetSteamId(object client) { object member = GetMember(client, "PlayerSteamID", "playerSteamID", "SteamID", "steamID"); if (member == null) { return 0uL; } if (member is ulong) { return (ulong)member; } object member2 = GetMember(member, "m_SteamID", "Value", "value"); if (member2 != null && ulong.TryParse(Convert.ToString(member2), out var result)) { return result; } ulong.TryParse(Convert.ToString(member), out var result2); return result2; } internal static Type FindType(string name) { Assembly[] assemblies = AppDomain.CurrentDomain.GetAssemblies(); foreach (Assembly assembly in assemblies) { try { Type type = assembly.GetType(name, throwOnError: false) ?? assembly.GetTypes().FirstOrDefault((Type x) => x.Name == name); if (type != null) { return type; } } catch { } } return null; } internal static object GetStatic(Type t, params string[] names) { if (t == null) { return null; } foreach (string name in names) { try { FieldInfo field = t.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field.GetValue(null); } PropertyInfo property = t.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanRead) { return property.GetValue(null); } } catch { } } return null; } internal static object GetMember(object obj, params string[] names) { if (obj == null) { return null; } Type type = obj.GetType(); foreach (string name in names) { try { FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null) { return field.GetValue(obj); } PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanRead) { return property.GetValue(obj); } } catch { } } return null; } private static void TrySetMember(object obj, string name, object value) { if (obj == null) { return; } try { Type type = obj.GetType(); PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property != null && property.CanWrite) { object value2 = value; if (value != null && !property.PropertyType.IsInstanceOfType(value)) { value2 = Convert.ChangeType(value, property.PropertyType); } property.SetValue(obj, value2); return; } FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (field != null && !field.IsInitOnly) { object value3 = value; if (value != null && !field.FieldType.IsInstanceOfType(value)) { value3 = Convert.ChangeType(value, field.FieldType); } field.SetValue(obj, value3); } } catch { } } private static object[] MakeArgs(MethodInfo method, object[] supplied) { ParameterInfo[] parameters = method.GetParameters(); object[] array = new object[parameters.Length]; for (int i = 0; i < parameters.Length; i++) { if (i < supplied.Length) { array[i] = supplied[i]; } else if (parameters[i].HasDefaultValue) { array[i] = parameters[i].DefaultValue; } else if (parameters[i].ParameterType.IsValueType) { array[i] = Activator.CreateInstance(parameters[i].ParameterType); } else { array[i] = null; } } return array; } } public sealed class MjolnirMenuRowBinding : MonoBehaviour { internal MjolnirPlugin Plugin; internal Component Toggle; internal Component Slider; private bool _initialized; private bool _lastToggle; private float _lastSlider; private float _nextRefresh; internal void Initialize() { if (!((Object)(object)Plugin == (Object)null)) { if ((Object)(object)Toggle != (Object)null) { MjolnirPlugin.SetBoolProperty(Toggle, "isOn", Plugin.SpawnEnabled.Value); } if ((Object)(object)Slider != (Object)null) { MjolnirPlugin.SetFloatProperty(Slider, "minValue", 0f); MjolnirPlugin.SetFloatProperty(Slider, "maxValue", 100f); MjolnirPlugin.SetFloatProperty(Slider, "value", Mathf.Clamp(Plugin.SpawnWeight.Value, 0f, 100f)); } _lastToggle = Plugin.SpawnEnabled.Value; _lastSlider = Mathf.Clamp(Plugin.SpawnWeight.Value, 0f, 100f); _initialized = true; RefreshWholePage(); } } private void Update() { if (!_initialized || (Object)(object)Plugin == (Object)null) { return; } bool flag = false; if ((Object)(object)Toggle != (Object)null) { bool boolProperty = MjolnirPlugin.GetBoolProperty(Toggle, "isOn", _lastToggle); if (boolProperty != _lastToggle) { _lastToggle = boolProperty; Plugin.SpawnEnabled.Value = boolProperty; flag = true; } } if ((Object)(object)Slider != (Object)null) { float num = Mathf.Clamp(MjolnirPlugin.GetFloatProperty(Slider, "value", _lastSlider), 0f, 100f); if (Mathf.Abs(num - _lastSlider) > 0.001f) { _lastSlider = num; Plugin.SpawnWeight.Value = num; flag = true; } } if (flag || Time.unscaledTime >= _nextRefresh) { _nextRefresh = Time.unscaledTime + 0.1f; RefreshWholePage(); } } private void RefreshWholePage() { //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_004b: Expected O, but got Unknown Transform parent = ((Component)this).transform.parent; if ((Object)(object)Plugin == (Object)null || (Object)(object)parent == (Object)null) { return; } List> list = new List>(); float num = 0f; try { foreach (Transform item3 in parent) { Transform val = item3; if ((Object)(object)val == (Object)null || !((Component)val).gameObject.activeInHierarchy) { continue; } Component val2 = null; Component val3 = null; Component item = null; Component[] componentsInChildren = ((Component)val).GetComponentsInChildren(true); foreach (Component val4 in componentsInChildren) { if ((Object)(object)val4 == (Object)null) { continue; } string name = ((object)val4).GetType().Name; if ((Object)(object)val2 == (Object)null && name == "Toggle") { val2 = val4; } else if ((Object)(object)val3 == (Object)null && name == "Slider") { val3 = val4; } PropertyInfo property = ((object)val4).GetType().GetProperty("text", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (!(property != null) || !property.CanRead || !property.CanWrite || !(property.PropertyType == typeof(string))) { continue; } try { if ((((string)property.GetValue(val4)) ?? "").Contains("%")) { item = val4; } } catch { } } if (!((Object)(object)val2 == (Object)null) && !((Object)(object)val3 == (Object)null)) { bool boolProperty = MjolnirPlugin.GetBoolProperty(val2, "isOn", fallback: false); float num2 = Mathf.Clamp(MjolnirPlugin.GetFloatProperty(val3, "value", 0f), 0f, 100f); list.Add(Tuple.Create(val2, val3, item, num2, boolProperty)); if (boolProperty) { num += num2; } } } } catch { } float num3 = Mathf.Max(0.0001f, num); Plugin.NativeRandomizerTotalWeight = num3; foreach (Tuple item4 in list) { Component item2 = item4.Item3; if ((Object)(object)item2 == (Object)null) { continue; } float num4 = ((Plugin.GlobalRandomizerEnabled && item4.Item5 && num > 0f) ? (item4.Item4 / num3 * 100f) : 0f); try { PropertyInfo property2 = ((object)item2).GetType().GetProperty("text", BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic); if (property2 != null && property2.CanWrite) { property2.SetValue(item2, num4.ToString("0.0", CultureInfo.InvariantCulture) + "%"); } } catch { } } } } public sealed class MjolnirBehaviour : MonoBehaviour { internal MjolnirPlugin Plugin; internal AudioClip SwingClip; internal AudioClip SmashClip; internal AudioClip ThunderClip; internal AudioClip FlightClip; internal AudioClip HumClip; internal AudioSource Audio; internal Transform Visual; private bool _swinging; private GameObject _auraRoot; private Transform _auraTarget; private readonly List _auraBolts = new List(); private float _nextAuraRefresh; private GameObject _hammerGlowRoot; private Light _hammerGlowLight; private float _nextHammerGlowUpdate; private void Awake() { ResolveVisualPivot(); } private void ResolveVisualPivot() { if ((Object)(object)Visual != (Object)null) { return; } Transform[] componentsInChildren = ((Component)this).GetComponentsInChildren(true); foreach (Transform val in componentsInChildren) { if ((Object)(object)val != (Object)null && ((Object)val).name == "Mjolnir_SwingPivot") { Visual = val; break; } } } private void Update() { UpdateWorthyAura(); UpdateHammerGlow(); } private void UpdateWorthyAura() { //IL_0075: 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_0233: Unknown result type (might be due to invalid IL or missing references) //IL_0234: 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_0243: 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) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010a: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0116: Unknown result type (might be due to invalid IL or missing references) //IL_011b: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_0140: Unknown result type (might be due to invalid IL or missing references) //IL_0142: 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_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_0177: 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_0188: 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_01a1: Unknown result type (might be due to invalid IL or missing references) //IL_01a6: Unknown result type (might be due to invalid IL or missing references) //IL_01ab: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01af: Unknown result type (might be due to invalid IL or missing references) //IL_01b6: Unknown result type (might be due to invalid IL or missing references) //IL_01e2: Unknown result type (might be due to invalid IL or missing references) //IL_01ec: Unknown result type (might be due to invalid IL or missing references) //IL_01f1: 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_01fa: Unknown result type (might be due to invalid IL or missing references) //IL_0203: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) Transform val = FindHolderTransform(); if ((Object)(object)val == (Object)null) { DestroyWorthyAura(); return; } if ((Object)(object)_auraRoot == (Object)null || (Object)(object)_auraTarget != (Object)(object)val) { DestroyWorthyAura(); _auraTarget = val; CreateWorthyAura(val); } if ((Object)(object)_auraRoot == (Object)null || Time.unscaledTime < _nextAuraRefresh) { return; } _nextAuraRefresh = Time.unscaledTime + 0.085f; Vector3 position = val.position; Vector3 val3 = default(Vector3); Vector3 val4 = default(Vector3); for (int i = 0; i < _auraBolts.Count; i++) { LineRenderer val2 = _auraBolts[i]; if (!((Object)(object)val2 == (Object)null)) { float num = Time.unscaledTime * 4.2f + (float)i * 1.37f; float num2 = 0.22f + (float)i * 0.21f % 1.55f; float num3 = num + (float)i * 0.55f; ((Vector3)(ref val3))..ctor(Mathf.Cos(num3), 0f, Mathf.Sin(num3)); ((Vector3)(ref val4))..ctor(0f - val3.z, 0f, val3.x); Vector3 val5 = position + Vector3.up * num2 + val3 * (0.27f + Mathf.Sin(num * 0.8f) * 0.05f); Vector3 val6 = position + Vector3.up * Mathf.Clamp(num2 + 0.18f + 0.1f * Mathf.Sin(num), 0.25f, 1.9f) + val3 * 0.22f + val4 * 0.16f * Mathf.Sin(num * 1.7f); Vector3 val7 = Vector3.Lerp(val5, val6, 0.5f) + new Vector3(Mathf.Sin(num * 2.3f), Mathf.Cos(num * 1.9f), Mathf.Sin(num * 2.7f)) * 0.045f; val2.SetPosition(0, val5); val2.SetPosition(1, val7); val2.SetPosition(2, val6); } } _auraRoot.transform.position = position + Vector3.up * 0.95f; } private void UpdateHammerGlow() { //IL_0049: Unknown result type (might be due to invalid IL or missing references) ResolveVisualPivot(); if ((Object)(object)Visual == (Object)null) { return; } if ((Object)(object)_hammerGlowRoot == (Object)null) { CreateHammerGlow(); } if (!((Object)(object)_hammerGlowRoot == (Object)null)) { _hammerGlowRoot.transform.position = Visual.position; if ((Object)(object)_hammerGlowLight != (Object)null && Time.unscaledTime >= _nextHammerGlowUpdate) { _nextHammerGlowUpdate = Time.unscaledTime + 0.066f; float intensity = 0.52f + 0.1f * Mathf.Sin(Time.unscaledTime * 3.4f); _hammerGlowLight.intensity = intensity; } } } private void CreateHammerGlow() { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_003c: 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_007d: Unknown result type (might be due to invalid IL or missing references) _hammerGlowRoot = new GameObject("Mjolnir_Subtle_Blue_Glow"); _hammerGlowRoot.transform.position = (((Object)(object)Visual != (Object)null) ? Visual.position : ((Component)this).transform.position); _hammerGlowLight = _hammerGlowRoot.AddComponent(); _hammerGlowLight.type = (LightType)2; _hammerGlowLight.color = new Color(0.18f, 0.48f, 1f, 1f); _hammerGlowLight.range = 1.55f; _hammerGlowLight.intensity = 0.52f; _hammerGlowLight.shadows = (LightShadows)0; } private void DestroyHammerGlow() { if ((Object)(object)_hammerGlowRoot != (Object)null) { Object.Destroy((Object)(object)_hammerGlowRoot); } _hammerGlowRoot = null; _hammerGlowLight = null; } private Transform FindHolderTransform() { try { FirstPersonController componentInParent = ((Component)this).GetComponentInParent(); if ((Object)(object)componentInParent != (Object)null) { return ((Component)componentInParent).transform; } PlayerHealth componentInParent2 = ((Component)this).GetComponentInParent(); if ((Object)(object)componentInParent2 != (Object)null && (Object)(object)componentInParent2.controller != (Object)null) { return ((Component)componentInParent2.controller).transform; } Transform parent = ((Component)this).transform.parent; int num = 0; while (num < 8 && (Object)(object)parent != (Object)null) { if ((Object)(object)((Component)parent).GetComponent() != (Object)null) { return parent; } PlayerHealth component = ((Component)parent).GetComponent(); if ((Object)(object)component != (Object)null && (Object)(object)component.controller != (Object)null) { return ((Component)component.controller).transform; } num++; parent = parent.parent; } } catch { } return null; } private void CreateWorthyAura(Transform holder) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Expected O, but got Unknown //IL_006d: 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_0091: 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) _auraRoot = new GameObject("Mjolnir_Worthy_Lightning_Aura"); _auraRoot.transform.position = holder.position + Vector3.up * 0.95f; Material val = new Material(Shader.Find("Sprites/Default") ?? Shader.Find("Standard")); val.color = new Color(0.18f, 0.6f, 1f, 1f); for (int i = 0; i < 7; i++) { GameObject val2 = new GameObject("WorthyBolt_" + i); val2.transform.SetParent(_auraRoot.transform, false); LineRenderer val3 = val2.AddComponent(); val3.useWorldSpace = true; val3.positionCount = 3; val3.startWidth = 0.008f; val3.endWidth = 0.0035f; ((Renderer)val3).sharedMaterial = val; _auraBolts.Add(val3); } Light obj = _auraRoot.AddComponent(); obj.type = (LightType)2; obj.color = new Color(0.12f, 0.42f, 1f, 1f); obj.range = 2.25f; obj.intensity = 0.7f; } private void DestroyWorthyAura() { _auraBolts.Clear(); if ((Object)(object)_auraRoot != (Object)null) { Object.Destroy((Object)(object)_auraRoot); } _auraRoot = null; _auraTarget = null; } private void OnDestroy() { DestroyWorthyAura(); DestroyHammerGlow(); } internal void PlaySwing() { if ((Object)(object)Audio != (Object)null && (Object)(object)SwingClip != (Object)null) { Audio.PlayOneShot(SwingClip, 0.75f); } if (!_swinging) { ((MonoBehaviour)this).StartCoroutine(SwingAnim()); } } internal void PlayFlight() { if ((Object)(object)Audio != (Object)null && (Object)(object)FlightClip != (Object)null) { Audio.PlayOneShot(FlightClip, 0.9f); } } private IEnumerator SwingAnim() { _swinging = true; ResolveVisualPivot(); if ((Object)(object)Visual == (Object)null) { _swinging = false; yield break; } Quaternion startRot = Visual.localRotation; Vector3 startPos = Visual.localPosition; Quaternion windRot = startRot * Quaternion.Euler(-38f, -18f, 34f); Quaternion hitRot = startRot * Quaternion.Euler(138f, 10f, -24f); Vector3 windPos = startPos + new Vector3(0.04f, 0.1f, -0.05f); Vector3 hitPos = startPos + new Vector3(-0.03f, -0.16f, 0.12f); float t = 0f; while (t < 0.11f) { t += Time.unscaledDeltaTime; float num = Mathf.Clamp01(t / 0.11f); Visual.localRotation = Quaternion.Slerp(startRot, windRot, num); Visual.localPosition = Vector3.Lerp(startPos, windPos, num); yield return null; } t = 0f; while (t < 0.1f) { t += Time.unscaledDeltaTime; float num2 = Mathf.Clamp01(t / 0.1f); Visual.localRotation = Quaternion.Slerp(windRot, hitRot, num2); Visual.localPosition = Vector3.Lerp(windPos, hitPos, num2); yield return null; } t = 0f; while (t < 0.18f) { t += Time.unscaledDeltaTime; float num3 = Mathf.Clamp01(t / 0.18f); Visual.localRotation = Quaternion.Slerp(hitRot, startRot, num3); Visual.localPosition = Vector3.Lerp(hitPos, startPos, num3); yield return null; } Visual.localRotation = startRot; Visual.localPosition = startPos; _swinging = false; } } internal static class ObjLoader { internal static Mesh Load(string path) { //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Expected O, but got Unknown //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0120: Unknown result type (might be due to invalid IL or missing references) if (!File.Exists(path)) { throw new FileNotFoundException("Mjolnir model missing", path); } List list = new List(); List list2 = new List(); List list3 = new List(); List list4 = new List(); List list5 = new List(); Dictionary cache = new Dictionary(); foreach (string item in File.ReadLines(path)) { string text = item.Trim(); if (text.Length == 0 || text[0] == '#') { continue; } string[] array = text.Split(new char[1] { ' ' }, StringSplitOptions.RemoveEmptyEntries); if (array[0] == "v" && array.Length >= 4) { float num = F(array[1]); float num2 = F(array[2]); float num3 = F(array[3]); list.Add(new Vector3(num, num3, num2)); } else if (array[0] == "vn" && array.Length >= 4) { float num4 = F(array[1]); float num5 = F(array[2]); float num6 = F(array[3]); Vector3 val = new Vector3(num4, num6, num5); list2.Add(((Vector3)(ref val)).normalized); } else if (array[0] == "f" && array.Length >= 4) { int[] array2 = new int[array.Length - 1]; for (int i = 1; i < array.Length; i++) { array2[i - 1] = Vertex(array[i], list, list2, list3, list4, cache); } for (int j = 1; j < array2.Length - 1; j++) { list5.Add(array2[0]); list5.Add(array2[j]); list5.Add(array2[j + 1]); } } } Mesh val2 = new Mesh(); ((Object)val2).name = "Mjolnir_RuntimeMesh"; val2.SetVertices(list3); val2.SetTriangles(list5, 0); if (list4.Count == list3.Count && list4.Any((Vector3 n) => ((Vector3)(ref n)).sqrMagnitude > 0.01f)) { val2.SetNormals(list4); } else { val2.RecalculateNormals(); } val2.RecalculateBounds(); return val2; } private static int Vertex(string token, List pos, List nor, List outV, List outN, Dictionary cache) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) if (cache.TryGetValue(token, out var value)) { return value; } string[] array = token.Split('/'); int num = ParseIndex((array.Length != 0) ? array[0] : "", pos.Count); int num2 = ((array.Length > 2) ? ParseIndex(array[2], nor.Count) : (-1)); if (num < 0 || num >= pos.Count) { throw new InvalidDataException("Bad OBJ vertex " + token); } value = outV.Count; outV.Add(pos[num]); outN.Add((num2 >= 0 && num2 < nor.Count) ? nor[num2] : Vector3.zero); cache[token] = value; return value; } private static int ParseIndex(string s, int count) { if (string.IsNullOrEmpty(s)) { return -1; } int num = int.Parse(s, CultureInfo.InvariantCulture); if (num <= 0) { return count + num; } return num - 1; } private static float F(string s) { return float.Parse(s, CultureInfo.InvariantCulture); } } internal static class WavLoader { internal static AudioClip Load(string path) { if (!File.Exists(path)) { return null; } byte[] array = File.ReadAllBytes(path); if (array.Length < 44) { return null; } int num = BitConverter.ToInt16(array, 22); int num2 = BitConverter.ToInt32(array, 24); if (BitConverter.ToInt16(array, 34) != 16) { return null; } int i = 12; int num3 = -1; int num4 = 0; int num5; for (; i + 8 <= array.Length; i += 8 + num5 + num5 % 2) { string text = Encoding.ASCII.GetString(array, i, 4); num5 = BitConverter.ToInt32(array, i + 4); if (text == "data") { num3 = i + 8; num4 = Math.Min(num5, array.Length - num3); break; } } if (num3 < 0) { return null; } int num6 = num4 / 2; float[] array2 = new float[num6]; for (int j = 0; j < num6; j++) { array2[j] = (float)BitConverter.ToInt16(array, num3 + j * 2) / 32768f; } int num7 = num6 / Math.Max(1, num); AudioClip obj = AudioClip.Create(Path.GetFileNameWithoutExtension(path), num7, num, num2, false); obj.SetData(array2, 0); return obj; } } }