using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text.Json;
using System.Text.Json.Serialization;
using Agents;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using GTFO.API;
using GTFO.API.JSON;
using Globals;
using Il2CppInterop.Runtime.Injection;
using Il2CppSystem;
using Il2CppSystem.Collections.Generic;
using MTFO.Managers;
using Microsoft.CodeAnalysis;
using Player;
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(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("PlayerSpawnApart")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("PlayerSpawnApart")]
[assembly: AssemblyTitle("PlayerSpawnApart")]
[assembly: AssemblyVersion("1.0.0.0")]
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;
}
}
}
namespace PlayerSpawnApart
{
[BepInPlugin("com.Brandonious.PlayerSpawnApart", "PlayerSpawnApart", "1.0.0")]
public class Loader : BasePlugin
{
public const string MODNAME = "PlayerSpawnApart";
public const string AUTHOR = "Brandonious";
public const string GUID = "com.Brandonious.PlayerSpawnApart";
public const string VERSION = "1.0.0";
public override void Load()
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Expected O, but got Unknown
ClassInjector.RegisterTypeInIl2Cpp<PlayerSpawnApart>();
EventAPI.OnManagersSetup += delegate
{
PlayerSpawnApart @object = ((Component)Global.Current).gameObject.AddComponent<PlayerSpawnApart>();
LevelAPI.OnEnterLevel += @object.LevelStarted;
LevelAPI.OnLevelCleanup += @object.LevelCleanup;
};
Directory.CreateDirectory(Path.Combine(ConfigManager.CustomPath, "PlayerSpawnApart"));
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(18, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("PlayerSpawnApart");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Loaded! :)");
}
log.LogInfo(val);
}
}
internal class PlayerSpawnApart : MonoBehaviour
{
private static List<PlayerSpawnData> spawnData;
public uint levelLayoutID;
private void Update()
{
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: 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_006b: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKeyDown((KeyCode)120))
{
Debug.Log(Object.op_Implicit("\nX:" + ((Agent)PlayerManager.GetLocalPlayerAgent()).Position.x + "\nY:" + ((Agent)PlayerManager.GetLocalPlayerAgent()).Position.y + "\nZ:" + ((Agent)PlayerManager.GetLocalPlayerAgent()).Position.z));
}
}
public void LevelStarted()
{
//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_0123: Unknown result type (might be due to invalid IL or missing references)
if (ReadData() == null)
{
Debug.LogError(Object.op_Implicit("There is no teleport data set up!"));
Debug.LogError(Object.op_Implicit("Place teleport data in Custom/PlayerSpawnApart"));
return;
}
spawnData = ReadData();
levelLayoutID = RundownManager.ActiveExpedition.LevelLayoutData;
for (int i = 0; i < spawnData.Count; i++)
{
if (spawnData[i].MainLevelLayoutID != levelLayoutID || !spawnData[i].InternalEnabled)
{
continue;
}
Enumerator<PlayerAgent> enumerator = PlayerManager.PlayerAgentsInLevel.GetEnumerator();
while (enumerator.MoveNext())
{
PlayerAgent current = enumerator.Current;
switch (current.PlayerSlotIndex)
{
case 0:
current.TeleportTo(spawnData[i].Player1Spawn);
break;
case 1:
current.TeleportTo(spawnData[i].Player2Spawn);
break;
case 2:
current.TeleportTo(spawnData[i].Player3Spawn);
break;
case 3:
current.TeleportTo(spawnData[i].Player4Spawn);
break;
}
}
}
}
public void LevelCleanup()
{
}
private static List<PlayerSpawnData> ReadData()
{
new JsonSerializerOptions
{
IncludeFields = false,
ReadCommentHandling = JsonCommentHandling.Skip,
PropertyNameCaseInsensitive = true,
WriteIndented = true,
Converters = { (JsonConverter)new JsonStringEnumConverter() }
};
return JsonSerializer.Deserialize<List<PlayerSpawnData>>(File.ReadAllText(Path.Combine(ConfigManager.CustomPath, "PlayerSpawnApart", "SpawnData.json")), (JsonSerializerOptions)null);
}
}
public class PlayerSpawnData
{
public Vector3 Player1Spawn { get; set; }
public Vector3 Player2Spawn { get; set; }
public Vector3 Player3Spawn { get; set; }
public Vector3 Player4Spawn { get; set; }
public uint MainLevelLayoutID { get; set; }
public bool InternalEnabled { get; set; }
public string DebugName { get; set; }
}
}