using System;
using System.Collections;
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;
using Zorro.Core;
using Zorro.Settings;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.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.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
internal sealed class NullableAttribute : Attribute
{
public readonly byte[] NullableFlags;
public NullableAttribute(byte P_0)
{
NullableFlags = new byte[1] { P_0 };
}
public NullableAttribute(byte[] P_0)
{
NullableFlags = P_0;
}
}
[CompilerGenerated]
[Embedded]
[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
internal sealed class NullableContextAttribute : Attribute
{
public readonly byte Flag;
public NullableContextAttribute(byte P_0)
{
Flag = P_0;
}
}
[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 CW_Test_Mod
{
[ContentWarningPlugin("ElectricSteve.cwtestmod", "1.1.1", false)]
[BepInPlugin("ElectricSteve.cwtestmod", "CW Test Mod", "1.1.1")]
public class CW_Test_Mod : BaseUnityPlugin
{
public static bool JustKilledPlayer;
private readonly Harmony harmony = new Harmony("ElectricSteve.cwtestmod");
public static CW_Test_Mod Instance { get; private set; }
internal static ManualLogSource Logger { get; private set; }
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
Instance = this;
harmony.PatchAll();
Logger.LogInfo((object)"ElectricSteve.cwtestmod v1.1.1 has loaded!");
}
private void Update()
{
if (!((Object)(object)Player.localPlayer == (Object)null) && SurfaceNetworkHandler.HasStarted && KillKeybind.EnsureBound() && KillKeybind.KillKey.GetKeyDown())
{
JustKilledPlayer = true;
Logger.LogDebug((object)"Killing Player");
Player.localPlayer.CallDie();
if (PhotonGameLobbyHandler.IsSurface)
{
((MonoBehaviour)this).StartCoroutine(WaitAndRevive(2f));
}
}
}
private IEnumerator WaitAndRevive(float waitTime)
{
yield return (object)new WaitForSeconds(waitTime);
RetrievableResourceSingleton<TransitionHandler>.Instance.TransitionToBlack(0f, (Action)delegate
{
//IL_000f: 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)
Player.localPlayer.Teleport(((Component)Hospital.instance).transform.position, Vector3.back);
Player.localPlayer.data.fallTime = 0f;
RetrievableResourceSingleton<TransitionHandler>.Instance.FadeOut((Action)delegate
{
}, 1f);
}, 0f);
yield return (object)new WaitForSeconds(1f);
Logger.LogDebug((object)"Reviving player...");
Player.localPlayer.CallRevive();
Logger.LogDebug((object)"Healing player...");
float num = PlayerData.maxHealth - Player.localPlayer.data.health;
Player.localPlayer.CallHeal(Mathf.Min(num, PlayerData.maxHealth - 0.01f));
}
}
public class KillKeybindSetting : KeyCodeSetting, IExposedSetting
{
protected override KeyCode GetDefaultKey()
{
return (KeyCode)107;
}
public SettingCategory GetSettingCategory()
{
return (SettingCategory)2;
}
public string GetDisplayName()
{
return "Kill Key";
}
}
[HarmonyPatch]
internal static class KillKeybind
{
public static InputKey KillKey = new InputKey();
internal static bool EnsureBound()
{
if (KillKey.KeyCodeSetting != null)
{
return true;
}
GameHandler instance = GameHandler.Instance;
SettingsHandler obj = ((instance != null) ? instance.SettingsHandler : null);
KillKeybindSetting killKeybindSetting = ((obj != null) ? obj.GetSetting<KillKeybindSetting>() : null);
if (killKeybindSetting == null)
{
return false;
}
KillKey.SetKeybind((KeyCodeSetting)(object)killKeybindSetting);
return true;
}
[HarmonyPatch(/*Could not decode attribute arguments.*/)]
[HarmonyPostfix]
private static void AddKillKeybind(SettingsHandler __instance)
{
if (__instance.GetSetting<KillKeybindSetting>() == null)
{
__instance.AddSetting((Setting)(object)new KillKeybindSetting());
}
}
[HarmonyPatch(typeof(PhotonGameLobbyHandler), "CheckForAllDead")]
[HarmonyPrefix]
private static bool SkipAllDeadAfterKill()
{
if (CW_Test_Mod.JustKilledPlayer && PhotonGameLobbyHandler.IsSurface)
{
CW_Test_Mod.Logger.LogDebug((object)"Player just killed, returning");
CW_Test_Mod.JustKilledPlayer = false;
return false;
}
return true;
}
}
}
namespace System.Runtime.CompilerServices
{
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
internal sealed class IgnoresAccessChecksToAttribute : Attribute
{
public IgnoresAccessChecksToAttribute(string assemblyName)
{
}
}
}