Decompiled source of PlayerServices v1.0.0
PlayerServices.dll
Decompiled a day ago
The result has been truncated due to the large size, download it to view full contents!
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 System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; 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 PlayerServices.Data; using PlayerServices.Services; using ProjectM; using ProjectM.CastleBuilding; using ProjectM.Network; using ProjectM.Physics; using ProjectM.Scripting; using ProjectM.Shared; using ProjectM.Terrain; using Stunlock.Core; using Stunlock.Network; using Unity.Collections; using Unity.Entities; using Unity.Mathematics; using Unity.Scenes; 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("PlayerServices")] [assembly: AssemblyConfiguration("Debug")] [assembly: AssemblyDescription("Server-side V Rising mod that adds player services, including player info, starter kits, daily kits, give sets, teleport points, aura purchases, name changes, banlist, whitelist, and admin tools")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0")] [assembly: AssemblyProduct("PlayerServices")] [assembly: AssemblyTitle("PlayerServices")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("1.0.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace PlayerServices { public static class Buffs { public static bool AddBuff(Entity User, Entity Character, PrefabGUID buffPrefab, int duration = 0, bool immortal = true) { //IL_000e: 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_0017: 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_001e: 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_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) //IL_0031: 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_0037: 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_003f: 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_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_0060: 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_006d: 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_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_008a: 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_0097: 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_00bd: 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_00d9: 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_00e6: Unknown result type (might be due to invalid IL or missing references) //IL_0101: Unknown result type (might be due to invalid IL or missing references) //IL_015a: Unknown result type (might be due to invalid IL or missing references) //IL_0132: 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_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0144: Unknown result type (might be due to invalid IL or missing references) //IL_0111: Unknown result type (might be due to invalid IL or missing references) //IL_0118: Unknown result type (might be due to invalid IL or missing references) //IL_011b: 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_0181: Unknown result type (might be due to invalid IL or missing references) //IL_0167: 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) //IL_016d: Unknown result type (might be due to invalid IL or missing references) //IL_0172: 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_0178: Unknown result type (might be due to invalid IL or missing references) //IL_0196: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Unknown result type (might be due to invalid IL or missing references) //IL_01a3: Unknown result type (might be due to invalid IL or missing references) DebugEventsSystem existingSystemManaged = Core.Server.GetExistingSystemManaged<DebugEventsSystem>(); ApplyBuffDebugEvent val = new ApplyBuffDebugEvent { BuffPrefabGUID = buffPrefab }; FromCharacter val2 = new FromCharacter { User = User, Character = Character }; Entity entity = default(Entity); if (!BuffUtility.TryGetBuff<EntityManager>(Core.Server.EntityManager, Character, PrefabIdentifier.op_Implicit(buffPrefab), ref entity)) { existingSystemManaged.ApplyBuff(val2, val); if (BuffUtility.TryGetBuff<EntityManager>(Core.Server.EntityManager, Character, PrefabIdentifier.op_Implicit(buffPrefab), ref entity)) { if (entity.Has<CreateGameplayEventsOnSpawn>()) { entity.Remove<CreateGameplayEventsOnSpawn>(); } if (entity.Has<GameplayEventListeners>()) { entity.Remove<GameplayEventListeners>(); } if (immortal) { entity.Add<Buff_Persists_Through_Death>(); if (entity.Has<RemoveBuffOnGameplayEvent>()) { entity.Remove<RemoveBuffOnGameplayEvent>(); } if (entity.Has<RemoveBuffOnGameplayEventEntry>()) { entity.Remove<RemoveBuffOnGameplayEventEntry>(); } } if (duration > -1 && duration != 0) { if (!entity.Has<LifeTime>()) { entity.Add<LifeTime>(); entity.Write<LifeTime>(new LifeTime { EndAction = (LifeTimeEndAction)2 }); } LifeTime componentData = entity.Read<LifeTime>(); componentData.Duration = duration; entity.Write<LifeTime>(componentData); } else if (duration == -1) { if (entity.Has<LifeTime>()) { LifeTime componentData2 = entity.Read<LifeTime>(); componentData2.EndAction = (LifeTimeEndAction)0; entity.Write<LifeTime>(componentData2); } if (entity.Has<RemoveBuffOnGameplayEvent>()) { entity.Remove<RemoveBuffOnGameplayEvent>(); } if (entity.Has<RemoveBuffOnGameplayEventEntry>()) { entity.Remove<RemoveBuffOnGameplayEventEntry>(); } } return true; } return false; } return false; } public static void RemoveBuff(Entity Character, PrefabGUID buffPrefab) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_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) Entity val = default(Entity); if (BuffUtility.TryGetBuff<EntityManager>(Core.EntityManager, Character, PrefabIdentifier.op_Implicit(buffPrefab), ref val)) { DestroyUtility.Destroy(Core.EntityManager, val, (DestroyDebugReason)13, (string)null, 0); } } } internal static class Core { private static World _server; private static bool _hasInitialized; public const int MAX_REPLY_LENGTH = 509; private static MonoBehaviour monoBehaviour; public static World Server { get { if (_server == null) { _server = GetWorld("Server"); } return _server; } } public static EntityManager EntityManager => Server.EntityManager; public static bool IsServer => Application.productName == "VRisingServer"; public static GameDataSystem GameDataSystem => Server.GetExistingSystemManaged<GameDataSystem>(); public static GenerateCastleSystem GenerateCastle { get; private set; } public static PrefabCollectionSystem PrefabCollectionSystem { get; internal set; } public static PrefabCollectionSystem PrefabCollection => Server.GetExistingSystemManaged<PrefabCollectionSystem>(); public static ServerScriptMapper ServerScriptMapper { get; internal set; } public static ServerGameManager ServerGameManager => ServerScriptMapper.GetServerGameManager(); public static ServerGameSettingsSystem ServerGameSettingsSystem { get; internal set; } public static ManualLogSource Log => Plugin.PluginLog; private static World GetWorld(string name) { Enumerator<World> enumerator = World.s_AllWorlds.GetEnumerator(); while (enumerator.MoveNext()) { World current = enumerator.Current; if (current.Name == name) { return current; } } return null; } public static void LogException(Exception e, [CallerMemberName] string caller = null) { //IL_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0012: Expected O, but got Unknown ManualLogSource log = Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(52, 5, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failure in "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(caller); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\nMessage: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.Message); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" Inner: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.InnerException?.Message); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\n\nStack: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.StackTrace); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\nInner Stack: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(e.InnerException?.StackTrace); } log.LogError(val); } internal static void InitializeAfterLoaded() { //IL_0084: Unknown result type (might be due to invalid IL or missing references) //IL_008a: Expected O, but got Unknown if (!_hasInitialized) { PrefabCollectionSystem = Server.GetExistingSystemManaged<PrefabCollectionSystem>(); ServerScriptMapper = Server.GetExistingSystemManaged<ServerScriptMapper>(); GenerateCastle = Server.GetOrCreateSystemManaged<GenerateCastleSystem>(); ServerGameSettingsSystem = Server.GetExistingSystemManaged<ServerGameSettingsSystem>(); PlayerDataService.Initialize(); DailyKitService.Initialize(); GiveService.Initialize(); StarterKitService.Initialize(); TeleportPointsService.Initialize(); AuraService.Initialize(); _hasInitialized = true; ManualLogSource log = Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(11, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("InitializeAfterLoaded"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" completed."); } log.LogInfo(val); } } 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("PlayerServices"); monoBehaviour = (MonoBehaviour)(object)val.AddComponent<IgnorePhysicsDebugSystem>(); Object.DontDestroyOnLoad((Object)(object)val); } return monoBehaviour.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(routine)); } public static void StopCoroutines() { if ((Object)(object)monoBehaviour != (Object)null) { monoBehaviour.StopAllCoroutines(); Object.Destroy((Object)(object)((Component)monoBehaviour).gameObject); monoBehaviour = null; } } } public 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_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_0040: 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) 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.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_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_0019: Unknown result type (might be due to invalid IL or missing references) T item = entity.ReadRW<T>(); action(ref item); EntityManager entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).SetComponentData<T>(entity, item); } public unsafe static T ReadRW<T>(this Entity entity) where T : struct { //IL_000e: 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_0016: 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) //IL_0018: 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.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_000e: 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_0016: 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) //IL_0018: 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.EntityManager; void* componentDataRawRO = ((EntityManager)(ref entityManager)).GetComponentDataRawRO(entity, val.TypeIndex); return Marshal.PtrToStructure<T>(new IntPtr(componentDataRawRO)); } 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 Has<T>(this Entity entity) { //IL_000e: 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_0016: 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) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0); EntityManager entityManager = Core.EntityManager; return ((EntityManager)(ref entityManager)).HasComponent(entity, val); } public static string LookupName(this PrefabGUID prefabGuid) { //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_0017: 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_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_0032: Unknown result type (might be due to invalid IL or missing references) PrefabCollectionSystem existingSystemManaged = Core.Server.GetExistingSystemManaged<PrefabCollectionSystem>(); NativeParallelHashMap<PrefabGUID, Entity> guidToEntityMap = existingSystemManaged._PrefabLookupMap.GuidToEntityMap; object result; if (!guidToEntityMap.ContainsKey(prefabGuid)) { result = "GUID Not Found"; } else { PrefabLookupMap prefabLookupMap = existingSystemManaged._PrefabLookupMap; result = ((PrefabLookupMap)(ref prefabLookupMap)).GetName(prefabGuid) + " PrefabGuid(" + ((PrefabGUID)(ref prefabGuid)).GuidHash + ")"; } return (string)result; } public static string PrefabName(this PrefabGUID prefabGuid) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) return prefabGuid.LookupName(); } public unsafe static string EntityName(this Entity entity) { //IL_0007: 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_0012: 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) //IL_0033: 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_0041: Unknown result type (might be due to invalid IL or missing references) string text = string.Empty; if (entity.Has<NameableInteractable>()) { NameableInteractable val = entity.Read<NameableInteractable>(); text = ((object)(*(FixedString64Bytes*)(&val.Name))/*cast due to .constrained prefix*/).ToString(); } if (string.IsNullOrEmpty(text) && entity.Has<PrefabGUID>()) { text = entity.Read<PrefabGUID>().PrefabName(); } if (string.IsNullOrEmpty(text)) { text = ((object)(*(Entity*)(&entity))/*cast due to .constrained prefix*/).ToString(); } return text; } public static void Add<T>(this Entity entity) { //IL_000e: 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_0016: 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) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0); EntityManager entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).AddComponent(entity, val); } public static void Remove<T>(this Entity entity) { //IL_000e: 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_0016: 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) ComponentType val = default(ComponentType); ((ComponentType)(ref val))..ctor(Il2CppType.Of<T>(), (AccessMode)0); EntityManager entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).RemoveComponent(entity, val); } } internal static class Helper { 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_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_004f: 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_0063: Unknown result type (might be due to invalid IL or missing references) //IL_0067: 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_006e: 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_0079: 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_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_008d: Unknown result type (might be due to invalid IL or missing references) //IL_008e: 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_0092: 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); } EntityQueryBuilder val2 = new EntityQueryBuilder(AllocatorHandle.op_Implicit((Allocator)2)); val2 = ((EntityQueryBuilder)(ref val2)).AddAll(new ComponentType(Il2CppType.Of<T1>(), (AccessMode)0)); EntityQueryBuilder val3 = ((EntityQueryBuilder)(ref val2)).WithOptions(val); EntityManager entityManager = Core.EntityManager; EntityQuery val4 = ((EntityManager)(ref entityManager)).CreateEntityQuery(ref val3); return ((EntityQuery)(ref val4)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); } public static bool TryGetInventoryEntity(Entity characterEntity, out Entity inventoryEntity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) return InventoryUtilities.TryGetInventoryEntity<EntityManager>(Core.EntityManager, characterEntity, ref inventoryEntity, 0); } public static int GetItemCountInInventory(Entity characterEntity, PrefabGUID itemPrefab) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0020: 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_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_0099: 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_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_0069: 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) EntityManager entityManager = Core.EntityManager; if (!TryGetInventoryEntity(characterEntity, out var inventoryEntity)) { return 0; } if (((EntityManager)(ref entityManager)).HasComponent<InventoryBuffer>(inventoryEntity)) { DynamicBuffer<InventoryBuffer> buffer = ((EntityManager)(ref entityManager)).GetBuffer<InventoryBuffer>(inventoryEntity, false); int num = 0; for (int i = 0; i < buffer.Length; i++) { InventoryBuffer val = buffer[i]; if (((PrefabGUID)(ref val.ItemType)).GuidHash == ((PrefabGUID)(ref itemPrefab)).GuidHash) { num += val.Amount; } } return num; } int num2 = 0; InventoryBuffer val2 = default(InventoryBuffer); for (int j = 0; j < 36; j++) { if (InventoryUtilities.TryGetItemAtSlot<EntityManager>(entityManager, characterEntity, j, ref val2) && ((PrefabGUID)(ref val2.ItemType)).GuidHash == ((PrefabGUID)(ref itemPrefab)).GuidHash) { num2 += val2.Amount; } } return num2; } public static Entity AddItemToInventory(Entity recipient, PrefabGUID guid, int amount) { //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_000a: 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_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_0013: 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_002d: 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_0035: Unknown result type (might be due to invalid IL or missing references) try { ServerGameManager serverGameManager = Core.ServerGameManager; AddItemResponse val = ((ServerGameManager)(ref serverGameManager)).TryAddInventoryItem(recipient, guid, amount); return val.NewEntity; } catch (Exception e) { Core.LogException(e, "AddItemToInventory"); } return Entity.Null; } public static bool TryRemoveItemsFromInventory(Entity characterEntity, PrefabGUID itemPrefab, int amount) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0022: 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_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_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_0081: Unknown result type (might be due to invalid IL or missing references) //IL_0096: 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_00e5: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: Unknown result type (might be due to invalid IL or missing references) //IL_00d3: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = Core.EntityManager; if (!TryGetInventoryEntity(characterEntity, out var inventoryEntity)) { return false; } if (!((EntityManager)(ref entityManager)).HasComponent<InventoryBuffer>(inventoryEntity)) { return false; } DynamicBuffer<InventoryBuffer> buffer = ((EntityManager)(ref entityManager)).GetBuffer<InventoryBuffer>(inventoryEntity, false); int num = amount; int num2 = buffer.Length - 1; while (num2 >= 0 && num > 0) { InventoryBuffer val = buffer[num2]; if (((PrefabGUID)(ref val.ItemType)).GuidHash == ((PrefabGUID)(ref itemPrefab)).GuidHash && val.Amount > 0) { int num3 = math.min(val.Amount, num); val.Amount -= num3; num -= num3; if (val.Amount <= 0) { val.ItemType = new PrefabGUID(0); val.Amount = 0; } buffer[num2] = val; } num2--; } return num == 0; } public static bool IsInCombat(Entity characterEntity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0016: 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_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_0044: 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) EntityManager entityManager = Core.EntityManager; if (characterEntity == Entity.Null || !((EntityManager)(ref entityManager)).Exists(characterEntity)) { return false; } foreach (PrefabGUID combatBuff in PrefabData.CombatBuffs) { if (BuffUtility.HasBuff<EntityManager>(entityManager, characterEntity, PrefabIdentifier.op_Implicit(combatBuff))) { return true; } } return false; } public static bool IsRaidTime() { //IL_0003: Unknown result type (might be due to invalid IL or missing references) //IL_01bc: 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_01c5: 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_000f: 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_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_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_0050: Invalid comparison between Unknown and I4 //IL_0060: 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_0067: Invalid comparison between Unknown and I4 //IL_0077: 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_007e: Invalid comparison between Unknown and I4 EntityQuery val = default(EntityQuery); try { EntityManager entityManager = Core.EntityManager; val = ((EntityManager)(ref entityManager)).CreateEntityQuery((ComponentType[])(object)new ComponentType[1] { ComponentType.ReadOnly<ServerGameBalanceSettings>() }); if (!((EntityQuery)(ref val)).HasSingleton<ServerGameBalanceSettings>()) { return false; } ServerGameBalanceSettings singleton = ((EntityQuery)(ref val)).GetSingleton<ServerGameBalanceSettings>(); if ((int)singleton.CastleDamageMode == 1) { return true; } if ((int)singleton.CastleDamageMode == 0) { return false; } if ((int)singleton.CastleDamageMode == 2) { ServerGameSettings settings = Core.ServerGameSettingsSystem.Settings; if (settings == null) { return false; } PlayerInteractionSettings playerInteractionSettings = settings.PlayerInteractionSettings; DayOfWeek dayOfWeek = DateTime.Now.DayOfWeek; StartEndTimeData val2 = ((dayOfWeek == DayOfWeek.Saturday || dayOfWeek == DayOfWeek.Sunday) ? playerInteractionSettings.VSCastleWeekendTime : playerInteractionSettings.VSCastleWeekdayTime); if (val2.StartHour == 0 && val2.StartMinute == 0 && val2.EndHour == 0 && val2.EndMinute == 0) { return false; } TimeSpan timeSpan = new TimeSpan(val2.StartHour, val2.StartMinute, 0); TimeSpan timeSpan2 = new TimeSpan(val2.EndHour, val2.EndMinute, 0); TimeSpan timeOfDay = DateTime.Now.TimeOfDay; if (timeSpan <= timeSpan2) { return timeOfDay >= timeSpan && timeOfDay <= timeSpan2; } return timeOfDay >= timeSpan || timeOfDay <= timeSpan2; } return false; } catch (Exception e) { Core.LogException(e, "IsRaidTime"); return false; } finally { if (val != default(EntityQuery)) { ((EntityQuery)(ref val)).Dispose(); } } } public static string TrimName(string name, int maxLength = 20) { if (string.IsNullOrEmpty(name)) { return name; } return (name.Length > maxLength) ? (name.Substring(0, maxLength) + "…") : name; } public unsafe static bool TryFindUserByExactName(string playerName, out Entity userEntity, out User user) { //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_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_002c: 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_003d: 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_0046: 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_0057: 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_0067: 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_0089: Unknown result type (might be due to invalid IL or missing references) //IL_008b: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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) userEntity = Entity.Null; user = default(User); if (string.IsNullOrWhiteSpace(playerName)) { return false; } EntityManager entityManager = Core.EntityManager; NativeArray<Entity> val = default(NativeArray<Entity>); try { val = GetEntitiesByComponentType<User>(); Enumerator<Entity> enumerator = val.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; if (!(current == Entity.Null) && ((EntityManager)(ref entityManager)).Exists(current) && ((EntityManager)(ref entityManager)).HasComponent<User>(current)) { User componentData = ((EntityManager)(ref entityManager)).GetComponentData<User>(current); string a = ((object)(*(FixedString64Bytes*)(&componentData.CharacterName))/*cast due to .constrained prefix*/).ToString(); if (string.Equals(a, playerName, StringComparison.OrdinalIgnoreCase)) { userEntity = current; user = componentData; return true; } } } } finally { if (val.IsCreated) { val.Dispose(); } } return false; } public unsafe static bool TryFindUserByName(string query, out Entity userEntity, out User user, out List<string> candidates) { //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_001a: 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_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_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_0056: 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_0063: 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_006c: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_0137: 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_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_0088: Unknown result type (might be due to invalid IL or missing references) //IL_017c: Unknown result type (might be due to invalid IL or missing references) //IL_0181: Unknown result type (might be due to invalid IL or missing references) //IL_018f: Unknown result type (might be due to invalid IL or missing references) //IL_0194: 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_00b0: Unknown result type (might be due to invalid IL or missing references) userEntity = Entity.Null; user = default(User); candidates = null; List<(Entity, User, string)> list = new List<(Entity, User, string)>(); NativeArray<Entity> val = default(NativeArray<Entity>); try { val = GetEntitiesByComponentType<User>(); for (int i = 0; i < val.Length; i++) { Entity val2 = val[i]; EntityManager entityManager = Core.EntityManager; if (!((EntityManager)(ref entityManager)).Exists(val2)) { continue; } entityManager = Core.EntityManager; if (((EntityManager)(ref entityManager)).HasComponent<User>(val2)) { User item = val2.Read<User>(); string text = ((object)(*(FixedString64Bytes*)(&item.CharacterName))/*cast due to .constrained prefix*/).ToString(); if (!string.IsNullOrWhiteSpace(text)) { list.Add((val2, item, text)); } } } } finally { if (val.IsCreated) { val.Dispose(); } } List<(Entity, User, string)> list2 = list.Where<(Entity, User, string)>(((Entity ent, User usr, string name) x) => string.Equals(x.name, query, StringComparison.OrdinalIgnoreCase)).ToList(); if (list2.Count == 1) { userEntity = list2[0].Item1; user = list2[0].Item2; return true; } List<(Entity, User, string)> list3 = list.Where<(Entity, User, string)>(((Entity ent, User usr, string name) x) => x.name.IndexOf(query, StringComparison.OrdinalIgnoreCase) >= 0).ToList(); if (list3.Count == 1) { userEntity = list3[0].Item1; user = list3[0].Item2; return true; } if (list3.Count > 1) { candidates = list3.Select<(Entity, User, string), string>(((Entity ent, User usr, string name) x) => x.name).Distinct<string>(StringComparer.OrdinalIgnoreCase).OrderBy<string, string>((string n) => n, StringComparer.OrdinalIgnoreCase) .ToList(); } return false; } public static bool TryFindUsersByRadius(Entity centerCharacter, float radius, out List<(Entity UserEntity, Entity CharacterEntity, User User, float Distance)> players, ulong excludeSteamId = 0uL, bool includeAdmins = false) { //IL_0008: 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_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_0034: 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_005a: 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_0060: 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_006c: 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_0086: Unknown result type (might be due to invalid IL or missing references) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00a4: 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_00be: Unknown result type (might be due to invalid IL or missing references) //IL_00c3: 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_00d1: Unknown result type (might be due to invalid IL or missing references) //IL_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0102: Unknown result type (might be due to invalid IL or missing references) //IL_0104: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_011d: Unknown result type (might be due to invalid IL or missing references) //IL_0134: Unknown result type (might be due to invalid IL or missing references) //IL_0136: Unknown result type (might be due to invalid IL or missing references) //IL_013b: Unknown result type (might be due to invalid IL or missing references) //IL_013f: Unknown result type (might be due to invalid IL or missing references) //IL_0144: 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_0148: 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_0161: Unknown result type (might be due to invalid IL or missing references) //IL_0163: Unknown result type (might be due to invalid IL or missing references) players = new List<(Entity, Entity, User, float)>(); EntityManager entityManager = Core.EntityManager; if (radius <= 0f) { return false; } if (centerCharacter == Entity.Null || !((EntityManager)(ref entityManager)).Exists(centerCharacter) || !((EntityManager)(ref entityManager)).HasComponent<LocalToWorld>(centerCharacter)) { return false; } LocalToWorld componentData = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(centerCharacter); float3 position = ((LocalToWorld)(ref componentData)).Position; NativeArray<Entity> val = default(NativeArray<Entity>); try { val = GetEntitiesByComponentType<User>(); Enumerator<Entity> enumerator = val.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; if (!((EntityManager)(ref entityManager)).Exists(current) || !((EntityManager)(ref entityManager)).HasComponent<User>(current)) { continue; } User val2 = current.Read<User>(); if (!val2.IsConnected || (excludeSteamId != 0L && val2.PlatformId == excludeSteamId) || (!includeAdmins && val2.IsAdmin)) { continue; } Entity entityOnServer = ((NetworkedEntity)(ref val2.LocalCharacter)).GetEntityOnServer(); if (!(entityOnServer == Entity.Null) && ((EntityManager)(ref entityManager)).Exists(entityOnServer) && ((EntityManager)(ref entityManager)).HasComponent<LocalToWorld>(entityOnServer)) { componentData = ((EntityManager)(ref entityManager)).GetComponentData<LocalToWorld>(entityOnServer); float3 position2 = ((LocalToWorld)(ref componentData)).Position; float num = math.distance(position2, position); if (!(num > radius)) { players.Add((current, entityOnServer, val2, num)); } } } } finally { if (val.IsCreated) { val.Dispose(); } } return players.Count > 0; } public static void NotifyUser(Entity userEntity, 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_000a: 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_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) try { EntityManager entityManager = Core.EntityManager; User componentData = ((EntityManager)(ref entityManager)).GetComponentData<User>(userEntity); FixedString512Bytes val = default(FixedString512Bytes); ((FixedString512Bytes)(ref val))..ctor(message); ServerChatUtils.SendSystemMessageToClient(entityManager, componentData, ref val); } catch (Exception e) { Core.LogException(e, "NotifyUser"); } } public static string Csv(string s) { if (string.IsNullOrEmpty(s)) { return "\"\""; } return "\"" + s.Replace("\"", "\"\"") + "\""; } } [BepInPlugin("PlayerServices", "PlayerServices", "1.0.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BasePlugin { internal static Harmony Harmony; internal static ManualLogSource PluginLog; internal static ConfigFile PluginConfig; internal static ConfigEntry<bool> pisCommandEnabled; internal static ConfigEntry<bool> playerInfoShowClanCastleInfo; internal static ConfigEntry<bool> playerInfoShowClanMemberLastOnline; internal static ConfigEntry<bool> dailyKitEnabled; internal static ConfigEntry<string> dailyKitItems; internal static ConfigEntry<bool> starterKitEnabled; internal static ConfigEntry<string> starterKitItems; internal static ConfigEntry<bool> changeNameFeatureEnabled; internal static ConfigEntry<bool> adminChangeNameBroadcastAndWebhookEnabled; internal static ConfigEntry<bool> playerChangeNameBroadcastEnabled; internal static ConfigEntry<bool> playerChangeNameWebhookEnabled; internal static ConfigEntry<string> changeNameCurrencyName; internal static ConfigEntry<int> changeNameCurrencyPrefab; internal static ConfigEntry<int> changeNameCurrencyCost; internal static ConfigEntry<string> changeNameBroadcastMessage; internal static ConfigEntry<string> changeNameWebhookMessage; internal static ConfigEntry<string> changeNameWebhookUrl; internal static ConfigEntry<bool> onlyWhitelistEnable; internal static ConfigEntry<bool> welcomeMessageEnabled; internal static ConfigEntry<string> welcomeMessageText1; internal static ConfigEntry<string> welcomeMessageText2; internal static ConfigEntry<bool> auraFeatureEnabled; internal static ConfigEntry<string> auraBroadcastMessage; internal static ConfigEntry<string> auraCurrencyName; internal static ConfigEntry<string> auraCurrencyPrefabGuid; internal static ConfigEntry<string> auraPrefabGuids; internal static ConfigEntry<string> auraCosts; internal static ConfigEntry<bool> playerTeleportEnabled; internal static ConfigEntry<int> playerTeleportDelaySeconds; public override void Load() { //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_0041: Expected O, but got Unknown //IL_0468: Unknown result type (might be due to invalid IL or missing references) //IL_0472: Expected O, but got Unknown //IL_047c: Unknown result type (might be due to invalid IL or missing references) //IL_0486: Expected O, but got Unknown if (!(Application.productName != "VRisingServer")) { PluginLog = ((BasePlugin)this).Log; PluginConfig = ((BasePlugin)this).Config; 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>("PlayerServices"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("1.0.0"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!"); } log.LogInfo(val); pisCommandEnabled = ((BasePlugin)this).Config.Bind<bool>("PlayerInformations", "pisCommandEnabled", true, "Enable the player information command."); playerInfoShowClanCastleInfo = ((BasePlugin)this).Config.Bind<bool>("PlayerInformations", "ShowClanCastleInfo", false, "Show clan castle information in .pis command. Admins can always see this information."); playerInfoShowClanMemberLastOnline = ((BasePlugin)this).Config.Bind<bool>("PlayerInformations", "ShowClanMemberLastOnline", false, "Show last online time for offline clan members in .pis command. Admins can always see this information."); dailyKitEnabled = ((BasePlugin)this).Config.Bind<bool>("DailyKit", "DailyKitEnabled", true, "Enable players to claim Daily Kits."); dailyKitItems = ((BasePlugin)this).Config.Bind<string>("DailyKit", "dailyKitItemsAndQuantity", "429052660:10,800879747:10", "List of daily kit items in the format PrefabGuid:Quantity, separated by commas."); starterKitEnabled = ((BasePlugin)this).Config.Bind<bool>("StarterKit", "StarterKitEnabled", true, "Enable automatically granting a one-time Starter Kit to new players upon character creation."); starterKitItems = ((BasePlugin)this).Config.Bind<string>("StarterKit", "StarterKitItemsAndQuantity", "1821405450:208,-1222725729:64,-219760992:1,-1593377811:300,-1531666018:300,862477668:100", "List of starter kit items in the format PrefabGuid:Quantity separated by commas."); changeNameFeatureEnabled = ((BasePlugin)this).Config.Bind<bool>("ChangeName", "ChangeNameFeatureEnabled", true, "Enable the character name change feature."); adminChangeNameBroadcastAndWebhookEnabled = ((BasePlugin)this).Config.Bind<bool>("ChangeName", "AdminChangeNameIngameBroadcastAndWebhookEnabled", false, "Enable in-game broadcasts and Discord webhook notifications when an admin changes a player's name."); playerChangeNameBroadcastEnabled = ((BasePlugin)this).Config.Bind<bool>("ChangeName", "PlayerChangeNameIngameBroadcastEnabled", true, "Enable in-game broadcast messages when players change their names."); playerChangeNameWebhookEnabled = ((BasePlugin)this).Config.Bind<bool>("ChangeName", "PlayerChangeNameWebhookEnabled", false, "Enable Discord webhook messages when players change their names."); changeNameCurrencyName = ((BasePlugin)this).Config.Bind<string>("ChangeName", "ChangeNameCurrencyName", "Primal Stygian Shards", "Currency name required to change a character name."); changeNameCurrencyPrefab = ((BasePlugin)this).Config.Bind<int>("ChangeName", "ChangeNameCurrencyPrefabGuid", 28358550, "Currency prefab Guid required to change a character name."); changeNameCurrencyCost = ((BasePlugin)this).Config.Bind<int>("ChangeName", "ChangeNameCurrencyCost", 1000, "Currency cost required to change a character name."); changeNameBroadcastMessage = ((BasePlugin)this).Config.Bind<string>("ChangeName", "ChangeNameIngameBroadcastMessage", "<color=white>#oldname#</color> has changed their name to <color=white>#newname#</color>. For more info, type <color=green>.changename help</color>", "Format of the in-game broadcast message."); changeNameWebhookMessage = ((BasePlugin)this).Config.Bind<string>("ChangeName", "ChangeNameWebhookMessage", "**[Change Name]** - **#oldname#** has changed their name to **#newname#**", "Format of the Discord webhook message."); changeNameWebhookUrl = ((BasePlugin)this).Config.Bind<string>("ChangeName", "ChangeNameWebhookUrl", "", "Webhook URL. Example: https://discord.com/api/webhooks/xxxxxxxxxxxxxxxxx/xxxxxxxxxxxxxxxxxxxxx"); onlyWhitelistEnable = ((BasePlugin)this).Config.Bind<bool>("Whitelist", "OnlyWhitelistEnable", false, "Set the server to private and only allow players marked as whitelisted to join."); welcomeMessageEnabled = ((BasePlugin)this).Config.Bind<bool>("WelcomeMessage", "WelcomeMessageEnabled", true, "Enable the welcome message sent to players after they connect."); welcomeMessageText1 = ((BasePlugin)this).Config.Bind<string>("WelcomeMessage", "WelcomeMessageText1", "Welcome to the server, <color=white>#player#</color>!", "Text for the first welcome message."); welcomeMessageText2 = ((BasePlugin)this).Config.Bind<string>("WelcomeMessage", "WelcomeMessageText2", "", "Text for the second welcome message. Leave blank to disable it."); auraFeatureEnabled = ((BasePlugin)this).Config.Bind<bool>("Aura", "AuraFeatureEnabled", true, "Enable the aura feature."); auraBroadcastMessage = ((BasePlugin)this).Config.Bind<string>("Aura", "AuraBroadcastMessage", "<color=white>#player#</color> bought aura #aura#. For more info, type <color=green>.aura help</color>", "Format of the in-game broadcast message."); auraCurrencyName = ((BasePlugin)this).Config.Bind<string>("Aura", "AuraCurrencyName", "Primal Stygian Shards,Primal Stygian Shards,Primal Stygian Shards,Primal Stygian Shards,Primal Stygian Shards,Primal Stygian Shards,Primal Stygian Shards,Primal Stygian Shards,Primal Stygian Shards,Primal Stygian Shards,Primal Stygian Shards", "Currency names for each aura, separated by comma."); auraCurrencyPrefabGuid = ((BasePlugin)this).Config.Bind<string>("Aura", "AuraCurrencyPrefabGuid", "28358550,28358550,28358550,28358550,28358550,28358550,28358550,28358550,28358550,28358550,28358550", "Currency prefab GUIDs for each aura, separated by comma."); auraCosts = ((BasePlugin)this).Config.Bind<string>("Aura", "AuraCosts", "100,200,300,400,500,600,700,800,900,0,0", "Comma-separated aura costs. The order must match AuraPrefabGuids. Cost must be greater than 0 to allow purchase; use 0 to make that aura admin-only/not for sale. Example: 100,0,300"); auraPrefabGuids = ((BasePlugin)this).Config.Bind<string>("Aura", "AuraPrefabGuids", "-1242403012,-1887712500,-1083643277,1343911070,784366378,1237097606,647429443,-646349605,-1124645803,-1640482518,1163490655", "Comma-separated aura prefab GUIDs. The order must match AuraCosts, AuraCurrencyName, and AuraCurrencyPrefabGuid."); playerTeleportEnabled = ((BasePlugin)this).Config.Bind<bool>("Teleport", "PlayerTeleportEnabled", false, "Enable players to use .pls tp where AdminOnly is false. Admins can still teleport."); playerTeleportDelaySeconds = ((BasePlugin)this).Config.Bind<int>("Teleport", "PlayerTeleportDelaySeconds", 10, new ConfigDescription("Delay in seconds before player teleport. Set to 0 for instant teleport.", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 20), Array.Empty<object>())); Harmony = new Harmony("PlayerServices"); Harmony.PatchAll(Assembly.GetExecutingAssembly()); CommandRegistry.RegisterAll(); } } public override bool Unload() { PlayerDataService.ForceSaveIfDirty(); Core.StopCoroutines(); CommandRegistry.UnregisterAssembly(); Harmony harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } return true; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "PlayerServices"; public const string PLUGIN_NAME = "PlayerServices"; public const string PLUGIN_VERSION = "1.0.0"; } } namespace PlayerServices.Services { internal static class AccessControlService { public static void CheckUserLogin(Entity userEntity, User user) { //IL_0001: 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_002b: 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_0045: Expected O, but got Unknown //IL_0058: 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_0073: 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_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Expected O, but got Unknown //IL_01f2: Unknown result type (might be due to invalid IL or missing references) //IL_01f9: Expected O, but got Unknown //IL_00ec: 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_0107: Unknown result type (might be due to invalid IL or missing references) //IL_020c: Unknown result type (might be due to invalid IL or missing references) //IL_020d: Unknown result type (might be due to invalid IL or missing references) //IL_0227: 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_015e: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_0172: Unknown result type (might be due to invalid IL or missing references) //IL_018c: Unknown result type (might be due to invalid IL or missing references) if (user.PlatformId == 0) { return; } PlayerCacheData playerCache = PlayerDataService.GetPlayerCache(user.PlatformId); bool flag = default(bool); if (BanService.IsBannedPlayer(playerCache)) { KickPlayer(userEntity); ManualLogSource log = Core.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(39, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Banlist] Banned player was kicked: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<FixedString64Bytes>(user.CharacterName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ulong>(user.PlatformId); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")"); } log.LogInfo(val); } else if (Plugin.onlyWhitelistEnable.Value) { BepInExInfoLogInterpolatedStringHandler val; if (!WhitelistService.IsWhitelistedPlayer(playerCache)) { KickPlayer(userEntity); ManualLogSource log2 = Core.Log; val = new BepInExInfoLogInterpolatedStringHandler(50, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Whitelist] Non-whitelisted player was kicked: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<FixedString64Bytes>(user.CharacterName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ulong>(user.PlatformId); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")"); } log2.LogInfo(val); return; } string text = (string.IsNullOrWhiteSpace(playerCache.KnownAs) ? "Unknown" : playerCache.KnownAs); ManualLogSource log3 = Core.Log; val = new BepInExInfoLogInterpolatedStringHandler(58, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Whitelist] Whitelisted player connected: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<FixedString64Bytes>(user.CharacterName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ulong>(user.PlatformId); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(") | Known As: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text); } log3.LogInfo(val); } else { string text2 = ((playerCache == null || string.IsNullOrWhiteSpace(playerCache.KnownAs)) ? "" : (" | Known As: " + playerCache.KnownAs)); ManualLogSource log4 = Core.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(33, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Connected] Player connected: "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<FixedString64Bytes>(user.CharacterName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" ("); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<ulong>(user.PlatformId); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(")"); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text2); } log4.LogInfo(val); } } public static void KickPlayer(Entity userEntity) { //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_000c: 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_0012: 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_001b: 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_0040: 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_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_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_0063: 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_006e: Unknown result type (might be due to invalid IL or missing references) //IL_0079: 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_0084: 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_0097: 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_00a2: 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) EntityManager entityManager = Core.Server.EntityManager; User val = userEntity.Read<User>(); if (val.IsConnected && val.PlatformId != 0) { Entity entity = ((EntityManager)(ref entityManager)).CreateEntity((ComponentType[])(object)new ComponentType[3] { ComponentType.ReadOnly<NetworkEventType>(), ComponentType.ReadOnly<SendEventToUser>(), ComponentType.ReadOnly<KickEvent>() }); entity.Write<KickEvent>(new KickEvent { PlatformId = val.PlatformId }); entity.Write<SendEventToUser>(new SendEventToUser { UserIndex = val.Index }); entity.Write<NetworkEventType>(new NetworkEventType { EventId = NetworkEvents.EventId_KickEvent, IsAdminEvent = false, IsDebugEvent = false }); } } public static void KickIfOnline(ulong steamId) { //IL_0003: 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_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_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) //IL_002f: 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_0039: 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) NativeArray<Entity> val = default(NativeArray<Entity>); try { val = Helper.GetEntitiesByComponentType<User>(); Enumerator<Entity> enumerator = val.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; User val2 = current.Read<User>(); if (val2.PlatformId == steamId && val2.IsConnected) { KickPlayer(current); break; } } } finally { if (val.IsCreated) { val.Dispose(); } } } } internal static class AdminService { private static readonly Dictionary<ulong, (Entity AdminUserEntity, Entity AdminChar, Entity TargetUserEntity, Entity TargetChar, string TargetName)> _trackers = new Dictionary<ulong, (Entity, Entity, Entity, Entity, string)>(); private static bool _trackingMonitorRunning = false; private const float TRACKING_INTERVAL = 0.04f; private const float REBUFF_DELAY_SECONDS = 0.2f; private unsafe static IEnumerator TrackPlayerRoutine(ChatCommandContext ctx, ulong adminSteamId, Entity adminUserEntity, Entity adminChar, Entity targetUserEntity, Entity targetChar, User targetUser, float delay) { //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_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_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_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_0033: 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) if (delay > 0f) { yield return (object)new WaitForSeconds(delay); } try { EntityManager em = Core.EntityManager; string targetName = ((object)(*(FixedString64Bytes*)(&targetUser.CharacterName))/*cast due to .constrained prefix*/).ToString(); if (!TryReadConnectedUser(em, adminUserEntity, out var user)) { yield break; } if (!TryReadConnectedUser(em, targetUserEntity, out user)) { Helper.NotifyUser(adminUserEntity, "<color=yellow>Tracking stopped:</color> <color=white>" + targetName + "</color> is offline."); } else if (adminChar == Entity.Null || !((EntityManager)(ref em)).Exists(adminChar) || !((EntityManager)(ref em)).HasComponent<Translation>(adminChar) || targetChar == Entity.Null || !((EntityManager)(ref em)).Exists(targetChar) || !((EntityManager)(ref em)).HasComponent<Translation>(targetChar) || !BuffUtility.HasBuff<EntityManager>(em, adminChar, PrefabIdentifier.op_Implicit(PrefabData.Observe))) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExWarningLogInterpolatedStringHandler val = new BepInExWarningLogInterpolatedStringHandler(46, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Admin] Failed to start tracking "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(targetName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" after delay."); } log.LogWarning(val); } else { _trackers[adminSteamId] = (adminUserEntity, adminChar, targetUserEntity, targetChar, targetName); EnsureTrackingMonitorRunning(); float3 targetPos = targetChar.Read<Translation>().Value; adminChar.Write<Translation>(new Translation { Value = targetPos }); ctx.Reply("<color=yellow>Now tracking:</color> <color=white>" + targetName + "</color>"); ctx.Reply("Usage: <color=green>.pls track <player></color> to track others or <color=green>.pls untrack</color> to stop."); ctx.Reply("Usage: <color=green>.pls observe</color> to toggle Observe mode and untrack."); em = default(EntityManager); } } catch (Exception e) { Core.LogException(e, "TrackPlayerRoutine"); } } private static void EnsureTrackingMonitorRunning() { if (!_trackingMonitorRunning) { _trackingMonitorRunning = true; Core.StartCoroutine(MonitorTrackingCoroutine()); } } private static IEnumerator MonitorTrackingCoroutine() { try { while (_trackers.Count > 0) { try { MonitorTrackingTick(); } catch (Exception e) { Core.LogException(e, "MonitorTrackingCoroutine"); _trackers.Clear(); } yield return (object)new WaitForSeconds(0.04f); } } finally { _trackingMonitorRunning = false; } } private static void MonitorTrackingTick() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_003d: 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_0048: Unknown result type (might be due to invalid IL or missing references) //IL_004d: 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_0055: 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_0080: 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_00bb: Unknown result type (might be due to invalid IL or missing references) //IL_00bd: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00c9: Unknown result type (might be due to invalid IL or missing references) //IL_00cb: Unknown result type (might be due to invalid IL or missing references) //IL_00d9: Unknown result type (might be due to invalid IL or missing references) //IL_0119: 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_0124: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: Unknown result type (might be due to invalid IL or missing references) //IL_0143: Unknown result type (might be due to invalid IL or missing references) //IL_0145: 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_014f: Unknown result type (might be due to invalid IL or missing references) //IL_0151: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Unknown result type (might be due to invalid IL or missing references) //IL_015d: 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) EntityManager entityManager = Core.EntityManager; List<ulong> list = new List<ulong>(); foreach (KeyValuePair<ulong, (Entity, Entity, Entity, Entity, string)> tracker in _trackers) { ulong key = tracker.Key; var (userEntity, val, userEntity2, val2, text) = tracker.Value; if (!TryReadConnectedUser(entityManager, userEntity, out var user)) { list.Add(key); } else if (!TryReadConnectedUser(entityManager, userEntity2, out user)) { Helper.NotifyUser(userEntity, "<color=yellow>Tracking stopped:</color> <color=white>" + text + "</color> is offline."); list.Add(key); } else if (val == Entity.Null || val2 == Entity.Null || !((EntityManager)(ref entityManager)).Exists(val) || !((EntityManager)(ref entityManager)).Exists(val2) || !BuffUtility.HasBuff<EntityManager>(entityManager, val, PrefabIdentifier.op_Implicit(PrefabData.Observe))) { list.Add(key); } else if (!((EntityManager)(ref entityManager)).HasComponent<Translation>(val) || !((EntityManager)(ref entityManager)).HasComponent<Translation>(val2)) { list.Add(key); } else { float3 value = val2.Read<Translation>().Value; val.Write<Translation>(new Translation { Value = value }); } } foreach (ulong item in list) { _trackers.Remove(item); } } private static bool TryReadConnectedUser(EntityManager em, Entity userEntity, out User user) { //IL_0002: 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_0017: 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_0039: 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) user = default(User); if (userEntity == Entity.Null || !((EntityManager)(ref em)).Exists(userEntity) || !((EntityManager)(ref em)).HasComponent<User>(userEntity)) { return false; } user = ((EntityManager)(ref em)).GetComponentData<User>(userEntity); return user.IsConnected; } public static void ToggleObserve(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_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_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_002b: 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_002d: 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_00cd: Unknown result type (might be due to invalid IL or missing references) //IL_00ce: 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_0100: Unknown result type (might be due to invalid IL or missing references) //IL_0107: Expected O, but got Unknown //IL_004a: 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_007a: Unknown result type (might be due to invalid IL or missing references) //IL_0081: Expected O, but got Unknown //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_012a: 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_00a4: Unknown result type (might be due to invalid IL or missing references) Entity senderUserEntity = ctx.Event.SenderUserEntity; Entity senderCharacterEntity = ctx.Event.SenderCharacterEntity; EntityManager entityManager = Core.EntityManager; ulong platformId = senderUserEntity.Read<User>().PlatformId; bool flag = default(bool); if (BuffUtility.HasBuff<EntityManager>(entityManager, senderCharacterEntity, PrefabIdentifier.op_Implicit(PrefabData.Observe))) { Buffs.RemoveBuff(senderCharacterEntity, PrefabData.Observe); _trackers.Remove(platformId); ctx.Reply("<color=yellow>Observe mode:</color> <color=red>Off</color>. Usage: <color=green>.pls observe</color> to toggle."); ManualLogSource log = Core.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(31, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Admin] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<FixedString64Bytes>(ctx.Event.SenderUserEntity.Read<User>().CharacterName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" disabled observe mode."); } log.LogInfo(val); } else { Buffs.AddBuff(senderUserEntity, senderCharacterEntity, PrefabData.Observe, -1); ctx.Reply("<color=yellow>Observe mode:</color> <color=green>On</color>. Usage: <color=green>.pls observe</color> to toggle."); ctx.Reply("Usage: <color=green>.pls track <player></color> to track a player."); ManualLogSource log2 = Core.Log; BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(30, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Admin] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<FixedString64Bytes>(ctx.Event.SenderUserEntity.Read<User>().CharacterName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" enabled observe mode."); } log2.LogInfo(val); } } public static void TrackPlayer(ChatCommandContext ctx, string targetName) { //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_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_0035: 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_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_0043: 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_0050: 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_0072: 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_008b: 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_00b1: 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_00c9: 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_00ee: Unknown result type (might be due to invalid IL or missing references) //IL_00f0: Unknown result type (might be due to invalid IL or missing references) //IL_00f5: 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_013a: 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_013e: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Unknown result type (might be due to invalid IL or missing references) //IL_010b: Unknown result type (might be due to invalid IL or missing references) //IL_010d: Unknown result type (might be due to invalid IL or missing references) if (!TryFindPlayerName(ctx, targetName, out var targetUserEntity, out var targetCharEntity, out var targetUser)) { return; } EntityManager entityManager = Core.EntityManager; Entity senderUserEntity = ctx.Event.SenderUserEntity; Entity senderCharacterEntity = ctx.Event.SenderCharacterEntity; User val = senderUserEntity.Read<User>(); ulong platformId = val.PlatformId; if (platformId == targetUser.PlatformId) { ctx.Reply("<color=red>You cannot track yourself.</color>"); return; } if (senderCharacterEntity == Entity.Null || !((EntityManager)(ref entityManager)).Exists(senderCharacterEntity) || !((EntityManager)(ref entityManager)).HasComponent<Translation>(senderCharacterEntity)) { ctx.Reply("<color=red>Could not read your character position.</color>"); return; } if (targetCharEntity == Entity.Null || !((EntityManager)(ref entityManager)).Exists(targetCharEntity) || !((EntityManager)(ref entityManager)).HasComponent<Translation>(targetCharEntity)) { ctx.Reply("<color=red>Could not read target position.</color>"); return; } bool flag = false; if (!BuffUtility.HasBuff<EntityManager>(entityManager, senderCharacterEntity, PrefabIdentifier.op_Implicit(PrefabData.Observe))) { if (!Buffs.AddBuff(senderUserEntity, senderCharacterEntity, PrefabData.Observe, -1)) { ctx.Reply("<color=red>Failed to enter observe mode.</color>"); return; } flag = true; } Core.StartCoroutine(TrackPlayerRoutine(ctx, platformId, senderUserEntity, senderCharacterEntity, targetUserEntity, targetCharEntity, targetUser, flag ? 0.2f : 0f)); } public static void UntrackPlayer(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) ulong platformId = ctx.Event.SenderUserEntity.Read<User>().PlatformId; if (_trackers.ContainsKey(platformId)) { _trackers.Remove(platformId); ctx.Reply("<color=yellow>Tracking stopped.</color> Usage: <color=green>.pls track <player></color> to track."); ctx.Reply("Usage: <color=green>.pls observe</color> to toggle Observe mode and untrack."); } else { ctx.Reply("<color=yellow>You are not currently tracking anyone.</color>"); } } public unsafe static void ApplyPotionBuffs(ChatCommandContext ctx, string targetName) { //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_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_002c: 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) //IL_008f: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown //IL_00f1: Unknown result type (might be due to invalid IL or missing references) //IL_00f2: 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_00b9: Unknown result type (might be due to invalid IL or missing references) Entity targetUserEntity; Entity targetCharEntity; User targetUser; if (string.IsNullOrWhiteSpace(targetName)) { targetUserEntity = ctx.Event.SenderUserEntity; targetCharEntity = ctx.Event.SenderCharacterEntity; targetUser = targetUserEntity.Read<User>(); } else if (!TryFindPlayerName(ctx, targetName, out targetUserEntity, out targetCharEntity, out targetUser)) { return; } string text = ((object)(*(FixedString64Bytes*)(&targetUser.CharacterName))/*cast due to .constrained prefix*/).ToString(); ctx.Reply("Applied <color=yellow>Potion Buffs</color> to <color=white>" + text + "</color>."); Helper.NotifyUser(targetUserEntity, "You have received <color=green>Potion Buffs</color>."); ManualLogSource log = Core.Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(34, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("[Admin] "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<FixedString64Bytes>(ctx.Event.SenderUserEntity.Read<User>().CharacterName); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" applied Potion Buffs to "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(text); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("."); } log.LogInfo(val); Core.StartCoroutine(ApplyBuffsRoutine(targetUserEntity, targetCharEntity)); } private static IEnumerator ApplyBuffsRoutine(Entity targetUserEntity, Entity targetCharEntity) { //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_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) bool hasRemovedAny; try { hasRemovedAny = RemoveExistingPotionBuffs(targetCharEntity); } catch (Exception ex) { Exception e = ex; Core.LogException(e, "ApplyBuffsRoutine"); yield break; } if (hasRemovedAny) { yield return (object)new WaitForSeconds(0.2f); } try { ApplyPotionBuffsAfterDelay(targetUserEntity, targetCharEntity); } catch (Exception e2) { Core.LogException(e2, "ApplyBuffsRoutine"); } } private static bool RemoveExistingPotionBuffs(Entity targetCharEntity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_0016: 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_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) //IL_0049: 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_005b: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = Core.EntityManager; if (targetCharEntity == Entity.Null || !((EntityManager)(ref entityManager)).Exists(targetCharEntity)) { return false; } bool result = false; foreach (PrefabGUID item in PrefabData.PotionBuff) { if (BuffUtility.HasBuff<EntityManager>(entityManager, targetCharEntity, PrefabIdentifier.op_Implicit(item))) { Buffs.RemoveBuff(targetCharEntity, item); result = true; } } return result; } private static void ApplyPotionBuffsAfterDelay(Entity targetUserEntity, Entity targetCharEntity) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: 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_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_0023: 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_0050: 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_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_0059: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = Core.EntityManager; if (targetCharEntity == Entity.Null || targetUserEntity == Entity.Null || !((EntityManager)(ref entityManager)).Exists(targetCharEntity) || !((EntityManager)(ref entityManager)).Exists(targetUserEntity)) { return; } foreach (PrefabGUID item in PrefabData.PotionBuff) { Buffs.AddBuff(targetUserEntity, targetCharEntity, item); } } private static bool TryFindPlayerName(ChatCommandContext ctx, string targetName, out Entity targetUserEntity, out Entity targetCharEntity, out User targetUser) { //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_0012: 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_0157: Unknown result type (might be due to invalid IL or missing references) //IL_015c: Unknown result type (might be due to invalid IL or missing references) //IL_0162: Unknown result type (might be due to invalid IL or missing references) //IL_0167: Unknown result type (might be due to invalid IL or missing references) //IL_0126: Unknown result type (might be due to invalid IL or missing