using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text.Json;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Bloodstone.API;
using Bloody.Core;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using NightbaneManualEvents;
using ProjectM;
using ProjectM.Network;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
using Unity.Transforms;
using UnityEngine;
using VampireCommandFramework;
[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("NightbaneManualEvents")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Adds tools to manually organize an event for players.")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("0.1.7+1.Branch.main.Sha.a322c9fb3b6e06343e3dfa71f39a27988d15f262.d834a33432e8cc57f287e3c48cc894f07e360c01")]
[assembly: AssemblyProduct("NightbaneManualEvents")]
[assembly: AssemblyTitle("NightbaneManualEvents")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.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;
}
}
}
[CommandGroup("event", null)]
[Description("")]
public static class Commands
{
[Command("pause", null, null, "", null, true)]
public static void PauseEventCommand(ChatCommandContext ctx)
{
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
ManualEventSystem.PauseEvent();
ctx.Reply("<color=green>The event is now " + (ManualEventSystem.EventPaused ? "paused" : "resumed") + ".</color>");
ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, "The event is now " + (ManualEventSystem.EventPaused ? "closed to new participants" : "open again") + ". Stay tuned!");
}
[Command("count", null, null, "", null, true)]
public static void EventPlayersCountCommand(ChatCommandContext ctx)
{
int count = ManualEventSystem.EventPlayers.Count;
ctx.Reply($"There are {count} Players in Event");
}
[Command("start", null, null, "", null, true)]
public static void EventStartCommand(ChatCommandContext ctx, string eventName)
{
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
if (ManualEventSystem.EventActive)
{
ctx.Reply("An event is already active.");
}
else
{
ManualEventSystem.StartEvent(ctx.Event.SenderCharacterEntity, eventName);
}
}
[Command("end", null, null, "", null, true)]
public static void EventEndCommand(ChatCommandContext ctx)
{
if (!ManualEventSystem.EventActive)
{
ctx.Reply("No event is currently active.");
}
else
{
ManualEventSystem.EndEvent();
}
}
[Command("ban", null, null, "", null, true)]
public static void EventBanCommand(ChatCommandContext ctx, string playerName)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
Entity val = Helper.FindPlayerByName(playerName);
if (val == Entity.Null)
{
ctx.Reply("Player " + playerName + " does not exist.");
}
else
{
ManualEventSystem.BanPlayer(val);
}
}
[Command("unban", null, null, "", null, true)]
public static void EventUnbanCommand(ChatCommandContext ctx, string playerName)
{
//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_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
if (!File.Exists(ManualEventSystem.bannedPlayersJsonLocation))
{
ctx.Reply("There are no banned players.");
return;
}
Entity val = Helper.FindPlayerByName(playerName);
if (val == Entity.Null)
{
ctx.Reply("Player " + playerName + " does not exist.");
return;
}
ulong platformId = ECSExtensions.Read<User>(ECSExtensions.Read<ControlledBy>(val).Controller).PlatformId;
if (!ManualEventSystem.BannedPlayers.Contains(platformId))
{
ctx.Reply("Player " + playerName + " is not banned.");
}
else
{
ManualEventSystem.UnbanPlayer(platformId, playerName);
}
}
[Command("kick", null, null, "", null, true)]
public static void EventKickCommand(ChatCommandContext ctx, string playerName)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0009: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: 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)
Entity val = Helper.FindPlayerByName(playerName);
if (val == Entity.Null || !ManualEventSystem.EventPlayers.Contains(val))
{
ctx.Reply("Player " + playerName + " is not in the event or does not exist.");
}
else
{
ManualEventSystem.KickPlayer(val, playerName);
}
}
[Command("add", null, null, "", null, true)]
public static void AddPlayerToEvent(ChatCommandContext ctx, string playerName)
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: 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_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_007d: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
if (!ManualEventSystem.EventActive)
{
ctx.Reply("No event is currently active.");
return;
}
Entity val = Helper.FindPlayerByName(playerName);
if (val == Entity.Null || ManualEventSystem.EventPlayers.Contains(val))
{
ctx.Reply("Player " + playerName + " is already in the event or does not exist.");
return;
}
EntityManager entityManager = VWorld.Server.EntityManager;
Equipment componentData = ((EntityManager)(ref entityManager)).GetComponentData<Equipment>(ctx.Event.SenderCharacterEntity);
if (!Helper.IsInventoryEmpty(componentData))
{
ctx.Reply("Player " + playerName + " inventory is not empty.");
return;
}
ManualEventSystem.JoinEvent(val);
ctx.Reply("Added " + playerName + " to the Event.");
}
[Command("gather", null, null, "", null, true)]
public static void GatherEventPlayersCommand(ChatCommandContext ctx)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
if (ManualEventSystem.GatherEventPlayers(ctx.Event.SenderCharacterEntity))
{
ctx.Reply("<color=green>Teleported all event players to you.");
}
else
{
ctx.Reply("<color=red>There is no event active right now.");
}
}
[Command("join", null, null, "", null, false)]
public static void EventJoinCommand(ChatCommandContext ctx)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: 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_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0092: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
Entity senderUserEntity = ctx.Event.SenderUserEntity;
Entity senderCharacterEntity = ctx.Event.SenderCharacterEntity;
EntityManager entityManager = VWorld.Server.EntityManager;
ulong platformId = ECSExtensions.Read<User>(senderUserEntity).PlatformId;
if (ManualEventSystem.EventPaused)
{
ctx.Reply("The event is closed to new participants.");
return;
}
if (ManualEventSystem.BannedPlayers.Contains(platformId))
{
ctx.Reply("You are banned from events.");
return;
}
if (!ManualEventSystem.EventActive)
{
ctx.Reply("No event is currently active.");
return;
}
if (ManualEventSystem.EventPlayers.Contains(senderCharacterEntity))
{
ctx.Reply("You are already in the event.");
return;
}
Equipment componentData = ((EntityManager)(ref entityManager)).GetComponentData<Equipment>(ctx.Event.SenderCharacterEntity);
if (!Helper.IsInventoryEmpty(componentData))
{
ctx.Reply("Your inventory must be empty to join the event.");
return;
}
ManualEventSystem.JoinEvent(senderCharacterEntity);
ctx.Reply("You have joined the event. Use .event leave to exit.");
}
[Command("leave", null, null, "", null, false)]
public static void OnEventLeave(ChatCommandContext ctx)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
Entity senderCharacterEntity = ctx.Event.SenderCharacterEntity;
if (!ManualEventSystem.EventPlayers.Contains(senderCharacterEntity))
{
ctx.Reply("You are not in the event.");
return;
}
ManualEventSystem.LeaveEvent(senderCharacterEntity);
ctx.Reply("You have left the event and were teleported back to your original position.");
}
}
public static class Helper
{
public static bool IsInventoryEmpty(Equipment inventory)
{
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: 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_0026: 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_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
NativeList<Entity> val = default(NativeList<Entity>);
val..ctor(AllocatorHandle.op_Implicit((Allocator)2));
try
{
((Equipment)(ref inventory)).GetAllEquipmentEntities(val, false);
Enumerator<Entity> enumerator = val.GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
if (current != Entity.Null)
{
return false;
}
}
return true;
}
finally
{
val.Dispose();
}
}
public static Vector3 GetPlayerPosition(Entity playerEntity)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//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)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: 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)
EntityManager entityManager = VWorld.Server.EntityManager;
Translation componentData = ((EntityManager)(ref entityManager)).GetComponentData<Translation>(playerEntity);
return float3.op_Implicit(componentData.Value);
}
public static void TeleportPlayer(Entity playerEntity, Vector3 position)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: 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_0030: 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_0039: 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)
EntityManager entityManager = VWorld.Server.EntityManager;
((EntityManager)(ref entityManager)).SetComponentData<LastTranslation>(playerEntity, new LastTranslation
{
Value = float3.op_Implicit(position)
});
((EntityManager)(ref entityManager)).SetComponentData<Translation>(playerEntity, new Translation
{
Value = float3.op_Implicit(position)
});
}
public static Entity FindPlayerByName(string playerName)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: 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_0026: 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_0034: Unknown result type (might be due to invalid IL or missing references)
//IL_0039: 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_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_009a: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = VWorld.Server.EntityManager;
EntityManager entityManager2 = VWorld.Server.EntityManager;
EntityQuery val = ((EntityManager)(ref entityManager2)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<User>() });
NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
try
{
Enumerator<Entity> enumerator = val2.GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
User componentData = ((EntityManager)(ref entityManager)).GetComponentData<User>(current);
if (((object)(FixedString64Bytes)(ref componentData.CharacterName)).ToString() == playerName)
{
return componentData.LocalCharacter._Entity;
}
}
return Entity.Null;
}
finally
{
val2.Dispose();
}
}
}
[HarmonyPatch(typeof(KillEventSystem), "OnUpdate")]
public static class DeathEventListenerHook
{
public static void Prefix(KillEventSystem __instance)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: 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_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: 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_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: 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_0083: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
EntityQuery _query_463356032_ = __instance.__query_463356032_0;
NativeArray<Entity> val = ((EntityQuery)(ref _query_463356032_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
try
{
Enumerator<Entity> enumerator = val.GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
if (ECSExtensions.Has<KillEvent>(current) && ECSExtensions.Has<FromCharacter>(current))
{
FromCharacter val2 = ECSExtensions.Read<FromCharacter>(current);
KillEvent val3 = ECSExtensions.Read<KillEvent>(current);
if (((object)(KillWho)(ref val3.Who)).ToString() == "Self" && ManualEventSystem.EventPlayers.Contains(val2.Character))
{
EntityManager entityManager = VWorld.Server.EntityManager;
((EntityManager)(ref entityManager)).DestroyEntity(current);
ServerChatUtils.SendSystemMessageToClient(VWorld.Server.EntityManager, ECSExtensions.Read<User>(val2.User), "<color=red>You can't use unstuck inside an Event.");
}
}
}
}
finally
{
val.Dispose();
}
}
}
[HarmonyPatch(typeof(VampireDownedServerEventSystem), "OnUpdate")]
public static class VampireDownedHook
{
public static void Prefix(VampireDownedServerEventSystem __instance)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: 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_0032: 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_0052: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: 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)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
EntityQuery _query_1174204813_ = __instance.__query_1174204813_0;
NativeArray<Entity> val = ((EntityQuery)(ref _query_1174204813_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
try
{
Enumerator<Entity> enumerator = val.GetEnumerator();
Entity val2 = default(Entity);
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
VampireDownedServerEventSystem.TryFindRootOwner(current, 1, VWorld.Server.EntityManager, ref val2);
if (ManualEventSystem.EventPlayers.Contains(val2))
{
ManualEventSystem.LeaveEvent(val2);
User val3 = ECSExtensions.Read<User>(ECSExtensions.Read<ControlledBy>(val2).Controller);
ServerChatUtils.SendSystemMessageToClient(VWorld.Server.EntityManager, val3, "<color=red>You have been removed from event.");
}
}
}
finally
{
val.Dispose();
}
}
}
public static class ManualEventSystem
{
public static List<ulong> BannedPlayers = new List<ulong>();
public static Dictionary<Entity, Vector3> PlayerPositions = new Dictionary<Entity, Vector3>();
public static List<Entity> EventPlayers = new List<Entity>();
public static Vector3 EventStartPosition;
public static string bannedPlayersJsonLocation = "BepInEx/config/EventManager/bannedplayers.json";
public static bool EventActive = false;
public static bool EventPaused = false;
public static void Initialize()
{
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Expected O, but got Unknown
Directory.CreateDirectory("BepInEx/config/EventManager");
if (!File.Exists(bannedPlayersJsonLocation))
{
return;
}
try
{
string json = File.ReadAllText(bannedPlayersJsonLocation);
BannedPlayers = JsonSerializer.Deserialize<List<ulong>>(json, new JsonSerializerOptions
{
WriteIndented = true
}) ?? new List<ulong>();
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.logger;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(31, 1, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to load banned players: ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
}
logger.LogError(val);
BannedPlayers = new List<ulong>();
}
}
public static void StartEvent(Entity character, string eventName)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: 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)
EventStartPosition = Helper.GetPlayerPosition(character);
EventActive = true;
EventPlayers.Clear();
PlayerPositions.Clear();
ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, "Event '" + eventName + "' started. Players can join now using .event join");
}
public static void EndEvent()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: 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_006e: Unknown result type (might be due to invalid IL or missing references)
foreach (var (playerEntity, position) in PlayerPositions)
{
Helper.TeleportPlayer(playerEntity, position);
}
EventPlayers.Clear();
PlayerPositions.Clear();
EventActive = false;
ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, "Event ended and all players were teleported back to their original positions.");
}
public static void BanPlayer(Entity playerEntity)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Unknown result type (might be due to invalid IL or missing references)
//IL_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
User val = ECSExtensions.Read<User>(ECSExtensions.Read<ControlledBy>(playerEntity).Controller);
string value = ((FixedString64Bytes)(ref val.CharacterName)).Value;
ulong platformId = ECSExtensions.Read<User>(ECSExtensions.Read<ControlledBy>(playerEntity).Controller).PlatformId;
if (PlayerPositions.ContainsKey(playerEntity))
{
EventPlayers.Remove(playerEntity);
Helper.TeleportPlayer(playerEntity, PlayerPositions[playerEntity]);
PlayerPositions.Remove(playerEntity);
}
if (File.Exists(bannedPlayersJsonLocation))
{
string json = File.ReadAllText(bannedPlayersJsonLocation);
List<ulong> list = JsonSerializer.Deserialize<List<ulong>>(json, new JsonSerializerOptions
{
WriteIndented = true
});
BannedPlayers.Add(platformId);
list.Add(platformId);
string contents = JsonSerializer.Serialize(list, new JsonSerializerOptions
{
WriteIndented = true
});
File.WriteAllText(bannedPlayersJsonLocation, contents);
}
else
{
BannedPlayers.Add(platformId);
string contents2 = JsonSerializer.Serialize(BannedPlayers, new JsonSerializerOptions
{
WriteIndented = true
});
File.WriteAllText(bannedPlayersJsonLocation, contents2);
}
ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, "Player " + value + " has been banned from events.");
}
public static void UnbanPlayer(ulong steamID, string playerName)
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
string json = File.ReadAllText(bannedPlayersJsonLocation);
List<ulong> list = JsonSerializer.Deserialize<List<ulong>>(json, new JsonSerializerOptions
{
WriteIndented = true
});
BannedPlayers.Remove(steamID);
list.Remove(steamID);
string contents = JsonSerializer.Serialize(list, new JsonSerializerOptions
{
WriteIndented = true
});
File.WriteAllText(bannedPlayersJsonLocation, contents);
ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, "Player " + playerName + " has been unbanned from events.");
}
public static void KickPlayer(Entity playerEntity, string playerName)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
if (PlayerPositions.ContainsKey(playerEntity))
{
EventPlayers.Remove(playerEntity);
Helper.TeleportPlayer(playerEntity, PlayerPositions[playerEntity]);
PlayerPositions.Remove(playerEntity);
}
ServerChatUtils.SendSystemMessageToAllClients(VWorld.Server.EntityManager, "Player " + playerName + " has been kicked from the event.");
}
public static bool GatherEventPlayers(Entity adminEntity)
{
//IL_001b: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: 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_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
if (EventActive)
{
foreach (Entity eventPlayer in EventPlayers)
{
Vector3 playerPosition = Helper.GetPlayerPosition(adminEntity);
Helper.TeleportPlayer(eventPlayer, playerPosition);
}
return true;
}
return false;
}
public static void PauseEvent()
{
EventPaused = !EventPaused;
}
public static void JoinEvent(Entity playerEntity)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: 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_0022: Unknown result type (might be due to invalid IL or missing references)
Vector3 playerPosition = Helper.GetPlayerPosition(playerEntity);
EventPlayers.Add(playerEntity);
PlayerPositions[playerEntity] = playerPosition;
Helper.TeleportPlayer(playerEntity, EventStartPosition);
}
public static void LeaveEvent(Entity playerEntity)
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: 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_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
EventPlayers.Remove(playerEntity);
if (PlayerPositions.ContainsKey(playerEntity))
{
Helper.TeleportPlayer(playerEntity, PlayerPositions[playerEntity]);
PlayerPositions.Remove(playerEntity);
}
}
}
namespace NightbaneManualEvents
{
[BepInPlugin("NightbaneManualEvents", "NightbaneManualEvents", "1.0.1")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[BepInDependency(/*Could not decode attribute arguments.*/)]
[Reloadable]
public class Plugin : BasePlugin
{
private Harmony _harmony;
public static ManualLogSource logger;
public override void Load()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Expected O, but got Unknown
//IL_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Expected O, but got Unknown
logger = ((BasePlugin)this).Log;
ManualLogSource log = ((BasePlugin)this).Log;
bool flag = default(bool);
BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("NightbaneManualEvents");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.1");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
log.LogInfo(val);
_harmony = new Harmony("NightbaneManualEvents");
_harmony.PatchAll(Assembly.GetExecutingAssembly());
CommandRegistry.RegisterAll();
ManualEventSystem.Initialize();
}
public override bool Unload()
{
CommandRegistry.UnregisterAssembly();
Harmony harmony = _harmony;
if (harmony != null)
{
harmony.UnpatchSelf();
}
return true;
}
}
public static class MyPluginInfo
{
public const string PLUGIN_GUID = "NightbaneManualEvents";
public const string PLUGIN_NAME = "NightbaneManualEvents";
public const string PLUGIN_VERSION = "1.0.1";
}
}