using System;
using System.Collections.Generic;
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.Configuration;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp-firstpass")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("Autodesk.Fbx")]
[assembly: IgnoresAccessChecksTo("Facepunch.Steamworks.Win64")]
[assembly: IgnoresAccessChecksTo("FbxBuildTestAssets")]
[assembly: IgnoresAccessChecksTo("Klattersynth")]
[assembly: IgnoresAccessChecksTo("Photon3Unity3D")]
[assembly: IgnoresAccessChecksTo("PhotonChat")]
[assembly: IgnoresAccessChecksTo("PhotonRealtime")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking")]
[assembly: IgnoresAccessChecksTo("PhotonUnityNetworking.Utilities")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.API")]
[assembly: IgnoresAccessChecksTo("PhotonVoice")]
[assembly: IgnoresAccessChecksTo("PhotonVoice.PUN")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime")]
[assembly: IgnoresAccessChecksTo("SingularityGroup.HotReload.Runtime.Public")]
[assembly: IgnoresAccessChecksTo("Sirenix.OdinInspector.Attributes")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization.Config")]
[assembly: IgnoresAccessChecksTo("Sirenix.Serialization")]
[assembly: IgnoresAccessChecksTo("Sirenix.Utilities")]
[assembly: IgnoresAccessChecksTo("Unity.AI.Navigation")]
[assembly: IgnoresAccessChecksTo("Unity.Formats.Fbx.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem")]
[assembly: IgnoresAccessChecksTo("Unity.InputSystem.ForUI")]
[assembly: IgnoresAccessChecksTo("Unity.Postprocessing.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.Core.ShaderLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.RenderPipelines.ShaderGraph.ShaderGraphLibrary")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Antlr3.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Core")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.Flow")]
[assembly: IgnoresAccessChecksTo("Unity.VisualScripting.State")]
[assembly: IgnoresAccessChecksTo("UnityEngine.ARModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.NVIDIAModule")]
[assembly: IgnoresAccessChecksTo("UnityEngine.UI")]
[assembly: IgnoresAccessChecksTo("websocket-sharp")]
[assembly: AssemblyCompany("ShaderLaze")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("Respawn")]
[assembly: AssemblyTitle("Respawn")]
[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.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]
[Microsoft.CodeAnalysis.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]
[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 RespawnMod
{
[BepInPlugin("ShaderLaze.Respawn", "Respawn", "1.1.1")]
public class Respawn : BaseUnityPlugin
{
internal ConfigEntry<bool> configUseDeathHead = null;
internal ConfigEntry<bool> configUseTumble = null;
internal ConfigEntry<bool> configRespawnAtDeathPosition = null;
internal static Respawn Instance { get; private set; }
private void Awake()
{
//IL_0070: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Expected O, but got Unknown
Instance = this;
configUseDeathHead = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "CreateDeathHead", true, "Создавать ли DeathHead при респавне");
configUseTumble = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "CreateTumble", true, "Создавать ли Tumble при респавне");
configRespawnAtDeathPosition = ((BaseUnityPlugin)this).Config.Bind<bool>("Settings", "RespawnAtDeathPosition", false, "Респавнить на месте смерти (true) или на точке спавна (false)");
GameObject val = new GameObject("RespawnUpdater");
((Object)val).hideFlags = (HideFlags)61;
val.AddComponent<RespawnUpdater>();
Object.DontDestroyOnLoad((Object)(object)val);
((BaseUnityPlugin)this).Logger.LogInfo((object)"Respawn mod initialized.");
}
}
public class RespawnUpdater : MonoBehaviour
{
private void Update()
{
if (Input.GetKeyDown((KeyCode)282))
{
RespawnAllDeadPlayers();
}
}
private void RespawnAllDeadPlayers()
{
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
List<PlayerAvatar> list = GameDirector.instance.PlayerList.FindAll((PlayerAvatar player) => player.deadSet);
int num = 0;
foreach (PlayerAvatar item in list)
{
bool flag = (Object)(object)item.playerDeathHead != (Object)null;
PlayerDeathHead playerDeathHead = item.playerDeathHead;
Vector3? obj;
if (playerDeathHead == null)
{
obj = null;
}
else
{
Transform transform = ((Component)playerDeathHead).transform;
obj = ((transform != null) ? new Vector3?(transform.position) : null);
}
Vector3? val = obj;
Vector3 val2 = new Vector3(0f, 3000f, 0f);
bool flag2 = val.HasValue && val.GetValueOrDefault() == val2;
if (flag && !flag2)
{
RespawnPlayer(item);
num++;
}
}
Debug.Log((object)$"Respawned {num} dead player(s).");
}
private void RespawnPlayer(PlayerAvatar player)
{
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_008d: Unknown result type (might be due to invalid IL or missing references)
Respawn instance = Respawn.Instance;
if (instance.configRespawnAtDeathPosition.Value)
{
player.photonView.RPC("ReviveRPC", (RpcTarget)0, new object[1] { false });
}
else
{
SpawnPoint[] array = Object.FindObjectsOfType<SpawnPoint>();
if (array.Length == 0)
{
Debug.LogWarning((object)"No spawn points found.");
return;
}
SpawnPoint val = array[Random.Range(0, array.Length)];
Vector3 position = ((Component)val).transform.position;
Quaternion rotation = ((Component)val).transform.rotation;
player.Revive(false);
player.Spawn(position, rotation);
}
Debug.Log((object)("Respawned player: " + player.playerName));
}
}
}