using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Net.Http;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using System.Text.Json;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using BepInEx.Unity.IL2CPP.Utils.Collections;
using HarmonyLib;
using Il2CppInterop.Runtime;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using NightbaneHardcore;
using ProjectM;
using ProjectM.Network;
using ProjectM.Physics;
using ProjectM.Scripting;
using ProjectM.Shared;
using Stunlock.Core;
using Unity.Collections;
using Unity.Entities;
using Unity.Mathematics;
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("NightbaneHardcore")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("V Rising Hardcore Mode - Wipes your entire progress on death.")]
[assembly: AssemblyFileVersion("1.0.3.0")]
[assembly: AssemblyInformationalVersion("0.1.10+1.Branch.main.Sha.c33d0879382e1a0da34861ec55914ba7e637a80e.a51823c37df10329e66978023b3f07ef97121203")]
[assembly: AssemblyProduct("NightbaneHardcore")]
[assembly: AssemblyTitle("NightbaneHardcore")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.3.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;
}
}
}
internal class Configuration
{
internal static bool PvPOnBloodmoon { get; private set; }
internal static bool HigherDropOnBloodmoon { get; private set; }
internal static int DropRateOnBloodmoon { get; private set; }
internal static bool AnnounceDeaths { get; private set; }
internal static bool LockItemDropping { get; private set; }
internal static bool LastWords { get; private set; }
internal static bool DiscordDeathlog { get; private set; }
internal static string DiscordWebhookID { get; private set; }
internal static string DiscordWebhookToken { get; private set; }
internal static string DiscordWebhookIDPvP { get; private set; }
internal static string DiscordWebhookTokenPvP { get; private set; }
internal static void InitConfig(ConfigFile config)
{
PvPOnBloodmoon = config.Bind<bool>("Bloodmoon", "PvPOnBloodmoon", true, "Enable PvP during Bloodmoon.").Value;
HigherDropOnBloodmoon = config.Bind<bool>("Bloodmoon", "HigherDropOnBloodmoon", true, "Enable higher item drop rates during Bloodmoon.").Value;
DropRateOnBloodmoon = config.Bind<int>("Bloodmoon", "DropRateOnBloodmoon", 3, "Drop rate during Bloodmoon. (if enabled)").Value;
AnnounceDeaths = config.Bind<bool>("General", "AnnounceDeaths", true, "Announce player deaths in chat.").Value;
LockItemDropping = config.Bind<bool>("General", "LockItemDropping", true, "Prevent players from dropping items.").Value;
LastWords = config.Bind<bool>("General", "LastWords", true, "Add last words of player that just died to the chat announcement.").Value;
DiscordDeathlog = config.Bind<bool>("Discord", "DiscordDeathlog", false, "Log deaths to a Discord webhook.").Value;
DiscordWebhookID = config.Bind<string>("Discord", "DiscordWebhookID", "", "Discord webhook ID for PvE death logging.").Value;
DiscordWebhookToken = config.Bind<string>("Discord", "DiscordWebhookToken", "", "Discord webhook token for PvE death logging.").Value;
DiscordWebhookIDPvP = config.Bind<string>("Discord", "DiscordWebhookIDPvP", "", "Discord webhook ID for PvP kill logging.").Value;
DiscordWebhookTokenPvP = config.Bind<string>("Discord", "DiscordWebhookTokenPvP", "", "Discord webhook token for PvP kill logging.").Value;
}
}
internal static class Core
{
public static World Server { get; } = GetServerWorld() ?? throw new Exception("There is no Server world!");
private static World GetServerWorld()
{
return ((IEnumerable<World>)World.s_AllWorlds.ToArray()).FirstOrDefault((Func<World, bool>)((World world) => world.Name == "Server"));
}
}
internal static class ECSExtensions
{
public delegate void ActionRef<T>(ref T item);
public unsafe static void Write<T>(this Entity entity, T componentData) where T : struct
{
//IL_003c: 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_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
byte[] array = StructureToByteArray(componentData);
int num = Marshal.SizeOf<T>();
fixed (byte* ptr = array)
{
EntityManager entityManager = Core.Server.EntityManager;
((EntityManager)(ref entityManager)).SetComponentDataRaw(entity, val.TypeIndex, (void*)ptr, num);
}
}
public static void With<T>(this Entity entity, ActionRef<T> action) where T : struct
{
//IL_0001: 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_001e: Unknown result type (might be due to invalid IL or missing references)
T item = entity.ReadRW<T>();
action(ref item);
EntityManager entityManager = Core.Server.EntityManager;
((EntityManager)(ref entityManager)).SetComponentData<T>(entity, item);
}
public unsafe static T ReadRW<T>(this Entity entity) where T : struct
{
//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_001b: 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_001d: Unknown result type (might be due to invalid IL or missing references)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
EntityManager entityManager = Core.Server.EntityManager;
void* componentDataRawRW = ((EntityManager)(ref entityManager)).GetComponentDataRawRW(entity, val.TypeIndex);
return Marshal.PtrToStructure<T>(new IntPtr(componentDataRawRW));
}
public static byte[] StructureToByteArray<T>(T structure) where T : struct
{
int num = Marshal.SizeOf(structure);
byte[] array = new byte[num];
IntPtr intPtr = Marshal.AllocHGlobal(num);
Marshal.StructureToPtr(structure, intPtr, fDeleteOld: true);
Marshal.Copy(intPtr, array, 0, num);
Marshal.FreeHGlobal(intPtr);
return array;
}
public unsafe static T Read<T>(this Entity entity) where T : struct
{
//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_001b: 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_001d: Unknown result type (might be due to invalid IL or missing references)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
EntityManager entityManager = Core.Server.EntityManager;
void* componentDataRawRO = ((EntityManager)(ref entityManager)).GetComponentDataRawRO(entity, val.TypeIndex);
return Marshal.PtrToStructure<T>(new IntPtr(componentDataRawRO));
}
public static DynamicBuffer<T> AddBuffer<T>(this Entity entity) where T : struct
{
//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_0017: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = Core.Server.EntityManager;
return ((EntityManager)(ref entityManager)).AddBuffer<T>(entity);
}
public static DynamicBuffer<T> ReadBuffer<T>(this Entity entity) where T : struct
{
//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_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_0018: Unknown result type (might be due to invalid IL or missing references)
EntityManager entityManager = Core.Server.EntityManager;
return ((EntityManager)(ref entityManager)).GetBuffer<T>(entity, false);
}
public static bool HasBuffer<T>(this Entity entity) where T : struct
{
//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)
EntityManager entityManager = Core.Server.EntityManager;
return ((EntityManager)(ref entityManager)).HasBuffer<T>(entity);
}
public static bool Has<T>(this Entity entity)
{
//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_001b: 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)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
EntityManager entityManager = Core.Server.EntityManager;
return ((EntityManager)(ref entityManager)).HasComponent(entity, val);
}
public static string LookupName(this PrefabGUID prefabGuid)
{
//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)
PrefabCollectionSystem existingSystemManaged = Core.Server.GetExistingSystemManaged<PrefabCollectionSystem>();
Enumerator<string, PrefabGUID> enumerator = existingSystemManaged.SpawnableNameToPrefabGuidDictionary.GetEnumerator();
while (enumerator.MoveNext())
{
KeyValuePair<string, PrefabGUID> current = enumerator.Current;
if (current.Value == prefabGuid)
{
return current.key;
}
}
return "GUID Not Found";
}
public static void Add<T>(this Entity entity)
{
//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_001b: 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)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
EntityManager entityManager = Core.Server.EntityManager;
((EntityManager)(ref entityManager)).AddComponent(entity, val);
}
public static void Remove<T>(this Entity entity)
{
//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_001b: 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)
ComponentType val = default(ComponentType);
((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0);
EntityManager entityManager = Core.Server.EntityManager;
((EntityManager)(ref entityManager)).RemoveComponent(entity, val);
}
}
[HarmonyPatch(typeof(ChatMessageSystem), "OnUpdate")]
public static class ChatMessageSystemHook
{
public static void Prefix(ChatMessageSystem __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_002f: 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_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: 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_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: 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_00b1: 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)
EntityQuery _query_661171423_ = __instance.__query_661171423_0;
NativeArray<Entity> val = ((EntityQuery)(ref _query_661171423_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
try
{
Enumerator<Entity> enumerator = val.GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
ChatMessageEvent val2 = current.Read<ChatMessageEvent>();
FromCharacter val3 = current.Read<FromCharacter>();
User val4 = val3.User.Read<User>();
if (Hardcore.LastWords.ContainsKey(val4.PlatformId))
{
Hardcore.LastWords[val4.PlatformId] = ((FixedString512Bytes)(ref val2.MessageText)).Value;
string contents = JsonSerializer.Serialize(Hardcore.LastWords, new JsonSerializerOptions
{
WriteIndented = true
});
File.WriteAllText(Hardcore.LastWordsJson, contents);
}
else
{
Hardcore.LastWords.Add(val4.PlatformId, ((FixedString512Bytes)(ref val2.MessageText)).Value);
}
}
}
finally
{
val.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_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: 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_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: 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_0083: 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_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: 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)
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 (current.Has<KillEvent>() && current.Has<FromCharacter>())
{
FromCharacter val2 = current.Read<FromCharacter>();
KillEvent val3 = current.Read<KillEvent>();
if (((object)(KillWho)(ref val3.Who)).ToString() == "Self")
{
EntityManager entityManager = Core.Server.EntityManager;
((EntityManager)(ref entityManager)).DestroyEntity(current);
Helper.SendSystemMessageToClient(Core.Server.EntityManager, val2.User.Read<User>(), "<color=red>You can't use unstuck in Hardcore mode!");
}
}
}
}
finally
{
val.Dispose();
}
}
}
[HarmonyPatch(typeof(DropInventoryItemSystem), "OnUpdate")]
public static class DropItemThrowSystemHook
{
[HarmonyPrefix]
public static void Prefix(DropInventoryItemSystem __instance)
{
//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_0018: 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_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_002c: 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_003c: 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_004c: 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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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_0066: 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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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_00b9: Unknown result type (might be due to invalid IL or missing references)
if (!Configuration.LockItemDropping)
{
return;
}
EntityQuery _query_1470978904_ = __instance.__query_1470978904_0;
NativeArray<Entity> val = ((EntityQuery)(ref _query_1470978904_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
try
{
Enumerator<Entity> enumerator = val.GetEnumerator();
Entity val3 = default(Entity);
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
if (current.Has<DropInventoryItemEvent>())
{
DropInventoryItemEvent val2 = current.Read<DropInventoryItemEvent>();
FromCharacter fromCharacter = current.Read<FromCharacter>();
((NetworkIdLookupMap)(ref Hardcore.networkIdSystem._NetworkIdLookupMap)).TryGetValue(val2.Inventory, ref val3);
if (!val3.Has<Attached>())
{
Hardcore.HandleDropItemChest(val3, fromCharacter, val2.SlotIndex);
}
else
{
Hardcore.HandleDropItem(fromCharacter, val2.SlotIndex);
}
EntityManager entityManager = Core.Server.EntityManager;
((EntityManager)(ref entityManager)).DestroyEntity(current);
}
}
}
finally
{
val.Dispose();
}
}
}
[HarmonyPatch(typeof(DropItemSystem), "OnUpdate")]
public static class DropItemSystemHook
{
[HarmonyPrefix]
public static void Prefix(DropItemSystem __instance)
{
//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_0019: 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_0028: 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_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_003b: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: 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)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: 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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: 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_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0103: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_010c: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_0142: Unknown result type (might be due to invalid IL or missing references)
//IL_0147: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_015f: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
if (!Configuration.LockItemDropping)
{
return;
}
EntityQuery val = __instance.__query_1470978519_2;
NativeArray<Entity> val2 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
EntityManager entityManager;
try
{
Enumerator<Entity> enumerator = val2.GetEnumerator();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
if (current.Has<DropEntireInventoryEvent>())
{
FromCharacter val3 = current.Read<FromCharacter>();
Helper.SendSystemMessageToClient(Core.Server.EntityManager, val3.User.Read<User>(), "<color=red>You can't drop your inventory in Hardcore Mode!");
entityManager = Core.Server.EntityManager;
((EntityManager)(ref entityManager)).DestroyEntity(current);
}
}
}
finally
{
val2.Dispose();
}
val = __instance.__query_1470978519_0;
NativeArray<Entity> val4 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
try
{
Enumerator<Entity> enumerator2 = val4.GetEnumerator();
while (enumerator2.MoveNext())
{
Entity current2 = enumerator2.Current;
if (current2.Has<DropItemAtSlotEvent>())
{
DropItemAtSlotEvent val5 = current2.Read<DropItemAtSlotEvent>();
FromCharacter fromCharacter = current2.Read<FromCharacter>();
Hardcore.HandleDropItem(fromCharacter, val5.SlotIndex);
entityManager = Core.Server.EntityManager;
((EntityManager)(ref entityManager)).DestroyEntity(current2);
}
}
}
finally
{
val4.Dispose();
}
val = __instance.__query_1470978519_1;
NativeArray<Entity> val6 = ((EntityQuery)(ref val)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
try
{
Enumerator<Entity> enumerator3 = val6.GetEnumerator();
while (enumerator3.MoveNext())
{
Entity current3 = enumerator3.Current;
entityManager = Core.Server.EntityManager;
((EntityManager)(ref entityManager)).DestroyEntity(current3);
}
}
finally
{
val6.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)
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();
while (enumerator.MoveNext())
{
Entity current = enumerator.Current;
Hardcore.HardcoreDeath(current);
}
}
finally
{
val.Dispose();
}
}
}
namespace NightbaneHardcore
{
public static class Hardcore
{
[HarmonyPatch]
internal static class InitializationPatch
{
[HarmonyPatch(typeof(GameBootstrap), "Start")]
[HarmonyPostfix]
private static void StartPostfix()
{
Initialize();
}
}
[CompilerGenerated]
private sealed class <DestroyCastleOnDeath>d__22 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Entity userEntity;
private User <userOwner>5__1;
private EntityManager <entityManager>5__2;
private EntityQuery <query>5__3;
private NativeArray<Entity> <entities>5__4;
private List<Entity> <entitiesToDestroy>5__5;
private int <batchSize>5__6;
private float <delayBetweenBatches>5__7;
private Enumerator<Entity> <>s__8;
private Entity <entity>5__9;
private UserOwner <ownerUser>5__10;
private User <owner>5__11;
private int <i>5__12;
private int <j>5__13;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DestroyCastleOnDeath>d__22(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<entitiesToDestroy>5__5 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//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_002f: 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_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_007f: Unknown result type (might be due to invalid IL or missing references)
//IL_0084: 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_00b2: Unknown result type (might be due to invalid IL or missing references)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00df: Unknown result type (might be due to invalid IL or missing references)
//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
//IL_0106: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_0213: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<userOwner>5__1 = userEntity.Read<User>();
<entityManager>5__2 = Core.Server.EntityManager;
<query>5__3 = ((EntityManager)(ref <entityManager>5__2)).CreateEntityQuery(Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1]
{
new ComponentType(Il2CppType.Of<UserOwner>(), (AccessMode)1)
}));
<entities>5__4 = ((EntityQuery)(ref <query>5__3)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)3));
<entitiesToDestroy>5__5 = new List<Entity>();
<>s__8 = <entities>5__4.GetEnumerator();
while (<>s__8.MoveNext())
{
<entity>5__9 = <>s__8.Current;
<ownerUser>5__10 = ((EntityManager)(ref <entityManager>5__2)).GetComponentData<UserOwner>(<entity>5__9);
if (!(<ownerUser>5__10.Owner._Entity == Entity.Null))
{
<owner>5__11 = ((EntityManager)(ref <entityManager>5__2)).GetComponentData<User>(<ownerUser>5__10.Owner._Entity);
if (((FixedString64Bytes)(ref <owner>5__11.CharacterName)).Value == ((FixedString64Bytes)(ref <userOwner>5__1.CharacterName)).Value)
{
<entitiesToDestroy>5__5.Add(<entity>5__9);
}
}
}
<entities>5__4.Dispose();
<batchSize>5__6 = 20;
<delayBetweenBatches>5__7 = 0.5f;
<i>5__12 = 0;
break;
case 1:
<>1__state = -1;
<i>5__12 += <batchSize>5__6;
break;
}
if (<i>5__12 < <entitiesToDestroy>5__5.Count)
{
<j>5__13 = 0;
while (<j>5__13 < <batchSize>5__6 && <i>5__12 + <j>5__13 < <entitiesToDestroy>5__5.Count)
{
DestroyUtility.Destroy(<entityManager>5__2, <entitiesToDestroy>5__5[<i>5__12 + <j>5__13], (DestroyDebugReason)0, (string)null, 0);
<j>5__13++;
}
<>2__current = (object)new WaitForSeconds(<delayBetweenBatches>5__7);
<>1__state = 1;
return true;
}
return false;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[CompilerGenerated]
private sealed class <KickPlayerWithDelay>d__21 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Entity userEntity;
private string <jsonDataDeaths>5__1;
private User <user>5__2;
private string <newName>5__3;
private Entity <entity>5__4;
private NetworkId <networkId>5__5;
private RenameUserDebugEvent <renameEvent>5__6;
private FromCharacter <fromCharacter>5__7;
private string <jsonData>5__8;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <KickPlayerWithDelay>d__21(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<jsonDataDeaths>5__1 = null;
<newName>5__3 = null;
<jsonData>5__8 = null;
<>1__state = -2;
}
private bool MoveNext()
{
//IL_005f: 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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Unknown result type (might be due to invalid IL or missing references)
//IL_0197: Unknown result type (might be due to invalid IL or missing references)
//IL_019c: Unknown result type (might be due to invalid IL or missing references)
//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
//IL_01ac: Unknown result type (might be due to invalid IL or missing references)
//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
//IL_01e0: Unknown result type (might be due to invalid IL or missing references)
//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
//IL_0201: Unknown result type (might be due to invalid IL or missing references)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_0220: Unknown result type (might be due to invalid IL or missing references)
//IL_0229: Unknown result type (might be due to invalid IL or missing references)
//IL_0230: Unknown result type (might be due to invalid IL or missing references)
//IL_0252: Unknown result type (might be due to invalid IL or missing references)
//IL_0268: Unknown result type (might be due to invalid IL or missing references)
//IL_026e: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
//IL_0284: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: Unknown result type (might be due to invalid IL or missing references)
//IL_028d: Unknown result type (might be due to invalid IL or missing references)
//IL_0292: Unknown result type (might be due to invalid IL or missing references)
//IL_029a: Unknown result type (might be due to invalid IL or missing references)
//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
//IL_02d2: Unknown result type (might be due to invalid IL or missing references)
//IL_02d7: Unknown result type (might be due to invalid IL or missing references)
//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
//IL_02f3: Unknown result type (might be due to invalid IL or missing references)
//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
//IL_0306: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_015b: Unknown result type (might be due to invalid IL or missing references)
//IL_0161: Unknown result type (might be due to invalid IL or missing references)
//IL_0177: Unknown result type (might be due to invalid IL or missing references)
//IL_0181: Expected O, but got Unknown
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
{
<>1__state = -1;
Deaths++;
<jsonDataDeaths>5__1 = JsonSerializer.Serialize(Deaths, new JsonSerializerOptions
{
WriteIndented = true
});
File.WriteAllText(DeathsJson, <jsonDataDeaths>5__1);
<user>5__2 = userEntity.Read<User>();
FixedString64Bytes characterName = <user>5__2.CharacterName;
<newName>5__3 = ((object)(FixedString64Bytes)(ref characterName)).ToString() + Deaths;
if (LastWords.ContainsKey(<user>5__2.PlatformId) && Configuration.LastWords)
{
Helper.SendSystemMessageToAllClients(Core.Server.EntityManager, "<color=red>Last Words: <color=yellow>" + LastWords[<user>5__2.PlatformId]);
LastWords.Remove(<user>5__2.PlatformId);
<jsonData>5__8 = JsonSerializer.Serialize(LastWords, new JsonSerializerOptions
{
WriteIndented = true
});
File.WriteAllText(LastWordsJson, <jsonData>5__8);
<jsonData>5__8 = null;
}
Helper.SendSystemMessageToClient(Core.Server.EntityManager, <user>5__2, "<color=red>You Died! Your character and castle is being removed.");
Helper.SendSystemMessageToClient(Core.Server.EntityManager, <user>5__2, "<color=red>You will be kicked from server in 5 seconds...");
<>2__current = (object)new WaitForSeconds(5f);
<>1__state = 1;
return true;
}
case 1:
{
<>1__state = -1;
EntityManager entityManager = Core.Server.EntityManager;
<entity>5__4 = ((EntityManager)(ref entityManager)).CreateEntity(Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[3]
{
ComponentType.ReadOnly<NetworkEventType>(),
ComponentType.ReadOnly<SendEventToUser>(),
ComponentType.ReadOnly<KickEvent>()
}));
<entity>5__4.Write<KickEvent>(new KickEvent
{
PlatformId = <user>5__2.PlatformId
});
<entity>5__4.Write<SendEventToUser>(new SendEventToUser
{
UserIndex = <user>5__2.Index
});
<entity>5__4.Write<NetworkEventType>(new NetworkEventType
{
EventId = NetworkEvents.EventId_KickEvent,
IsAdminEvent = false,
IsDebugEvent = false
});
<user>5__2.PlatformId = 0uL;
userEntity.Write<User>(<user>5__2);
entityManager = Core.Server.EntityManager;
<networkId>5__5 = ((EntityManager)(ref entityManager)).GetComponentData<NetworkId>(userEntity);
<renameEvent>5__6 = new RenameUserDebugEvent
{
NewName = FixedString64Bytes.op_Implicit(<newName>5__3),
Target = <networkId>5__5
};
<fromCharacter>5__7 = new FromCharacter
{
User = userEntity,
Character = <user>5__2.LocalCharacter._Entity
};
debugEventsSystem.RenameUser(<fromCharacter>5__7, <renameEvent>5__6);
return false;
}
}
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
private static MonoBehaviour monoBehaviour;
private static HttpClient httpClient = new HttpClient();
public static ServerGameSettingsSystem serverGameSettingsSystem;
public static DebugEventsSystem debugEventsSystem;
public static Singleton networkIdSystem;
public static string LastWordsJson = "BepInEx/config/NightbaneHardcore/LastWords.json";
public static string DeathsJson = "BepInEx/config/NightbaneHardcore/DeathsCount.json";
public static string ItemDropsJson = "BepInEx/config/NightbaneHardcore/ItemDropsConfirms.json";
public static Dictionary<ulong, string> LastWords = new Dictionary<ulong, string>();
public static List<ulong> ItemDropConfirms = new List<ulong>();
public static int Deaths = 0;
public static bool PvPEnabled;
public static half DefaultDropRate;
public static bool HigherDropRateEnabled = false;
public static bool Initialized = false;
public static void Initialize()
{
//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_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_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Invalid comparison between Unknown and I4
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
if (!Initialized)
{
serverGameSettingsSystem = Core.Server.GetExistingSystemManaged<ServerGameSettingsSystem>();
debugEventsSystem = Core.Server.GetExistingSystemManaged<DebugEventsSystem>();
ServerScriptMapper existingSystemManaged = Core.Server.GetExistingSystemManaged<ServerScriptMapper>();
networkIdSystem = ((ComponentSystemBase)existingSystemManaged).GetSingleton<Singleton>();
ServerGameBalanceSettings val = serverGameSettingsSystem._Settings.ToStruct(false);
if ((int)val.GameModeType == 1)
{
PvPEnabled = true;
}
else
{
PvPEnabled = false;
}
DefaultDropRate = val.DropTableModifier_General;
string path = "BepInEx/config/NightbaneHardcore";
Directory.CreateDirectory(path);
File.AppendAllText(LastWordsJson, "{}");
File.AppendAllText(DeathsJson, "{}");
File.AppendAllText(ItemDropsJson, "{}");
LastWords = Helper.LoadJson<Dictionary<ulong, string>>(LastWordsJson);
Deaths = Helper.LoadJson<int>(DeathsJson);
ItemDropConfirms = Helper.LoadJson<List<ulong>>(ItemDropsJson);
StartCoroutine(Helper.RepeatingCoroutine(delegate
{
PvPOnBloodmoon();
}, 2f));
Plugin.logger.LogInfo((object)"Initialized!");
Initialized = true;
}
}
public static void HandleDropItem(FromCharacter fromCharacter, int slotIndex)
{
//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_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: 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_004c: 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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: 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_002f: Unknown result type (might be due to invalid IL or missing references)
User val = fromCharacter.User.Read<User>();
if (!ItemDropConfirms.Contains(val.PlatformId))
{
Helper.SendSystemMessageToClient(Core.Server.EntityManager, val, "<color=red>WARNING! item drops on ground is disabled in Hardcore Mode! If you want to remove your items, use <color=yellow>.dropenable<color=red> command, it will let you remove items instead of dropping.");
return;
}
InventoryInstanceElement val2 = fromCharacter.Character.ReadBuffer<InventoryInstanceElement>()[0];
InventoryUtilitiesServer.ClearSlot(Core.Server.EntityManager, val2.ExternalInventoryEntity._Entity, slotIndex);
}
public static void HandleDropItemChest(Entity chestEntity, FromCharacter fromCharacter, int slotIndex)
{
//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_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: 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_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_004c: 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_0058: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: 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_002f: Unknown result type (might be due to invalid IL or missing references)
User val = fromCharacter.User.Read<User>();
if (!ItemDropConfirms.Contains(val.PlatformId))
{
Helper.SendSystemMessageToClient(Core.Server.EntityManager, val, "<color=red>WARNING! item drops on ground is disabled in Hardcore Mode! If you want to remove your items, use <color=yellow>.dropenable<color=red> command, it will let you remove items instead of dropping.");
return;
}
InventoryInstanceElement val2 = chestEntity.ReadBuffer<InventoryInstanceElement>()[0];
InventoryUtilitiesServer.ClearSlot(Core.Server.EntityManager, val2.ExternalInventoryEntity._Entity, slotIndex);
}
public static void HardcoreDeath(Entity deathEntity)
{
//IL_0001: 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_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_001c: 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_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: Unknown result type (might be due to invalid IL or missing references)
//IL_0047: 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_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0050: 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_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_005c: 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_0068: 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_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0095: 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_009b: 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_00af: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: 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)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_0266: Unknown result type (might be due to invalid IL or missing references)
//IL_0204: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_020a: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_016a: Unknown result type (might be due to invalid IL or missing references)
//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
//IL_0300: Unknown result type (might be due to invalid IL or missing references)
//IL_0305: Unknown result type (might be due to invalid IL or missing references)
//IL_0319: Unknown result type (might be due to invalid IL or missing references)
//IL_0397: Unknown result type (might be due to invalid IL or missing references)
//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
//IL_0335: Unknown result type (might be due to invalid IL or missing references)
//IL_0353: Unknown result type (might be due to invalid IL or missing references)
//IL_0355: Unknown result type (might be due to invalid IL or missing references)
Entity val = default(Entity);
VampireDownedServerEventSystem.TryFindRootOwner(deathEntity, 1, Core.Server.EntityManager, ref val);
VampireDownedBuff val2 = deathEntity.Read<VampireDownedBuff>();
Entity val3 = default(Entity);
VampireDownedServerEventSystem.TryFindRootOwner(val2.Source, 1, Core.Server.EntityManager, ref val3);
bool flag = val3.Has<PlayerCharacter>();
Entity controller = val.Read<ControlledBy>().Controller;
User val4 = controller.Read<User>();
Equipment val5 = val.Read<Equipment>();
float num = ModifiableFloat.op_Implicit(val5.ArmorLevel) + ModifiableFloat.op_Implicit(val5.SpellLevel) + ModifiableFloat.op_Implicit(val5.WeaponLevel);
ServerScriptMapper existingSystemManaged = Core.Server.GetExistingSystemManaged<ServerScriptMapper>();
ServerGameManager serverGameManager = existingSystemManaged._ServerGameManager;
if (flag && val3 != val)
{
Equipment val6 = val3.Read<Equipment>();
float num2 = ModifiableFloat.op_Implicit(val6.ArmorLevel) + ModifiableFloat.op_Implicit(val6.SpellLevel) + ModifiableFloat.op_Implicit(val6.WeaponLevel);
if (Configuration.DiscordDeathlog)
{
string discordWebhookIDPvP = Configuration.DiscordWebhookIDPvP;
string discordWebhookTokenPvP = Configuration.DiscordWebhookTokenPvP;
List<object> list = new List<object>();
DefaultInterpolatedStringHandler defaultInterpolatedStringHandler = new DefaultInterpolatedStringHandler(25, 4);
defaultInterpolatedStringHandler.AppendLiteral("Player ");
PlayerCharacter val7 = val3.Read<PlayerCharacter>();
defaultInterpolatedStringHandler.AppendFormatted(((FixedString64Bytes)(ref val7.Name)).Value);
defaultInterpolatedStringHandler.AppendLiteral(" (");
defaultInterpolatedStringHandler.AppendFormatted(Mathf.Floor(num2));
defaultInterpolatedStringHandler.AppendLiteral(") has slain ");
defaultInterpolatedStringHandler.AppendFormatted<FixedString64Bytes>(val.Read<PlayerCharacter>().Name);
defaultInterpolatedStringHandler.AppendLiteral(" (");
defaultInterpolatedStringHandler.AppendFormatted(Mathf.Floor(num));
defaultInterpolatedStringHandler.AppendLiteral(")!");
list.Add(new
{
title = "PvP Kill",
description = defaultInterpolatedStringHandler.ToStringAndClear(),
color = int.Parse("FF0000", NumberStyles.HexNumber)
});
var value = new
{
embeds = list
};
string requestUri = $"https://discordapp.com/api/webhooks/{discordWebhookIDPvP}/{discordWebhookTokenPvP}";
StringContent content = new StringContent(JsonSerializer.Serialize(value), Encoding.UTF8, "application/json");
httpClient.PostAsync(requestUri, content);
}
StatChangeUtility.KillEntity(Core.Server.EntityManager, val, serverGameManager.ServerTime, (StatChangeReason)1);
}
else if (Configuration.DiscordDeathlog)
{
string discordWebhookID = Configuration.DiscordWebhookID;
string discordWebhookToken = Configuration.DiscordWebhookToken;
var value2 = new
{
embeds = new List<object>
{
new
{
title = "PvE Death",
description = $"Player {val.Read<PlayerCharacter>().Name} has died at level {Mathf.Floor(num)}!",
color = int.Parse("FF0000", NumberStyles.HexNumber)
}
}
};
string requestUri2 = $"https://discordapp.com/api/webhooks/{discordWebhookID}/{discordWebhookToken}";
StringContent content2 = new StringContent(JsonSerializer.Serialize(value2), Encoding.UTF8, "application/json");
httpClient.PostAsync(requestUri2, content2);
}
Helper.TeleportUser(controller, val4.LocalCharacter._Entity, new float3(-2016.0348f, 5f, -2778.0544f));
if (Configuration.AnnounceDeaths)
{
Helper.SendSystemMessageToAllClients(Core.Server.EntityManager, $"<color=red><size=20>Vampire {val4.CharacterName} Has died at level {Mathf.Floor(num)}!");
}
StartCoroutine(KickPlayerWithDelay(controller));
StartCoroutine(DestroyCastleOnDeath(controller));
}
public static Coroutine StartCoroutine(IEnumerator routine)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Expected O, but got Unknown
if ((Object)(object)monoBehaviour == (Object)null)
{
GameObject val = new GameObject("NightbaneHardcore");
monoBehaviour = (MonoBehaviour)(object)val.AddComponent<IgnorePhysicsDebugSystem>();
Object.DontDestroyOnLoad((Object)(object)val);
}
return monoBehaviour.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(routine));
}
[IteratorStateMachine(typeof(<KickPlayerWithDelay>d__21))]
public static IEnumerator KickPlayerWithDelay(Entity userEntity)
{
//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)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <KickPlayerWithDelay>d__21(0)
{
userEntity = userEntity
};
}
[IteratorStateMachine(typeof(<DestroyCastleOnDeath>d__22))]
public static IEnumerator DestroyCastleOnDeath(Entity userEntity)
{
//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)
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DestroyCastleOnDeath>d__22(0)
{
userEntity = userEntity
};
}
public static void PvPOnBloodmoon()
{
//IL_000d: 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_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_002f: 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_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
//IL_00b2: 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)
//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_0190: Unknown result type (might be due to invalid IL or missing references)
//IL_0195: Unknown result type (might be due to invalid IL or missing references)
//IL_0199: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: Unknown result type (might be due to invalid IL or missing references)
//IL_0124: Unknown result type (might be due to invalid IL or missing references)
//IL_0129: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013c: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: Unknown result type (might be due to invalid IL or missing references)
//IL_014a: Unknown result type (might be due to invalid IL or missing references)
//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
//IL_01d4: Unknown result type (might be due to invalid IL or missing references)
ServerScriptMapper existingSystemManaged = Core.Server.GetExistingSystemManaged<ServerScriptMapper>();
ServerGameManager serverGameManager = existingSystemManaged._ServerGameManager;
bool flag = ((DayNightCycle)(ref serverGameManager.DayNightCycle)).IsBloodMoonDay();
Entity val = Helper.GetEntitiesByComponentType<ServerGameBalanceSettings>()[0];
ServerGameBalanceSettings val2 = serverGameSettingsSystem._Settings.ToStruct(false);
float timeSinceDayStart = ((DayNightCycle)(ref serverGameManager.DayNightCycle)).TimeSinceDayStart;
if (timeSinceDayStart < 361f && flag)
{
return;
}
EntityManager entityManager;
if (Configuration.HigherDropOnBloodmoon)
{
if (flag && !HigherDropRateEnabled)
{
HigherDropRateEnabled = true;
val2.DropTableModifier_General = (half)(float)Configuration.DropRateOnBloodmoon;
entityManager = Core.Server.EntityManager;
((EntityManager)(ref entityManager)).SetComponentData<ServerGameBalanceSettings>(val, val2);
Helper.SendSystemMessageToAllClients(Core.Server.EntityManager, $"<color=red>The Blood Moon rises, X{Configuration.DropRateOnBloodmoon} Drop Rate is now ACTIVE!");
}
else if (!flag && HigherDropRateEnabled)
{
HigherDropRateEnabled = false;
val2.DropTableModifier_General = DefaultDropRate;
entityManager = Core.Server.EntityManager;
((EntityManager)(ref entityManager)).SetComponentData<ServerGameBalanceSettings>(val, val2);
Helper.SendSystemMessageToAllClients(Core.Server.EntityManager, "<color=green>The Blood Moon fades, drop rates are back to normal.");
}
}
if (Configuration.PvPOnBloodmoon)
{
if (flag && !PvPEnabled)
{
PvPEnabled = true;
val2.GameModeType = (GameModeType)1;
entityManager = Core.Server.EntityManager;
((EntityManager)(ref entityManager)).SetComponentData<ServerGameBalanceSettings>(val, val2);
}
else if (!flag && PvPEnabled)
{
PvPEnabled = false;
val2.GameModeType = (GameModeType)0;
entityManager = Core.Server.EntityManager;
((EntityManager)(ref entityManager)).SetComponentData<ServerGameBalanceSettings>(val, val2);
}
}
}
[Command("dropenable", null, null, null, null, false)]
public static void DropEnableCommand(ChatCommandContext ctx)
{
//IL_000c: 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)
if (ItemDropConfirms.Contains(ctx.Event.User.PlatformId))
{
ctx.Reply("<color=red>Item removing is already enabled! Use .dropdisable command to disable it.");
return;
}
ItemDropConfirms.Add(ctx.Event.User.PlatformId);
string contents = JsonSerializer.Serialize(ItemDropConfirms, new JsonSerializerOptions
{
WriteIndented = true
});
File.WriteAllText(ItemDropsJson, contents);
ctx.Reply("<color=green>Item removing is now enabled! Use .dropdisable command to disable it.");
}
[Command("dropdisable", null, null, null, null, false)]
public static void DropDisableCommand(ChatCommandContext ctx)
{
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
if (!ItemDropConfirms.Contains(ctx.Event.User.PlatformId))
{
ctx.Reply("<color=red>Item removing is already disabled! Use .dropenable command to enable it.");
return;
}
ItemDropConfirms.Remove(ctx.Event.User.PlatformId);
string contents = JsonSerializer.Serialize(ItemDropConfirms, new JsonSerializerOptions
{
WriteIndented = true
});
File.WriteAllText(ItemDropsJson, contents);
ctx.Reply("<color=green>Item removing is now disabled! Use .dropenable command to enable it again.");
}
}
public static class Helper
{
[CompilerGenerated]
private sealed class <RepeatingCoroutine>d__0 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Action action;
public float delay;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <RepeatingCoroutine>d__0(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
break;
case 1:
<>1__state = -1;
action?.Invoke();
break;
}
<>2__current = (object)new WaitForSeconds(delay);
<>1__state = 1;
return true;
}
bool IEnumerator.MoveNext()
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
return this.MoveNext();
}
[DebuggerHidden]
void IEnumerator.Reset()
{
throw new NotSupportedException();
}
}
[IteratorStateMachine(typeof(<RepeatingCoroutine>d__0))]
public static IEnumerator RepeatingCoroutine(Action action, float delay)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <RepeatingCoroutine>d__0(0)
{
action = action,
delay = delay
};
}
public static void SendSystemMessageToClient(EntityManager entityManager, User user, string message)
{
//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)
FixedString512Bytes val = FixedString512Bytes.op_Implicit(message);
ServerChatUtils.SendSystemMessageToClient(entityManager, user, ref val);
}
public static void SendSystemMessageToAllClients(EntityManager entityManager, string message)
{
//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)
FixedString512Bytes val = FixedString512Bytes.op_Implicit(message);
ServerChatUtils.SendSystemMessageToAllClients(entityManager, ref val);
}
public static void TeleportUser(Entity User, Entity Character, float3 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_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_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_0031: 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_0039: 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_0042: 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_0050: Unknown result type (might be due to invalid IL or missing references)
//IL_0056: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: 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_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_0070: 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_0076: 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_007f: 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)
EntityManager entityManager = Core.Server.EntityManager;
Entity val = ((EntityManager)(ref entityManager)).CreateEntity(Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[2]
{
ComponentType.ReadOnly<FromCharacter>(),
ComponentType.ReadOnly<PlayerTeleportDebugEvent>()
}));
FromCharacter val2 = default(FromCharacter);
val2.Character = Character;
val2.User = User;
FromCharacter val3 = val2;
entityManager = Core.Server.EntityManager;
((EntityManager)(ref entityManager)).SetComponentData<FromCharacter>(val, val3);
entityManager = Core.Server.EntityManager;
((EntityManager)(ref entityManager)).SetComponentData<PlayerTeleportDebugEvent>(val, new PlayerTeleportDebugEvent
{
Position = position,
Target = (TeleportTarget)0
});
}
public static NativeArray<Entity> GetEntitiesByComponentType<T1>(bool includeAll = false, bool includeDisabled = false, bool includeSpawn = false, bool includePrefab = false, bool includeDestroyed = false)
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: 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_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_001b: 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_0024: 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_0030: 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_0033: 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_004b: Expected O, but got Unknown
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: 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_0081: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0098: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: 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)
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: 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_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Unknown result type (might be due to invalid IL or missing references)
//IL_0042: 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_00c0: Unknown result type (might be due to invalid IL or missing references)
EntityQueryOptions val = (EntityQueryOptions)0;
if (includeAll)
{
val = (EntityQueryOptions)(val | 0xC3);
}
if (includeDisabled)
{
val = (EntityQueryOptions)(val | 2);
}
if (includeSpawn)
{
val = (EntityQueryOptions)(val | 0x40);
}
if (includePrefab)
{
val = (EntityQueryOptions)(val | 1);
}
if (includeDestroyed)
{
val = (EntityQueryOptions)(val | 0x80);
}
EntityQueryDesc val2 = new EntityQueryDesc();
val2.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1]
{
new ComponentType(Il2CppType.Of<T1>(), (AccessMode)0)
});
val2.Options = val;
EntityQueryDesc val3 = val2;
EntityManager entityManager = Core.Server.EntityManager;
EntityQuery val4 = ((EntityManager)(ref entityManager)).CreateEntityQuery(Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1]
{
new ComponentType(Il2CppType.Of<T1>(), (AccessMode)0)
}));
return ((EntityQuery)(ref val4)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2));
}
public static T LoadJson<T>(string filePath) where T : new()
{
//IL_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Expected O, but got Unknown
if (!File.Exists(filePath))
{
return new T();
}
try
{
string json = File.ReadAllText(filePath);
T val = JsonSerializer.Deserialize<T>(json, new JsonSerializerOptions
{
WriteIndented = true
});
return (val != null) ? val : new T();
}
catch (Exception ex)
{
ManualLogSource logger = Plugin.logger;
bool flag = default(bool);
BepInExErrorLogInterpolatedStringHandler val2 = new BepInExErrorLogInterpolatedStringHandler(46, 2, ref flag);
if (flag)
{
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("[NightbaneHardcore] Error loading JSON from ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(filePath);
((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(": ");
((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>(ex.Message);
}
logger.LogError(val2);
return new T();
}
}
}
[BepInPlugin("NightbaneHardcore", "NightbaneHardcore", "1.0.6")]
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>("NightbaneHardcore");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version ");
((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.6");
((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!");
}
log.LogInfo(val);
_harmony = new Harmony("NightbaneHardcore");
_harmony.PatchAll(Assembly.GetExecutingAssembly());
CommandRegistry.RegisterAll();
Configuration.InitConfig(((BasePlugin)this).Config);
}
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 = "NightbaneHardcore";
public const string PLUGIN_NAME = "NightbaneHardcore";
public const string PLUGIN_VERSION = "1.0.6";
}
}