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.Logging; using HarmonyLib; using Microsoft.CodeAnalysis; using PluginConfig.API; using PluginConfig.API.Fields; using UnityEngine; [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("funyslookalike.voneliner")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("VOneLiner")] [assembly: AssemblyTitle("funyslookalike.voneliner")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.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 VOneLiner { [BepInPlugin("funyslookalike.voneliner", "VOneLiner", "1.0.0")] [BepInDependency("com.eternalUnion.pluginConfigurator", "1.6.0")] public class Main : BaseUnityPlugin { [HarmonyPatch] public static class VOneLiner_Patch { private static readonly FieldRef layerStringField = AccessTools.FieldRefAccess("layerString"); [HarmonyPrefix] [HarmonyPatch(typeof(StyleHUD), "GetLocalizedName")] public static void patch_GetLocalizedName(StyleHUD __instance, string id) { if (id == null) { return; } switch (id.Length) { case 20: switch (id[16]) { case 'b': break; case 'k': if (id == "ultrakill.doublekill") { playAudio($"double{Random.Range(1, 3)}", -1); } return; case 'u': goto IL_02b2; case 'l': if (id == "ultrakill.iconoclasm") { playAudio("idol1"); } return; case 'r': if (id == "ultrakill.heartbreak") { playAudio("heartbreak1"); } return; case 's': goto IL_02e5; case 'm': if (id == "ultrakill.nailbombed") { playAudio("nailbombed1"); } return; case 'e': goto IL_0317; default: return; } if (!(id == "ultrakill.chargeback")) { break; } goto IL_05e1; case 19: switch (id[10]) { default: return; case 'r': break; case 'm': if (id == "ultrakill.multikill") { playAudio($"multikill{Random.Range(1, 2)}", 0); } return; case 'i': if (id == "ultrakill.instakill") { playAudio($"instakill{Random.Range(1, 3)}"); } return; case 'f': if (id == "ultrakill.fireworks") { if (Random.Range(0, 2) == 0) { playAudio($"fireworks{Random.Range(1, 4)}"); } else { playAudio($"airshot{Random.Range(1, 4)}", 0); } } return; } if (!(id == "ultrakill.roundtrip")) { break; } goto IL_05e1; case 22: switch (id[10]) { case 'r': break; case 'i': if (id == "ultrakill.interruption") { playAudio($"interruption{Random.Range(1, 3)}"); } return; case 'f': if (id == "ultrakill.friendlyfire") { playAudio($"friendly{Random.Range(1, 3)}", 0); } return; case 'h': goto IL_039f; default: return; } if (!(id == "ultrakill.rocketreturn")) { break; } goto IL_05e1; case 18: switch (id[10]) { default: return; case 'e': if (id == "ultrakill.exploded" && Random.Range(0, 3) == 0) { playAudio($"explode{Random.Range(1, 5)}", 0); } return; case 'm': if (id == "ultrakill.mauriced") { playAudio($"mauriced{Random.Range(1, 3)}", 2); } return; case 'o': break; case 'r': if (id == "ultrakill.ricoshot") { playAudio($"fistful{Random.Range(1, 5)}", 0); } return; } if (!(id == "ultrakill.overkill")) { break; } goto IL_0940; case 17: switch (id[10]) { case 'h': if (id == "ultrakill.halfoff") { playAudio($"halfoff{Random.Range(1, 4)}"); } break; case 'e': if (id == "ultrakill.enraged") { playAudio($"enraged{Random.Range(1, 4)}"); } break; case 'a': if (id == "ultrakill.airshot") { playAudio($"airshot{Random.Range(1, 4)}", 0); } break; case 'b': if (id == "ultrakill.bigkill") { playAudio($"bigkill{Random.Range(1, 3)}", 0); } break; } break; case 23: switch (id[10]) { default: return; case 'c': break; case 'h': if (id == "ultrakill.headshotcombo") { playAudio($"headshot{Random.Range(1, 3)}", 0); } return; } if (!(id == "ultrakill.criticalpunch")) { break; } goto IL_06c4; case 21: switch (id[10]) { default: return; case 'b': break; case 'c': if (id == "ultrakill.cannonboost") { playAudio($"cannon{Random.Range(1, 4)}"); } return; } if (!(id == "ultrakill.bigfistkill")) { break; } goto IL_06c4; case 24: { char c = id[10]; if (c != 'd') { if (c != 'h' || !(id == "ultrakill.hammerhitheavy")) { break; } goto IL_095d; } if (!(id == "ultrakill.drillpunchkill")) { break; } goto IL_06e1; } case 5: switch (id[0]) { case 'F': if (id == "FRIED") { playAudio($"fried{Random.Range(1, 4)}"); } break; case 'N': if (id == "NO-NO" && Random.Range(0, 3) == 0) { playAudio($"chainsaw{Random.Range(1, 3)}"); } break; } break; case 26: switch (id[10]) { case 't': if (id == "ultrakill.terminalvelocity") { playAudio("terminal1", 3); } break; case 'f': if (id == "ultrakill.fistfullofdollar") { playAudio($"fistful{Random.Range(1, 5)}"); } break; } break; case 13: switch (id[0]) { default: return; case 'R': if (id == "RAISON D'ETRE") { playAudio("earthmover", 998); } return; case 'L': break; } if (!(id == "LONG WAY DOWN")) { break; } goto IL_09f2; case 8: { char c = id[0]; if (c != 'R') { if (c != 'S' || !(id == "SHREDDED")) { break; } goto IL_097a; } if (!(id == "RE-NO-NO")) { break; } goto IL_0886; } case 32: switch (id[0]) { case 'u': if (id == "ultrakill.cannonballedfrombounce") { playAudio($"cannon{Random.Range(0, 4)}"); } break; case '<': if (id == "GUARD BREAK") { playAudio($"guardbreak{Random.Range(1, 3)}"); } break; } break; case 15: if (!(id == "ultrakill.parry")) { break; } goto IL_05e1; case 14: if (id == "ultrakill.kill" && Random.Range(0, 4) == 0) { playAudio($"kill{Random.Range(1, 2)}", 0); } break; case 34: if (id == "CONDUCTOR") { playAudio($"shock{Random.Range(1, 4)}", 2); } break; case 12: if (!(id == "UNCHAINEDSAW")) { break; } goto IL_0886; case 6: if (!(id == "MINCED")) { break; } goto IL_097a; case 7: if (id == "CRUSHED") { if (Object.FindFirstObjectByType().levelNumber == 21) { playAudio("sea1"); } else if (Random.Range(0, 2) == 0) { playAudio($"crush{Random.Range(1, 3)}"); } } break; case 33: if (id == "GONE SWIMMING") { playAudio("sea1"); } break; case 40: if (id == "STOP HITTING YOURSELF") { playAudio($"stopHitting{Random.Range(1, 3)}", 2); } break; case 4: if (!(id == "FALL")) { break; } goto IL_09f2; case 25: if (id == "ultrakill.projectileboost" && Random.Range(0, 4) == 0) { playAudio($"boomstick{Random.Range(1, 2)}", 0); } break; case 9: case 10: case 11: case 16: case 27: case 28: case 29: case 30: case 31: case 35: case 36: case 37: case 38: case 39: break; IL_0317: if (!(id == "ultrakill.splattered")) { break; } goto IL_0940; IL_0940: playAudio($"splattered{Random.Range(1, 3)}"); break; IL_02e5: if (!(id == "ultrakill.downtosize")) { if (id == "ultrakill.groundslam" && Random.Range(0, 3) == 0) { playAudio($"groundslam{Random.Range(1, 4)}"); } } else { playAudio($"downtosize{Random.Range(1, 3)}", 2); } break; IL_06c4: playAudio($"punch{Random.Range(1, 4)}"); break; IL_02b2: if (!(id == "ultrakill.drillpunch")) { break; } goto IL_06e1; IL_039f: if (!(id == "ultrakill.hammerhitred")) { break; } goto IL_095d; IL_06e1: playAudio($"screw{Random.Range(1, 3)}", 2); break; IL_097a: playAudio("shred1"); break; IL_095d: playAudio($"hammer{Random.Range(1, 3)}"); break; IL_0886: playAudio($"chainsaw{Random.Range(1, 3)}"); break; IL_09f2: playAudio($"fall{Random.Range(1, 3)}"); break; IL_05e1: playAudio($"parry{Random.Range(1, 3)}"); break; } } [HarmonyPostfix] [HarmonyPatch(typeof(StyleHUD), "AscendRank")] public static void patch_AscendRank(StyleHUD __instance) { if (__instance.rankIndex == 7) { playAudio($"ultrakill{Random.Range(1, 4)}"); } } [HarmonyPostfix] [HarmonyPatch(typeof(Revolver), "Shoot")] public static void patch_RevolverShoot(Revolver __instance, int shotType = 1) { if (shotType == 2 && __instance.gunVariation == 2 && Object.op_Implicit((Object)(object)__instance.twirlShotSound) && Random.Range(0, 3) == 0) { playAudio($"redRevolve{Random.Range(1, 3)}", 0); } } [HarmonyPrefix] [HarmonyPatch(typeof(BossBarManager), "CreateBossBar")] public static void patch_CreateBossBar(BossBarManager __instance, BossHealthBar bossBar) { switch (bossBar.bossName) { case "FLESH PRISON": case "FLESH PANOPTICON": playAudio("bossPrison", 6); break; case "1000-THR DEFENCE SYSTEM": playAudio("bossDefense", 6); break; default: playAudio("boss", 6); break; } } [HarmonyPrefix] [HarmonyPatch(typeof(PlayerActivator), "Activate")] public static void patch_PlayerActivate(PlayerActivator __instance) { StatsManager obj = Object.FindFirstObjectByType(); if (obj.seconds < 1f) { timerStarted = false; state = 0; } if (obj.levelNumber == 23) { playAudio("levelLeviathan", 999); } } [HarmonyPostfix] [HarmonyPatch(typeof(NewMovement), "HandleInputs")] public static void patch_HandleInputs(NewMovement __instance) { if (MonoSingleton.Instance.InputSource.Jump.WasPerformedThisFrame && __instance.currentWallJumps >= 3) { playAudio("walljump", 3); } } [HarmonyPrefix] [HarmonyPatch(typeof(StatsManager), "GetFinalRank")] public static void patch_GetFinalRank(StatsManager __instance) { switch (__instance.levelNumber) { case 21: if (!MonoSingleton.Instance.challengeFailed) { playAudio("finishFerryman", 999); } else { playAudio($"finish{Random.Range(1, 5)}", 999); } break; case 24: playAudio("finishHeresy", 999); break; default: playAudio($"finish{Random.Range(1, 5)}", 999); break; case 33: break; } } [HarmonyPrefix] [HarmonyPatch(typeof(StatsManager), "StopTimer")] public static void patch_StopTimer(StatsManager __instance) { if (__instance.levelNumber == 30 && state == 0) { playAudio($"finish{Random.Range(1, 5)}", 999); state = 1; } } [HarmonyPostfix] [HarmonyPatch(typeof(HudMessage), "PlayMessage")] public static void patch_PlayMessage(HudMessage __instance) { switch (__instance.message) { case "SPLIT COLOR doors only require ONE SKULL to open.$If you do not seek hardship, stay indoors.": playAudio("levelCastle", 999); break; case "You're not getting away this time.": playAudio("levelV22", 999); break; case "WHIPLASH: Hold ": playAudio("levelV2Arm", 999); break; } } [HarmonyPostfix] [HarmonyPatch(typeof(Nailgun), "Shoot")] public static void patch_NailgunShoot(Nailgun __instance) { bool value = Traverse.Create((object)__instance).Field("burnOut").GetValue(); float value2 = Traverse.Create((object)__instance).Field("heatUp").GetValue(); if (!__instance.altVersion && value && !nailBurntOut && value2 > 0.68f && Random.Range(0, 2) == 0) { playAudio($"overheat{Random.Range(1, 3)}"); } nailBurntOut = value; } [HarmonyPrefix] [HarmonyPatch(typeof(Railcannon), "OnEnable")] public static void patch_OnEnable(Railcannon __instance) { if (__instance.fullCharge.activeSelf) { playAudio("railcannon1"); } } [HarmonyPrefix] [HarmonyPatch(typeof(DualWield), "Start")] public static void patch_Start(DualWield __instance) { playAudio("dual1", 4); } [HarmonyPrefix] [HarmonyPatch(typeof(FinalDoor), "Open")] public static void patch_Open(FinalDoor __instance) { StatsManager val = Object.FindFirstObjectByType(); if (val.levelNumber == 9 && val.seconds > 2f) { playAudio("levelV2Arm", 998); } } [HarmonyPrefix] [HarmonyPatch(typeof(DeathSequence), "OnEnable")] public static void patch_OnEnable(DeathSequence __instance) { playAudio($"death{Random.Range(1, 5)}", 5); } [HarmonyPrefix] [HarmonyPatch(typeof(NewMovement), "TryDash")] public static void patch_TryDash(NewMovement __instance) { bool num = (Object.op_Implicit((Object)(object)__instance.groundProperties) && !__instance.groundProperties.canDash) || __instance.modNoDashSlide || __instance.boostCharge < 100f; bool flag = __instance.modNoDashSlide || (Object.op_Implicit((Object)(object)__instance.groundProperties) && __instance.groundProperties.silentDashFail); if (num && !flag) { playAudio($"failDash{Random.Range(1, 3)}", 0); } } [HarmonyPostfix] [HarmonyPatch(typeof(ObjectActivator), "Activate", new Type[] { typeof(bool) })] public static void patch_ObjectActivate(ObjectActivator __instance) { //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) int levelNumber = Object.FindFirstObjectByType().levelNumber; Vector3 position = ((Component)__instance).transform.position; string text = ((object)(Vector3)(ref position)).ToString(); switch (levelNumber) { case 1: if (((Object)__instance).name == "TitleActivator" && text == "(40.00, 13.00, 393.00)" && state == 0) { state = 1; playAudio("levelIntro", 999); } break; case 21: if (((Object)__instance).name == "ShipRaiser" && text == "(87.50, -273.00, 1240.00)") { ((MonoBehaviour)__instance).StartCoroutine(playAudioDelayed("levelHolyShip", 5, 2f)); } break; case 22: if (((Object)__instance).name == "Screenshaker" && text == "(-122.50, 104.00, 336.00)" && state == 0) { state = 1; playAudio("levelShipTurn", 998); } break; case 24: if (((Object)__instance).name == "MusicChanger" && text == "(168.50, -133.00, 457.00)" && state == 0) { state = 1; playAudio("levelHeresyDrop", 999); } break; case 26: if (((Object)__instance).name == "Trigger" && text == "(143.50, 46.00, 483.00)") { playAudio("arenaMeatgrinder", 999); } break; case 31: if (((Object)__instance).name == "Fake 17" && text == "(-22.00, 15.00, 474.00)") { playAudio("levelFraudEye", 999); } else if (((Object)__instance).name == "OpenZone (1)" && text == "(422.00, 85.00, 521.00)" && state == 0) { state = 1; ((MonoBehaviour)__instance).StartCoroutine(playAudioDelayed("levelFraudLookin", 5, 0.75f)); } break; case 32: if (((Object)__instance).name == "10 - Split Color Door" && text == "(200.00, 47.50, 213.00)" && state == 0) { state = 1; ((MonoBehaviour)__instance).StartCoroutine(playAudioDelayed("levelCastle", 998)); } else if (((Object)__instance).name == "Trigger" && text == "(215.00, 47.50, 366.00)" && state == 1) { state = 2; ((MonoBehaviour)__instance).StartCoroutine(playAudioDelayed("arenaFilthy", 999, 0.5f)); } else if (((Object)__instance).name == "GravityChanger" && text == "(300.00, 40.00, 615.00)") { ((MonoBehaviour)__instance).StartCoroutine(playAudioDelayed("levelSpace", 999, 2f)); } break; case 33: if (((Object)__instance).name == "The Fall" && text == "(0.00, -10.00, -200.00)") { playAudio("levelGeryonFall", 999); } else if (((Object)__instance).name.StartsWith("OrchestraHit")) { switch (((Object)__instance).name) { case "OrchestraHit (1)": playAudio("levelGeryon1", 996); break; case "OrchestraHit (2)": playAudio("levelGeryon2", 997); break; case "OrchestraHit": playAudio("levelGeryon3", 998); break; } } else if (((Object)__instance).name == "Impact" && text == "(-200.00, -50.00, 240.00)") { playAudio("levelGeryon4", 999); } break; } } [HarmonyPrefix] [HarmonyPatch(typeof(StatsManager), "StartTimer")] public static void patch_StartTimer(StatsManager __instance) { if (__instance.levelNumber == 30 && __instance.seconds > 0f && state == 1) { ((MonoBehaviour)__instance).StartCoroutine(playAudioDelayed("levelFraudExit", 1000)); state = 2; } if (timerStarted) { return; } timerStarted = true; switch (__instance.levelNumber) { case 6: playAudio("levelSunshine", 998); break; case 11: playAudio("WHOISTHAT", 999); ((MonoBehaviour)__instance).StartCoroutine(subtitleDelayed("WHOISTHAT2", 2f)); break; case 14: playAudio("levelGluttony", 999); break; case 15: ((MonoBehaviour)__instance).StartCoroutine(playAudioDelayed("levelGabe", 5)); ((MonoBehaviour)__instance).StartCoroutine(subtitleDelayed("levelGabe2", 3.5f)); break; case 17: playAudio("levelGodDamnSun", 999); break; case 18: case 666: playAudio("levelDark1", 999); ((MonoBehaviour)__instance).StartCoroutine(subtitleDelayed("levelDark12", 3f)); break; case 21: playAudio("levelWrath2", 999); break; case 28: playAudio("levelDark2", 999); ((MonoBehaviour)__instance).StartCoroutine(subtitleDelayed("levelDark22", 3f)); break; case 30: if (state == 0) { playAudio("levelFraud1", 998); ((MonoBehaviour)__instance).StartCoroutine(playAudioDelayed("levelFraud2", 999, 4.75f)); } break; case 32: playAudio("levelDisintegrate1", 997); break; case 100: playAudio("levelChilly1", 999); break; } } [HarmonyPrefix] [HarmonyPatch(typeof(LevelNamePopup), "ShowLayerText")] public static void patch_ShowLayerText(LevelNamePopup __instance) { string text = layerStringField.Invoke(__instance); switch (text) { default: _ = text == "FRAUD /// THIRD"; break; case "PRELUDE /// ENCORE": playAudio("levelChilly2", 999); break; case "LIMBO /// SECOND": playAudio("levelBurning", 999); break; case "LIMBO /// CLIMAX": playAudio("levelV2", 999); break; case "LUST /// CLIMAX": playAudio("levelLustClimax", 999); break; } } [HarmonyPrefix] [HarmonyPatch(typeof(ActivateArena), "Activate")] public static void patch_ArenaActivate(ActivateArena __instance) { //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) if (__instance.activated) { return; } StatsManager val = Object.FindFirstObjectByType(); int levelNumber = val.levelNumber; Vector3 position = ((Component)__instance).transform.position; string text = ((object)(Vector3)(ref position)).ToString(); switch (levelNumber) { case 1: if (text == "(60.00, 3.00, 447.00)") { playAudio("arenaFilthy", 999); } break; case 2: if (text == "(-5.00, -8.00, 277.00)") { playAudio("arenaMeatgrinder", 999); } break; case 3: if (text == "(99.00, 54.00, 459.00)") { playAudio("arenaFilthy", 999); } break; case 5: if (text == "(182.00, 4.00, 382.00)" && state == 0) { state = 1; playAudio("levelCerb", 999); ((MonoBehaviour)val).StartCoroutine(subtitleDelayed("levelCerb2", 3f)); } break; case 7: if (text == "(0.00, 27.50, 406.00)") { ((MonoBehaviour)__instance).StartCoroutine(playAudioDelayed("arenaFilthy", 999)); } break; case 22: if (text == "(-16.50, 204.00, 363.50)") { playAudio("arenaFilthy", 999); } break; } } [HarmonyPostfix] [HarmonyPatch(typeof(ItemIdentifier), "PickUp")] public static void patch_PickUp(ItemIdentifier __instance) { string text = ((object)(ItemType)(ref __instance.itemType)).ToString(); int levelNumber = Object.FindFirstObjectByType().levelNumber; switch (text) { case "SkullBlue": playAudio($"blueskull{Random.Range(1, 4)}", 5); break; case "SkullRed": if (levelNumber == 26 && state == 0) { state = 1; playAudio("redSkullSpecial", 999); } else { playAudio($"redskull{Random.Range(1, 4)}", 5); } break; case "Readable": playAudio("read1", 5); break; case "Soap": if (levelNumber != 0) { playAudio("soap1", 5); } break; default: playAudio("pickup1", 5); break; } } } [CompilerGenerated] private sealed class d__16 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float delay; public string audioName; public int priority; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__16(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(delay); <>1__state = 1; return true; case 1: <>1__state = -1; playAudio(audioName, priority); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class d__17 : IEnumerator, IEnumerator, IDisposable { private int <>1__state; private object <>2__current; public float delay; public string subName; object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public d__17(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; if (!enabler.value || !subtitles.value) { return false; } <>2__current = (object)new WaitForSeconds(delay); <>1__state = 1; return true; case 1: <>1__state = -1; MonoSingleton.Instance.DisplaySubtitle(subs[subName], (AudioSource)null, false); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } private static ManualLogSource log; private static AssetBundle assets; private static Dictionary clips = new Dictionary(); private static Dictionary subs = new Dictionary(); private static AudioSource currentLine; private static int currentPriority = 0; private static bool timerStarted = false; private static byte state = 0; private static bool nailBurntOut = false; private PluginConfigurator config; private static BoolField enabler; private static BoolField subtitles; private static BoolField overlapping; private static FloatField volume; private void Awake() { //IL_0079: Unknown result type (might be due to invalid IL or missing references) //IL_0083: Expected O, but got Unknown //IL_0099: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Expected O, but got Unknown //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Expected O, but got Unknown //IL_00dd: Unknown result type (might be due to invalid IL or missing references) //IL_00e7: Expected O, but got Unknown Harmony.CreateAndPatchAll(typeof(VOneLiner_Patch), (string)null); assets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "audio")); config = PluginConfigurator.Create("VOneLiner", "voneliner"); config.image = assets.LoadAsset("icon"); enabler = new BoolField(config.rootPanel, "Enabled", "enabler", true); subtitles = new BoolField(config.rootPanel, "V1 Subtitles", "subtitles", true); volume = new FloatField(config.rootPanel, "Volume", "volume", 1f); overlapping = new BoolField(config.rootPanel, "bad mode", "overlapping", false); AudioClip[] array = assets.LoadAllAssets(); foreach (AudioClip val in array) { clips.Add(((Object)val).name, val); } TextAsset[] array2 = assets.LoadAllAssets(); foreach (TextAsset val2 in array2) { subs.Add(((Object)val2).name, val2.text); } log = ((BaseUnityPlugin)this).Logger; } public static void playAudio(string audioName, int priority = 1) { if (!enabler.value) { return; } if (overlapping.value) { playAudioFunny(audioName); return; } if (Object.op_Implicit((Object)(object)currentLine)) { if (currentLine.isPlaying && priority <= currentPriority) { return; } currentLine.Stop(); } currentPriority = priority; currentLine = ((Component)Camera.main).gameObject.AddComponent(); currentLine.PlayOneShot(clips[audioName], volume.value); if (subs.Keys.Contains(audioName) && subtitles.value) { MonoSingleton.Instance.DisplaySubtitle(subs[audioName], (AudioSource)null, false); } } [IteratorStateMachine(typeof(d__16))] public static IEnumerator playAudioDelayed(string audioName, int priority = 1, float delay = 1f) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__16(0) { audioName = audioName, priority = priority, delay = delay }; } [IteratorStateMachine(typeof(d__17))] public static IEnumerator subtitleDelayed(string subName, float delay = 1f) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new d__17(0) { subName = subName, delay = delay }; } public static void playAudioFunny(string audioName) { AudioSource obj = ((Component)Camera.main).gameObject.AddComponent(); obj.PlayOneShot(clips[audioName], volume.value); Object.Destroy((Object)(object)obj, 10f); if (subs.Keys.Contains(audioName) && subtitles.value) { MonoSingleton.Instance.DisplaySubtitle(subs[audioName], (AudioSource)null, false); } } } public static class MyPluginInfo { public const string PLUGIN_GUID = "funyslookalike.voneliner"; public const string PLUGIN_NAME = "VOneLiner"; public const string PLUGIN_VERSION = "1.0.0"; } }