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 TerrifyingMario v1.3.0
TerrifyingMario.dll
Decompiled 12 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.Configuration; using BepInEx.Logging; using GameNetcodeStuff; using LethalLib.Modules; using Microsoft.CodeAnalysis; using Unity.Netcode; using UnityEngine; using UnityEngine.AI; using UnityEngine.Events; using UnityEngine.Networking; using UnityEngine.SceneManagement; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")] [assembly: AssemblyCompany("TerrifyingMario")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("Terrifying Mario")] [assembly: AssemblyTitle("TerrifyingMario")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace TerrifyingMario { internal class AutoTestDriver : MonoBehaviour { private PlayerControllerB me; private TerrifyingMarioAI mario; private TerrifyingLuigiAI luigi; private FlashlightItem flashlight; private Transform aimAt; private bool lookAway; private string scenario = "-"; private readonly Dictionary<string, HashSet<string>> statesByScenario = new Dictionary<string, HashSet<string>>(); private readonly List<string> errors = new List<string>(); private int damageEvents; private bool powerWentOff; private static readonly FieldInfo CameraUp = typeof(PlayerControllerB).GetField("cameraUp", BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic); private static void Log(string s) { Plugin.Log.LogInfo((object)("[AutoTest] " + s)); } private void OnEnable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown Application.logMessageReceived += new LogCallback(OnLog); } private void OnDisable() { //IL_0007: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Expected O, but got Unknown Application.logMessageReceived -= new LogCallback(OnLog); } private void OnLog(string message, string stack, LogType type) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0002: Invalid comparison between Unknown and I4 //IL_0004: Unknown result type (might be due to invalid IL or missing references) if (((int)type == 4 || (int)type == 0) && (stack ?? "").Contains("TerrifyingMario")) { errors.Add(message.Split('\n')[0]); } } private IEnumerator Start() { Log("Démarrage du test automatique."); yield return WaitFor(() => (Object)(object)Object.FindObjectOfType<PreInitSceneScript>() != (Object)null || (Object)(object)MainMenu() != (Object)null, 90f); PreInitSceneScript pre = Object.FindObjectOfType<PreInitSceneScript>(); if ((Object)(object)pre != (Object)null) { yield return (object)new WaitForSeconds(2f); pre.ChooseLaunchOption(false); Log("Mode LAN choisi."); } MenuManager menu = null; yield return WaitFor(() => (Object)(object)(menu = MainMenu()) != (Object)null, 120f); if ((Object)(object)menu == (Object)null) { Fail("menu principal introuvable"); yield break; } yield return (object)new WaitForSeconds(4f); GameNetworkManager.Instance.currentSaveFileName = "LCMarioAutoTest"; menu.ClickHostButton(); yield return (object)new WaitForSeconds(1f); menu.lobbyNameInputField.text = "MarioAutoTest"; menu.ConfirmHostButton(); Log("Partie LAN hébergée (sauvegarde LCMarioAutoTest)."); yield return WaitFor(() => (Object)(object)StartOfRound.Instance != (Object)null && (Object)(object)StartOfRound.Instance.localPlayerController != (Object)null && StartOfRound.Instance.inShipPhase && StartOfRound.Instance.fullyLoadedPlayers.Count > 0, 120f); if ((Object)(object)StartOfRound.Instance == (Object)null) { Fail("vaisseau non chargé"); yield break; } yield return (object)new WaitForSeconds(6f); StartMatchLever obj = Object.FindObjectOfType<StartMatchLever>(); obj.singlePlayerEnabled = true; obj.leverHasBeenPulled = true; obj.StartGame(); Log("Levier tiré, lune : " + StartOfRound.Instance.currentLevel.PlanetName + "."); yield return WaitFor(() => StartOfRound.Instance.shipHasLanded && RoundManager.Instance.dungeonCompletedGenerating, 240f); if (!StartOfRound.Instance.shipHasLanded) { Fail("le vaisseau n'a pas atterri"); yield break; } Log("Atterri."); me = StartOfRound.Instance.localPlayerController; yield return (object)new WaitForSeconds(4f); EntranceTeleport val = ((IEnumerable<EntranceTeleport>)Object.FindObjectsOfType<EntranceTeleport>()).FirstOrDefault((Func<EntranceTeleport, bool>)((EntranceTeleport e) => e.entranceId == 0 && e.isEntranceToBuilding)); if ((Object)(object)val == (Object)null) { Fail("entrée principale introuvable"); yield break; } val.TeleportPlayer(); yield return (object)new WaitForSeconds(2f); Log($"Dans l'installation : {me.isInsideFactory}."); yield return WaitFor(() => (Object)(object)(mario = BrotherAI.FindSpawned<TerrifyingMarioAI>()) != (Object)null && (Object)(object)(luigi = BrotherAI.FindSpawned<TerrifyingLuigiAI>()) != (Object)null, 30f); if ((Object)(object)mario == (Object)null || (Object)(object)luigi == (Object)null) { Fail($"ennemis absents (Mario {(Object)(object)mario != (Object)null}, Luigi {(Object)(object)luigi != (Object)null}) — SpawnAtStart activé ?"); yield break; } Log("Mario et Luigi sont présents."); ((MonoBehaviour)this).StartCoroutine(Monitor()); if (RoundManager.Instance.onPowerSwitch != null) { ((UnityEvent<bool>)(object)RoundManager.Instance.onPowerSwitch).AddListener((UnityAction<bool>)delegate(bool on) { if (!on) { powerWentOff = true; } Log("Courant " + (on ? "rétabli" : "COUPÉ") + "."); }); } yield return Scenario("1-noir-sans-lampe", 40f, delegate { //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0032: Unknown result type (might be due to invalid IL or missing references) TeleportTo(Spot(false, ((Component)mario).transform.position, 14f, 30f)); }); yield return Scenario("2-lampe-sur-Mario", 25f, delegate { //IL_002e: 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) GiveFlashlight(on: true); TeleportTo(Spot(false, ((Component)mario).transform.position, 8f, 16f, needSight: true)); aimAt = ((Component)mario).transform; }); yield return Scenario("3-lampe-sur-Luigi", 25f, delegate { //IL_0025: 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) TeleportTo(Spot(null, ((Component)luigi).transform.position, 6f, 12f, needSight: true)); aimAt = ((Component)luigi).transform; }); yield return Scenario("4-lampe-allumee-regard-ailleurs", 35f, delegate { aimAt = null; lookAway = true; }); yield return Scenario("5-sous-les-lampes-sans-lampe", 45f, delegate { //IL_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: 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_008b: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0084: Unknown result type (might be due to invalid IL or missing references) lookAway = false; GiveFlashlight(on: false); Vector3 val2 = Spot(true, ((Component)mario).transform.position, 6f, 22f, needSight: true); TeleportTo(MarioLight.IsFacilityLit(val2) ? val2 : Spot(true, ((Component)me).transform.position, 0f, 80f)); }); yield return Scenario("6-courant-coupe", 35f, delegate { if (MarioLight.PowerOn()) { Log("Le courant est encore là : coupure forcée."); MarioLight.CutPower(); } }); Summary(); yield return (object)new WaitForSeconds(3f); Application.Quit(); } private IEnumerator Scenario(string name, float duration, Action setup) { scenario = name; statesByScenario[name] = new HashSet<string>(); Log($"===== Scénario {name} ({duration:0} s) ====="); try { setup(); } catch (Exception ex) { errors.Add("setup " + name + ": " + ex.Message); Log($"ERREUR setup : {ex}"); } yield return (object)new WaitForSeconds(duration); } private IEnumerator Monitor() { while (true) { if ((Object)(object)me != (Object)null && (Object)(object)mario != (Object)null && (Object)(object)luigi != (Object)null) { string text = StateName((EnemyAI)(object)mario); string text2 = StateName((EnemyAI)(object)luigi); if (!statesByScenario.ContainsKey(scenario)) { statesByScenario[scenario] = new HashSet<string>(); } statesByScenario[scenario].Add("Mario:" + text); statesByScenario[scenario].Add("Luigi:" + text2); Log($"[{scenario}] Mario {text} d={Dist((EnemyAI)(object)mario):0.0} lumière={MarioLight.At(((Component)mario).transform.position)} | " + $"Luigi {text2} d={Dist((EnemyAI)(object)luigi):0.0} lumière={MarioLight.At(((Component)luigi).transform.position)} | " + $"joueur lampe={MarioLight.HasLightOn(me)} sol={MarioLight.At(((Component)me).transform.position)} courant={MarioLight.PowerOn()} | " + string.Format("musique Mario {0}, Luigi {1}, volumeGlobal={2:0.00}", ((EnemyAI)mario).creatureSFX.isPlaying ? $"ON vol={((EnemyAI)mario).creatureSFX.volume:0.00}" : "off", ((EnemyAI)luigi).creatureSFX.isPlaying ? $"ON vol={((EnemyAI)luigi).creatureSFX.volume:0.00}" : "off", AudioListener.volume)); } yield return (object)new WaitForSeconds(2f); } } private void LateUpdate() { //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: 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_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0132: Unknown result type (might be due to invalid IL or missing references) //IL_0137: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_014a: Unknown result type (might be due to invalid IL or missing references) //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00ed: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: 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_016f: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_017a: Unknown result type (might be due to invalid IL or missing references) //IL_01cb: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)me == (Object)null || me.isPlayerDead) { return; } if (me.health < 100) { damageEvents++; Log($"[{scenario}] Joueur touché : PV {me.health} -> soigné à 100."); me.health = 100; me.criticallyInjured = false; } Vector3? val = null; if ((Object)(object)aimAt != (Object)null) { val = aimAt.position + Vector3.up * 1.6f; } else if (lookAway && (Object)(object)mario != (Object)null) { val = ((Component)me.gameplayCamera).transform.position + (((Component)me).transform.position - ((Component)mario).transform.position); } if (val.HasValue) { Vector3 val2 = val.Value - ((Component)me.gameplayCamera).transform.position; Vector3 val3 = default(Vector3); ((Vector3)(ref val3))..ctor(val2.x, 0f, val2.z); if (!(((Vector3)(ref val3)).sqrMagnitude < 0.01f)) { me.thisPlayerBody.rotation = Quaternion.LookRotation(val3); float num = (0f - Mathf.Atan2(val2.y, ((Vector3)(ref val3)).magnitude)) * 57.29578f; CameraUp?.SetValue(me, num); ((Component)me.gameplayCamera).transform.localEulerAngles = new Vector3(num, 0f, 0f); } } } private void GiveFlashlight(bool on) { //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a8: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)flashlight == (Object)null) { Item val = (from i in StartOfRound.Instance.allItemsList.itemsList where (Object)(object)i != (Object)null && (Object)(object)i.spawnPrefab != (Object)null && (Object)(object)i.spawnPrefab.GetComponent<FlashlightItem>() != (Object)null orderby i.itemName.Contains("Pro") descending select i).FirstOrDefault(); if ((Object)(object)val == (Object)null) { errors.Add("aucune lampe torche dans la liste des objets"); return; } GameObject val2 = Object.Instantiate<GameObject>(val.spawnPrefab, ((Component)me).transform.position + Vector3.up, Quaternion.identity, RoundManager.Instance.spawnedScrapContainer); val2.GetComponent<NetworkObject>().Spawn(false); flashlight = val2.GetComponent<FlashlightItem>(); ((GrabbableObject)flashlight).playerHeldBy = me; ((GrabbableObject)flashlight).isHeld = true; ((GrabbableObject)flashlight).parentObject = me.localItemHolder; me.ItemSlots[me.currentItemSlot] = (GrabbableObject)(object)flashlight; me.currentlyHeldObjectServer = (GrabbableObject)(object)flashlight; me.isHoldingObject = true; ((GrabbableObject)flashlight).EquipItem(); Log("Lampe donnée : " + val.itemName + "."); } flashlight.SwitchFlashlight(on); Log("Lampe " + (on ? "allumée" : "éteinte") + "."); } private Vector3 Spot(bool? lit, Vector3 from, float minD, float maxD, bool needSight = false) { //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0077: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //IL_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d0: Unknown result type (might be due to invalid IL or missing references) //IL_0103: Unknown result type (might be due to invalid IL or missing references) List<Vector3> list = (from n in RoundManager.Instance.insideAINodes where (Object)(object)n != (Object)null select n.transform.position).ToList(); Vector3? val = null; float num = float.MaxValue; foreach (Vector3 item in list) { float num2 = Vector3.Distance(item, from); if (!(num2 < minD) && !(num2 > maxD) && (!lit.HasValue || MarioLight.IsFacilityLit(item) == lit.Value) && (!needSight || !Physics.Linecast(item + Vector3.up * 1.6f, from + Vector3.up * 1.6f, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1))) { float num3 = Mathf.Abs(num2 - (minD + maxD) * 0.5f); if (num3 < num) { num = num3; val = item; } } } if (!val.HasValue) { Log($"Aucun point idéal (lumière={lit}, {minD}-{maxD} m) : on garde la position actuelle."); } return (Vector3)(((??)val) ?? ((Component)me).transform.position); } private void TeleportTo(Vector3 pos) { //IL_0006: 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_002b: Unknown result type (might be due to invalid IL or missing references) me.TeleportPlayer(pos, false, 0f, false, true); me.isInsideFactory = true; Log($"Joueur téléporté en {pos} (sol={MarioLight.At(pos)})."); } private float Dist(EnemyAI e) { //IL_0006: 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) return Vector3.Distance(((Component)e).transform.position, ((Component)me).transform.position); } private static string StateName(EnemyAI e) { int currentBehaviourStateIndex = e.currentBehaviourStateIndex; if (e.enemyBehaviourStates == null || currentBehaviourStateIndex < 0 || currentBehaviourStateIndex >= e.enemyBehaviourStates.Length) { return currentBehaviourStateIndex.ToString(); } return e.enemyBehaviourStates[currentBehaviourStateIndex].name; } private static MenuManager MainMenu() { return ((IEnumerable<MenuManager>)Object.FindObjectsOfType<MenuManager>()).FirstOrDefault((Func<MenuManager, bool>)((MenuManager m) => !m.isInitScene && (Object)(object)m.lobbyNameInputField != (Object)null)); } private static IEnumerator WaitFor(Func<bool> cond, float timeout) { float t = 0f; while (t < timeout) { bool flag = false; try { flag = cond(); } catch { } if (flag) { break; } t += 0.5f; yield return (object)new WaitForSeconds(0.5f); } } private void Fail(string why) { Log("ÉCHEC : " + why); Summary(); Application.Quit(); } private void Summary() { Log("===== RÉSUMÉ ====="); foreach (KeyValuePair<string, HashSet<string>> item in statesByScenario) { Log(item.Key + " : " + string.Join(", ", item.Value.OrderBy((string s) => s))); } Log($"Coups reçus par le joueur : {damageEvents}. Courant coupé pendant le test : {powerWentOff}."); Log((errors.Count == 0) ? "Aucune erreur du mod." : string.Format("{0} erreur(s) du mod : {1}", errors.Count, string.Join(" | ", errors.Distinct().Take(10)))); } } public abstract class BrotherAI : EnemyAI { protected MarioModel model; protected string[] stateNames; private readonly Queue<GameObject> recentNodes = new Queue<GameObject>(); private Vector3 stuckCheckPos; private float stuckTimer; protected float stateTimer; private float litFor; private float darkFor; private int lastSeenState = -1; protected float musicVolume; protected float basePitch = 1f; private float voiceCooldown; private bool[] wasDead = new bool[0]; private bool powerListenerAdded; protected Vector3 lastPos; protected float walkCycle; protected float moveSpeed; private float musicHoldUntil; protected bool SelfLit { get; private set; } protected float DarkTime => darkFor; protected abstract ModelStyle Style { get; } protected bool Halted { get; private set; } protected PlayerControllerB LocalPlayer { get { if (!((Object)(object)GameNetworkManager.Instance != (Object)null)) { return null; } return GameNetworkManager.Instance.localPlayerController; } } protected float Swing => Mathf.Sin(walkCycle) * Mathf.Clamp01(moveSpeed / 4f) * 40f; public static T FindSpawned<T>() where T : EnemyAI { List<EnemyAI> list = (((Object)(object)RoundManager.Instance != (Object)null) ? RoundManager.Instance.SpawnedEnemies : null); if (list == null) { return default(T); } foreach (EnemyAI item in list) { T val = (T)(object)((item is T) ? item : null); if (val != null && (Object)(object)val != (Object)null && !((EnemyAI)val).isEnemyDead) { return val; } } return default(T); } public override void Start() { //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0033: Unknown result type (might be due to invalid IL or missing references) //IL_003f: Unknown result type (might be due to invalid IL or missing references) //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) model = MarioModel.Build(((Component)this).transform, Plugin.ModelScale.Value, Style); ((EnemyAI)this).Start(); lastPos = ((Component)this).transform.position; stuckCheckPos = ((Component)this).transform.position; SelfLit = MarioLight.IsFacilityLit(((Component)this).transform.position); base.creatureSFX.loop = true; base.creatureSFX.volume = 0f; if ((Object)(object)RoundManager.Instance != (Object)null && RoundManager.Instance.onPowerSwitch != null) { ((UnityEvent<bool>)(object)RoundManager.Instance.onPowerSwitch).AddListener((UnityAction<bool>)OnPowerSwitch); powerListenerAdded = true; } } public override void OnDestroy() { if (powerListenerAdded && (Object)(object)RoundManager.Instance != (Object)null) { ((UnityEvent<bool>)(object)RoundManager.Instance.onPowerSwitch).RemoveListener((UnityAction<bool>)OnPowerSwitch); } ((EnemyAI)this).OnDestroy(); } public override void DoAIInterval() { //IL_007c: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).DoAIInterval(); StartOfRound instance = StartOfRound.Instance; Halted = (Object)(object)instance == (Object)null || instance.shipIsLeaving || !instance.shipHasLanded || instance.allPlayersDead || base.allAINodes == null || base.allAINodes.Length == 0; if (Halted) { base.agent.speed = 0f; return; } float aIIntervalTime = base.AIIntervalTime; stateTimer += aIIntervalTime; if (MarioLight.IsFacilityLit(((Component)this).transform.position)) { litFor += aIIntervalTime; darkFor = 0f; } else { darkFor += aIIntervalTime; litFor = 0f; } if (!SelfLit && litFor >= 0.4f) { SelfLit = true; } if (SelfLit && darkFor >= 0.8f) { SelfLit = false; } } protected void SwitchState(int state) { if (state != base.currentBehaviourStateIndex) { if (Plugin.DebugLogs.Value) { Plugin.Log.LogInfo((object)("[" + base.enemyType.enemyName + "] " + Name(base.currentBehaviourStateIndex) + " -> " + Name(state) + (((Object)(object)base.targetPlayer != (Object)null) ? (" (cible " + base.targetPlayer.playerUsername + ")") : ""))); } stateTimer = 0f; stuckTimer = 0f; ((EnemyAI)this).SwitchToBehaviourState(state); } } protected string Name(int s) { if (stateNames == null || s < 0 || s >= stateNames.Length) { return s.ToString(); } return stateNames[s]; } protected bool IsStuck(float dt) { //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) if (base.agent.speed < 0.5f || Vector3.Distance(((Component)this).transform.position, base.destination) < 1.5f) { stuckTimer = 0f; stuckCheckPos = ((Component)this).transform.position; return false; } stuckTimer += dt; if (stuckTimer < 3f) { return false; } bool result = Vector3.Distance(((Component)this).transform.position, stuckCheckPos) < 1f; stuckTimer = 0f; stuckCheckPos = ((Component)this).transform.position; return result; } protected bool Arrived(float within = 1.6f) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) return Vector3.Distance(((Component)this).transform.position, base.destination) < within; } protected Vector3? PickNode(float minDist, float maxDist, bool? wantLit, Func<Vector3, float> score = null, int samples = 30) { //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00a4: Unknown result type (might be due to invalid IL or missing references) //IL_00cf: Unknown result type (might be due to invalid IL or missing references) GameObject[] allAINodes = base.allAINodes; if (allAINodes == null || allAINodes.Length == 0) { return null; } GameObject val = null; float num = float.MaxValue; for (int i = 0; i < samples; i++) { GameObject val2 = allAINodes[Random.Range(0, allAINodes.Length)]; if ((Object)(object)val2 == (Object)null || recentNodes.Contains(val2)) { continue; } Vector3 position = val2.transform.position; float num2 = Vector3.Distance(position, ((Component)this).transform.position); if (!(num2 < minDist) && !(num2 > maxDist)) { float num3 = score?.Invoke(position) ?? Random.value; if (!(num3 >= num) && (!wantLit.HasValue || MarioLight.IsFacilityLit(position) == wantLit.Value) && base.agent.CalculatePath(position, base.path1) && (int)base.path1.status == 0) { val = val2; num = num3; } } } if ((Object)(object)val == (Object)null) { return null; } recentNodes.Enqueue(val); while (recentNodes.Count > 8) { recentNodes.Dequeue(); } return val.transform.position; } protected bool HasPath(Vector3 p) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Invalid comparison between Unknown and I4 if (base.agent.CalculatePath(p, base.path1)) { return (int)base.path1.status == 0; } return false; } protected static float FlatAngleFromView(PlayerControllerB p, Vector3 point) { //IL_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) Vector3 forward = ((Component)p.gameplayCamera).transform.forward; forward.y = 0f; Vector3 val = point - ((Component)p).transform.position; val.y = 0f; return Vector3.Angle(forward, val); } protected bool Visible(PlayerControllerB p, float width = 120f, int range = 30) { //IL_0015: Unknown result type (might be due to invalid IL or missing references) if ((Object)(object)p != (Object)null) { return ((EnemyAI)this).CheckLineOfSightForPosition(((Component)p.gameplayCamera).transform.position, width, range, 4f, (Transform)null); } return false; } public override void Update() { //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010e: Unknown result type (might be due to invalid IL or missing references) ((EnemyAI)this).Update(); if (!base.isEnemyDead && model != null) { float deltaTime = Time.deltaTime; if (voiceCooldown > 0f) { voiceCooldown -= deltaTime; } int currentBehaviourStateIndex = base.currentBehaviourStateIndex; if (currentBehaviourStateIndex != lastSeenState) { int previous = lastSeenState; lastSeenState = currentBehaviourStateIndex; OnStateChangedLocal(previous, currentBehaviourStateIndex); } CheckPlayerDeaths(); float num = ((Time.time < musicHoldUntil) ? 1f : musicVolume); base.creatureSFX.volume = Mathf.MoveTowards(base.creatureSFX.volume, num, deltaTime * ((num > base.creatureSFX.volume) ? 2.5f : 0.5f)); if (num <= 0f && base.creatureSFX.volume <= 0f && base.creatureSFX.isPlaying) { base.creatureSFX.Stop(); } Vector3 val = ((Component)this).transform.position - lastPos; lastPos = ((Component)this).transform.position; val.y = 0f; moveSpeed = Mathf.Lerp(moveSpeed, ((Vector3)(ref val)).magnitude / Mathf.Max(deltaTime, 0.0001f), deltaTime * 8f); walkCycle += moveSpeed * deltaTime * 2.3f; Animate(deltaTime); } } protected abstract void OnStateChangedLocal(int previous, int state); protected abstract void Animate(float dt); protected virtual void OnPowerSwitch(bool on) { } protected virtual void OnPlayerDiedNear(PlayerControllerB p) { } protected void Music(float volume, float pitch = 1f, float distortion = 0f, float hold = 0f) { //IL_013f: 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_01fc: Unknown result type (might be due to invalid IL or missing references) if (volume <= 0f && hold > 0f && musicVolume > 0f) { musicHoldUntil = Time.time + hold; } else if (volume <= 0f) { musicHoldUntil = 0f; } musicVolume = volume; base.creatureSFX.pitch = basePitch * pitch; AudioDistortionFilter component = ((Component)base.creatureSFX).GetComponent<AudioDistortionFilter>(); if ((Object)(object)component != (Object)null) { component.distortionLevel = distortion; } if (volume > 0f && !base.creatureSFX.isPlaying && (Object)(object)base.creatureSFX.clip != (Object)null) { base.creatureSFX.volume = 0f; base.creatureSFX.Play(); } if (Plugin.DebugLogs.Value && volume > 0f) { AudioListener val = Object.FindObjectOfType<AudioListener>(); Plugin.Log.LogInfo((object)("[" + base.enemyType.enemyName + "] musique : clip=" + (((Object)(object)base.creatureSFX.clip != (Object)null) ? (((Object)base.creatureSFX.clip).name + $" ({base.creatureSFX.clip.loadState}, {base.creatureSFX.clip.length:0}s)") : "AUCUN") + " " + $"joue={base.creatureSFX.isPlaying} enabled={((Behaviour)base.creatureSFX).isActiveAndEnabled} mute={base.creatureSFX.mute} " + $"volumeGlobal={AudioListener.volume:0.00} pause={AudioListener.pause} " + string.Format("distanceÉcoute={0} max={1}", ((Object)(object)val != (Object)null) ? Vector3.Distance(((Component)val).transform.position, ((Component)base.creatureSFX).transform.position).ToString("0.0") : "?", base.creatureSFX.maxDistance))); } } protected void Say(string key, float volume = 1f, AudioClip fallback = null, bool force = false) { if (!(voiceCooldown > 0f) || force) { AudioClip val = MarioSounds.Voice(key) ?? fallback; if (!((Object)(object)val == (Object)null)) { base.creatureVoice.PlayOneShot(val, volume); WalkieTalkie.TransmitOneShotAudio(base.creatureVoice, val, volume * 0.6f); voiceCooldown = Mathf.Max(1.5f, val.length); } } } protected bool LocalNear(float dist) { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB localPlayer = LocalPlayer; if ((Object)(object)localPlayer != (Object)null && !localPlayer.isPlayerDead) { return Vector3.Distance(((Component)localPlayer).transform.position, ((Component)this).transform.position) < dist; } return false; } private void CheckPlayerDeaths() { //IL_0071: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; if (wasDead.Length != allPlayerScripts.Length) { wasDead = new bool[allPlayerScripts.Length]; for (int i = 0; i < allPlayerScripts.Length; i++) { wasDead[i] = allPlayerScripts[i].isPlayerDead; } return; } for (int j = 0; j < allPlayerScripts.Length; j++) { bool isPlayerDead = allPlayerScripts[j].isPlayerDead; if (isPlayerDead && !wasDead[j] && !allPlayerScripts[j].isPlayerControlled && Vector3.Distance(((Component)allPlayerScripts[j]).transform.position, ((Component)this).transform.position) < 25f) { OnPlayerDiedNear(allPlayerScripts[j]); } wasDead[j] = isPlayerDead; } } protected void Pose(Vector3 lArm, Vector3 rArm, Vector3 lElbow, Vector3 rElbow, float hunch, float dt, float speed = 10f) { //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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: Unknown result type (might be due to invalid IL or missing references) //IL_004e: Unknown result type (might be due to invalid IL or missing references) //IL_0054: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0080: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_010f: Unknown result type (might be due to invalid IL or missing references) float num = dt * speed; model.LeftArm.localRotation = Quaternion.Slerp(model.LeftArm.localRotation, Quaternion.Euler(lArm), num); model.RightArm.localRotation = Quaternion.Slerp(model.RightArm.localRotation, Quaternion.Euler(rArm), num); model.LeftElbow.localRotation = Quaternion.Slerp(model.LeftElbow.localRotation, Quaternion.Euler(lElbow), num); model.RightElbow.localRotation = Quaternion.Slerp(model.RightElbow.localRotation, Quaternion.Euler(rElbow), num); model.Torso.localRotation = Quaternion.Slerp(model.Torso.localRotation, Quaternion.Euler(hunch, 0f, Mathf.Sin(walkCycle * 0.5f) * Mathf.Clamp01(moveSpeed / 4f) * 4f), dt * 5f); } protected void Legs(float amplitude = 40f) { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_00d6: Unknown result type (might be due to invalid IL or missing references) float num = Mathf.Clamp01(moveSpeed / 4f); float num2 = Mathf.Sin(walkCycle) * num * amplitude; model.LeftLeg.localRotation = Quaternion.Euler(num2, 0f, 0f); model.RightLeg.localRotation = Quaternion.Euler(0f - num2, 0f, 0f); model.LeftKnee.localRotation = Quaternion.Euler(Mathf.Max(0f, 0f - Mathf.Sin(walkCycle)) * num * amplitude * 1.1f, 0f, 0f); model.RightKnee.localRotation = Quaternion.Euler(Mathf.Max(0f, Mathf.Sin(walkCycle)) * num * amplitude * 1.1f, 0f, 0f); } } internal class DebugSpawner : MonoBehaviour { internal static EnemyType[] Types = (EnemyType[])(object)new EnemyType[0]; private bool spawnedThisRound; public static DebugSpawner Create() { //IL_0005: Unknown result type (might be due to invalid IL or missing references) //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Expected O, but got Unknown GameObject val = new GameObject("TerrifyingMarioDebugSpawner") { hideFlags = (HideFlags)61 }; Object.DontDestroyOnLoad((Object)val); return val.AddComponent<DebugSpawner>(); } private void Update() { //IL_0091: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_01d1: Unknown result type (might be due to invalid IL or missing references) //IL_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_0207: Unknown result type (might be due to invalid IL or missing references) //IL_0218: Unknown result type (might be due to invalid IL or missing references) //IL_021e: Unknown result type (might be due to invalid IL or missing references) if (!Plugin.SpawnAtStart.Value) { return; } StartOfRound instance = StartOfRound.Instance; RoundManager instance2 = RoundManager.Instance; if ((Object)(object)instance == (Object)null || (Object)(object)instance2 == (Object)null) { return; } if (!instance.shipHasLanded) { spawnedThisRound = false; } else { if (spawnedThisRound || !((NetworkBehaviour)instance2).IsServer || !instance2.dungeonCompletedGenerating) { return; } spawnedThisRound = true; if (instance2.insideAINodes == null || instance2.insideAINodes.Length == 0) { Plugin.Log.LogWarning((object)"Mode test : aucun nœud IA intérieur (lune sans installation ?)."); return; } Vector3 entrance = instance2.insideAINodes[0].transform.position; EntranceTeleport val = ((IEnumerable<EntranceTeleport>)Object.FindObjectsOfType<EntranceTeleport>()).FirstOrDefault((Func<EntranceTeleport, bool>)((EntranceTeleport e) => e.entranceId == 0 && !e.isEntranceToBuilding)); if ((Object)(object)val != (Object)null) { entrance = (((Object)(object)val.entrancePoint != (Object)null) ? val.entrancePoint.position : ((Component)val).transform.position); } GameObject[] source = instance2.insideAINodes.Where((GameObject n) => (Object)(object)n != (Object)null).ToArray(); GameObject[] array = source.Where(delegate(GameObject n) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000c: Unknown result type (might be due to invalid IL or missing references) float num3 = Vector3.Distance(n.transform.position, entrance); return num3 > 15f && num3 < 35f; }).ToArray(); EnemyType[] types = Types; foreach (EnemyType type in types) { GameObject val2 = ((array.Length != 0) ? array[Random.Range(0, array.Length)] : source.OrderBy((GameObject n) => Vector3.Distance(n.transform.position, entrance)).First()); int num2 = instance2.currentLevel.Enemies.FindIndex((SpawnableEnemyWithRarity e) => (Object)(object)e.enemyType == (Object)(object)type); instance2.SpawnEnemyGameObject(val2.transform.position, 0f, num2, type); Plugin.Log.LogInfo((object)$"Mode test : {type.enemyName} apparu à {val2.transform.position} ({Vector3.Distance(val2.transform.position, entrance):0} m de l'entrée)."); } } } } internal static class MarioFactory { public static (EnemyType, TerminalNode, TerminalKeyword) CreateMario() { return Create<TerrifyingMarioAI>("TerrifyingMario", "Mario", "mario", new string[9] { "Roam", "Stalk", "Chase", "Flee", "GoToBreaker", "Sabotage", "Darken", "Investigate", "Retreat" }, "Il a peur de la lumière.", "MARIO\n\nSigurd's danger level: ??? \n\nUn plombier d'origine inconnue, bien plus grand que dans les souvenirs d'enfance. Il erre dans les couloirs obscurs sans un bruit... jusqu'à ce qu'il vous trouve.\n\nIl ne supporte pas la lumière. Un faisceau de lampe torche braqué sur lui le fait hurler et fuir. Il n'attaque jamais dans la lumière : c'est pour ça qu'il coupe le disjoncteur.\n\nNe laissez jamais votre batterie se vider.\n\n"); } public static (EnemyType, TerminalNode, TerminalKeyword) CreateLuigi() { return Create<TerrifyingLuigiAI>("TerrifyingLuigi", "Luigi", "luigi", new string[7] { "Wander", "Follow", "Panic", "Cower", "Charge", "Recover", "Scared" }, "Il cherche son frère.", "LUIGI\n\nSigurd's danger level: ??? \n\nGrand, maigre, terrifié. Il appelle son frère dans les couloirs : « Mario ? »\n\nIl a peur du noir et s'enfuit dès que les lumières s'éteignent. Sous les lampes, il suit l'équipe comme un chien perdu, en appelant Mario.\n\nMais il déteste les lampes torches. Allumez-en une devant lui et il vous fonce dessus.\n\n"); } private static (EnemyType, TerminalNode, TerminalKeyword) Create<TAI>(string id, string displayName, string keywordWord, string[] states, string scanSub, string terminal) where TAI : EnemyAI { //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_01ba: Unknown result type (might be due to invalid IL or missing references) //IL_029b: Unknown result type (might be due to invalid IL or missing references) //IL_02a0: Unknown result type (might be due to invalid IL or missing references) //IL_02b2: Unknown result type (might be due to invalid IL or missing references) //IL_02b9: Unknown result type (might be due to invalid IL or missing references) //IL_02c4: 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_030f: Unknown result type (might be due to invalid IL or missing references) //IL_0319: Unknown result type (might be due to invalid IL or missing references) //IL_0342: Unknown result type (might be due to invalid IL or missing references) //IL_0347: Unknown result type (might be due to invalid IL or missing references) //IL_0359: Unknown result type (might be due to invalid IL or missing references) //IL_036e: Unknown result type (might be due to invalid IL or missing references) //IL_0378: Unknown result type (might be due to invalid IL or missing references) //IL_037f: Unknown result type (might be due to invalid IL or missing references) //IL_038c: Unknown result type (might be due to invalid IL or missing references) EnemyType val = ScriptableObject.CreateInstance<EnemyType>(); ((Object)val).name = id; val.enemyName = displayName; val.probabilityCurve = AnimationCurve.Constant(0f, 1f, 1f); val.numberSpawnedFalloff = AnimationCurve.Constant(0f, 1f, 1f); val.useNumberSpawnedFalloff = false; val.spawningDisabled = false; val.MaxCount = 1; val.PowerLevel = 2f; val.isOutsideEnemy = false; val.isDaytimeEnemy = false; val.canDie = false; val.destroyOnDeath = false; val.canBeStunned = true; val.stunTimeMultiplier = 0.6f; val.doorSpeedMultiplier = 2f; val.canSeeThroughFog = false; val.loudnessMultiplier = 1f; int layer = LayerMask.NameToLayer("Enemies"); int layer2 = LayerMask.NameToLayer("ScanNode"); GameObject val2 = NetworkPrefabs.CreateNetworkPrefab(id); val2.layer = layer; NavMeshAgent obj = val2.AddComponent<NavMeshAgent>(); obj.speed = 4f; obj.angularSpeed = 720f; obj.acceleration = 35f; obj.stoppingDistance = 0f; obj.radius = 0.4f; obj.height = 2.3f; obj.autoBraking = false; TAI val3 = val2.AddComponent<TAI>(); ((EnemyAI)val3).enemyType = val; ((EnemyAI)val3).enemyHP = 99; ((EnemyAI)val3).AIIntervalTime = 0.2f; ((EnemyAI)val3).enemyBehaviourStates = Array.ConvertAll(states, (Converter<string, EnemyBehaviourState>)((string s) => new EnemyBehaviourState { name = s })); Transform transform = new GameObject("Eye").transform; transform.SetParent(val2.transform, false); transform.localPosition = new Vector3(0f, 2.1f, 0.25f); ((EnemyAI)val3).eye = transform; ((EnemyAI)val3).creatureSFX = CreateAudio(val2.transform, id + "Music", 45f); ((EnemyAI)val3).creatureSFX.minDistance = 5f; ((Component)((EnemyAI)val3).creatureSFX).gameObject.AddComponent<AudioReverbFilter>().reverbPreset = (AudioReverbPreset)13; ((Component)((EnemyAI)val3).creatureSFX).gameObject.AddComponent<AudioDistortionFilter>().distortionLevel = 0f; ((EnemyAI)val3).creatureVoice = CreateAudio(val2.transform, id + "Voice", 40f); ((Component)((EnemyAI)val3).creatureVoice).gameObject.AddComponent<AudioReverbFilter>().reverbPreset = (AudioReverbPreset)13; GameObject val4 = new GameObject(id + "Collision"); val4.transform.SetParent(val2.transform, false); val4.layer = layer; val4.tag = "Enemy"; BoxCollider obj2 = val4.AddComponent<BoxCollider>(); ((Collider)obj2).isTrigger = true; float value = Plugin.HitboxSize.Value; obj2.center = new Vector3(0f, 1.25f, 0.2f * value); obj2.size = new Vector3(1f * value, 2.5f, 1.2f * value); Rigidbody obj3 = val4.AddComponent<Rigidbody>(); obj3.isKinematic = true; obj3.useGravity = false; val4.AddComponent<EnemyAICollisionDetect>().mainScript = (EnemyAI)(object)val3; GameObject val5 = new GameObject("ScanNode"); val5.transform.SetParent(val2.transform, false); val5.transform.localPosition = new Vector3(0f, 1.9f, 0f); val5.layer = layer2; BoxCollider obj4 = val5.AddComponent<BoxCollider>(); ((Collider)obj4).isTrigger = true; obj4.size = Vector3.one; ScanNodeProperties obj5 = val5.AddComponent<ScanNodeProperties>(); obj5.headerText = displayName + " ?"; obj5.subText = scanSub; obj5.nodeType = 1; obj5.minRange = 1; obj5.maxRange = 25; obj5.requiresLineOfSight = true; val.enemyPrefab = val2; TerminalNode val6 = ScriptableObject.CreateInstance<TerminalNode>(); ((Object)val6).name = id + "File"; val6.creatureName = displayName; val6.clearPreviousText = true; val6.maxCharactersToType = 35; val6.displayText = terminal; TerminalKeyword val7 = ScriptableObject.CreateInstance<TerminalKeyword>(); ((Object)val7).name = id + "Keyword"; val7.word = keywordWord; val7.isVerb = false; return (val, val6, val7); } private static AudioSource CreateAudio(Transform parent, string name, float maxDistance) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0013: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) GameObject val = new GameObject(name); val.transform.SetParent(parent, false); val.transform.localPosition = new Vector3(0f, 1.8f, 0f); AudioSource obj = val.AddComponent<AudioSource>(); obj.playOnAwake = false; obj.spatialBlend = 1f; obj.rolloffMode = (AudioRolloffMode)1; obj.minDistance = 2f; obj.maxDistance = maxDistance; obj.dopplerLevel = 0f; return obj; } } internal enum LightKind { None, Facility, Flashlight } internal static class MarioLight { private const float FlashlightAuraRadius = 3.5f; private static float lastPowerCheck = -10f; private static bool lastPower; private static BreakerBox cachedBox; private static float lastBoxSearch = -10f; public static bool HasLightOn(PlayerControllerB p) { if ((Object)(object)p == (Object)null || !p.isPlayerControlled || p.isPlayerDead) { return false; } GrabbableObject currentlyHeldObjectServer = p.currentlyHeldObjectServer; FlashlightItem val = (FlashlightItem)(object)((currentlyHeldObjectServer is FlashlightItem) ? currentlyHeldObjectServer : null); if (val != null && Works(val)) { return true; } GrabbableObject pocketedFlashlight = p.pocketedFlashlight; FlashlightItem val2 = (FlashlightItem)(object)((pocketedFlashlight is FlashlightItem) ? pocketedFlashlight : null); if (val2 != null && Works(val2) && (Object)(object)p.helmetLight != (Object)null && ((Behaviour)p.helmetLight).enabled) { return true; } return false; } private static bool Works(FlashlightItem f) { if (!((GrabbableObject)f).isBeingUsed) { return false; } if (f.flashlightInterferenceLevel >= 2 || FlashlightItem.globalFlashlightInterferenceLevel >= 2) { return false; } if (((GrabbableObject)f).insertedBattery != null) { return !((GrabbableObject)f).insertedBattery.empty; } return true; } public static bool BeamHits(PlayerControllerB p, Vector3 target) { //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001d: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_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_0057: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) if (!HasLightOn(p)) { return false; } Transform transform = ((Component)p.gameplayCamera).transform; Vector3 val = target - transform.position; float value = Plugin.FlashlightRange.Value; if (((Vector3)(ref val)).sqrMagnitude > value * value) { return false; } if (Vector3.Angle(transform.forward, val) > Plugin.FlashlightHalfAngle.Value) { return false; } return !Physics.Linecast(transform.position, target, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1); } public static LightKind At(Vector3 pos) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) if (IsFacilityLit(pos)) { return LightKind.Facility; } PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts; foreach (PlayerControllerB val in allPlayerScripts) { if (HasLightOn(val)) { Vector3 val2 = ((Component)val).transform.position - pos; if (((Vector3)(ref val2)).sqrMagnitude < 12.25f) { return LightKind.Flashlight; } } } return LightKind.None; } public static bool IsFacilityLit(Vector3 pos) { //IL_002c: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0037: Unknown result type (might be due to invalid IL or missing references) //IL_003c: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Unknown result type (might be due to invalid IL or missing references) //IL_007c: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00b3: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_00db: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Unknown result type (might be due to invalid IL or missing references) //IL_00f1: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fd: Unknown result type (might be due to invalid IL or missing references) //IL_00fe: Unknown result type (might be due to invalid IL or missing references) RoundManager instance = RoundManager.Instance; if ((Object)(object)instance == (Object)null || instance.allPoweredLightsAnimators == null || instance.powerOffPermanently) { return false; } float value = Plugin.FacilityLightRadius.Value; Vector3 val = pos + Vector3.up * 1.2f; foreach (Animator allPoweredLightsAnimator in instance.allPoweredLightsAnimators) { if ((Object)(object)allPoweredLightsAnimator == (Object)null || !((Behaviour)allPoweredLightsAnimator).isActiveAndEnabled) { continue; } Vector3 position = ((Component)allPoweredLightsAnimator).transform.position; float num = position.y - pos.y; if (num < -1.5f || num > 7f) { continue; } float num2 = position.x - pos.x; float num3 = position.z - pos.z; if (!(num2 * num2 + num3 * num3 > value * value) && LightOn(allPoweredLightsAnimator)) { Vector3 val2 = val - position; Vector3 val3 = position + ((Vector3)(ref val2)).normalized * 0.4f; if (!Physics.Linecast(val, val3, StartOfRound.Instance.collidersAndRoomMaskAndDefault, (QueryTriggerInteraction)1)) { return true; } } } return false; } private static bool LightOn(Animator a) { try { return a.GetBool("on"); } catch { return true; } } public static bool PowerOn() { RoundManager instance = RoundManager.Instance; if ((Object)(object)instance == (Object)null || instance.powerOffPermanently || instance.allPoweredLightsAnimators == null) { return false; } if (Time.time - lastPowerCheck < 0.5f) { return lastPower; } lastPowerCheck = Time.time; lastPower = false; foreach (Animator allPoweredLightsAnimator in instance.allPoweredLightsAnimators) { if ((Object)(object)allPoweredLightsAnimator != (Object)null && ((Behaviour)allPoweredLightsAnimator).isActiveAndEnabled && LightOn(allPoweredLightsAnimator)) { lastPower = true; break; } } return lastPower; } public static BreakerBox FindBreaker() { //IL_0017: 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_006d: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) Scene scene; if ((Object)(object)cachedBox != (Object)null) { scene = ((Component)cachedBox).gameObject.scene; if (((Scene)(ref scene)).isLoaded) { return cachedBox; } } if (Time.time - lastBoxSearch < 3f) { return null; } lastBoxSearch = Time.time; cachedBox = null; BreakerBox[] array = Resources.FindObjectsOfTypeAll<BreakerBox>(); foreach (BreakerBox val in array) { if ((Object)(object)val != (Object)null) { scene = ((Component)val).gameObject.scene; if (((Scene)(ref scene)).isLoaded) { cachedBox = val; break; } } } return cachedBox; } public static void CutPower() { RoundManager instance = RoundManager.Instance; BreakerBox val = FindBreaker(); if (!((Object)(object)instance == (Object)null) && !((Object)(object)val == (Object)null) && PowerOn()) { val.SetSwitchesOff(); val.isPowerOn = false; if ((Object)(object)val.breakerBoxHum != (Object)null) { val.breakerBoxHum.Stop(); } if (((NetworkBehaviour)instance).IsServer) { instance.SwitchPower(false); } lastPowerCheck = -10f; } } } public class ModelStyle { public Color Shirt = new Color(0.52f, 0.03f, 0.03f); public char Letter = 'M'; public float Height = 1f; public float Width = 1f; public bool Grin = true; public static readonly ModelStyle Mario = new ModelStyle(); public static readonly ModelStyle Luigi = new ModelStyle { Shirt = new Color(0.04f, 0.38f, 0.07f), Letter = 'L', Height = 1.1f, Width = 0.88f, Grin = false }; } public class MarioModel { public Transform Root; public Transform Torso; public Transform Head; public Transform LeftArm; public Transform RightArm; public Transform LeftElbow; public Transform RightElbow; public Transform LeftLeg; public Transform RightLeg; public Transform LeftKnee; public Transform RightKnee; private static Material blue; private static Material skin; private static Material white; private static Material hair; private static Material brown; private static Material black; private static Material yellow; private static Material eyeGlow; private static readonly Dictionary<Color, Material> shirtMats = new Dictionary<Color, Material>(); private static Material red; private static Material darkRed; private static ModelStyle style; private static Material Lit(Color c, float smoothness = 0.25f) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0031: 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) Material val = new Material(Shader.Find("HDRP/Lit") ?? Shader.Find("Standard")); if (val.HasProperty("_BaseColor")) { val.SetColor("_BaseColor", c); } if (val.HasProperty("_Smoothness")) { val.SetFloat("_Smoothness", smoothness); } val.color = c; return val; } private static Material Unlit(Color c) { //IL_0018: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Expected O, but got Unknown //IL_0038: 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) Material val = new Material(Shader.Find("HDRP/Unlit") ?? Shader.Find("Unlit/Color")); if (val.HasProperty("_UnlitColor")) { val.SetColor("_UnlitColor", c); } val.color = c; return val; } private static void EnsureMaterials() { //IL_001d: 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_0063: 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_00a9: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Unknown result type (might be due to invalid IL or missing references) //IL_0112: Unknown result type (might be due to invalid IL or missing references) if (!((Object)(object)blue != (Object)null)) { blue = Lit(new Color(0.07f, 0.11f, 0.38f), 0.15f); skin = Lit(new Color(0.74f, 0.58f, 0.49f), 0.35f); white = Lit(new Color(0.86f, 0.84f, 0.8f), 0.4f); hair = Lit(new Color(0.12f, 0.06f, 0.03f), 0.1f); brown = Lit(new Color(0.23f, 0.12f, 0.05f), 0.3f); black = Lit(new Color(0.005f, 0.005f, 0.005f), 0.6f); yellow = Lit(new Color(0.75f, 0.58f, 0.12f), 0.7f); eyeGlow = Unlit(new Color(1f, 0.04f, 0.02f)); } } private static Transform Pivot(string name, Transform parent, Vector3 pos) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) Transform transform = new GameObject(name).transform; transform.SetParent(parent, false); transform.localPosition = pos; ((Component)transform).gameObject.layer = ((Component)parent).gameObject.layer; return transform; } private static void Part(PrimitiveType type, Transform parent, Vector3 pos, Vector3 scale, Material mat, Vector3 euler = default(Vector3)) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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) GameObject obj = GameObject.CreatePrimitive(type); Object.DestroyImmediate((Object)(object)obj.GetComponent<Collider>()); obj.transform.SetParent(parent, false); obj.transform.localPosition = pos; obj.transform.localEulerAngles = euler; obj.transform.localScale = scale; ((Renderer)obj.GetComponent<MeshRenderer>()).sharedMaterial = mat; obj.layer = ((Component)parent).gameObject.layer; } private static void Sphere(Transform p, Vector3 pos, Vector3 scale, Material m, Vector3 euler = default(Vector3)) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Part((PrimitiveType)0, p, pos, scale, m, euler); } private static void Capsule(Transform p, Vector3 pos, Vector3 scale, Material m, Vector3 euler = default(Vector3)) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Part((PrimitiveType)1, p, pos, scale, m, euler); } private static void Cube(Transform p, Vector3 pos, Vector3 scale, Material m, Vector3 euler = default(Vector3)) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Part((PrimitiveType)3, p, pos, scale, m, euler); } private static void Disc(Transform p, Vector3 pos, Vector3 scale, Material m, Vector3 euler = default(Vector3)) { //IL_0002: Unknown result type (might be due to invalid IL or missing references) //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_0005: Unknown result type (might be due to invalid IL or missing references) Part((PrimitiveType)2, p, pos, scale, m, euler); } public static MarioModel Build(Transform owner, float scale, ModelStyle s) { //IL_0011: 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_0090: Unknown result type (might be due to invalid IL or missing references) //IL_00ac: Unknown result type (might be due to invalid IL or missing references) //IL_00c1: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00dc: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0121: Unknown result type (might be due to invalid IL or missing references) //IL_0156: Unknown result type (might be due to invalid IL or missing references) //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_0176: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01d6: Unknown result type (might be due to invalid IL or missing references) //IL_0023: 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_0052: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) EnsureMaterials(); style = s; if (!shirtMats.TryGetValue(s.Shirt, out red)) { red = Lit(s.Shirt); shirtMats[s.Shirt] = red; shirtMats[s.Shirt * 0.6f] = Lit(s.Shirt * 0.6f); } darkRed = shirtMats[s.Shirt * 0.6f]; MarioModel marioModel = new MarioModel(); marioModel.Root = Pivot("MarioModel", owner, Vector3.zero); marioModel.Root.localScale = Vector3.one * scale; Transform val = Pivot("Body", marioModel.Root, Vector3.zero); val.localScale = new Vector3(s.Width, s.Height, s.Width); BuildLegs(marioModel, val); marioModel.Torso = Pivot("Torso", val, new Vector3(0f, 0.92f, 0f)); BuildBody(marioModel.Torso); BuildArms(marioModel); Disc(marioModel.Torso, new Vector3(0f, 0.83f, 0.01f), new Vector3(0.16f, 0.06f, 0.16f), skin); marioModel.Head = Pivot("Head", marioModel.Torso, new Vector3(0f, 0.86f, 0.04f)); marioModel.Head.localScale = new Vector3(1f / s.Width, 1f / s.Height, 1f / s.Width); BuildHead(marioModel.Head); return marioModel; } private static void BuildLegs(MarioModel m, Transform body) { //IL_0016: 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_0065: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_00ff: Unknown result type (might be due to invalid IL or missing references) //IL_0113: Unknown result type (might be due to invalid IL or missing references) //IL_011f: Unknown result type (might be due to invalid IL or missing references) //IL_0125: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_014f: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0177: Unknown result type (might be due to invalid IL or missing references) //IL_018b: Unknown result type (might be due to invalid IL or missing references) //IL_0197: Unknown result type (might be due to invalid IL or missing references) //IL_019d: Unknown result type (might be due to invalid IL or missing references) //IL_01b2: Unknown result type (might be due to invalid IL or missing references) //IL_01c6: Unknown result type (might be due to invalid IL or missing references) //IL_01d2: Unknown result type (might be due to invalid IL or missing references) //IL_01d8: Unknown result type (might be due to invalid IL or missing references) m.LeftLeg = Pivot("LegL", body, new Vector3(-0.13f, 0.92f, 0f)); m.RightLeg = Pivot("LegR", body, new Vector3(0.13f, 0.92f, 0f)); m.LeftKnee = Pivot("KneeL", m.LeftLeg, new Vector3(0f, -0.44f, 0f)); m.RightKnee = Pivot("KneeR", m.RightLeg, new Vector3(0f, -0.44f, 0f)); (Transform, Transform)[] array = new(Transform, Transform)[2] { (m.LeftLeg, m.LeftKnee), (m.RightLeg, m.RightKnee) }; for (int i = 0; i < array.Length; i++) { var (p, p2) = array[i]; Capsule(p, new Vector3(0f, -0.22f, 0f), new Vector3(0.21f, 0.24f, 0.21f), blue); Capsule(p2, new Vector3(0f, -0.2f, 0f), new Vector3(0.18f, 0.22f, 0.18f), blue); Sphere(p2, new Vector3(0f, -0.41f, 0.08f), new Vector3(0.23f, 0.14f, 0.38f), brown); Cube(p2, new Vector3(0f, -0.47f, 0.06f), new Vector3(0.22f, 0.03f, 0.36f), hair); } } private static void BuildBody(Transform t) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00ea: 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_0114: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_015b: Unknown result type (might be due to invalid IL or missing references) //IL_0174: Unknown result type (might be due to invalid IL or missing references) //IL_018e: 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_01bb: 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_01e4: Unknown result type (might be due to invalid IL or missing references) //IL_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_01f6: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_0211: 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_0227: Unknown result type (might be due to invalid IL or missing references) //IL_022d: Unknown result type (might be due to invalid IL or missing references) //IL_0243: Unknown result type (might be due to invalid IL or missing references) //IL_0257: Unknown result type (might be due to invalid IL or missing references) //IL_0270: Unknown result type (might be due to invalid IL or missing references) Sphere(t, new Vector3(0f, 0.1f, 0f), new Vector3(0.6f, 0.46f, 0.46f), blue); Sphere(t, new Vector3(0f, 0.32f, 0.03f), new Vector3(0.62f, 0.56f, 0.5f), blue); Sphere(t, new Vector3(0f, 0.6f, -0.02f), new Vector3(0.58f, 0.44f, 0.42f), red); Sphere(t, new Vector3(0f, 0.68f, -0.03f), new Vector3(0.66f, 0.2f, 0.36f), red); Cube(t, new Vector3(0f, 0.5f, 0.235f), new Vector3(0.34f, 0.22f, 0.05f), blue, new Vector3(-8f, 0f, 0f)); Cube(t, new Vector3(-0.16f, 0.66f, 0.18f), new Vector3(0.08f, 0.3f, 0.04f), blue, new Vector3(-22f, 0f, 0f)); Cube(t, new Vector3(0.16f, 0.66f, 0.18f), new Vector3(0.08f, 0.3f, 0.04f), blue, new Vector3(-22f, 0f, 0f)); Sphere(t, new Vector3(-0.15f, 0.54f, 0.255f), Vector3.one * 0.075f, yellow); Sphere(t, new Vector3(0.15f, 0.54f, 0.255f), Vector3.one * 0.075f, yellow); Cube(t, new Vector3(0.05f, 0.25f, 0.27f), new Vector3(0.12f, 0.1f, 0.02f), darkRed, new Vector3(0f, 0f, 12f)); } private static void BuildArms(MarioModel m) { //IL_001b: 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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: 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_010a: 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_011c: Unknown result type (might be due to invalid IL or missing references) //IL_0133: Unknown result type (might be due to invalid IL or missing references) //IL_0147: Unknown result type (might be due to invalid IL or missing references) //IL_0153: Unknown result type (might be due to invalid IL or missing references) //IL_0159: Unknown result type (might be due to invalid IL or missing references) //IL_0170: Unknown result type (might be due to invalid IL or missing references) //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_0190: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_01ad: Unknown result type (might be due to invalid IL or missing references) //IL_01c1: Unknown result type (might be due to invalid IL or missing references) //IL_01cd: Unknown result type (might be due to invalid IL or missing references) //IL_01d3: Unknown result type (might be due to invalid IL or missing references) //IL_01ea: 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_020a: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_023d: Unknown result type (might be due to invalid IL or missing references) //IL_0251: Unknown result type (might be due to invalid IL or missing references) //IL_026d: Unknown result type (might be due to invalid IL or missing references) //IL_028a: Unknown result type (might be due to invalid IL or missing references) //IL_029e: Unknown result type (might be due to invalid IL or missing references) //IL_02ba: Unknown result type (might be due to invalid IL or missing references) //IL_02e2: Unknown result type (might be due to invalid IL or missing references) //IL_02f6: Unknown result type (might be due to invalid IL or missing references) //IL_030f: Unknown result type (might be due to invalid IL or missing references) m.LeftArm = Pivot("ArmL", m.Torso, new Vector3(-0.34f, 0.68f, 0f)); m.RightArm = Pivot("ArmR", m.Torso, new Vector3(0.34f, 0.68f, 0f)); m.LeftElbow = Pivot("ElbowL", m.LeftArm, new Vector3(0f, -0.5f, 0f)); m.RightElbow = Pivot("ElbowR", m.RightArm, new Vector3(0f, -0.5f, 0f)); (Transform, Transform)[] array = new(Transform, Transform)[2] { (m.LeftArm, m.LeftElbow), (m.RightArm, m.RightElbow) }; for (int i = 0; i < array.Length; i++) { var (p, p2) = array[i]; Sphere(p, Vector3.zero, Vector3.one * 0.19f, red); Capsule(p, new Vector3(0f, -0.25f, 0f), new Vector3(0.15f, 0.26f, 0.15f), red); Capsule(p2, new Vector3(0f, -0.24f, 0f), new Vector3(0.12f, 0.25f, 0.12f), skin); Disc(p2, new Vector3(0f, -0.47f, 0f), new Vector3(0.19f, 0.035f, 0.19f), white); Sphere(p2, new Vector3(0f, -0.56f, 0.01f), new Vector3(0.2f, 0.18f, 0.16f), white); for (int j = -1; j <= 2; j++) { float num = ((float)j - 0.5f) * 0.045f; Capsule(p2, new Vector3(num, -0.72f, 0.03f), new Vector3(0.04f, 0.12f, 0.04f), white, new Vector3(-10f, 0f, num * 120f)); Capsule(p2, new Vector3(num * 1.1f, -0.88f, 0.06f), new Vector3(0.028f, 0.06f, 0.028f), black, new Vector3(-25f, 0f, num * 120f)); } Capsule(p2, new Vector3(0f, -0.6f, 0.11f), new Vector3(0.045f, 0.08f, 0.045f), white, new Vector3(-60f, 0f, 0f)); } } private static void BuildHead(Transform h) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0024: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006c: Unknown result type (might be due to invalid IL or missing references) //IL_0072: Unknown result type (might be due to invalid IL or missing references) //IL_0088: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00ae: Unknown result type (might be due to invalid IL or missing references) //IL_00c4: 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_00ea: 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_0114: 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_0126: Unknown result type (might be due to invalid IL or missing references) //IL_013c: Unknown result type (might be due to invalid IL or missing references) //IL_0150: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0178: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) //IL_0198: Unknown result type (might be due to invalid IL or missing references) //IL_019e: Unknown result type (might be due to invalid IL or missing references) //IL_01b4: Unknown result type (might be due to invalid IL or missing references) //IL_01c8: Unknown result type (might be due to invalid IL or missing references) //IL_01d4: 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_01f0: Unknown result type (might be due to invalid IL or missing references) //IL_0204: Unknown result type (might be due to invalid IL or missing references) //IL_0210: Unknown result type (might be due to invalid IL or missing references) //IL_0216: Unknown result type (might be due to invalid IL or missing references) //IL_022c: Unknown result type (might be due to invalid IL or missing references) //IL_0240: Unknown result type (might be due to invalid IL or missing references) //IL_024c: Unknown result type (might be due to invalid IL or missing references) //IL_0252: Unknown result type (might be due to invalid IL or missing references) //IL_0268: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0295: Unknown result type (might be due to invalid IL or missing references) //IL_02af: Unknown result type (might be due to invalid IL or missing references) //IL_02c3: Unknown result type (might be due to invalid IL or missing references) //IL_02dc: Unknown result type (might be due to invalid IL or missing references) //IL_02fb: Unknown result type (might be due to invalid IL or missing references) //IL_0316: Unknown result type (might be due to invalid IL or missing references) //IL_03bb: Unknown result type (might be due to invalid IL or missing references) //IL_03cf: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e1: Unknown result type (might be due to invalid IL or missing references) //IL_03f7: Unknown result type (might be due to invalid IL or missing references) //IL_040b: Unknown result type (might be due to invalid IL or missing references) //IL_0417: Unknown result type (might be due to invalid IL or missing references) //IL_041d: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_0447: Unknown result type (might be due to invalid IL or missing references) //IL_0460: Unknown result type (might be due to invalid IL or missing references) //IL_047a: Unknown result type (might be due to invalid IL or missing references) //IL_048e: Unknown result type (might be due to invalid IL or missing references) //IL_04a7: Unknown result type (might be due to invalid IL or missing references) //IL_033e: Unknown result type (might be due to invalid IL or missing references) //IL_0352: Unknown result type (might be due to invalid IL or missing references) //IL_035e: Unknown result type (might be due to invalid IL or missing references) //IL_0364: Unknown result type (might be due to invalid IL or missing references) //IL_037a: Unknown result type (might be due to invalid IL or missing references) //IL_038e: Unknown result type (might be due to invalid IL or missing references) //IL_039a: Unknown result type (might be due to invalid IL or missing references) //IL_03a0: Unknown result type (might be due to invalid IL or missing references) //IL_04e1: Unknown result type (might be due to invalid IL or missing references) //IL_04f5: Unknown result type (might be due to invalid IL or missing references) //IL_0501: Unknown result type (might be due to invalid IL or missing references) //IL_0507: Unknown result type (might be due to invalid IL or missing references) //IL_051a: Unknown result type (might be due to invalid IL or missing references) //IL_052e: Unknown result type (might be due to invalid IL or missing references) //IL_053a: Unknown result type (might be due to invalid IL or missing references) //IL_0540: Unknown result type (might be due to invalid IL or missing references) //IL_0553: Unknown result type (might be due to invalid IL or missing references) //IL_0567: Unknown result type (might be due to invalid IL or missing references) //IL_0573: Unknown result type (might be due to invalid IL or missing references) //IL_0579: Unknown result type (might be due to invalid IL or missing references) //IL_058c: Unknown result type (might be due to invalid IL or missing references) //IL_0591: Unknown result type (might be due to invalid IL or missing references) //IL_059b: Unknown result type (might be due to invalid IL or missing references) //IL_05a7: Unknown result type (might be due to invalid IL or missing references) //IL_05ad: Unknown result type (might be due to invalid IL or missing references) //IL_05c0: Unknown result type (might be due to invalid IL or missing references) //IL_05d4: Unknown result type (might be due to invalid IL or missing references) //IL_0624: Unknown result type (might be due to invalid IL or missing references) //IL_0638: Unknown result type (might be due to invalid IL or missing references) //IL_0644: Unknown result type (might be due to invalid IL or missing references) //IL_064a: Unknown result type (might be due to invalid IL or missing references) //IL_0660: Unknown result type (might be due to invalid IL or missing references) //IL_0674: Unknown result type (might be due to invalid IL or missing references) //IL_068d: Unknown result type (might be due to invalid IL or missing references) //IL_06a7: Unknown result type (might be due to invalid IL or missing references) //IL_06bb: Unknown result type (might be due to invalid IL or missing references) //IL_06d4: Unknown result type (might be due to invalid IL or missing references) //IL_06ee: Unknown result type (might be due to invalid IL or missing references) //IL_0702: Unknown result type (might be due to invalid IL or missing references) //IL_070e: Unknown result type (might be due to invalid IL or missing references) //IL_0714: Unknown result type (might be due to invalid IL or missing references) //IL_0736: Unknown result type (might be due to invalid IL or missing references) //IL_074a: Unknown result type (might be due to invalid IL or missing references) //IL_0756: Unknown result type (might be due to invalid IL or missing references) //IL_075c: Unknown result type (might be due to invalid IL or missing references) //IL_0772: Unknown result type (might be due to invalid IL or missing references) //IL_0786: Unknown result type (might be due to invalid IL or missing references) //IL_0792: Unknown result type (might be due to invalid IL or missing references) //IL_0798: Unknown result type (might be due to invalid IL or missing references) //IL_05fd: Unknown result type (might be due to invalid IL or missing references) //IL_084c: Unknown result type (might be due to invalid IL or missing references) //IL_085d: Unknown result type (might be due to invalid IL or missing references) //IL_0867: Unknown result type (might be due to invalid IL or missing references) //IL_08b0: Unknown result type (might be due to invalid IL or missing references) //IL_08c1: Unknown result type (might be due to invalid IL or missing references) //IL_08cb: Unknown result type (might be due to invalid IL or missing references) //IL_08f1: Unknown result type (might be due to invalid IL or missing references) //IL_0908: Unknown result type (might be due to invalid IL or missing references) //IL_0912: Unknown result type (might be due to invalid IL or missing references) Sphere(h, new Vector3(0f, 0.25f, 0f), new Vector3(0.5f, 0.52f, 0.48f), skin); Sphere(h, new Vector3(0f, 0.11f, 0.05f), new Vector3(0.46f, 0.3f, 0.42f), skin); Sphere(h, new Vector3(0f, 0.02f, 0.12f), new Vector3(0.22f, 0.12f, 0.2f), skin); Sphere(h, new Vector3(0f, 0.22f, -0.15f), new Vector3(0.46f, 0.26f, 0.26f), hair); Cube(h, new Vector3(-0.235f, 0.24f, 0.07f), new Vector3(0.04f, 0.15f, 0.09f), hair); Cube(h, new Vector3(0.235f, 0.24f, 0.07f), new Vector3(0.04f, 0.15f, 0.09f), hair); Sphere(h, new Vector3(-0.25f, 0.25f, 0f), new Vector3(0.07f, 0.13f, 0.08f), skin); Sphere(h, new Vector3(0.25f, 0.25f, 0f), new Vector3(0.07f, 0.13f, 0.08f), skin); Sphere(h, new Vector3(0f, 0.44f, -0.02f), new Vector3(0.54f, 0.34f, 0.54f), red); Disc(h, new Vector3(0f, 0.39f, -0.02f), new Vector3(0.53f, 0.04f, 0.53f), red); Disc(h, new Vector3(0f, 0.375f, 0.25f), new Vector3(0.46f, 0.012f, 0.26f), red, new Vector3(-6f, 0f, 0f)); Disc(h, new Vector3(0f, 0.5f, 0.225f), new Vector3(0.17f, 0.008f, 0.17f), white, new Vector3(70f, 0f, 0f)); Transform val = Pivot("Emblem", h, new Vector3(0f, 0.5f, 0.235f)); val.localEulerAngles = new Vector3(-20f, 0f, 0f); if (style.Letter == 'L') { Cube(val, new Vector3(-0.02f, 0f, 0f), new Vector3(0.018f, 0.085f, 0.006f), red); Cube(val, new Vector3(0.005f, -0.034f, 0f), new Vector3(0.05f, 0.018f, 0.006f), red); } else { Cube(val, new Vector3(-0.045f, 0f, 0f), new Vector3(0.018f, 0.085f, 0.006f), red); Cube(val, new Vector3(0.045f, 0f, 0f), new Vector3(0.018f, 0.085f, 0.006f), red); Cube(val, new Vector3(-0.022f, 0.012f, 0f), new Vector3(0.016f, 0.06f, 0.006f), red, new Vector3(0f, 0f, 35f)); Cube(val, new Vector3(0.022f, 0.012f, 0f), new Vector3(0.016f, 0.06f, 0.006f), red, new Vector3(0f, 0f, -35f)); } float[] array = new float[2] { -0.088f, 0.088f }; foreach (float num in array) { Sphere(h, new Vector3(num, 0.27f, 0.2f), new Vector3(0.15f, 0.19f, 0.06f), black); Sphere(h, new Vector3(num, 0.27f, 0.215f), new Vector3(0.115f, 0.155f, 0.06f), white); Sphere(h, new Vector3(num, 0.265f, 0.243f), new Vector3(0.03f, 0.03f, 0.012f), black); Sphere(h, new Vector3(num, 0.265f, 0.248f), Vector3.one * 0.018f, eyeGlow); Cube(h, new Vector3(num, 0.372f, 0.215f), new Vector3(0.12f, 0.03f, 0.03f), hair, new Vector3(0f, 0f, (num > 0f) ? 18f : (-18f))); } Sphere(h, new Vector3(0f, 0.18f, 0.26f), new Vector3(0.18f, 0.15f, 0.17f), skin); Sphere(h, new Vector3(-0.1f, 0.105f, 0.235f), new Vector3(0.17f, 0.075f, 0.08f), hair, new Vector3(0f, 0f, 18f)); Sphere(h, new Vector3(0.1f, 0.105f, 0.235f), new Vector3(0.17f, 0.075f, 0.08f), hair, new Vector3(0f, 0f, -18f)); Sphere(h, new Vector3(0f, 0.115f, 0.25f), new Vector3(0.12f, 0.07f, 0.08f), hair); if (!style.Grin) { Sphere(h, new Vector3(0f, 0.02f, 0.2f), new Vector3(0.13f, 0.17f, 0.06f), black); Sphere(h, new Vector3(0f, 0.035f, 0.205f), new Vector3(0.05f, 0.05f, 0.04f), darkRed); return; } Vector3 euler = default(Vector3); for (int j = 0; j < 15; j++) { float num2 = -0.16f + (float)j * (4f / 175f); float num3 = 0.035f + 1.1f * num2 * num2; float num4 = JawSurfaceZ(num2, num3); float num5 = (JawSurfaceZ(num2 + 0.005f, num3) - JawSurfaceZ(num2 - 0.005f, num3)) / 0.01f; ((Vector3)(ref euler))..ctor(0f, (0f - Mathf.Atan(num5)) * 57.29578f, Mathf.Atan(2.2f * num2) * 57.29578f); float num6 = 0.05f - Mathf.Abs(num2) * 0.12f; Cube(h, new Vector3(num2, num3, num4 - 0.004f), new Vector3(0.026f, num6, 0.02f), black, euler); float num7 = 0.004f * Mathf.Sin((float)j * 2.7f); float num8 = num6 * 0.42f + num7; Cube(h, new Vector3(num2, num3 + num6 * 0.5f - num8 * 0.5f, num4 + 0.002f), new Vector3(0.017f, num8, 0.008f), white, euler); Cube(h, new Vector3(num2, num3 - num6 * 0.5f + num8 * 0.5f, num4 + 0.002f), new Vector3(0.017f, num8 * 0.9f, 0.008f), white, euler); } } private static float JawSurfaceZ(float x, float y) { float num = 1f - Mathf.Pow((y - 0.11f) / 0.15f, 2f) - Mathf.Pow(x / 0.23f, 2f); return 0.05f + 0.21f * Mathf.Sqrt(Mathf.Max(0.05f, num)); } } internal static class MarioSounds { private const int SampleRate = 44100; private static readonly Random Rng = new Random(1985); public static AudioClip Ambient; public static AudioClip Laugh; public static AudioClip Shriek; public static AudioClip Scream; public static bool IsCustomMusic; public static AudioClip LuigiMusic; public static readonly Dictionary<string, List<AudioClip>> Voices = new Dictionary<string, List<AudioClip>>(); private static readonly (string ext, AudioType type)[] Formats = new(string, AudioType)[3] { (".ogg", (AudioType)14), (".wav", (AudioType)20), (".mp3", (AudioType)13) }; public static void Generate() { Ambient = BuildAmbient(); Laugh = BuildLaugh(); Shriek = BuildShriek(); Scream = BuildScream(); } private static float Noise() { return (float)(Rng.NextDouble() * 2.0 - 1.0); } private static float Square(float phase, float duty = 0.5f) { if (!(phase - Mathf.Floor(phase) < duty)) { return -1f; } return 1f; } private static float Saw(float phase) { return 2f * (phase - Mathf.Floor(phase)) - 1f; } private static AudioClip Make(string name, float seconds, Func<float, float> sample) { int num = (int)(seconds * 44100f); float[] array = new float[num]; for (int i = 0; i < num; i++) { array[i] = Mathf.Clamp(sample((float)i / 44100f), -1f, 1f); } AudioClip obj = AudioClip.Create(name, num, 1, 44100, false); obj.SetData(array, 0); return obj; } private static AudioClip BuildAmbient() { List<(float, float, float)> list = new List<(float, float, float)> { (0f, 622.25f, 1f), (1f, 622.25f, 1f), (3f, 622.25f, 1f), (5f, 523.25f, 1f), (6f, 622.25f, 2f), (8f, 783.99f, 4f), (12f, 392f, 4f), (16f, 523.25f, 1f), (17f, 493.88f, 1f), (18f, 466.16f, 1.5f), (19.5f, 440f, 1.5f), (21f, 415.3f, 2f), (23f, 392f, 3f), (26f, 369.99f, 4f) }; (float, float, float)[] array = new(float, float, float)[7] { (0f, 622.25f, 1f), (1f, 622.25f, 1f), (3f, 622.25f, 1f), (5f, 523.25f, 1f), (6f, 622.25f, 2f), (8f, 783.99f, 4f), (12f, 392f, 6f) }; for (int i = 0; i < array.Length; i++) { var (num, num2, item) = array[i]; list.Add((num + 31f, num2 * 0.5f, item)); } list.Add((44f, 261.63f, 8f)); float num3 = BeatToTime(52f) + 2f; int num4 = (int)(num3 * 44100f); float[] array2 = new float[num4]; for (int j = 0; j < list.Count; j++) { (float, float, float) tuple2 = list[j]; float item2 = tuple2.Item1; float item3 = tuple2.Item2; float item4 = tuple2.Item3; float num5 = BeatToTime(item2); float num6 = BeatToTime(item2 + item4) - num5 + 1.5f; float num7 = item3 * Mathf.Pow(2f, (0f - ((float)j * 2.5f + (float)Rng.NextDouble() * 15f)) / 1200f); int num8 = (int)(num5 * 44100f); int num9 = Mathf.Min((int)(num6 * 44100f), num4 - num8); for (int k = 0; k < num9; k++) { float num10 = (float)k / 44100f; float num11 = MathF.PI * 2f * num7 * (num10 + 0.0002f * Mathf.Sin(MathF.PI * 9f * num10)); float num12 = Mathf.Sin(num11) + 0.45f * Mathf.Sin(num11 * 2.01f) * Mathf.Exp((0f - num10) * 6f) + 0.25f * Mathf.Sin(num11 * 3.98f) * Mathf.Exp((0f - num10) * 10f) + 0.15f * Mathf.Sin(num11 * 6.3f) * Mathf.Exp((0f - num10) * 18f); float num13 = Mathf.Min(1f, num10 / 0.003f) * Mathf.Exp((0f - num10) * 2.4f); array2[num8 + k] += num12 * num13 * 0.22f; } } float num14 = 0f; float num15 = 0f; float num16 = 0f; for (int l = 0; l < num4; l++) { float num17 = (float)l / 44100f; num15 += 0.00148322f; num16 += 92.5f * (1f + 0.003f * Mathf.Sin(num17 * 0.7f)) / 44100f; float num18 = 0.5f + 0.5f * Mathf.Sin(MathF.PI * 2f * num17 / num3 - MathF.PI / 2f); float num19 = Saw(num15) * 0.6f + Saw(num16) * 0.4f; num14 += (num19 - num14) * 0.02f; array2[l] += num14 * 0.18f * num18 + Noise() * 0.004f; } int num20 = 14553; for (int m = num20; m < num4; m++) { array2[m] += array2[m - num20] * 0.35f; } for (int n = 0; n < num4; n++) { array2[n] = (float)Math.Tanh(array2[n] * 1.4f); } int num21 = 22050; for (int num22 = 0; num22 < num21; num22++) { array2[num22] *= (float)num22 / (float)num21; array2[num4 - 1 - num22] *= (float)num22 / (float)num21; } AudioClip obj = AudioClip.Create("MarioAmbient", num4, 1, 44100, false); obj.SetData(array2, 0); return obj; static float BeatToTime(float b) { return b * 0.36f * (1f + b / 70f); } } public static AudioClip Voice(string key) { if (!Voices.TryGetValue(key, out var value) || value.Count <= 0) { return null; } return value[Random.Range(0, value.Count)]; } public static IEnumerator LoadAudioFiles(params string[] folders) { yield return LoadFirst(folders, "music", delegate(AudioClip c) { Ambient = c; IsCustomMusic = true; }); yield return LoadFirst(folders, "luigi", delegate(AudioClip c) { LuigiMusic = c; }); HashSet<string> seen = new HashSet<string>(); foreach (string path in folders) { if (!Directory.Exists(path)) { continue; } string[] files = Directory.GetFiles(path, "*.wav"); foreach (string path2 in files) { string text = Path.GetFileNameWithoutExtension(path2).ToLowerInvariant(); if ((!text.StartsWith("mario_") && !text.StartsWith("luigi_")) || !seen.Add(text)) { continue; } string key = text.TrimEnd('0', '1', '2', '3', '4', '5', '6', '7', '8', '9'); yield return Load(path2, (AudioType)20, delegate(AudioClip c) { if (!Voices.TryGetValue(key, out var value)) { value = (Voices[key] = new List<AudioClip>()); } value.Add(c); }); } } Plugin.Log.LogInfo((object)("Répliques chargées : " + string.Join(", ", Voices.Select((KeyValuePair<string, List<AudioClip>> kv) => kv.Key + "×" + kv.Value.Count)) + ".")); } private static IEnumerator LoadFirst(string[] folders, string baseName, Action<AudioClip> onLoaded) { foreach (string path in folders) { (string, AudioType)[] formats = Formats; for (int j = 0; j < formats.Length; j++) { (string, AudioType) tuple = formats[j]; string item = tuple.Item1; AudioType item2 = tuple.Item2; string path2 = Path.Combine(path, baseName + item); if (File.Exists(path2)) { yield return Load(path2, item2, onLoaded); yield break; } } } } private static IEnumerator Load(string path, AudioType type, Action<AudioClip> onLoaded) { //IL_000e: Unknown result type (might be due to invalid IL or missing references) //I