Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of MahoragaLC v1.0.0
BepInEx/plugins/Fede-MahoragaLC/Fede.MahoragaLC.dll
Decompiled 2 hours ago
The result has been truncated due to the large size, download it to view full contents!
using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.IO; using System.Linq; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using System.Security; using System.Security.Permissions; using BepInEx; using BepInEx.Bootstrap; using BepInEx.Configuration; using BepInEx.Logging; using Fede.MahoragaLC.NetcodePatcher; using GameNetcodeStuff; using HarmonyLib; using LethalLib.Modules; using MahoragaLC.AI; using MahoragaLC.Audio; using MahoragaLC.Config; using MahoragaLC.Effects; using MahoragaLC.Patches; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Audio; using UnityEngine.Networking; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: IgnoresAccessChecksTo("Assembly-CSharp")] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("Fede.MahoragaLC")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Eight-Handled Sword Divergent Sila Divine General Mahoraga apex enemy mod for Lethal Company.")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+7ef0aeacf18abc5e4ccf94397f34cd3168fb5d92")] [assembly: AssemblyProduct("MahoragaLC")] [assembly: AssemblyTitle("Fede.MahoragaLC")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] [module: NetcodePatchedAssembly] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [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 MahoragaLC { [BepInPlugin("Fede.MahoragaLC", "MahoragaLC", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] [BepInDependency(/*Could not decode attribute arguments.*/)] public sealed class Plugin : BaseUnityPlugin { public const string PluginGuid = "Fede.MahoragaLC"; public const string PluginName = "MahoragaLC"; public const string PluginVersion = "1.0.0"; private const string AssetBundleName = "mahoraga_assets"; private static readonly string[] RequiredAudioClipNames = new string[8] { "mahoraga_wheel_turn", "mahoraga_footstep_1", "mahoraga_footstep_2", "mahoraga_slash", "mahoraga_impact", "mahoraga_roar", "mahoraga_death", "mahoraga_summon" }; private Harmony? _harmony; internal static ManualLogSource Logger { get; private set; } = null; internal static MahoragaConfig BoundConfig { get; private set; } = null; internal static string PluginDirectory { get; private set; } = string.Empty; internal static AssetBundle? ModAssets { get; private set; } internal static TerminalNode? BestiaryNode { get; private set; } internal static Dictionary<string, AudioClip> CachedAudioClips { get; } = new Dictionary<string, AudioClip>(StringComparer.Ordinal); private void Awake() { //IL_03a4: Unknown result type (might be due to invalid IL or missing references) //IL_03ae: Expected O, but got Unknown Logger = ((BaseUnityPlugin)this).Logger; PluginDirectory = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? string.Empty; InitializeNetworkBehaviours(); BoundConfig = MahoragaConfig.Bind(((BaseUnityPlugin)this).Config); if (!BoundConfig.EnableMod.Value) { Logger.LogInfo((object)"Fede.MahoragaLC is disabled via configuration (EnableMod = false)."); return; } string text = Path.Combine(PluginDirectory, "mahoraga_assets"); if (!File.Exists(text)) { Logger.LogError((object)("Missing AssetBundle 'mahoraga_assets' at '" + text + "'. Mod cannot register Mahoraga.")); return; } ModAssets = AssetBundle.LoadFromFile(text); if ((Object)(object)ModAssets == (Object)null) { Logger.LogError((object)("Failed to load AssetBundle 'mahoraga_assets' from '" + text + "'.")); return; } EnemyType val = ModAssets.LoadAsset<EnemyType>("MahoragaEnemyType"); GameObject val2 = ModAssets.LoadAsset<GameObject>("MahoragaPrefab"); EnemyType val3 = ModAssets.LoadAsset<EnemyType>("MahoragaEnemyType_Outside"); GameObject val4 = ModAssets.LoadAsset<GameObject>("MahoragaPrefab_Outside"); TerminalNode val5 = ModAssets.LoadAsset<TerminalNode>("MahoragaTerminalNode"); TerminalKeyword val6 = ModAssets.LoadAsset<TerminalKeyword>("MahoragaTerminalKeyword"); BestiaryNode = val5; if ((Object)(object)val == (Object)null) { Logger.LogError((object)"AssetBundle 'mahoraga_assets' is missing 'MahoragaEnemyType'."); return; } if ((Object)(object)val2 == (Object)null) { val2 = val.enemyPrefab; } if ((Object)(object)val2 == (Object)null) { Logger.LogError((object)"AssetBundle 'mahoraga_assets' is missing 'MahoragaPrefab'."); return; } MahoragaAI mahoragaAI = default(MahoragaAI); if (!val2.TryGetComponent<MahoragaAI>(ref mahoragaAI)) { Logger.LogError((object)"'MahoragaPrefab' is missing its MahoragaAI component."); return; } if ((Object)(object)val4 == (Object)null && (Object)(object)val3 != (Object)null) { val4 = val3.enemyPrefab; } MahoragaAI mahoragaAI2 = default(MahoragaAI); if ((Object)(object)val3 == (Object)null || (Object)(object)val3 == (Object)(object)val || (Object)(object)val4 == (Object)null || (Object)(object)val4 == (Object)(object)val2 || !val4.TryGetComponent<MahoragaAI>(ref mahoragaAI2)) { Logger.LogWarning((object)"AssetBundle 'mahoraga_assets' has no valid dedicated outdoor assets. Rebuild the bundle to enable natural outdoor spawning."); val3 = null; val4 = null; } else { ((EnemyAI)mahoragaAI2).enemyType = val3; } val.enemyPrefab = val2; ((EnemyAI)mahoragaAI).enemyType = val; CacheBundleAudioClips(ModAssets); val.PowerLevel = BoundConfig.PowerLevel.Value; val.MaxCount = BoundConfig.MaxCount.Value; val.isOutsideEnemy = false; val.isDaytimeEnemy = false; Utilities.FixMixerGroups(val2); NetworkPrefabs.RegisterNetworkPrefab(val2); if ((Object)(object)val3 != (Object)null && (Object)(object)val4 != (Object)null) { val3.enemyPrefab = val4; val3.PowerLevel = BoundConfig.OutdoorPowerLevel.Value; val3.MaxCount = BoundConfig.OutdoorMaxCount.Value; val3.isOutsideEnemy = true; val3.isDaytimeEnemy = false; Utilities.FixMixerGroups(val4); NetworkPrefabs.RegisterNetworkPrefab(val4); } Dictionary<LevelTypes, int> dictionary = new Dictionary<LevelTypes, int> { { (LevelTypes)(-1), BoundConfig.DefaultInteriorRarity.Value }, { (LevelTypes)1024, BoundConfig.DefaultInteriorRarity.Value } }; Dictionary<string, int> dictionary2 = new Dictionary<string, int>(); BoundConfig.ApplyMoonOverrides(dictionary, dictionary2); Enemies.RegisterEnemy(val, (SpawnType)0, dictionary, dictionary2, val5, val6); bool flag = BoundConfig.AllowOutdoorSpawn.Value && (Object)(object)val3 != (Object)null; if (BoundConfig.AllowOutdoorSpawn.Value && (Object)(object)val3 != (Object)null) { Dictionary<LevelTypes, int> dictionary3 = new Dictionary<LevelTypes, int> { { (LevelTypes)(-1), BoundConfig.OutdoorRarity.Value }, { (LevelTypes)1024, BoundConfig.OutdoorRarity.Value } }; Dictionary<string, int> dictionary4 = new Dictionary<string, int>(); BoundConfig.ApplyOutdoorMoonOverrides(dictionary3, dictionary4); Enemies.RegisterEnemy(val3, (SpawnType)2, dictionary3, dictionary4, (TerminalNode)null, (TerminalKeyword)null); } _harmony = new Harmony("Fede.MahoragaLC"); _harmony.PatchAll(typeof(ExplosionTrackingPatch)); _harmony.PatchAll(typeof(OldBirdCompatibilityPatch)); ImperiumSpawningPatch.Install(_harmony, val, val3); Logger.LogInfo((object)(string.Format("{0} v{1} loaded! Interior rarity={2}, ", "Fede.MahoragaLC", "1.0.0", BoundConfig.DefaultInteriorRarity.Value) + $"Outdoor={flag} (rarity={BoundConfig.OutdoorRarity.Value}, dedicatedAssets={(Object)(object)val3 != (Object)null}), " + $"MaxHP={BoundConfig.MaxHP.Value}, HitsPerAdaptationStage={BoundConfig.HitsPerAdaptationStage.Value}.")); } private static void CacheBundleAudioClips(AssetBundle bundle) { CachedAudioClips.Clear(); AudioClip val = bundle.LoadAsset<AudioClip>("mahoraga_music_main"); if ((Object)(object)val != (Object)null) { CachedAudioClips[((Object)val).name] = val; } for (int i = 0; i < RequiredAudioClipNames.Length; i++) { string text = RequiredAudioClipNames[i]; AudioClip val2 = bundle.LoadAsset<AudioClip>(text); if ((Object)(object)val2 != (Object)null) { CachedAudioClips[text] = val2; } else { Logger.LogWarning((object)("Optional fallback AudioClip '" + text + "' not found directly by name in 'mahoraga_assets'.")); } } } private static void InitializeNetworkBehaviours() { Type[] array; try { array = Assembly.GetExecutingAssembly().GetTypes(); } catch (ReflectionTypeLoadException ex) { array = Array.FindAll(ex.Types, (Type t) => t != null); } foreach (Type type in array) { MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic); foreach (MethodInfo methodInfo in methods) { if (methodInfo.IsStatic && methodInfo.GetParameters().Length == 0) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false); if (customAttributes.Length != 0) { methodInfo.Invoke(null, null); } } } } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "Fede.MahoragaLC"; public const string PLUGIN_NAME = "MahoragaLC"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace MahoragaLC.Patches { [HarmonyPatch] internal static class ExplosionTrackingPatch { private struct TimedEvent { public Vector3 Position; public float Time; public float Range; } private struct MissileEvent { public Vector3 Position; public float Time; public float Range; public EnemyAI? Source; } private const int BufferCapacity = 16; private static readonly TimedEvent[] ExplosionRing = new TimedEvent[16]; private static int _explosionCursor; private static readonly TimedEvent[] FlashRing = new TimedEvent[16]; private static int _flashCursor; private static readonly MissileEvent[] MissileRing = new MissileEvent[16]; private static int _missileCursor; [HarmonyPatch(typeof(Landmine), "SpawnExplosion")] [HarmonyPrefix] private static void OnSpawnExplosion(Vector3 explosionPosition, float damageRange) { //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) ExplosionRing[_explosionCursor] = new TimedEvent { Position = explosionPosition, Time = Time.time, Range = Mathf.Max(damageRange, 4.5f) }; _explosionCursor = (_explosionCursor + 1) % 16; } [HarmonyPatch(typeof(StunGrenadeItem), "ExplodeStunGrenade")] [HarmonyPrefix] private static void OnExplodeStunGrenade(StunGrenadeItem __instance) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance == (Object)null) && !__instance.hasExploded) { FlashRing[_flashCursor] = new TimedEvent { Position = ((Component)__instance).transform.position, Time = Time.time, Range = 13f }; _flashCursor = (_flashCursor + 1) % 16; } } [HarmonyPatch(typeof(RadMechAI), "SetExplosion")] [HarmonyPrefix] private static void OnRadMechSetExplosion(RadMechAI __instance, Vector3 explosionPosition, Vector3 forwardRotation) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)__instance == (Object)null)) { MissileRing[_missileCursor] = new MissileEvent { Position = explosionPosition - forwardRotation * 0.1f, Time = Time.time, Range = 7f, Source = (EnemyAI?)(object)__instance }; _missileCursor = (_missileCursor + 1) % 16; } } public static bool HasRecentMissileNear(Vector3 worldPos, float now, out EnemyAI? source, float maxAge = 0.25f, float extraMargin = 2f) { //IL_004b: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0057: Unknown result type (might be due to invalid IL or missing references) source = null; float num = float.MaxValue; bool result = false; for (int i = 0; i < 16; i++) { MissileEvent missileEvent = MissileRing[i]; if (missileEvent.Range <= 0f) { continue; } float num2 = now - missileEvent.Time; if (!(num2 < 0f) && !(num2 > maxAge)) { float num3 = missileEvent.Range + extraMargin; Vector3 val = worldPos - missileEvent.Position; float sqrMagnitude = ((Vector3)(ref val)).sqrMagnitude; if (sqrMagnitude <= num3 * num3 && sqrMagnitude < num) { num = sqrMagnitude; source = missileEvent.Source; result = true; } } } return result; } public static bool HasRecentExplosionNear(Vector3 worldPos, float now, float maxAge = 0.25f, float extraMargin = 5f) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 16; i++) { TimedEvent timedEvent = ExplosionRing[i]; if (timedEvent.Range <= 0f) { continue; } float num = now - timedEvent.Time; if (!(num < 0f) && !(num > maxAge)) { float num2 = timedEvent.Range + extraMargin; Vector3 val = worldPos - timedEvent.Position; if (((Vector3)(ref val)).sqrMagnitude <= num2 * num2) { return true; } } } return false; } public static bool HasRecentFlashNear(Vector3 worldPos, float now, float maxAge = 0.25f, float extraMargin = 4f) { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003d: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) for (int i = 0; i < 16; i++) { TimedEvent timedEvent = FlashRing[i]; if (timedEvent.Range <= 0f) { continue; } float num = now - timedEvent.Time; if (!(num < 0f) && !(num > maxAge)) { float num2 = timedEvent.Range + extraMargin; Vector3 val = worldPos - timedEvent.Position; if (((Vector3)(ref val)).sqrMagnitude <= num2 * num2) { return true; } } } return false; } } internal static class ImperiumSpawningPatch { internal const string PluginGuid = "giosuel.Imperium"; private static EnemyType _indoorMahoraga; private static EnemyType? _outdoorMahoraga; private static GameObject? _oldBirdPrefab; private static GameObject? _manualOldBirdPrefab; internal static void Install(Harmony harmony, EnemyType indoor, EnemyType? outdoor) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Expected O, but got Unknown //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Expected O, but got Unknown _indoorMahoraga = indoor; _outdoorMahoraga = outdoor; harmony.Patch((MethodBase)AccessTools.Method(typeof(GameNetworkManager), "Start", (Type[])null, (Type[])null), (HarmonyMethod)null, new HarmonyMethod(typeof(ImperiumSpawningPatch), "RegisterManualOldBirdPrefab", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null); if (!Chainloader.PluginInfos.TryGetValue("giosuel.Imperium", out var value) || (Object)(object)value.Instance == (Object)null) { return; } Type type = ((object)value.Instance).GetType().Assembly.GetType("Imperium.Core.Lifecycle.ObjectManager"); MethodInfo methodInfo = ((type == null) ? null : AccessTools.DeclaredMethod(type, "OnSpawnEntity", (Type[])null, (Type[])null)); MethodInfo methodInfo2 = ((type == null) ? null : AccessTools.DeclaredMethod(type, "FetchGlobalSpawnLists", (Type[])null, (Type[])null)); if (methodInfo == null || methodInfo2 == null) { Plugin.Logger.LogWarning((object)"Imperium's entity spawning methods were not found."); return; } try { harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(ImperiumSpawningPatch), "PatchSpawn", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null); harmony.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(ImperiumSpawningPatch), "PatchCatalog", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null); } catch (Exception ex) { harmony.Unpatch((MethodBase)methodInfo, (HarmonyPatchType)3, harmony.Id); harmony.Unpatch((MethodBase)methodInfo2, (HarmonyPatchType)3, harmony.Id); Plugin.Logger.LogWarning((object)("Could not install Imperium spawning compatibility: " + ex.Message)); } } private static void RegisterManualOldBirdPrefab() { NetworkManager singleton = NetworkManager.Singleton; if ((Object)(object)singleton == (Object)null) { return; } if ((Object)(object)_manualOldBirdPrefab == (Object)null) { RadMechAI val2 = default(RadMechAI); _oldBirdPrefab = singleton.NetworkConfig.Prefabs.Prefabs.Select((NetworkPrefab entry) => entry.Prefab).FirstOrDefault((Func<GameObject, bool>)((GameObject prefab) => (Object)(object)prefab != (Object)null && prefab.TryGetComponent<RadMechAI>(ref val2) && (Object)(object)((EnemyAI)val2).enemyType != (Object)null && (Object)(object)((EnemyAI)val2).enemyType.enemyPrefab == (Object)(object)prefab)); if ((Object)(object)_oldBirdPrefab == (Object)null) { return; } EnemyType val = Object.Instantiate<EnemyType>(((EnemyAI)_oldBirdPrefab.GetComponent<RadMechAI>()).enemyType); ((Object)val).name = "MahoragaLC_ManualOldBirdType"; ((Object)val).hideFlags = (HideFlags)61; val.nestSpawnPrefab = null; val.requireNestObjectsToSpawn = false; val.PowerLevel = 0f; val.enemyPrefab = null; _manualOldBirdPrefab = NetworkPrefabs.CloneNetworkPrefab(_oldBirdPrefab, "MahoragaLC_ManualOldBird"); ((EnemyAI)_manualOldBirdPrefab.GetComponent<RadMechAI>()).enemyType = val; } if (!singleton.NetworkConfig.Prefabs.Contains(_manualOldBirdPrefab)) { singleton.AddNetworkPrefab(_manualOldBirdPrefab); } } private static IEnumerable<CodeInstruction> PatchCatalog(IEnumerable<CodeInstruction> instructions) { Func<EnemyType[]> func = Resources.FindObjectsOfTypeAll<EnemyType>; return ReplaceCall(instructions, func.Method, "FindManuallySpawnableEnemyTypes"); } private static IEnumerable<CodeInstruction> PatchSpawn(IEnumerable<CodeInstruction> instructions) { Func<GameObject, Vector3, Quaternion, GameObject> func = Object.Instantiate<GameObject>; return ReplaceCall(instructions, func.Method, "InstantiateManualEnemy"); } private static IEnumerable<CodeInstruction> ReplaceCall(IEnumerable<CodeInstruction> instructions, MethodInfo original, string replacement) { List<CodeInstruction> list = instructions.ToList(); CodeInstruction val = ((IEnumerable<CodeInstruction>)list).SingleOrDefault((Func<CodeInstruction, bool>)((CodeInstruction code) => CodeInstructionExtensions.Calls(code, original))); if (val == null) { throw new InvalidOperationException("Imperium no longer calls " + original.Name + " at the expected spawn hook."); } val.operand = AccessTools.DeclaredMethod(typeof(ImperiumSpawningPatch), replacement, (Type[])null, (Type[])null); return list; } private static EnemyType[] FindManuallySpawnableEnemyTypes() { return (from type in Resources.FindObjectsOfTypeAll<EnemyType>() where (Object)(object)type != (Object)(object)_outdoorMahoraga select type).ToArray(); } private static GameObject InstantiateManualEnemy(GameObject prefab, Vector3 position, Quaternion rotation) { //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: 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_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_005a: Unknown result type (might be due to invalid IL or missing references) //IL_0067: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)prefab == (Object)(object)_oldBirdPrefab && (Object)(object)_manualOldBirdPrefab != (Object)null) { prefab = _manualOldBirdPrefab; NavMeshAgent val = default(NavMeshAgent); if (prefab.TryGetComponent<NavMeshAgent>(ref val)) { NavMeshQueryFilter val2 = default(NavMeshQueryFilter); ((NavMeshQueryFilter)(ref val2)).agentTypeID = val.agentTypeID; ((NavMeshQueryFilter)(ref val2)).areaMask = val.areaMask; NavMeshQueryFilter val3 = val2; NavMeshHit val4 = default(NavMeshHit); if (NavMesh.SamplePosition(position, ref val4, 8f, val3)) { position = ((NavMeshHit)(ref val4)).position; } } } else if ((Object)(object)prefab == (Object)(object)_indoorMahoraga.enemyPrefab || (Object)(object)prefab == (Object)(object)_outdoorMahoraga?.enemyPrefab) { if ((Object)(object)_outdoorMahoraga != (Object)null) { prefab = (HuntLogic.IsOutsideAt(position.y, currentlyOutside: false) ? _outdoorMahoraga.enemyPrefab : _indoorMahoraga.enemyPrefab); } GameObject val5 = Object.Instantiate<GameObject>(prefab, position, rotation); ((EnemyAI)val5.GetComponent<MahoragaAI>()).removedPowerLevel = true; return val5; } return Object.Instantiate<GameObject>(prefab, position, rotation); } } [HarmonyPatch] internal static class OldBirdCompatibilityPatch { private const int EnemyLayerMask = 524288; private const int SolidWorldAndEnemyMask = 526592; private const int PlayerLayerMask = 8; private const float ChestHeightMeters = 1.8f; private static readonly RaycastHit[] MissileHitsBuffer = (RaycastHit[])(object)new RaycastHit[8]; private static readonly Collider[] MissileOverlapBuffer = (Collider[])(object)new Collider[8]; private static bool TryGetActiveMahoraga(IVisibleThreat? threat, out MahoragaAI mahoraga) { if (threat is MahoragaAI mahoragaAI && (Object)(object)mahoragaAI != (Object)null && !((EnemyAI)mahoragaAI).isEnemyDead && !mahoragaAI.IsSummonOrSubmergeActive) { mahoraga = mahoragaAI; return true; } mahoraga = null; return false; } private static Vector3 GetChestPosition(MahoragaAI mahoraga) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_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) return ((Component)mahoraga).transform.position + Vector3.up * (1.8f * mahoraga.ScaleFactor); } private static Vector3 GetGroundApproachPosition(RadMechAI oldBird, MahoragaAI mahoraga) { //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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_005a: 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_0070: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_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_00b7: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) Vector3 val = default(Vector3); if (oldBird.hasLOS) { val = ((Component)mahoraga).transform.position; } else { Vector3 lastSeenPosition = oldBird.targetedThreat.lastSeenPosition; RaycastHit val2 = default(RaycastHit); if ((Object)(object)StartOfRound.Instance != (Object)null && Physics.Raycast(lastSeenPosition, Vector3.down, ref val2, 10f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { val = ((RaycastHit)(ref val2)).point; } else { ((Vector3)(ref val))..ctor(lastSeenPosition.x, ((Component)mahoraga).transform.position.y, lastSeenPosition.z); } } if ((Object)(object)RoundManager.Instance != (Object)null) { Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(val, RoundManager.Instance.navHit, 4f, ((EnemyAI)oldBird).agentMask); if (RoundManager.Instance.GotNavMeshPositionResult) { return navMeshPosition; } } return val; } private static void UpdateMahoragaChestLastSeen(RadMechAI instance) { //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_0058: Unknown result type (might be due to invalid IL or missing references) //IL_005d: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)instance == (Object)null) && instance.hasLOS && !((Object)(object)instance.focusedThreatTransform == (Object)null) && instance.targetedThreat != null && TryGetActiveMahoraga(instance.targetedThreat.threatScript, out MahoragaAI mahoraga)) { instance.targetedThreat.lastSeenPosition = GetChestPosition(mahoraga) + instance.targetedThreat.threatScript.GetThreatVelocity(); } } [HarmonyPatch(typeof(RadMechAI), "MoveTowardsThreat")] [HarmonyPrefix] private static bool OnMoveTowardsThreat(RadMechAI __instance) { //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0043: Unknown result type (might be due to invalid IL or missing references) //IL_02ca: Unknown result type (might be due to invalid IL or missing references) //IL_02e0: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_00af: Unknown result type (might be due to invalid IL or missing references) //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f0: Unknown result type (might be due to invalid IL or missing references) //IL_00d8: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00e9: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_0351: Unknown result type (might be due to invalid IL or missing references) //IL_0356: Unknown result type (might be due to invalid IL or missing references) //IL_0108: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) //IL_01ee: Unknown result type (might be due to invalid IL or missing references) //IL_021b: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || __instance.targetedThreat == null || (Object)(object)__instance.focusedThreatTransform == (Object)null || !TryGetActiveMahoraga(__instance.targetedThreat.threatScript, out MahoragaAI mahoraga)) { return true; } Vector3 chestPosition = GetChestPosition(mahoraga); Vector3 groundApproachPosition = GetGroundApproachPosition(__instance, mahoraga); if (!__instance.lostCreatureInChase) { if (__instance.lostCreatureInChaseDebounce) { __instance.lostCreatureInChaseDebounce = false; __instance.SetLostCreatureInChaseClientRpc(false); __instance.losTimer = 0f; } if (__instance.searchForPlayers != null && __instance.searchForPlayers.inProgress) { ((EnemyAI)__instance).StopSearch(__instance.searchForPlayers, true); } float visibility = __instance.targetedThreat.threatScript.GetVisibility(); __instance.hasLOS = visibility > 0f && ((EnemyAI)__instance).CheckLineOfSightForPosition(chestPosition, 70f, 60, 12f, (Transform)null); if (__instance.hasLOS) { __instance.targetedThreat.lastSeenPosition = chestPosition + __instance.targetedThreat.threatScript.GetThreatVelocity(); } if (__instance.hasLOS || (__instance.losTimer < 2f && Vector3.Distance(chestPosition, ((Component)__instance).transform.position) < 14f)) { __instance.losTimer = 0f; __instance.alertTimer += ((EnemyAI)__instance).AIIntervalTime * Mathf.Max(visibility, 0.3f); } else { if (!__instance.aimingGun) { __instance.losTimer += ((EnemyAI)__instance).AIIntervalTime; __instance.alertTimer = Mathf.Max(__instance.alertTimer - ((EnemyAI)__instance).AIIntervalTime, 0f); } if (__instance.CheckSightForThreat()) { __instance.hasLOS = true; return false; } } if (__instance.hasLOS != __instance.SyncedLOSState) { __instance.syncLOSInterval += ((EnemyAI)__instance).AIIntervalTime; if (__instance.syncLOSInterval > 0.6f) { __instance.SyncedLOSState = __instance.hasLOS; __instance.SetHasLineOfSightClientRpc(__instance.hasLOS); } } __instance.checkForPathInterval = (__instance.checkForPathInterval + 1) % 10; bool flag = ((EnemyAI)__instance).SetDestinationToPosition(groundApproachPosition, __instance.checkForPathInterval == 0); bool flag2 = !__instance.hasLOS && (Object)(object)((EnemyAI)__instance).agent != (Object)null && Vector3.Distance(((EnemyAI)__instance).agent.destination, ((Component)__instance).transform.position) < 1.75f; if (!flag || flag2 || __instance.losTimer > 10f) { __instance.lostCreatureInChase = true; } return false; } if (!__instance.lostCreatureInChaseDebounce) { __instance.lostCreatureInChaseDebounce = true; __instance.losTimer = 0f; __instance.SetLostCreatureInChaseClientRpc(true); __instance.SetChargingForwardOnLocalClient(false); if (__instance.searchForPlayers != null && !__instance.searchForPlayers.inProgress) { ((EnemyAI)__instance).StartSearch(((Component)__instance).transform.position, __instance.searchForPlayers); } } float visibility2 = __instance.targetedThreat.threatScript.GetVisibility(); if (visibility2 > 0f && ((EnemyAI)__instance).CheckLineOfSightForPosition(chestPosition, 70f, 60, 12f, (Transform)null) && ((EnemyAI)__instance).SetDestinationToPosition(groundApproachPosition, true)) { __instance.targetedThreat.lastSeenPosition = chestPosition; __instance.hasLOS = true; __instance.lostCreatureInChase = false; } else if (__instance.CheckSightForThreat()) { __instance.lostCreatureInChase = false; } else if (!__instance.aimingGun) { __instance.losTimer += ((EnemyAI)__instance).AIIntervalTime; if (__instance.losTimer > 10f || (__instance.losTimer > 5f && Vector3.Distance(((Component)__instance).transform.position, groundApproachPosition) < 2f)) { __instance.losTimer = 0f; ((EnemyAI)__instance).SwitchToBehaviourState(0); } } return false; } [HarmonyPatch(typeof(RadMechAI), "AimGunArmTowardsTarget")] [HarmonyPrefix] private static void OnAimGunArmPrefix(RadMechAI __instance) { UpdateMahoragaChestLastSeen(__instance); } [HarmonyPatch(typeof(RadMechAI), "Update")] [HarmonyPostfix] private static void OnUpdatePostfix(RadMechAI __instance) { UpdateMahoragaChestLastSeen(__instance); } [HarmonyPatch(typeof(RadMechAI), "AimAndShootCycle")] [HarmonyPrefix] private static bool OnAimAndShootCycle(RadMechAI __instance) { //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || __instance.targetedThreat == null || !TryGetActiveMahoraga(__instance.targetedThreat.threatScript, out MahoragaAI _)) { return true; } if (__instance.takingStep || !(((EnemyAI)__instance).stunNormalizedTimer <= 0f)) { return false; } if ((Object)(object)((EnemyAI)__instance).creatureAnimator != (Object)null) { ((EnemyAI)__instance).creatureAnimator.SetBool("AimGun", true); } if (!((NetworkBehaviour)__instance).IsServer) { return false; } if (__instance.shootTimer > __instance.fireRate) { float num = Vector3.Distance(__instance.targetedThreat.lastSeenPosition, ((Component)__instance).transform.position); if (__instance.shootCooldown > 4.75f || __instance.chargingForward) { __instance.SetAimingGun(false); return false; } if (!__instance.hadLOSDuringLastShot && (!__instance.hasLOS || num < 1.5f)) { __instance.SetAimingGun(false); return false; } __instance.shootTimer = 0f + Random.Range((0f - __instance.fireRateVariance) * 0.5f, __instance.fireRateVariance * 0.5f); __instance.StartShootGun(); __instance.hadLOSDuringLastShot = __instance.hasLOS && num < 40f; } else { __instance.shootTimer += Time.deltaTime; } return false; } [HarmonyPatch(typeof(RadMechMissile), "CheckCollision")] [HarmonyPrefix] private static bool OnMissileCheckCollision(RadMechMissile __instance) { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0045: Unknown result type (might be due to invalid IL or missing references) //IL_0052: Unknown result type (might be due to invalid IL or missing references) //IL_0053: Unknown result type (might be due to invalid IL or missing references) //IL_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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_01e5: Unknown result type (might be due to invalid IL or missing references) //IL_01e6: Unknown result type (might be due to invalid IL or missing references) //IL_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_01fe: Unknown result type (might be due to invalid IL or missing references) //IL_0200: Unknown result type (might be due to invalid IL or missing references) //IL_01a2: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) //IL_0212: Unknown result type (might be due to invalid IL or missing references) //IL_0214: Unknown result type (might be due to invalid IL or missing references) //IL_021a: Unknown result type (might be due to invalid IL or missing references) //IL_021f: Unknown result type (might be due to invalid IL or missing references) //IL_0224: Unknown result type (might be due to invalid IL or missing references) //IL_0226: Unknown result type (might be due to invalid IL or missing references) //IL_022f: Unknown result type (might be due to invalid IL or missing references) //IL_023b: Unknown result type (might be due to invalid IL or missing references) //IL_0244: Unknown result type (might be due to invalid IL or missing references) //IL_0249: Unknown result type (might be due to invalid IL or missing references) //IL_0253: Unknown result type (might be due to invalid IL or missing references) //IL_0258: Unknown result type (might be due to invalid IL or missing references) //IL_01c2: Unknown result type (might be due to invalid IL or missing references) //IL_01c3: Unknown result type (might be due to invalid IL or missing references) //IL_02a3: Unknown result type (might be due to invalid IL or missing references) //IL_02a9: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)__instance == (Object)null || __instance.hitWall || (Object)(object)__instance.RadMechScript == (Object)null) { return true; } float num = 0.6f * __instance.currentMissileSpeed; Vector3 position = ((Component)__instance).transform.position; Vector3 forward = ((Component)__instance).transform.forward; MahoragaAI mahoragaAI = null; Collider val = null; float num2 = float.MaxValue; int num3 = Physics.RaycastNonAlloc(position, forward, MissileHitsBuffer, num, 524288, (QueryTriggerInteraction)2); for (int i = 0; i < num3; i++) { RaycastHit val2 = MissileHitsBuffer[i]; if (!((Object)(object)((RaycastHit)(ref val2)).collider == (Object)null)) { EnemyAICollisionDetect component = ((Component)((RaycastHit)(ref val2)).collider).GetComponent<EnemyAICollisionDetect>(); if ((Object)(object)component != (Object)null && component.mainScript is MahoragaAI { isEnemyDead: false, IsSummonOrSubmergeActive: false } mahoragaAI2 && ((RaycastHit)(ref val2)).distance < num2) { num2 = ((RaycastHit)(ref val2)).distance; mahoragaAI = mahoragaAI2; val = ((RaycastHit)(ref val2)).collider; } } } if ((Object)(object)mahoragaAI == (Object)null) { int num4 = Physics.OverlapSphereNonAlloc(position, 0.15f, MissileOverlapBuffer, 524288, (QueryTriggerInteraction)2); for (int j = 0; j < num4; j++) { Collider val3 = MissileOverlapBuffer[j]; if (!((Object)(object)val3 == (Object)null)) { EnemyAICollisionDetect component2 = ((Component)val3).GetComponent<EnemyAICollisionDetect>(); if ((Object)(object)component2 != (Object)null && component2.mainScript is MahoragaAI { isEnemyDead: false, IsSummonOrSubmergeActive: false } mahoragaAI3) { mahoragaAI = mahoragaAI3; val = val3; num2 = 0f; break; } } } } if ((Object)(object)mahoragaAI == (Object)null || (Object)(object)val == (Object)null) { return true; } if (num2 > 0f) { RaycastHit val4 = default(RaycastHit); if (Physics.Raycast(position, forward, ref val4, num2, 526592, (QueryTriggerInteraction)1) && ((RaycastHit)(ref val4)).distance < num2) { return true; } RaycastHit val5 = default(RaycastHit); if (Physics.Raycast(position, forward, ref val5, num2, 8, (QueryTriggerInteraction)2) && ((RaycastHit)(ref val5)).distance < num2) { return true; } } __instance.hitWall = true; Vector3 val6 = position - forward * 0.5f; __instance.RadMechScript.StartExplosion(val6, forward, false); if (((NetworkBehaviour)mahoragaAI).IsOwner) { Vector3 val7 = val6 - forward * 0.1f; float num5 = Vector3.Distance(val7, ((Component)val).transform.position); RaycastHit val8 = default(RaycastHit); if ((Physics.Linecast(val7, ((Component)val).transform.position + Vector3.up * 0.3f, ref val8, 1073742080, (QueryTriggerInteraction)1) && (((Component)((RaycastHit)(ref val8)).collider).gameObject.layer == 30 || num5 > 4f)) || num5 >= 4.5f) { ((EnemyAI)mahoragaAI).HitEnemyOnLocalClient(6, default(Vector3), (PlayerControllerB)null, false, -1); ((EnemyAI)mahoragaAI).HitFromExplosion(Mathf.Min(num5, 4.4f)); } } Object.Destroy((Object)(object)((Component)__instance).gameObject); return false; } } } namespace MahoragaLC.Effects { public class MahoragaSummonEffect : MonoBehaviour { public Transform? poolTransform; public MeshRenderer? poolRenderer; public ParticleSystem? droplets; private const float GroundLift = 0.018f; private const float PoolSpinDegPerSecond = 18f; private bool _active; private bool _dropletsPlaying; private float _lastRate = -1f; private float _baseRadius = 2.7f; private float _lastTime; private void Awake() { ResolveReferences(); SetPoolVisible(visible: false); } private void ResolveReferences() { if ((Object)(object)poolTransform == (Object)null) { poolTransform = ((Component)this).transform.Find("ShadowPool"); } if ((Object)(object)poolRenderer == (Object)null && (Object)(object)poolTransform != (Object)null) { poolRenderer = ((Component)poolTransform).GetComponent<MeshRenderer>(); } if ((Object)(object)droplets == (Object)null) { Transform val = ((Component)this).transform.Find("Droplets"); if ((Object)(object)val != (Object)null) { droplets = ((Component)val).GetComponent<ParticleSystem>(); } } } public void Begin(float poolRadius) { //IL_007d: Unknown result type (might be due to invalid IL or missing references) //IL_0082: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_0089: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_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_0120: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0129: Unknown result type (might be due to invalid IL or missing references) //IL_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0139: Unknown result type (might be due to invalid IL or missing references) //IL_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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_0154: Unknown result type (might be due to invalid IL or missing references) //IL_0173: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00d7: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) ResolveReferences(); _baseRadius = Mathf.Max(0.5f, poolRadius); _active = true; _lastRate = -1f; _lastTime = 0f; if ((Object)(object)droplets != (Object)null) { droplets.Stop(false, (ParticleSystemStopBehavior)0); } _dropletsPlaying = false; Transform val = (((Object)(object)((Component)this).transform.parent != (Object)null) ? ((Component)this).transform.parent : ((Component)this).transform); Vector3 val2 = Vector3.up; Vector3 val3 = val.position; StartOfRound instance = StartOfRound.Instance; RaycastHit val4 = default(RaycastHit); if ((Object)(object)instance != (Object)null && Physics.Raycast(val.position + Vector3.up * 0.8f, Vector3.down, ref val4, 3.5f, instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { val3 = ((RaycastHit)(ref val4)).point; if (((RaycastHit)(ref val4)).normal.y >= 0.6f) { val2 = ((RaycastHit)(ref val4)).normal; } } Quaternion val5 = Quaternion.FromToRotation(Vector3.up, val2) * Quaternion.Euler(0f, val.eulerAngles.y + 37f, 0f); ((Component)this).transform.SetPositionAndRotation(val3 + val2 * 0.018f, val5); if ((Object)(object)poolTransform != (Object)null) { poolTransform.localRotation = Quaternion.identity; poolTransform.localScale = new Vector3(0.001f, 1f, 0.001f); } SetPoolVisible(visible: false); } public void Evaluate(float poolScale, float dropletRate, float time) { //IL_0091: Unknown result type (might be due to invalid IL or missing references) if (!_active) { return; } float num = Mathf.Max(0f, time - _lastTime); _lastTime = time; if ((Object)(object)poolTransform != (Object)null) { bool flag = poolScale > 0.002f; SetPoolVisible(flag); if (flag) { float num2 = 1f + 0.035f * Mathf.Sin(time * 3.1f) + 0.02f * Mathf.Sin(time * 7.3f + 1.2f); float num3 = _baseRadius * poolScale * num2; poolTransform.localScale = new Vector3(num3, 1f, num3); poolTransform.Rotate(0f, 18f * num, 0f, (Space)1); } } UpdateDroplets(dropletRate); } private void UpdateDroplets(float rate) { //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_0039: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)droplets == (Object)null)) { if (Mathf.Abs(rate - _lastRate) > 0.01f) { _lastRate = rate; EmissionModule emission = droplets.emission; ((EmissionModule)(ref emission)).rateOverTime = MinMaxCurve.op_Implicit(rate); } if (rate > 0.01f && !_dropletsPlaying) { droplets.Play(); _dropletsPlaying = true; } else if (rate <= 0.01f && _dropletsPlaying) { droplets.Stop(false, (ParticleSystemStopBehavior)1); _dropletsPlaying = false; } } } public void End() { _active = false; SetPoolVisible(visible: false); if ((Object)(object)droplets != (Object)null) { droplets.Stop(false, (ParticleSystemStopBehavior)0); } _dropletsPlaying = false; } private void SetPoolVisible(bool visible) { if ((Object)(object)poolRenderer != (Object)null && ((Renderer)poolRenderer).enabled != visible) { ((Renderer)poolRenderer).enabled = visible; } } } } namespace MahoragaLC.Config { public static class MoonRarityParser { public static Dictionary<string, int> Parse(string? raw) { Dictionary<string, int> dictionary = new Dictionary<string, int>(StringComparer.OrdinalIgnoreCase); if (string.IsNullOrWhiteSpace(raw)) { return dictionary; } string[] array = raw.Split(',', StringSplitOptions.RemoveEmptyEntries); for (int i = 0; i < array.Length; i++) { string text = array[i].Trim(); int num = text.LastIndexOf(':'); if (num > 0 && num < text.Length - 1) { string text2 = text.Substring(0, num).Trim(); string s = text.Substring(num + 1).Trim(); if (!string.IsNullOrEmpty(text2) && int.TryParse(s, out var result)) { dictionary[text2] = Math.Max(0, result); } } } return dictionary; } } public sealed class MahoragaConfig { public static MahoragaConfig? Current { get; private set; } public ConfigEntry<bool> EnableMod { get; } public ConfigEntry<int> DefaultInteriorRarity { get; } public ConfigEntry<string> MoonRarityOverrides { get; } public ConfigEntry<bool> AllowOutdoorSpawn { get; } public ConfigEntry<int> OutdoorRarity { get; } public ConfigEntry<string> OutdoorMoonRarityOverrides { get; } public ConfigEntry<float> PowerLevel { get; } public ConfigEntry<int> MaxCount { get; } public ConfigEntry<float> OutdoorPowerLevel { get; } public ConfigEntry<int> OutdoorMaxCount { get; } public ConfigEntry<int> MaxHP { get; } public ConfigEntry<int> CleaveDamage { get; } public ConfigEntry<int> SlamDamage { get; } public ConfigEntry<bool> CanForceLockedDoors { get; } public ConfigEntry<float> PlayerKnockbackMultiplier { get; } public ConfigEntry<float> RetaliationHalfLifeSeconds { get; } public ConfigEntry<float> RetaliationSwitchLockoutSeconds { get; } public ConfigEntry<float> RegenDelaySeconds { get; } public ConfigEntry<float> RegenPercentPerSecond { get; } public ConfigEntry<int> HitsPerAdaptationStage { get; } public ConfigEntry<float> Stage1Resistance { get; } public ConfigEntry<float> Stage2Resistance { get; } public ConfigEntry<float> AdaptedDamageResistance { get; } public ConfigEntry<float> AdaptationHealPercent { get; } public ConfigEntry<bool> VisibleToOtherEnemies { get; } public ConfigEntry<int> EnemyCleaveDamage { get; } public ConfigEntry<int> EnemySlamDamage { get; } public ConfigEntry<float> EnemyKnockbackMultiplier { get; } public ConfigEntry<float> EnemyGrudgeHalfLifeSeconds { get; } public ConfigEntry<float> EnemyEngageMaxSeconds { get; } public ConfigEntry<float> DisengageCooldownSeconds { get; } public ConfigEntry<bool> FightOldBirds { get; } public ConfigEntry<string> OldBirdPriorityMode { get; } public ConfigEntry<float> OldBirdPriorityDistance { get; } public ConfigEntry<float> OldBirdSeekRange { get; } public ConfigEntry<float> OldBirdHitsToDestroy { get; } public ConfigEntry<float> OldBirdEngageMaxSeconds { get; } public ConfigEntry<int> OldBirdsRequiredToKill { get; } public ConfigEntry<float> OldBirdKillWindowSeconds { get; } public ConfigEntry<float> OldBirdSoloHpFloorFraction { get; } public ConfigEntry<float> OldBirdMissileFullResistance { get; } public ConfigEntry<bool> GrowthEnabled { get; } public ConfigEntry<float> GrowthMaxScale { get; } public ConfigEntry<int> GrowthStepsToMatch { get; } public ConfigEntry<float> GrowthTransitionSeconds { get; } public AdaptationSettings Adaptation { get; private set; } public ConfigEntry<float> PatrolSpeed { get; } public ConfigEntry<float> InvestigateSpeed { get; } public ConfigEntry<float> ChaseSpeed { get; } public ConfigEntry<float> ChaseSpeedPerAdaptation { get; } public ConfigEntry<bool> MusicEnabled { get; } public ConfigEntry<float> MusicMasterVolume { get; } public ConfigEntry<float> MusicOuterRange { get; } public ConfigEntry<float> MusicInnerRange { get; } public ConfigEntry<bool> EnableWallMuffling { get; } public ConfigEntry<bool> UseCustomMusicOverride { get; } public ConfigEntry<bool> EnableSummonSequence { get; private set; } public ConfigEntry<float> SummonDuration { get; private set; } public ConfigEntry<bool> SummonCameraShake { get; private set; } public ConfigEntry<bool> HuntPlayers { get; private set; } public ConfigEntry<bool> HuntPlayersOutdoors { get; private set; } public ConfigEntry<float> HuntRepathSeconds { get; private set; } public ConfigEntry<bool> EnableShadowAmbush { get; private set; } public ConfigEntry<float> ShadowAmbushMinTime { get; private set; } public ConfigEntry<float> ShadowAmbushLostSightDelay { get; private set; } public ConfigEntry<float> ShadowAmbushCooldown { get; private set; } public ConfigEntry<float> ShadowAmbushSubmergeDuration { get; private set; } private MahoragaConfig(ConfigFile cfg) { //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Expected O, but got Unknown //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b7: Expected O, but got Unknown //IL_0106: Unknown result type (might be due to invalid IL or missing references) //IL_0110: Expected O, but got Unknown //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_013d: Expected O, but got Unknown //IL_016c: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Expected O, but got Unknown //IL_0199: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Expected O, but got Unknown //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Expected O, but got Unknown //IL_01f8: Unknown result type (might be due to invalid IL or missing references) //IL_0202: Expected O, but got Unknown //IL_0228: Unknown result type (might be due to invalid IL or missing references) //IL_0232: Expected O, but got Unknown //IL_027d: Unknown result type (might be due to invalid IL or missing references) //IL_0287: Expected O, but got Unknown //IL_02b6: Unknown result type (might be due to invalid IL or missing references) //IL_02c0: Expected O, but got Unknown //IL_02ef: Unknown result type (might be due to invalid IL or missing references) //IL_02f9: Expected O, but got Unknown //IL_0328: Unknown result type (might be due to invalid IL or missing references) //IL_0332: Expected O, but got Unknown //IL_0361: Unknown result type (might be due to invalid IL or missing references) //IL_036b: Expected O, but got Unknown //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_0398: Expected O, but got Unknown //IL_03c7: Unknown result type (might be due to invalid IL or missing references) //IL_03d1: Expected O, but got Unknown //IL_0400: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Expected O, but got Unknown //IL_0439: Unknown result type (might be due to invalid IL or missing references) //IL_0443: Expected O, but got Unknown //IL_0472: Unknown result type (might be due to invalid IL or missing references) //IL_047c: Expected O, but got Unknown //IL_04db: Unknown result type (might be due to invalid IL or missing references) //IL_04e5: Expected O, but got Unknown //IL_0514: Unknown result type (might be due to invalid IL or missing references) //IL_051e: Expected O, but got Unknown //IL_054d: Unknown result type (might be due to invalid IL or missing references) //IL_0557: Expected O, but got Unknown //IL_0586: Unknown result type (might be due to invalid IL or missing references) //IL_0590: Expected O, but got Unknown //IL_05bf: Unknown result type (might be due to invalid IL or missing references) //IL_05c9: Expected O, but got Unknown //IL_05ed: Unknown result type (might be due to invalid IL or missing references) //IL_05f7: Expected O, but got Unknown //IL_0626: Unknown result type (might be due to invalid IL or missing references) //IL_0630: Expected O, but got Unknown //IL_065f: Unknown result type (might be due to invalid IL or missing references) //IL_0669: Expected O, but got Unknown //IL_0698: Unknown result type (might be due to invalid IL or missing references) //IL_06a2: Expected O, but got Unknown //IL_06ed: Unknown result type (might be due to invalid IL or missing references) //IL_06f7: Expected O, but got Unknown //IL_071b: Unknown result type (might be due to invalid IL or missing references) //IL_0725: Expected O, but got Unknown //IL_0754: Unknown result type (might be due to invalid IL or missing references) //IL_075e: Expected O, but got Unknown //IL_079e: Unknown result type (might be due to invalid IL or missing references) //IL_07a8: Expected O, but got Unknown //IL_07cd: Unknown result type (might be due to invalid IL or missing references) //IL_07d7: Expected O, but got Unknown //IL_0806: Unknown result type (might be due to invalid IL or missing references) //IL_0810: Expected O, but got Unknown //IL_083f: Unknown result type (might be due to invalid IL or missing references) //IL_0849: Expected O, but got Unknown //IL_0878: Unknown result type (might be due to invalid IL or missing references) //IL_0882: Expected O, but got Unknown //IL_08b1: Unknown result type (might be due to invalid IL or missing references) //IL_08bb: Expected O, but got Unknown //IL_08ea: Unknown result type (might be due to invalid IL or missing references) //IL_08f4: Expected O, but got Unknown //IL_0923: Unknown result type (might be due to invalid IL or missing references) //IL_092d: Expected O, but got Unknown //IL_095c: Unknown result type (might be due to invalid IL or missing references) //IL_0966: Expected O, but got Unknown //IL_0995: Unknown result type (might be due to invalid IL or missing references) //IL_099f: Expected O, but got Unknown //IL_09ea: Unknown result type (might be due to invalid IL or missing references) //IL_09f4: Expected O, but got Unknown //IL_0a23: Unknown result type (might be due to invalid IL or missing references) //IL_0a2d: Expected O, but got Unknown //IL_0a5c: Unknown result type (might be due to invalid IL or missing references) //IL_0a66: Expected O, but got Unknown EnableMod = cfg.Bind<bool>("Spawning", "EnableMod", true, "Master toggle for registering Mahoraga in Lethal Company."); DefaultInteriorRarity = cfg.Bind<int>("Spawning", "DefaultInteriorRarity", 20, new ConfigDescription("Default interior spawn weight across all vanilla and modded moons (0 disables interior spawns unless overridden).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); MoonRarityOverrides = cfg.Bind<string>("Spawning", "MoonRarityOverrides", "", "Comma-separated per-moon spawn weight overrides. Examples: \"Experimentation:10,Titan:35,Artifice:40\" or modded moon names like \"46 Infernis:25\"."); AllowOutdoorSpawn = cfg.Bind<bool>("Spawning", "AllowOutdoorSpawn", true, "If true, registers the dedicated outdoor spawn profile (MahoragaEnemyType_Outside) across all vanilla and modded moons."); OutdoorRarity = cfg.Bind<int>("Spawning", "OutdoorRarity", 14, new ConfigDescription("Default outdoor spawn weight used when AllowOutdoorSpawn is enabled (0 disables outdoor spawns unless overridden).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>())); OutdoorMoonRarityOverrides = cfg.Bind<string>("Spawning", "OutdoorMoonRarityOverrides", "", "Optional comma-separated per-moon outdoor spawn weight overrides (layered on top of MoonRarityOverrides). Examples: \"Artifice:35,Experimentation:0\"."); PowerLevel = cfg.Bind<float>("Spawning", "PowerLevel", 3f, new ConfigDescription("Indoor moon enemy power budget consumed by each spawned Mahoraga.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>())); MaxCount = cfg.Bind<int>("Spawning", "MaxCount", 1, new ConfigDescription("Maximum concurrent indoor Mahoraga instances allowed on a moon.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 5), Array.Empty<object>())); OutdoorPowerLevel = cfg.Bind<float>("Spawning", "OutdoorPowerLevel", 3f, new ConfigDescription("Outdoor moon enemy power budget consumed by each outdoor Mahoraga.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>())); OutdoorMaxCount = cfg.Bind<int>("Spawning", "OutdoorMaxCount", 1, new ConfigDescription("Maximum concurrent outdoor Mahoraga instances allowed on a moon.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 5), Array.Empty<object>())); MaxHP = cfg.Bind<int>("Combat", "MaxHP", 18, new ConfigDescription("Base HP of Mahoraga in Lethal Company hit-force units (Shovel=1, Shotgun=2-5, Landmine=6).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(6, 100), Array.Empty<object>())); CleaveDamage = cfg.Bind<int>("Combat", "CleaveDamage", 55, new ConfigDescription("Player HP damage dealt by Mahoraga's Sword Cleave attack.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 100), Array.Empty<object>())); SlamDamage = cfg.Bind<int>("Combat", "SlamDamage", 65, new ConfigDescription("Player HP damage dealt by Mahoraga's 360-degree Divergent Slam attack.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(10, 100), Array.Empty<object>())); CanForceLockedDoors = cfg.Bind<bool>("Combat", "CanForceLockedDoors", true, "If true, Mahoraga forces key-locked interior DoorLock doors open after 2.2 seconds of pounding."); PlayerKnockbackMultiplier = cfg.Bind<float>("Combat", "PlayerKnockbackMultiplier", 1f, new ConfigDescription("Scales the shove players receive from Sword Cleave / Divergent Slam (0 disables knockback).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); RetaliationHalfLifeSeconds = cfg.Bind<float>("Combat", "RetaliationHalfLifeSeconds", 6f, new ConfigDescription("How long a player who hurts Mahoraga stays its priority target (aggro weight halves every this many seconds).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(2f, 30f), Array.Empty<object>())); RetaliationSwitchLockoutSeconds = cfg.Bind<float>("Combat", "RetaliationSwitchLockoutSeconds", 2.5f, new ConfigDescription("Minimum time between two retaliation target switches (anti-oscillation hysteresis).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 10f), Array.Empty<object>())); RegenDelaySeconds = cfg.Bind<float>("Combat", "RegenDelaySeconds", 8f, new ConfigDescription("Seconds without taking damage before Mahoraga starts regenerating slowly.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 60f), Array.Empty<object>())); RegenPercentPerSecond = cfg.Bind<float>("Combat", "RegenPercentPerSecond", 0.01f, new ConfigDescription("Out-of-combat regeneration as a fraction of MaxHP per second (0.01 = 1%/s, 0 disables).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.1f), Array.Empty<object>())); HitsPerAdaptationStage = cfg.Bind<int>("Adaptation", "HitsPerAdaptationStage", 1, new ConfigDescription("Exposures of one damage/stun category needed to turn the Wheel one stage. There are 3 stages: the 3rd completes the adaptation (heal + category blocked).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 5), Array.Empty<object>())); Stage1Resistance = cfg.Bind<float>("Adaptation", "Stage1Resistance", 0.4f, new ConfigDescription("Resistance to a category after its 1st Wheel turn (0.40 = 40% less damage / stun time). The turn itself is a quick click and does not stop Mahoraga.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.9f), Array.Empty<object>())); Stage2Resistance = cfg.Bind<float>("Adaptation", "Stage2Resistance", 0.7f, new ConfigDescription("Resistance to a category after its 2nd Wheel turn. Raised to at least Stage1Resistance.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.95f), Array.Empty<object>())); AdaptedDamageResistance = cfg.Bind<float>("Adaptation", "AdaptedDamageResistance", 0.95f, new ConfigDescription("Resistance once a category is fully adapted (0.95 = 95% resistance, 1.00 = full immunity). Raised to at least Stage2Resistance.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 1f), Array.Empty<object>())); AdaptationHealPercent = cfg.Bind<float>("Adaptation", "AdaptationHealPercent", 0.2f, new ConfigDescription("Fraction of MaxHP regenerated when a category reaches FULL adaptation (intermediate Wheel turns do not heal).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.5f), Array.Empty<object>())); FightOldBirds = cfg.Bind<bool>("OldBird", "FightOldBirds", true, "If true, Mahoraga hunts living Old Birds (RadMechAI) in its own area (outside/inside) even if they never attacked first, and can destroy them."); OldBirdPriorityMode = cfg.Bind<string>("OldBird", "OldBirdPriorityMode", "WhenClose", new ConfigDescription("Who comes first when both an Old Bird and players are around. WhenClose = the Old Bird wins while it is within OldBirdPriorityDistance or attacking; Always = Old Birds first (except players who hurt Mahoraga); PlayersFirst = only when no player is in sight.", (AcceptableValueBase)(object)new AcceptableValueList<string>(new string[3] { "WhenClose", "Always", "PlayersFirst" }), Array.Empty<object>())); OldBirdPriorityDistance = cfg.Bind<float>("OldBird", "OldBirdPriorityDistance", 20f, new ConfigDescription("Fighting distance (meters) inside which an Old Bird outranks players in WhenClose mode.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 80f), Array.Empty<object>())); OldBirdSeekRange = cfg.Bind<float>("OldBird", "OldBirdSeekRange", 250f, new ConfigDescription("Maximum distance (meters) at which Mahoraga goes looking for a living Old Bird in its domain.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 500f), Array.Empty<object>())); OldBirdHitsToDestroy = cfg.Bind<float>("OldBird", "OldBirdHitsToDestroy", 8f, new ConfigDescription("Cleave hits needed to destroy an Old Bird at Mahoraga's base size (a Slam counts double). A grown Mahoraga hits proportionally harder, so it needs fewer.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 100f), Array.Empty<object>())); OldBirdEngageMaxSeconds = cfg.Bind<float>("OldBird", "OldBirdEngageMaxSeconds", 120f, new ConfigDescription("Hard cap for one hunt against a single Old Bird before Mahoraga gives up (see DisengageCooldownSeconds).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 300f), Array.Empty<object>())); OldBirdsRequiredToKill = cfg.Bind<int>("OldBird", "OldBirdsRequiredToKill", 5, new ConfigDescription("Old Birds that must be hitting Mahoraga within OldBirdKillWindowSeconds before their missiles may push it below the HP floor (fewer Old Birds can never kill it).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 10), Array.Empty<object>())); OldBirdKillWindowSeconds = cfg.Bind<float>("OldBird", "OldBirdKillWindowSeconds", 6f, new ConfigDescription("Sliding window used to count how many different Old Birds are attacking Mahoraga at the same time.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 30f), Array.Empty<object>())); OldBirdSoloHpFloorFraction = cfg.Bind<float>("OldBird", "OldBirdSoloHpFloorFraction", 0.3f, new ConfigDescription("Fraction of MaxHP that Old Bird missiles cannot take Mahoraga below unless OldBirdsRequiredToKill of them attack together.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.05f, 0.9f), Array.Empty<object>())); OldBirdMissileFullResistance = cfg.Bind<float>("OldBird", "OldBirdMissileFullResistance", 0.9f, new ConfigDescription("Resistance to Old Bird missiles once that category is fully adapted (kept below 1.0 so a big flock can still wear it down).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.5f, 1f), Array.Empty<object>())); GrowthEnabled = cfg.Bind<bool>("Growth", "GrowthEnabled", true, "If true, Mahoraga grows (outdoors only) every time an Old Bird hurts it, up to the Old Bird's own height."); GrowthMaxScale = cfg.Bind<float>("Growth", "GrowthMaxScale", 2f, new ConfigDescription("Maximum size multiplier (1.0 = never grows). The real target is the measured Old Bird height, capped by this.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 3f), Array.Empty<object>())); GrowthStepsToMatch = cfg.Bind<int>("Growth", "GrowthStepsToMatch", 6, new ConfigDescription("Old Bird damage events needed to grow from base size all the way to the Old Bird's height.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 20), Array.Empty<object>())); GrowthTransitionSeconds = cfg.Bind<float>("Growth", "GrowthTransitionSeconds", 2f, new ConfigDescription("Approximate seconds each growth step takes to animate.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0.2f, 10f), Array.Empty<object>())); VisibleToOtherEnemies = cfg.Bind<bool>("EnemyInteraction", "VisibleToOtherEnemies", true, "If true, other enemies that watch for threats (Old Birds, Baboon Hawks, Giant Kiwis...) can detect Mahoraga and react to it. Takes effect for new sightings immediately."); EnemyCleaveDamage = cfg.Bind<int>("EnemyInteraction", "EnemyCleaveDamage", 6, new ConfigDescription("Hit force dealt to an enemy by Sword Cleave (same units as a Shovel = 1, Shotgun = 2-5, Landmine = 6 against enemy HP).", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 50), Array.Empty<object>())); EnemySlamDamage = cfg.Bind<int>("EnemyInteraction", "EnemySlamDamage", 10, new ConfigDescription("Hit force dealt to an enemy by the Divergent Slam.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 50), Array.Empty<object>())); EnemyKnockbackMultiplier = cfg.Bind<float>("EnemyInteraction", "EnemyKnockbackMultiplier", 1f, new ConfigDescription("Scales the shove enemies receive from Mahoraga's attacks (0 disables; giants are always pushed much less).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 3f), Array.Empty<object>())); EnemyGrudgeHalfLifeSeconds = cfg.Bind<float>("EnemyInteraction", "EnemyGrudgeHalfLifeSeconds", 5f, new ConfigDescription("How long an Old Bird that hurt Mahoraga stays a priority retaliation target (aggro weight halves every this many seconds).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 30f), Array.Empty<object>())); EnemyEngageMaxSeconds = cfg.Bind<float>("EnemyInteraction", "EnemyEngageMaxSeconds", 20f, new ConfigDescription("Fallback engagement cap in seconds; afterwards Mahoraga disengages for DisengageCooldownSeconds.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 120f), Array.Empty<object>())); DisengageCooldownSeconds = cfg.Bind<float>("EnemyInteraction", "DisengageCooldownSeconds", 30f, new ConfigDescription("After giving up on an Old Bird (timeout or unreachable) it is ignored for this long.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 300f), Array.Empty<object>())); PatrolSpeed = cfg.Bind<float>("Movement", "PatrolSpeed", 3.2f, new ConfigDescription("Movement speed (m/s) while patrolling.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>())); InvestigateSpeed = cfg.Bind<float>("Movement", "InvestigateSpeed", 4.5f, new ConfigDescription("Movement speed (m/s) while investigating noises or last-known positions.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 12f), Array.Empty<object>())); ChaseSpeed = cfg.Bind<float>("Movement", "ChaseSpeed", 6.2f, new ConfigDescription("Base chase speed (m/s) before adaptation escalation.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(2f, 14f), Array.Empty<object>())); ChaseSpeedPerAdaptation = cfg.Bind<float>("Movement", "ChaseSpeedPerAdaptation", 0.35f, new ConfigDescription("Additional chase speed (m/s) gained per completed adaptation (capped at 4 stacks).", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1.5f), Array.Empty<object>())); MusicEnabled = cfg.Bind<bool>("Audio", "MusicEnabled", true, "Enable dynamic proximity and encounter music when Mahoraga is nearby."); MusicMasterVolume = cfg.Bind<float>("Audio", "MusicMasterVolume", 0.75f, new ConfigDescription("Peak volume multiplier for Mahoraga's proximity music.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 1f), Array.Empty<object>())); MusicOuterRange = cfg.Bind<float>("Audio", "MusicOuterRange", 35f, new ConfigDescription("Distance (meters) at which Mahoraga's theme begins fading in.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 80f), Array.Empty<object>())); MusicInnerRange = cfg.Bind<float>("Audio", "MusicInnerRange", 16f, new ConfigDescription("Distance (meters) at which Mahoraga's theme reaches full intensity.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(5f, 40f), Array.Empty<object>())); EnableWallMuffling = cfg.Bind<bool>("Audio", "EnableWallMuffling", true, "Apply AudioLowPassFilter occlusion when facility walls block line of sight to Mahoraga."); UseCustomMusicOverride = cfg.Bind<bool>("Audio", "UseCustomMusicOverride", false, "If true, loads the first .ogg, .wav, or .mp3 audio file placed in the CustomMusic/ folder beside Fede.MahoragaLC.dll instead of the bundled theme."); BindSummonAndHunt(cfg); Adaptation = BuildAdaptationSettings(); HitsPerAdaptationStage.SettingChanged += delegate { Adaptation = BuildAdaptationSettings(); }; Stage1Resistance.SettingChanged += delegate { Adaptation = BuildAdaptationSettings(); }; Stage2Resistance.SettingChanged += delegate { Adaptation = BuildAdaptationSettings(); }; AdaptedDamageResistance.SettingChanged += delegate { Adaptation = BuildAdaptationSettings(); }; AdaptationHealPercent.SettingChanged += delegate { Adaptation = BuildAdaptationSettings(); }; OldBirdMissileFullResistance.SettingChanged += delegate { Adaptation = BuildAdaptationSettings(); }; ClearOrphanedEntries(cfg); } private AdaptationSettings BuildAdaptationSettings() { return AdaptationSettings.CreateProgressive(HitsPerAdaptationStage.Value, Stage1Resistance.Value, Stage2Resistance.Value, AdaptedDamageResistance.Value, AdaptationHealPercent.Value, OldBirdMissileFullResistance.Value); } public static MahoragaConfig Bind(ConfigFile cfg) { Current = new MahoragaConfig(cfg); return Current; } public void ApplyMoonOverrides(Dictionary<LevelTypes, int> levelRarities, Dictionary<string, int> customLevelRarities) { ApplyOverrideString(MoonRarityOverrides.Value, levelRarities, customLevelRarities); } public void ApplyOutdoorMoonOverrides(Dictionary<LevelTypes, int> levelRarities, Dictionary<string, int> customLevelRarities) { ApplyOverrideString(MoonRarityOverrides.Value, levelRarities, customLevelRarities); if (!string.IsNullOrWhiteSpace(OutdoorMoonRarityOverrides.Value)) { ApplyOverrideString(OutdoorMoonRarityOverrides.Value, levelRarities, customLevelRarities); } } private static void ApplyOverrideString(string rawOverrides, Dictionary<LevelTypes, int> levelRarities, Dictionary<string, int> customLevelRarities) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) Dictionary<string, int> dictionary = MoonRarityParser.Parse(rawOverrides); foreach (KeyValuePair<string, int> item in dictionary) { if (TryResolveVanillaLevelType(item.Key, out var levelType)) { levelRarities[levelType] = item.Value; } else { customLevelRarities[item.Key] = item.Value; } } } private static bool TryResolveVanillaLevelType(string moonName, out LevelTypes levelType) { string text = moonName.Trim(); if (Enum.TryParse<LevelTypes>(text, ignoreCase: true, out levelType)) { return true; } if (!text.EndsWith("Level", StringComparison.OrdinalIgnoreCase) && Enum.TryParse<LevelTypes>(text + "Level", ignoreCase: true, out levelType)) { return true; } levelType = (LevelTypes)1; return false; } private static void ClearOrphanedEntries(ConfigFile cfg) { try { if (((object)cfg).GetType().GetProperty("OrphanedEntries", BindingFlags.Instance | BindingFlags.NonPublic)?.GetValue(cfg, null) is Dictionary<ConfigDefinition, string> { Count: >0 } dictionary) { dictionary.Clear(); cfg.Save(); } } catch { } } private void BindSummonAndHunt(ConfigFile cfg) { //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Expected O, but got Unknown //IL_00d3: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Expected O, but got Unknown //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Expected O, but got Unknown //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_016b: Expected O, but got Unknown //IL_019a: Unknown result type (might be due to invalid IL or missing references) //IL_01a4: Expected O, but got Unknown //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01dd: Expected O, but got Unknown EnableSummonSequence = cfg.Bind<bool>("Summoning", "EnableSummonSequence", true, "If true, Mahoraga is summoned from a pool of black shadow (Ten Shadows style) every time it spawns: he is invulnerable and motionless while he rises, the Dharma wheel turns one spoke (+45 deg) and he roars. If false he appears instantly."); SummonDuration = cfg.Bind<float>("Summoning", "SummonDuration", 4.8f, new ConfigDescription("Total length in seconds of the summoning sequence (shadow pool, rise, wheel turn, roar, dissolve). The animation and effects stretch to fit.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(3f, 10f), Array.Empty<object>())); SummonCameraShake = cfg.Bind<bool>("Summoning", "SummonCameraShake", true, "Shake the camera of nearby players during the emergence boom and the roar of the summoning."); HuntPlayers = cfg.Bind<bool>("Hunting", "HuntPlayers", true, "If true, indoors while it has no line of sight Mahoraga walks toward the closest reachable living player instead of wandering between AI nodes. If false it only patrols indoors."); HuntPlayersOutdoors = cfg.Bind<bool>("Hunting", "HuntPlayersOutdoors", false, "If false (default), outdoors Mahoraga wanders naturally and only chases players it genuinely sees (line of sight) or hears (noise investigation). If true, outdoors Mahoraga also hunts players without line of sight like indoors."); HuntRepathSeconds = cfg.Bind<float>("Hunting", "HuntRepathSeconds", 2.5f, new ConfigDescription("How often (seconds) the hunt re-selects the closest reachable player and recomputes its destination.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>())); EnableShadowAmbush = cfg.Bind<bool>("ShadowAmbush", "EnableShadowAmbush", true, "If true, late in the day when Mahoraga has not seen any player for a while (and no living Old Bird is in its domain), it dives into a shadow pool and re-emerges directly in front of a living player."); ShadowAmbushMinTime = cfg.Bind<float>("ShadowAmbush", "ShadowAmbushMinTime", 0.62f, new ConfigDescription("Minimum normalized TimeOfDay (0.0 = 6 AM, 1.0 = midnight; 0.62 = late afternoon) before Mahoraga can trigger a Shadow Ambush.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 0.95f), Array.Empty<object>())); ShadowAmbushLostSightDelay = cfg.Bind<float>("ShadowAmbush", "ShadowAmbushLostSightDelay", 12f, new ConfigDescription("Seconds without line of sight to any player before Mahoraga considers diving into the shadows for an ambush.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(2f, 120f), Array.Empty<object>())); ShadowAmbushCooldown = cfg.Bind<float>("ShadowAmbush", "ShadowAmbushCooldown", 45f, new ConfigDescription("Minimum seconds between two Shadow Ambush dives.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(10f, 300f), Array.Empty<object>())); ShadowAmbushSubmergeDuration = cfg.Bind<float>("ShadowAmbush", "ShadowAmbushSubmergeDuration", 2.6f, new ConfigDescription("Duration in seconds of the downward shadow-dive animation before warping to emerge in front of a player.", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 6f), Array.Empty<object>())); } } } namespace MahoragaLC.Audio { public class MahoragaAudioController : MonoBehaviour { private const float WalkStrideMeters = 1.75f; private const float RunStrideMeters = 2.15f; public AudioSource? voiceSource; public AudioSource? bodySource; public AudioClip? musicMainClip; public AudioClip? wheelTurnClip; public AudioClip? footstep1Clip; public AudioClip? footstep2Clip; public AudioClip? slashClip; public AudioClip? impactClip; public AudioClip? roarClip; public AudioClip? deathClip; public AudioClip? summonClip; private AudioSource? _summonSource; private float _strideAccum; private bool _useSecondFootstep; internal MahoragaAI? AI { get; private set; } public bool IsAlive { get { if ((Object)(object)AI != (Object)null) { return !((EnemyAI)AI).isEnemyDead; } return false; } } public bool IsChasingOrAttacking { get { if ((Object)(object)AI != (Object)null) { if (((EnemyAI)AI).currentBehaviourStateIndex != 2 && ((EnemyAI)AI).currentBehaviourStateIndex != 3) { return ((EnemyAI)AI).currentBehaviourStateIndex == 6; } return true; } return false; } } public bool IsSummoning { get { if ((Object)(object)AI != (Object)null) { return AI.IsSummoning; } return false; } } private void Awake() { AI = ((Component)this).GetComponent<MahoragaAI>(); ResolveFallbackReferences(); } private void OnEnable() { if ((Object)(object)AI == (Object)null) { AI = ((Component)this).GetComponent<MahoragaAI>(); } ResolveFallbackReferences(); RouteSoundEffects(); MahoragaMusicCoordinator.Register(this); } private void OnDisable() { MahoragaMusicCoordinator.Unregister(this); } private void OnDestroy() { MahoragaMusicCoordinator.Unregister(this); } private void ResolveFallbackReferences() { if ((Object)(object)voiceSource == (Object)null) { Transform val = ((Component)this).transform.Find("VoiceSFXSource"); if ((Object)(object)val != (Object)null) { voiceSource = ((Component)val).GetComponent<AudioSource>(); } } if ((Object)(object)bodySource == (Object)null) { Transform val2 = ((Component)this).transform.Find("BodySFXSource"); if ((Object)(object)val2 != (Object)null) { bodySource = ((Component)val2).GetComponent<AudioSource>(); } } if (musicMainClip == null) { musicMainClip = GetCachedClip("mahoraga_music_main"); } if (wheelTurnClip == null) { wheelTurnClip = GetCachedClip("mahoraga_wheel_turn"); } if (footstep1Clip == null) { footstep1Clip = GetCachedClip("mahoraga_footstep_1"); } if (footstep2Clip == null) { footstep2Clip = GetCachedClip("mahoraga_footstep_2"); } if (slashClip == null) { slashClip = GetCachedClip("mahoraga_slash"); } if (impactClip == null) { impactClip = GetCachedClip("mahoraga_impact"); } if (roarClip == null) { roarClip = GetCachedClip("mahoraga_roar"); } if (deathClip == null) { deathClip = GetCachedClip("mahoraga_death"); } if (summonClip == null) { summonClip = GetCachedClip("mahoraga_summon"); } } private static AudioClip? GetCachedClip(string clipName) { if (!Plugin.CachedAudioClips.TryGetValue(clipName, out AudioClip value)) { return null; } return value; } private void RouteSoundEffects() { if ((Object)(object)SoundManager.Instance == (Object)null || (Object)(object)SoundManager.Instance.diageticMixer == (Object)null) { return; } AudioMixerGroup[] array = SoundManager.Instance.diageticMixer.FindMatchingGroups("SFX"); if (array.Length != 0) { if ((Object)(object)voiceSource != (Object)null && (Object)(object)voiceSource.outputAudioMixerGroup == (Object)null) { voiceSource.outputAudioMixerGroup = array[0]; } if ((Object)(object)bodySource != (Object)null && (Object)(object)bodySource.outputAudioMixerGroup == (Object)null) { bodySource.outputAudioMixerGroup = array[0]; } } } public void TickStrideFootsteps(float horizontalDistanceMoved, bool isChasing) { if (!(horizontalDistanceMoved <= 0.0001f)) { _strideAccum += horizontalDistanceMoved; float num = (isChasing ? 2.15f : 1.75f); if (!(_strideAccum < num)) { _strideAccum -= num; PlayFootstep(isChasing ? 1f : 0.78f); } } } public void ResetStride() { _strideAccum = 0f; } public void PlayFootstep(float volume = 0.85f) { AudioClip val = (_useSecondFootstep ? (footstep2Clip ?? footstep1Clip) : (footstep1Clip ?? footstep2Clip)); _useSecondFootstep = !_useSecondFootstep; if (!((Object)(object)bodySource == (Object)null) && !((Object)(object)val == (Object)null)) { bodySource.pitch = Random.Range(0.94f, 1.06f); bodySource.PlayOneShot(val, volume); } } public void PlayRoar(float volume = 1f) { if (!((Object)(object)voiceSource == (Object)null) && !((Object)(object)roarClip == (Object)null)) { voiceSource.pitch = Random.Range(0.96f, 1.04f); voiceSource.PlayOneShot(roarClip, volume); WalkieTalkie.TransmitOneShotAudio(voiceSource, roarClip, volume); } } public void PlayWheelTurn(float volume = 1f) { MahoragaMusicCoordinator.NotifyWheelTurn(); if (!((Object)(object)voiceSource == (Object)null) && !((Object)(object)wheelTurnClip == (Object)null)) { voiceSource.pitch = 1f; voiceSource.PlayOneShot(wheelTurnClip, volume); WalkieTalkie.TransmitOneShotAudio(voiceSource, wheelTurnClip, volume); } } public void PlaySummonRumble(float startOffsetSeconds = 0f) { //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Expected O, but got Unknown //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Invalid comparison between Unknown and I4 if ((Object)(object)summonClip == (Object)null || (Object)(object)voiceSource == (Object)null || startOffsetSeconds >= summonClip.length - 0.05f) { return; } if ((Object)(object)_summonSource == (Object)null) { GameObject val = new GameObject("SummonRumbleSource"); val.transform.SetParent(((Component)voiceSource).transform, false); _summonSource = val.AddComponent<AudioSource>(); _summonSource.playOnAwake = false; _summonSource.loop = false; _summonSource.spatialBlend = 1f; _summonSource.rolloffMode = voiceSource.rolloffMode; _summonSource.minDistance = voiceSource.minDistance; _summonSource.maxDistance = voiceSource.maxDistance; _summonSource.dopplerLevel = 0f; _summonSource.outputAudioMixerGroup = voiceSource.outputAudioMixerGroup; if ((int)voiceSource.rolloffMode == 2) { _summonSource.SetCustomCurve((AudioSourceCurveType)0, voiceSource.GetCustomCurve((AudioSourceCurveType)0)); } } _summonSource.Stop(); _summonSource.clip = summonClip; _summonSource.volume = 1f; _summonSource.pitch = 1f; _summonSource.time = Mathf.Max(0f, startOffsetSeconds); _summonSource.Play(); } public void PlayWheelClick(float volume = 0.6f) { if (!((Object)(object)voiceSource == (Object)null) && !((Object)(object)wheelTurnClip == (Object)null)) { voiceSource.pitch = Random.Range(1.28f, 1.38f); voiceSource.PlayOneShot(wheelTurnClip, Mathf.Clamp01(volume)); } } public void PlayDeflectChime() { if (!((Object)(object)voiceSource == (Object)null) && !((Object)(object)wheelTurnClip == (Object)null)) { voiceSource.pitch = Random.Range(1.42f, 1.52f); voiceSource.PlayOneShot(wheelTurnClip, 0.45f); } } public void PlaySlash(float volume = 1f) { if (!((Object)(object)bodySource == (Object)null) && !((Object)(object)slashClip == (Object)null)) { bodySource.pitch = Random.Range(0.95f, 1.05f); bodySource.PlayOneShot(slashClip, volume); } } public void PlayImpact(float volume = 1f) { if (!((Object)(object)bodySource == (Object)null) && !((Object)(object)impactClip == (Object)null)) { bodySource.pitch = Random.Range(0.94f, 1.04f); bodySource.PlayOneShot(impactClip, volume); WalkieTalkie.TransmitOneShotAudio(bodySource, impactClip, volume); } } public void OnMahoragaDied(bool playDeathAudio) { MahoragaMusicCoordinator.NotifyMahoragaDied(); if (playDeathAudio && (Object)(object)voiceSource != (Object)null && (Object)(object)deathClip != (Object)null) { voiceSource.pitch = 1f; voiceSource.PlayOneShot(deathClip, 1f); WalkieTalkie.TransmitOneShotAudio(voiceSource, deathClip, 1f); } } } public sealed class MahoragaMusicCoordinator : MonoBehaviour { private const float OcclusionPollInterval = 0.15f; private const float GongDuckDuration = 1f; private const float GongDuckMultiplier = 0.55f; private const float PatrolStateMultiplier = 0.65f; private const float ChaseStateMultiplier = 1f; private const float OccludedVolumeMultiplier = 0.7f; private const float ClearMinCutoffHz = 900f; private const float ClearMaxCutoffHz = 22000f; private const float OccludedPatrolCutoffHz = 1100f; private const float OccludedChaseCutoffHz = 2600f; private const float DeathFastFadeRate = 3f; private const float NormalFadeOutRate = 2.2f; private const float NormalFadeInRate = 1.8f; private static MahoragaMusicCoordinator? _instance; private static readonly List<MahoragaAudioController> ActiveInstances = new List<MahoragaAudioController>(4); private AudioSource _musicSource; private AudioLowPassFilter _lowPassFilter; private AudioClip? _bundledMusicClip; private AudioClip? _customMusicClip; private bool _customMusicAttempted; private float _occlusionTimer; private bool _isOccluded; private float _gongDuckUntil = -999f; private bool _deathFastFade; private bool _summonMusicRestarted; public static void Register(MahoragaAudioController controller) { if (!((Object)(object)controller == (Object)null)) { if (!ActiveInstances.Contains(controller)) { ActiveInstances.Add(controller); } MahoragaMusicCoordinator mahoragaMusicCoordinator = EnsureInstance(); if ((Object)(object)controller.musicMainClip != (Object)null && (Object)(object)mahoragaMusicCoordinator._bundledMusicClip == (Object)null) { mahoragaMusicCoordinator._bundledMusicClip = controller.musicMainClip; } mahoragaMusicCoordinator.TryStartCustomMusicLoad(); } } public static void Unregister(MahoragaAudioController controller) { ActiveInstances.Remove(controller); } public static void NotifyWheelTurn() { if ((Object)(object)_instance != (Object)null) { _instance._gongDuckUntil = Time.time + 1f; } } public static void NotifyMahoragaDied() { if ((Object)(object)_instance != (Object)null) { _instance._deathFastFade = true; } } private static MahoragaMusicCoordinator EnsureInstance() { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown if ((Object)(object)_instance != (Object)null) { return _instance; } GameObject val = new GameObject("MahoragaMusicCoordinator"); Object.DontDestroyOnLoad((Object)(object)val); _instance = val.AddComponent<MahoragaMusicCoordinator>(); return _instance; } private void Awake() { if ((Object)(object)_instance != (Object)null && (Object)(object)_instance != (Object)(object)this) { Object.Destroy((Object)(object)((Component)this).gameObject); return; } _instance = this; _musicSource = ((Component)this).gameObject.AddComponent<AudioSource>(); _musicSource.spatialBlend = 0f; _musicSource.loop = true; _musicSource.playOnAwake = false; _musicSource.priority = 32; _musicSource.volume = 0f; _lowPassFilter = ((Component)this).gameObject.AddComponent<AudioLowPassFilter>(); _lowPassFilter.cutoffFrequency = 22000f; _lowPassFilter.lowpassResonanceQ = 1f; if (Plugin.CachedAudioClips.TryGetValue("mahoraga_music_main", out AudioClip value)) { _bundledMusicClip = value; } } private void OnDestroy() { if ((Object)(object)_instance == (Object)(object)this) { _instance = null; } } private void TryStartCustomMusicLoad() { //IL_0050: 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_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) if (_customMusicAttempted) { return; } MahoragaConfig current = MahoragaConfig.Current; if (current == null || !current.UseCustomMusicOverride.Value) { return; } _customMusicAttempted = true; if (string.IsNullOrEmpty(Plugin.PluginDirectory)) { return; } string path = Path.Combine(Plugin.PluginDirectory, "CustomMusic"); if (!Directory.Exists(path)) { return; } string text = null; AudioType audioType = (AudioType)0; string[] files = Directory.GetFiles(path); foreach (string text2 in files) { switch (Path.GetExtension(text2).ToLowerInvariant()) { case ".ogg": text = text2; audioType = (AudioType)14; break; case ".wav": text = text2; audioType = (AudioType)20; break; case ".mp3": text = text2; audioType = (AudioType)13; break; default: continue; } break; } if (text != null) { ((MonoBehaviour)this).StartCoroutine(LoadCustomMusicCoroutine(text, audioType)); } } private IEnumerator LoadCustomMusicCoroutine(string filePath, AudioType audioType) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) string absoluteUri = new Uri(filePath).AbsoluteUri; UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(absoluteUri, audioType); try { yield return request.SendWebRequest(); if ((int)request.result != 1) { Plugin.Logger.LogWarning((object)("Failed to load CustomMusic override '" + Path.GetFileName(filePath) + "': " + request.error + ".")); yield break; } AudioClip content = DownloadHandlerAudioClip.GetContent(request); if ((Object)(object)content == (Object)null || content.length <= 0.1f) { Plugin.Logger.LogWarning((object)("CustomMusic override '" + Path.GetFileName(filePath) + "' produced an empty AudioClip.")); yield break; } ((Object)content).name = "mahoraga_custom_music"; _customMusicClip = content; Plugin.Logger.LogInfo((object)$"Loaded CustomMusic override: {Path.GetFileName(filePath)} ({content.length:F1}s)"); if ((Object)(object)_musicSource != (Object)null) { bool isPlaying = _musicSource.isPlaying; float volume = _musicSource.volume; _musicSource.Stop(); _musicSource.clip = _customMusicClip; if (isPlaying && volume > 0.001f) { _musicSource.volume = volume; _musicSource.Play(); } } } finally { ((IDisposable)request)?.Dispose(); } } private AudioClip? GetActiveMusicClip() { if ((Object)(object)_customMusicClip != (Object)null) { return _customMusicClip; } if ((Object)(object)_bundledMusicClip != (Object)null) { return _bundledMusicClip; } if (Plugin.CachedAudioClips.TryGetValue("mahoraga_music_main", out AudioClip value)) { _bundledMusicClip = value; return value; } return null; } private void Update() { //IL_0142: 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_0120: 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_012f: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_01c9: 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_01da: Unknown result type (might be due to invalid IL or missing references) //IL_01df: Unknown result type (might be due to invalid IL or missing references) //IL_03d4: Unknown result type (might be due to invalid IL or missing references) //IL_03ad: Unknown result type (might be due to invalid IL or missing references) //IL_03b2: Unknown result type (might be due to invalid IL or missing references) //IL_03bc: Unknown result type (might be due to invalid IL or missing references) //IL_03c1: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03dc: 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) MahoragaConfig current = MahoragaConfig.Current; bool flag = current?.MusicEnabled.Value ?? true; float num = current?.MusicMasterVolume.Value ?? 0.75f; float num2 = current?.MusicOuterRange.Value ?? 35f; float num3 = current?.MusicInnerRange.Value ?? 16f; bool flag2 = current?.EnableWallMuffling.Value ?? true; if (num2 < num3 + 1f) { num2 = num3 + 1f; } PlayerControllerB val = (((Object)(object)GameNetworkManager.Instance != (Object)null) ? GameNetworkManager.Instance.localPlayerController : null); StartOfRound instance = StartOfRound.Instance; if (!flag || (Object)(object)val == (Object)null || (Object)(object)insta