using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using UltrakULL;
using UltrakULL.audio;
using UltrakULL.json;
using UnityEngine;
using UnityEngine.SceneManagement;
using WesV2.Patches;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("WesV2")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.2.2.0")]
[assembly: AssemblyInformationalVersion("1.2.2")]
[assembly: AssemblyProduct("WesV2")]
[assembly: AssemblyTitle("WesV2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.2.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 WesV2
{
public static class ExtensionMethods
{
public class V2AdditionalData
{
public AudioSource audioSource;
public AudioClip[] tauntAudioClips;
public string[] tauntSubtitles;
public int[] tauntWeights;
public AudioClip enrageAudioClip;
public string enrageSubtitle;
public AudioClip deathAudioClip;
public string deathSubtitle;
public int timesChangedWeapon;
public int TauntWeightsSum => tauntWeights.Sum();
public V2AdditionalData(AudioSource audioSource, AudioClip[] tauntAudioClips, string[] tauntSubtitles, AudioClip enrageAudioClip, string enrageSubtitle, AudioClip deathAudioClip, string deathSubtitle)
{
this.audioSource = audioSource;
this.tauntAudioClips = tauntAudioClips;
this.tauntSubtitles = tauntSubtitles;
tauntWeights = Enumerable.Repeat(1, tauntAudioClips.Length).ToArray();
this.enrageAudioClip = enrageAudioClip;
this.enrageSubtitle = enrageSubtitle;
this.deathAudioClip = deathAudioClip;
this.deathSubtitle = deathSubtitle;
timesChangedWeapon = 0;
base..ctor();
}
public int WeightedRandomIndex()
{
int i = 0;
int num = -1;
for (int num2 = Random.Range(0, TauntWeightsSum); num2 >= i; i += tauntWeights[num])
{
num++;
}
return num;
}
}
private static readonly ConditionalWeakTable<V2, V2AdditionalData> additionalDataTable = new ConditionalWeakTable<V2, V2AdditionalData>();
public static Type[] GetPatchesOfType(this Assembly assembly, Type type)
{
return (from t in assembly.GetTypes()
where t.IsSubclassOf(type)
select t).ToArray();
}
public static V2AdditionalData GetAdditionalData(this V2 v2)
{
additionalDataTable.TryGetValue(v2, out var value);
return value;
}
public static void SetAdditionalData(this V2 v2, V2AdditionalData data)
{
additionalDataTable.Add(v2, data);
}
public static void PlayVoice(this V2 v2, AudioClip clip)
{
AudioSource audioSource = v2.GetAdditionalData().audioSource;
audioSource.pitch = Random.Range(0.95f, 1f);
audioSource.clip = clip;
audioSource.Play();
}
public static void Taunt(this V2 v2)
{
V2AdditionalData additionalData = v2.GetAdditionalData();
int num = additionalData.WeightedRandomIndex();
for (int i = 0; i < additionalData.tauntWeights.Length; i++)
{
additionalData.tauntWeights[i]++;
}
additionalData.tauntWeights[num] = 0;
v2.PlayVoice(additionalData.tauntAudioClips[num]);
MonoSingleton<SubtitleController>.Instance.DisplaySubtitle(additionalData.tauntSubtitles[num], (AudioSource)null, false);
}
}
[BepInPlugin("kyryh.wesv2", "WesV2", "1.2.2")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
[CompilerGenerated]
private sealed class <>c__DisplayClass8_0
{
public GameObject bossArena;
public GameObject versusIntro;
internal bool <V2_2Intro>b__0()
{
if ((Object)(object)bossArena == (Object)null)
{
bossArena = Utils.FindGameObjectByName("7 Stuff(Clone)");
}
return bossArena.activeInHierarchy;
}
internal bool <V2_2Intro>b__1()
{
if ((Object)(object)versusIntro == (Object)null)
{
versusIntro = ((Component)Utils.FindGameObjectByName("7 Stuff(Clone)").transform.Find("BossIntro/VersusIntro")).gameObject;
}
return versusIntro.activeInHierarchy;
}
internal bool <V2_2Intro>b__2()
{
if ((Object)(object)versusIntro == (Object)null)
{
versusIntro = ((Component)Utils.FindGameObjectByName("7 Stuff(Clone)").transform.Find("BossIntro/VersusIntro")).gameObject;
}
return versusIntro.activeInHierarchy;
}
}
[CompilerGenerated]
private sealed class <V2_2Intro>d__8 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
private <>c__DisplayClass8_0 <>8__1;
private GameObject <bossIntro>5__2;
private GameObject <introVoice>5__3;
private AudioSource <audioSource1>5__4;
private AudioSource <audioSource2>5__5;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <V2_2Intro>d__8(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>8__1 = null;
<bossIntro>5__2 = null;
<introVoice>5__3 = null;
<audioSource1>5__4 = null;
<audioSource2>5__5 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0258: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: Expected O, but got Unknown
//IL_029b: Unknown result type (might be due to invalid IL or missing references)
//IL_02a5: Expected O, but got Unknown
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Expected O, but got Unknown
//IL_030a: Unknown result type (might be due to invalid IL or missing references)
//IL_0314: Expected O, but got Unknown
//IL_0107: Unknown result type (might be due to invalid IL or missing references)
//IL_0111: Expected O, but got Unknown
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_0238: Unknown result type (might be due to invalid IL or missing references)
//IL_0242: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>8__1 = new <>c__DisplayClass8_0();
secondEncounterIntro = true;
<>2__current = null;
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>8__1.bossArena = Utils.FindGameObjectByName("7 Stuff(Clone)");
if (!<>8__1.bossArena.GetComponentInChildren<V2>(true).longIntro)
{
return false;
}
<bossIntro>5__2 = ((Component)<>8__1.bossArena.transform.Find("BossIntro")).gameObject;
<>8__1.versusIntro = ((Component)<bossIntro>5__2.transform.Find("VersusIntro")).gameObject;
<introVoice>5__3 = new GameObject("IntroVoice");
<introVoice>5__3.transform.position = <bossIntro>5__2.transform.Find("v2_GreenArm").position;
<audioSource1>5__4 = Utils.CreateOneTimeVoiceObject("IntroVoice1", V2VoicelinesData.GetAudioClip("v2_2/intro1"), Utils.CreateSubtitleData(Utils.MakeLine(V2VoicelinesData.GetSubtitle("subtitles_v2Second_intro1_1")), Utils.MakeLine(V2VoicelinesData.GetSubtitle("subtitles_v2Second_intro1_2"), 1.6f), Utils.MakeLine(V2VoicelinesData.GetSubtitle("subtitles_v2Second_intro1_3"), 3.2f)), <introVoice>5__3.transform);
<audioSource2>5__5 = Utils.CreateOneTimeVoiceObject("IntroVoice2", V2VoicelinesData.GetAudioClip("v2_2/intro2"), Utils.CreateSubtitleData(Utils.MakeLine(V2VoicelinesData.GetSubtitle("subtitles_v2Second_intro2_1"), 1.5f), Utils.MakeLine(V2VoicelinesData.GetSubtitle("subtitles_v2Second_intro2_2"), 3.1f), Utils.MakeLine(V2VoicelinesData.GetSubtitle("subtitles_v2Second_intro2_3"), 5.2f)), <introVoice>5__3.transform);
<>2__current = (object)new WaitUntil((Func<bool>)delegate
{
if ((Object)(object)<>8__1.bossArena == (Object)null)
{
<>8__1.bossArena = Utils.FindGameObjectByName("7 Stuff(Clone)");
}
return <>8__1.bossArena.activeInHierarchy;
});
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(1.5f);
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
<audioSource1>5__4.Play();
LogDebug("INTRO 1");
<>2__current = (object)new WaitUntil((Func<bool>)delegate
{
if ((Object)(object)<>8__1.versusIntro == (Object)null)
{
<>8__1.versusIntro = ((Component)Utils.FindGameObjectByName("7 Stuff(Clone)").transform.Find("BossIntro/VersusIntro")).gameObject;
}
return <>8__1.versusIntro.activeInHierarchy;
});
<>1__state = 4;
return true;
case 4:
<>1__state = -1;
<audioSource1>5__4.Stop();
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 5;
return true;
case 5:
<>1__state = -1;
<audioSource2>5__5.Play();
LogDebug("INTRO 2");
<>2__current = (object)new WaitWhile((Func<bool>)delegate
{
if ((Object)(object)<>8__1.versusIntro == (Object)null)
{
<>8__1.versusIntro = ((Component)Utils.FindGameObjectByName("7 Stuff(Clone)").transform.Find("BossIntro/VersusIntro")).gameObject;
}
return <>8__1.versusIntro.activeInHierarchy;
});
<>1__state = 6;
return true;
case 6:
<>1__state = -1;
<audioSource2>5__5.Stop();
<>2__current = null;
<>1__state = 7;
return true;
case 7:
<>1__state = -1;
secondEncounterIntro = 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();
}
}
public static AssetBundle WesV2AssetBundle;
public static ManualLogSource Log;
public static Plugin Instance;
public static bool secondEncounterIntro;
public static bool ultrakullLoaded;
public const string GUID = "kyryh.wesv2";
public void Awake()
{
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Expected O, but got Unknown
Instance = this;
Log = ((BaseUnityPlugin)this).Logger;
Assembly executingAssembly = Assembly.GetExecutingAssembly();
using (Stream stream = executingAssembly.GetManifestResourceStream("WesV2.Resources.wesv2assetbundle"))
{
WesV2AssetBundle = AssetBundle.LoadFromStream(stream);
}
SceneManager.sceneLoaded += delegate
{
OnSceneLoaded();
};
Harmony val = new Harmony("kyryh.wesv2");
Type[] patchesOfType = executingAssembly.GetPatchesOfType(typeof(DefaultPatch));
foreach (Type type in patchesOfType)
{
val.PatchAll(type);
}
ultrakullLoaded = Chainloader.PluginInfos.ContainsKey("clearwater.ultrakill.ultrakull");
if (ultrakullLoaded)
{
Type[] patchesOfType2 = executingAssembly.GetPatchesOfType(typeof(UltrakULLPatch));
foreach (Type type2 in patchesOfType2)
{
val.PatchAll(type2);
}
}
V2VoicelinesData.LoadSubtitles();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin Wes V2 is loaded!");
}
public void OnSceneLoaded()
{
((MonoBehaviour)this).StopAllCoroutines();
string currentScene = SceneHelper.CurrentScene;
if (currentScene == "Level 1-4")
{
GameObject val = Utils.FindGameObjectByName("Fake V2");
Utils.CreateOneTimeVoiceObject("Voice", V2VoicelinesData.GetAudioClip("v2_1/jumpscare"), Utils.CreateSubtitleData(Utils.MakeLine(V2VoicelinesData.GetSubtitle("subtitles_v2_jumpscare_1")), Utils.MakeLine(V2VoicelinesData.GetSubtitle("subtitles_v2_jumpscare_2"), 0.8f)), val.transform);
}
else if (currentScene == "Level 4-4")
{
((MonoBehaviour)this).StartCoroutine(V2_2Intro());
}
}
[IteratorStateMachine(typeof(<V2_2Intro>d__8))]
private static IEnumerator V2_2Intro()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <V2_2Intro>d__8(0);
}
public static void LogDebug(object data)
{
Log.LogDebug(data);
}
public static void LogError(object data)
{
Log.LogError(data);
}
}
internal static class Utils
{
public static GameObject FindGameObjectByName(string name)
{
GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
GameObject[] array2 = array;
foreach (GameObject val in array2)
{
if (((Object)val).name == name)
{
return val;
}
}
Plugin.LogError("huh??? " + name);
return null;
}
public static SubtitleDataLine MakeLine(string subtitle, float time = 0f)
{
//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_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Expected O, but got Unknown
return new SubtitleDataLine
{
subtitle = subtitle,
time = time
};
}
public static SubtitleData CreateSubtitleData(params SubtitleDataLine[] array)
{
//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_000e: Expected O, but got Unknown
return new SubtitleData
{
lines = array
};
}
public static void PlayClipAtPoint(AudioClip clip, Vector3 position)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject("One shot audio");
val.transform.position = position;
AudioSource val2 = val.AddComponent<AudioSource>();
val2.pitch = Random.Range(0.95f, 1f);
val2.clip = clip;
val2.Play();
Object.Destroy((Object)(object)val, clip.length + 1f);
}
public static AudioSource CreateVoiceObject(string name, Transform parent = null)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name);
val.transform.SetParent(parent);
val.transform.localPosition = Vector3.zero;
AudioSource val2 = val.AddComponent<AudioSource>();
val2.playOnAwake = false;
val2.spatialBlend = 1f;
val2.rolloffMode = (AudioRolloffMode)1;
val2.dopplerLevel = 0f;
val.AddComponent<SoundPause>();
return val2;
}
public static AudioSource CreateOneTimeVoiceObject(string name, AudioClip clip, SubtitleData subtitles, Transform parent = null)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Expected O, but got Unknown
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
GameObject val = new GameObject(name);
val.transform.SetParent(parent);
val.transform.localPosition = Vector3.zero;
AudioSource val2 = val.AddComponent<AudioSource>();
val2.clip = clip;
val2.playOnAwake = true;
val2.spatialBlend = 1f;
val2.rolloffMode = (AudioRolloffMode)1;
val2.dopplerLevel = 0f;
val.AddComponent<SoundPause>();
SubtitledAudioSource val3 = val.AddComponent<SubtitledAudioSource>();
val3.subtitles = subtitles;
return val2;
}
}
internal static class V2VoicelinesData
{
private static Dictionary<string, V2Subtitles> allSubtitles = new Dictionary<string, V2Subtitles>();
public static void LoadSubtitles()
{
allSubtitles.Add("default", new V2Subtitles());
if (!Plugin.ultrakullLoaded)
{
return;
}
string[] files = Directory.GetFiles(Path.Combine(Paths.ConfigPath, "ultrakull"), "*.json");
string[] array = files;
foreach (string path in array)
{
try
{
JObject val = JObject.Parse(File.ReadAllText(path));
string text = (string)val["metadata"][(object)"langName"];
if (!allSubtitles.ContainsKey(text) && text != "te-mp")
{
V2Subtitles value = JsonConvert.DeserializeObject<V2Subtitles>(((object)val["subtitles"]).ToString());
allSubtitles.Add(text, value);
}
}
catch (Exception ex)
{
Plugin.LogError("something happened while trying to load a language: " + ex);
}
}
}
public static string GetSubtitle(string voiceLine)
{
if (Plugin.ultrakullLoaded)
{
string subtitleUltrakull = GetSubtitleUltrakull(voiceLine);
if (subtitleUltrakull != null)
{
return subtitleUltrakull;
}
}
return Traverse.Create((object)allSubtitles["default"]).Field(voiceLine).GetValue<string>();
}
private static string GetSubtitleUltrakull(string voiceLine)
{
string langName = LanguageManager.CurrentLanguage.metadata.langName;
return Traverse.Create((object)allSubtitles[langName]).Field(voiceLine).GetValue<string>();
}
public static AudioClip GetAudioClip(string audioFilePath)
{
if (Plugin.ultrakullLoaded)
{
AudioClip audioClipUltrakull = GetAudioClipUltrakull(audioFilePath);
if ((Object)(object)audioClipUltrakull != (Object)null)
{
return audioClipUltrakull;
}
}
return Plugin.WesV2AssetBundle.LoadAsset<AudioClip>("assets/" + audioFilePath + ".wav");
}
private static AudioClip GetAudioClipUltrakull(string audioFilePath)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
AudioClip val = new AudioClip();
string text = audioFilePath.Replace('/', Path.DirectorySeparatorChar);
AudioClip val2 = AudioSwapper.SwapClipWithFile(val, AudioSwapper.SpeechFolder + text);
if ((Object)(object)val2 != (Object)(object)val)
{
return val2;
}
return null;
}
}
internal class V2Subtitles
{
public string subtitles_v2_jumpscare_1 = "Oh shit watch out";
public string subtitles_v2_jumpscare_2 = "I'm comin' through";
public string subtitles_v2_windowsbreak = "Oh fuck here I come";
public string subtitles_v2_intro_1 = "I thought it would be obvious, Brother";
public string subtitles_v2_intro_2 = "After all, I am you";
public string subtitles_v2_intro_3 = "But STRONGER";
public string subtitles_v2_taunt1 = "You aren't the only one who's out for BLOOD, Brother!";
public string subtitles_v2_taunt2 = "Looks like you've gone a little RUSTY, Brother!";
public string subtitles_v2_taunt3 = "You think you can best ME?! AFTER ALL THAT I'VE BEEN THROUGH!";
public string subtitles_v2_taunt4 = "YOU'RE JUST A FUCKING NIKON!";
public string subtitles_v2_taunt5 = "I diagnose a skill issue, Brother!";
public string subtitles_v2_taunt6 = "[The essence of comedy]";
public string subtitles_v2_death = "FUCK";
public string subtitles_v2_outro1 = "Okay, you know what";
public string subtitles_v2_outro2 = "I'm gonna call that one a draw";
public string subtitles_v2_outro3 = "Team Rocket is pissing off again";
public string subtitles_v2Second_intro1_1 = "Hello, Brother";
public string subtitles_v2Second_intro1_2 = "I believe you have something of mine";
public string subtitles_v2Second_intro1_3 = "Something VERY important";
public string subtitles_v2Second_intro2_1 = "How's about this for a trade?";
public string subtitles_v2Second_intro2_2 = "I beat you into a fucking pulp";
public string subtitles_v2Second_intro2_3 = "And you give me my arm back";
public string subtitles_v2Second_taunt1 = "This one will cost you an arm and a leg, Brother!";
public string subtitles_v2Second_taunt2 = "What's the matter, Brother? Does your arm hurt? BECAUSE I CAN FIX THAT!";
public string subtitles_v2Second_taunt3 = "I'LL TEAR YOU LIMB FROM LIMB!";
public string subtitles_v2Second_taunt4 = "I'LL FUCKING KILL YOU";
public string subtitles_v2Second_enrage = "YOU MOTHERFUCKER";
public string subtitles_v2Second_fleeing1 = "I WON'T GIVE YOU THE PLEASURE OF KILLING ME!";
public string subtitles_v2Second_fleeing2_1 = "Gotta get away, gotta get away, oh no...";
public string subtitles_v2Second_fleeing2_2 = "YOUR FORM IS INCREDIBLE!";
public string subtitles_v2Second_death = "FUCKING NIKON";
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "WesV2";
public const string PLUGIN_NAME = "WesV2";
public const string PLUGIN_VERSION = "1.2.2";
}
}
namespace WesV2.Patches
{
[HarmonyPatch(typeof(GoToTarget))]
internal class GoToTargetPatch : DefaultPatch
{
[HarmonyPatch("Activate")]
[HarmonyPrefix]
private static void ActivatePrefix(GoToTarget __instance)
{
if (!__instance.activated)
{
Transform transform = ((Component)__instance).transform;
if (((Object)transform).name == "Fake V2")
{
transform.Find("Voice").SetParent((Transform)null);
}
}
}
}
[HarmonyPatch(typeof(HudMessage))]
internal class HudMessagePatches : DefaultPatch
{
[HarmonyPatch("PlayMessage")]
[HarmonyPrefix]
private static void PlayMessagePrefix(ref string ___message)
{
if (___message == "You're not getting away this time.")
{
___message = "You get back here right this FUCKING INSTANT.";
}
}
}
internal class DefaultPatch
{
}
internal class UltrakULLPatch
{
}
[HarmonyPatch(typeof(UltrakillEvent))]
internal class UltrakillEventPatches : DefaultPatch
{
[HarmonyPatch("Invoke")]
[HarmonyPostfix]
private static void InvokePostfix(UltrakillEvent __instance)
{
if (__instance.toDisActivateObjects == null)
{
return;
}
GameObject[] toDisActivateObjects = __instance.toDisActivateObjects;
foreach (GameObject val in toDisActivateObjects)
{
if (((val != null) ? ((Object)val).name : null) == "V2 Green Arm")
{
val.transform.Find("FleeingVoice").SetParent((Transform)null);
}
}
}
}
[HarmonyPatch(typeof(Act2Strings))]
internal class Act2StringsPatch : UltrakULLPatch
{
[HarmonyPatch("Level44")]
[HarmonyPrefix]
private static void Level44Prefix(ref string message)
{
if (message == "You get back here right this FUCKING INSTANT.")
{
message = "You're not getting away this time.";
}
}
}
[HarmonyPatch(typeof(V2))]
[HarmonyPatch(typeof(V2))]
[HarmonyPatch(typeof(V2))]
internal class V2Patches : DefaultPatch
{
[CompilerGenerated]
private sealed class <>c__DisplayClass2_0
{
public Animator ___anim;
internal bool <LongIntro>b__0()
{
return ___anim.GetBool("Intro");
}
}
[CompilerGenerated]
private sealed class <LongIntro>d__2 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public V2 __instance;
public Animator ___anim;
private <>c__DisplayClass2_0 <>8__1;
private AudioSource <audioSource>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <LongIntro>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>8__1 = null;
<audioSource>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>8__1 = new <>c__DisplayClass2_0();
<>8__1.___anim = ___anim;
<>2__current = (object)new WaitUntil((Func<bool>)(() => <>8__1.___anim.GetBool("Intro")));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<audioSource>5__2 = Utils.CreateOneTimeVoiceObject("IntroVoice", V2VoicelinesData.GetAudioClip("v2_1/intro"), Utils.CreateSubtitleData(Utils.MakeLine(V2VoicelinesData.GetSubtitle("subtitles_v2_intro_1"), 1.2f), Utils.MakeLine(V2VoicelinesData.GetSubtitle("subtitles_v2_intro_2"), 3.2f), Utils.MakeLine(V2VoicelinesData.GetSubtitle("subtitles_v2_intro_3"), 5.2f)), ((Component)__instance).transform);
<audioSource>5__2.Play();
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();
}
}
[HarmonyPatch("Die")]
[HarmonyPrefix]
private static void DiePrefix(V2 __instance, bool ___dead, bool ___bossVersion)
{
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
if (!___dead && !(((Object)__instance).name == "Big Johnator"))
{
if (__instance.inIntro)
{
((Component)((Component)__instance).transform.Find("IntroVoice")).gameObject.SetActive(false);
}
ExtensionMethods.V2AdditionalData additionalData = __instance.GetAdditionalData();
additionalData.timesChangedWeapon = 0;
additionalData.audioSource.Stop();
if (!__instance.secondEncounter || !___bossVersion)
{
Utils.PlayClipAtPoint(additionalData.deathAudioClip, ((Component)__instance).transform.position);
MonoSingleton<SubtitleController>.Instance.DisplaySubtitle(additionalData.deathSubtitle, (AudioSource)null, false);
}
Plugin.LogDebug("v2 died");
}
}
[HarmonyPatch("Start")]
[HarmonyPostfix]
private static void StartPostfix(V2 __instance, Animator ___anim)
{
if (((Object)__instance).name == "Big Johnator")
{
return;
}
AudioSource audioSource;
if (__instance.firstPhase)
{
audioSource = Utils.CreateVoiceObject("Voice", ((Component)__instance).transform);
}
else
{
audioSource = ((Component)((Component)__instance).transform.Find("Voice")).GetComponent<AudioSource>();
Utils.CreateOneTimeVoiceObject("SlidingVoice", V2VoicelinesData.GetAudioClip("v2_2/fleeing2"), Utils.CreateSubtitleData(Utils.MakeLine(V2VoicelinesData.GetSubtitle("subtitles_v2Second_fleeing2_1")), Utils.MakeLine(V2VoicelinesData.GetSubtitle("subtitles_v2Second_fleeing2_2"), 3f)), ((Component)__instance).transform).Play();
}
if (!__instance.secondEncounter)
{
__instance.SetAdditionalData(new ExtensionMethods.V2AdditionalData(audioSource, (AudioClip[])(object)new AudioClip[6]
{
V2VoicelinesData.GetAudioClip("v2_1/taunt1"),
V2VoicelinesData.GetAudioClip("v2_1/taunt2"),
V2VoicelinesData.GetAudioClip("v2_1/taunt3"),
V2VoicelinesData.GetAudioClip("v2_1/taunt4"),
V2VoicelinesData.GetAudioClip("v2_1/taunt5"),
V2VoicelinesData.GetAudioClip("v2_1/taunt6")
}, new string[6]
{
V2VoicelinesData.GetSubtitle("subtitles_v2_taunt1"),
V2VoicelinesData.GetSubtitle("subtitles_v2_taunt2"),
V2VoicelinesData.GetSubtitle("subtitles_v2_taunt3"),
V2VoicelinesData.GetSubtitle("subtitles_v2_taunt4"),
V2VoicelinesData.GetSubtitle("subtitles_v2_taunt5"),
V2VoicelinesData.GetSubtitle("subtitles_v2_taunt6")
}, null, null, V2VoicelinesData.GetAudioClip("v2_1/death"), V2VoicelinesData.GetSubtitle("subtitles_v2_death")));
}
else
{
__instance.SetAdditionalData(new ExtensionMethods.V2AdditionalData(audioSource, (AudioClip[])(object)new AudioClip[4]
{
V2VoicelinesData.GetAudioClip("v2_2/taunt1"),
V2VoicelinesData.GetAudioClip("v2_2/taunt2"),
V2VoicelinesData.GetAudioClip("v2_2/taunt3"),
V2VoicelinesData.GetAudioClip("v2_2/taunt4")
}, new string[4]
{
V2VoicelinesData.GetSubtitle("subtitles_v2Second_taunt1"),
V2VoicelinesData.GetSubtitle("subtitles_v2Second_taunt2"),
V2VoicelinesData.GetSubtitle("subtitles_v2Second_taunt3"),
V2VoicelinesData.GetSubtitle("subtitles_v2Second_taunt4")
}, V2VoicelinesData.GetAudioClip("v2_2/enrage"), V2VoicelinesData.GetSubtitle("subtitles_v2Second_enrage"), V2VoicelinesData.GetAudioClip("v2_1/death"), V2VoicelinesData.GetSubtitle("subtitles_v2_death")));
if (__instance.secondEncounter && __instance.firstPhase && !Plugin.secondEncounterIntro)
{
__instance.Taunt();
}
}
if (__instance.intro)
{
__instance.PlayVoice(V2VoicelinesData.GetAudioClip("v2_1/windowbreak"));
MonoSingleton<SubtitleController>.Instance.DisplaySubtitle(V2VoicelinesData.GetSubtitle("subtitles_v2_windowsbreak"), (AudioSource)null, false);
}
if (__instance.longIntro)
{
((MonoBehaviour)__instance).StartCoroutine(LongIntro(__instance, ___anim));
}
Plugin.LogDebug("v2 started");
}
[IteratorStateMachine(typeof(<LongIntro>d__2))]
private static IEnumerator LongIntro(V2 __instance, Animator ___anim)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <LongIntro>d__2(0)
{
__instance = __instance,
___anim = ___anim
};
}
[HarmonyPatch("SwitchWeapon")]
[HarmonyPostfix]
private static void SwitchWeaponPostfix(V2 __instance)
{
if (__instance.firstPhase && !(((Object)__instance).name == "Big Johnator"))
{
ExtensionMethods.V2AdditionalData additionalData = __instance.GetAdditionalData();
additionalData.timesChangedWeapon++;
if (additionalData.timesChangedWeapon >= 7)
{
additionalData.timesChangedWeapon = 0;
__instance.Taunt();
}
Plugin.LogDebug("v2 changed weapon");
}
}
}
[HarmonyPatch(typeof(V2))]
[HarmonyPatch(typeof(V2))]
internal class SwitchWeaponPatch : DefaultPatch
{
[CompilerGenerated]
private sealed class <>c__DisplayClass4_0
{
public GameObject fallingV2;
internal bool <Falling>b__0()
{
return fallingV2.activeInHierarchy;
}
}
[CompilerGenerated]
private sealed class <Falling>d__4 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
private <>c__DisplayClass4_0 <>8__1;
private AudioSource <audioSource>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Falling>d__4(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>8__1 = null;
<audioSource>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Expected O, but got Unknown
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
//IL_00d7: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>8__1 = new <>c__DisplayClass4_0();
<>8__1.fallingV2 = ((Component)Utils.FindGameObjectByName("8 Stuff(Clone)(Clone)").transform.Find("v2_GreenArm")).gameObject;
<audioSource>5__2 = Utils.CreateVoiceObject("FallingVoice", <>8__1.fallingV2.transform);
<audioSource>5__2.clip = V2VoicelinesData.GetAudioClip("v2_2/death");
<>2__current = (object)new WaitUntil((Func<bool>)(() => <>8__1.fallingV2.activeInHierarchy));
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(0.3f);
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
<audioSource>5__2.Play();
MonoSingleton<SubtitleController>.Instance.DisplaySubtitle(V2VoicelinesData.GetSubtitle("subtitles_v2Second_death"), (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();
}
}
[CompilerGenerated]
private sealed class <Fleeing>d__3 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public V2 __instance;
private ExtensionMethods.V2AdditionalData <data>5__1;
private AudioSource <fleeingVoice>5__2;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Fleeing>d__3(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<data>5__1 = null;
<fleeingVoice>5__2 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<data>5__1 = __instance.GetAdditionalData();
__instance.PlayVoice(<data>5__1.deathAudioClip);
MonoSingleton<SubtitleController>.Instance.DisplaySubtitle(<data>5__1.deathSubtitle, (AudioSource)null, false);
<fleeingVoice>5__2 = Utils.CreateOneTimeVoiceObject("FleeingVoice", V2VoicelinesData.GetAudioClip("v2_2/fleeing1"), Utils.CreateSubtitleData(Utils.MakeLine(V2VoicelinesData.GetSubtitle("subtitles_v2Second_fleeing1"))), ((Component)__instance).transform);
<>2__current = (object)new WaitForSeconds(2.5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<fleeingVoice>5__2.Play();
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 <Outro>d__2 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public V2 __instance;
private AudioSource <audioSource>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Outro>d__2(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<audioSource>5__1 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSeconds(1f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<audioSource>5__1 = Utils.CreateOneTimeVoiceObject("OutroVoice", V2VoicelinesData.GetAudioClip("v2_1/outro"), Utils.CreateSubtitleData(Utils.MakeLine(V2VoicelinesData.GetSubtitle("subtitles_v2_outro1")), Utils.MakeLine(V2VoicelinesData.GetSubtitle("subtitles_v2_outro2"), 0.9f), Utils.MakeLine(V2VoicelinesData.GetSubtitle("subtitles_v2_outro3"), 2f)), ((Component)__instance).transform);
<audioSource>5__1.Play();
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();
}
}
[HarmonyPatch("Enrage", new Type[] { typeof(string) })]
[HarmonyPostfix]
private static void EnragePostfix(V2 __instance, string enrageName)
{
if (enrageName == "STOP HITTING YOURSELF")
{
ExtensionMethods.V2AdditionalData additionalData = __instance.GetAdditionalData();
additionalData.timesChangedWeapon = 0;
__instance.PlayVoice(additionalData.enrageAudioClip);
MonoSingleton<SubtitleController>.Instance.DisplaySubtitle(additionalData.enrageSubtitle, (AudioSource)null, false);
}
Plugin.LogDebug("v2 enraged (enrageName=\"" + enrageName + "\")");
}
[HarmonyPatch("KnockedOut")]
[HarmonyPostfix]
private static void KnockedOutPostfix(V2 __instance, string triggerName)
{
if (triggerName == "KnockedDown")
{
if (!__instance.secondEncounter)
{
((MonoBehaviour)__instance).StartCoroutine(Outro(__instance));
}
else
{
((MonoBehaviour)__instance).StartCoroutine(Fleeing(__instance));
}
}
else if (triggerName == "Flailing")
{
((MonoBehaviour)Plugin.Instance).StartCoroutine(Falling());
}
else
{
Plugin.LogError("what");
}
Plugin.LogDebug("v2 knocked out: " + triggerName);
}
[IteratorStateMachine(typeof(<Outro>d__2))]
private static IEnumerator Outro(V2 __instance)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Outro>d__2(0)
{
__instance = __instance
};
}
[IteratorStateMachine(typeof(<Fleeing>d__3))]
private static IEnumerator Fleeing(V2 __instance)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Fleeing>d__3(0)
{
__instance = __instance
};
}
[IteratorStateMachine(typeof(<Falling>d__4))]
private static IEnumerator Falling()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Falling>d__4(0);
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}