using System;
using System.Diagnostics;
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 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("SpectateEnemiesFix")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Fixes for Spectate Enemies Mod")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("SpectateEnemiesFix")]
[assembly: AssemblyTitle("SpectateEnemiesFix")]
[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 SpectateEnemiesFix
{
[BepInPlugin("SpectateEnemiesFix", "SpectateEnemiesFix", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class Plugin : BaseUnityPlugin
{
public static ManualLogSource log;
private Harmony harmony = new Harmony("red.thishalf.spectateenemiesfix");
private void Awake()
{
log = ((BaseUnityPlugin)this).Logger;
harmony.PatchAll();
((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin SpectateEnemiesFix is loaded!");
}
}
[HarmonyPatch]
public static class ZoomFix
{
private static Type spectateEnemiesType;
private static FieldInfo spectateEnemiesZoomLevelField;
private static FieldInfo spectateEnemiesSpectatingEnemiesField;
[HarmonyTargetMethod]
private static MethodBase TargetMethod()
{
spectateEnemiesType = AccessTools.TypeByName("SpectateEnemy.SpectateEnemies");
spectateEnemiesZoomLevelField = AccessTools.Field(spectateEnemiesType, "zoomLevel");
spectateEnemiesSpectatingEnemiesField = AccessTools.Field(spectateEnemiesType, "SpectatingEnemies");
return AccessTools.Method(spectateEnemiesType, "LateUpdate", (Type[])null, (Type[])null);
}
private static void Postfix(object __instance)
{
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: 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)
float num = (float)spectateEnemiesZoomLevelField.GetValue(__instance);
if ((bool)spectateEnemiesSpectatingEnemiesField.GetValue(__instance))
{
Transform spectateCameraPivot = GameNetworkManager.Instance.localPlayerController.spectateCameraPivot;
spectateCameraPivot.position -= Vector3.up * num;
((Component)((Component)GameNetworkManager.Instance.localPlayerController.spectateCameraPivot).GetComponentInChildren<Camera>()).transform.localPosition = Vector3.back * (num + 0.5f);
}
}
}
public static class PluginInfo
{
public const string PLUGIN_GUID = "SpectateEnemiesFix";
public const string PLUGIN_NAME = "SpectateEnemiesFix";
public const string PLUGIN_VERSION = "1.0.0";
}
}