using System;
using System.Collections;
using System.Diagnostics;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using UnityEngine;
using UnityEngine.AI;
using UnityEngine.AddressableAssets;
using UnityEngine.Events;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ThundergunRevised")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ThundergunRevised")]
[assembly: AssemblyCopyright("Copyright © 2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("5711e2a0-d5a7-4ddf-b8d4-00f355fe9397")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: NeutralResourcesLanguage("en-FI")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace Follower20;
public class FollowerFlayer : MonoBehaviour
{
public Follow follow;
public NewMovement player;
public AlwaysLookAtCamera ALAC;
public bool dead;
public V2 mindflayYergh;
private void Start()
{
follow = ((Component)this).gameObject.GetComponent<Follow>();
mindflayYergh = ((Component)this).gameObject.GetComponent<V2>();
ALAC = ((Component)this).gameObject.GetComponent<AlwaysLookAtCamera>();
player = MonoSingleton<NewMovement>.Instance;
}
private void Update()
{
}
}
[BepInPlugin("vqevs.spectatorv2", "spectatorv2", "1.0.0")]
public class MainCode : BaseUnityPlugin
{
public class KillTracker
{
public static void Postfix(EnemyIdentifier __instance)
{
if ((Object)(object)v2Instance != (Object)null && (Object)(object)((Component)__instance).gameObject != (Object)(object)v2Instance && Random.value > 0.75f)
{
instance.StartBeef("V2", v2KillRoasts[Random.Range(0, v2KillRoasts.Length)]);
}
}
}
public static GameObject v2Instance;
private bool firstSpawnDone;
private float lastPlayerHealth = 100f;
private bool v1WasDead;
private static string[] v2KillRoasts = new string[8] { "Lame.", "Boring.", "My sensors are asleep.", "Is that all?", "Slow.", "Pathetic.", "Gabe must be ashamed.", "You call that a kill?" };
private string[] v2HurtRoasts = new string[7] { "Watch it!", "Stop dying.", "Rusty.", "Embarrassing.", "Move!", "You parry like a filth.", "I hope you perish" };
private static string[] v1Comebacks = new string[7] { "Shut up.", "I didn't ask.", "Still better than you.", "Focus on being dead.", "Cry about it.", "Mind your business.", "I wasnt the puddle on the floor in 4-4" };
private static MainCode instance;
public void Update()
{
if (SceneHelper.CurrentScene == "Main Menu")
{
firstSpawnDone = false;
}
else
{
if ((Object)(object)MonoSingleton<NewMovement>.Instance == (Object)null)
{
return;
}
if ((Object)(object)v2Instance == (Object)null)
{
SpawnV2();
}
if ((Object)(object)v2Instance != (Object)null)
{
if (Input.GetKeyDown((KeyCode)45) || Input.GetKeyDown((KeyCode)269))
{
ManualRecall();
}
float num = MonoSingleton<NewMovement>.Instance.hp;
if (num < lastPlayerHealth && num > 0f && Random.value > 0.65f)
{
StartBeef("V2", v2HurtRoasts[Random.Range(0, v2HurtRoasts.Length)]);
}
lastPlayerHealth = num;
if (MonoSingleton<NewMovement>.Instance.dead && !v1WasDead)
{
StartBeef("V2", "Dumbass.");
}
v1WasDead = MonoSingleton<NewMovement>.Instance.dead;
}
}
}
private void SpawnV2()
{
//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_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: 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_00d5: Expected O, but got Unknown
v2Instance = Object.Instantiate<GameObject>(Addressables.LoadAssetAsync<GameObject>((object)"Assets/Prefabs/Enemies/V2.prefab").WaitForCompletion(), ((Component)MonoSingleton<NewMovement>.Instance).transform.position + Vector3.up * 1f, Quaternion.identity);
Collider[] componentsInChildren = v2Instance.GetComponentsInChildren<Collider>();
for (int i = 0; i < componentsInChildren.Length; i++)
{
componentsInChildren[i].isTrigger = true;
}
Rigidbody component;
if ((component = v2Instance.GetComponent<Rigidbody>()) != null)
{
component.isKinematic = true;
component.useGravity = false;
}
NavMeshAgent component2;
if ((component2 = v2Instance.GetComponent<NavMeshAgent>()) != null)
{
((Behaviour)component2).enabled = true;
component2.baseOffset = 0f;
}
EnemyIdentifier component3;
if ((component3 = v2Instance.GetComponent<EnemyIdentifier>()) != null)
{
component3.ignorePlayer = false;
component3.health = 9999f;
component3.onDeath = new UnityEvent();
}
Transform[] componentsInChildren2 = v2Instance.GetComponentsInChildren<Transform>(true);
foreach (Transform val in componentsInChildren2)
{
if (((Object)val).name.ToLower().Contains("gun") || ((Object)val).name.ToLower().Contains("weapon"))
{
((Component)val).gameObject.SetActive(false);
}
}
v2Instance.SetActive(true);
if (!firstSpawnDone)
{
SendMsg("V2", "I'm back to see you fail.");
firstSpawnDone = true;
}
}
private void ManualRecall()
{
//IL_0014: 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_002d: 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)
v2Instance.transform.position = ((Component)MonoSingleton<NewMovement>.Instance).transform.position + ((Component)MonoSingleton<NewMovement>.Instance).transform.forward * 3f;
StartBeef("V2", "Keep your hands off me.");
}
public static void SendMsg(string name, string content)
{
if ((Object)(object)MonoSingleton<HudMessageReceiver>.Instance != (Object)null)
{
string text = ((name == "V2") ? "#FF0000" : "#00FFFF");
string text2 = "<color=" + text + ">" + name + ": " + content + "</color>";
MonoSingleton<HudMessageReceiver>.Instance.SendHudMessage(text2, "", "", 0, false, false, true);
}
}
public void Start()
{
//IL_000b: 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_0053: Expected O, but got Unknown
instance = this;
try
{
Harmony val = new Harmony("vqevs.spectatorv2");
MethodInfo methodInfo = AccessTools.Method(typeof(EnemyIdentifier), "Death", new Type[0], (Type[])null);
MethodInfo methodInfo2 = AccessTools.Method(typeof(KillTracker), "Postfix", (Type[])null, (Type[])null);
val.Patch((MethodBase)methodInfo, (HarmonyMethod)null, new HarmonyMethod(methodInfo2), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
}
catch (Exception ex)
{
Debug.LogError((object)("Harmony Patch Başarısız: " + ex.Message));
}
}
public void StartBeef(string speaker, string msg)
{
SendMsg(speaker, msg);
if (speaker == "V2")
{
((MonoBehaviour)this).StartCoroutine(V1ReplyDelayed());
}
}
private IEnumerator V1ReplyDelayed()
{
yield return (object)new WaitForSeconds(0.8f);
SendMsg("V1", v1Comebacks[Random.Range(0, v1Comebacks.Length)]);
}
}
public class StaticCoroutine : MonoBehaviour
{
public static void DoAfter(Action action, float delay)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
GameObject val = new GameObject("DelayRunner");
((MonoBehaviour)val.AddComponent<StaticCoroutine>()).StartCoroutine(Execute(action, delay, val));
}
private static IEnumerator Execute(Action action, float delay, GameObject runner)
{
yield return (object)new WaitForSeconds(delay);
action();
Object.Destroy((Object)(object)runner);
}
}
public class StaticCoroutine__0 : MonoBehaviour
{
public static void DoAfter(Action action, float delay)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
GameObject val = new GameObject("DelayRunner");
((MonoBehaviour)val.AddComponent<StaticCoroutine__0>()).StartCoroutine(Execute(action, delay, val));
}
private static IEnumerator Execute(Action action, float delay, GameObject runner)
{
yield return (object)new WaitForSeconds(delay);
action();
Object.Destroy((Object)(object)runner);
}
}
public class StaticCoroutine__1 : MonoBehaviour
{
public static void DoAfter(Action action, float delay)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
GameObject val = new GameObject("DelayRunner");
((MonoBehaviour)val.AddComponent<StaticCoroutine__1>()).StartCoroutine(Execute(action, delay, val));
}
private static IEnumerator Execute(Action action, float delay, GameObject runner)
{
yield return (object)new WaitForSeconds(delay);
action();
Object.Destroy((Object)(object)runner);
}
}
public class StaticCoroutine__2 : MonoBehaviour
{
public static void DoAfter(Action action, float delay)
{
//IL_0005: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Expected O, but got Unknown
GameObject val = new GameObject("DelayRunner");
((MonoBehaviour)val.AddComponent<StaticCoroutine__2>()).StartCoroutine(Execute(action, delay, val));
}
private static IEnumerator Execute(Action action, float delay, GameObject runner)
{
yield return (object)new WaitForSeconds(delay);
action();
Object.Destroy((Object)(object)runner);
}
}