Decompiled source of KindredCommands v2.3.0
KindredCommands.dll
Decompiled a week 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.IO; using System.Linq; 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.Json.Serialization; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; using BepInEx; 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; using Il2CppSystem.Collections.Generic; using KindredCommands; using KindredCommands.Commands.Converters; using KindredCommands.Data; using KindredCommands.Models; using KindredCommands.Services; using Microsoft.CodeAnalysis; using ProjectM; using ProjectM.CastleBuilding; using ProjectM.Gameplay.Clan; using ProjectM.Gameplay.Scripting; using ProjectM.Gameplay.Systems; using ProjectM.Network; using ProjectM.Physics; using ProjectM.Scripting; using ProjectM.Shared; using ProjectM.Shared.Systems; using ProjectM.Terrain; using Stunlock.Core; using Stunlock.Localization; using Stunlock.Network; using Unity.Collections; using Unity.Entities; using Unity.Mathematics; using Unity.Physics; using Unity.Transforms; using UnityEngine; using VampireCommandFramework; using VampireCommandFramework.Breadstone; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("odjit")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyDescription("Commands to expand Administration efforts and provide information")] [assembly: AssemblyFileVersion("2.3.0.0")] [assembly: AssemblyInformationalVersion("2.3.0+e2366abd73726d081f9d826149b9cf04540995cf")] [assembly: AssemblyProduct("KindredCommands")] [assembly: AssemblyTitle("KindredCommands")] [assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)] [assembly: AssemblyVersion("2.3.0.0")] [module: UnverifiableCode] [module: RefSafetyRules(11)] namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)] internal sealed class NullableContextAttribute : Attribute { public readonly byte Flag; public NullableContextAttribute(byte P_0) { Flag = P_0; } } [CompilerGenerated] [Microsoft.CodeAnalysis.Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } [HarmonyBefore(new string[] { "gg.deca.VampireCommandFramework" })] [HarmonyPatch(typeof(ChatMessageSystem), "OnUpdate")] public static class StealthAdminChatPatch { public static bool Prefix(ChatMessageSystem __instance) { //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_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_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Unknown result type (might be due to invalid IL or missing references) //IL_017f: Unknown result type (might be due to invalid IL or missing references) //IL_0186: Expected O, but got Unknown //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_002a: Unknown result type (might be due to invalid IL or missing references) //IL_002b: Unknown result type (might be due to invalid IL or missing references) //IL_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_0034: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_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_0046: Unknown result type (might be due to invalid IL or missing references) //IL_005c: Unknown result type (might be due to invalid IL or missing references) //IL_006a: 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_011b: 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_012a: Unknown result type (might be due to invalid IL or missing references) //IL_012c: 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_0140: Unknown result type (might be due to invalid IL or missing references) //IL_014d: 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_0164: Expected O, but got Unknown //IL_015f: Unknown result type (might be due to invalid IL or missing references) //IL_0166: Expected O, but got Unknown //IL_016a: Unknown result type (might be due to invalid IL or missing references) //IL_016f: Unknown result type (might be due to invalid IL or missing references) //IL_00ab: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_0245: Unknown result type (might be due to invalid IL or missing references) //IL_0248: Invalid comparison between Unknown and I4 //IL_028d: Unknown result type (might be due to invalid IL or missing references) //IL_0294: Unknown result type (might be due to invalid IL or missing references) //IL_0297: Unknown result type (might be due to invalid IL or missing references) //IL_02b1: Expected I4, but got Unknown //IL_026c: Unknown result type (might be due to invalid IL or missing references) //IL_0271: Unknown result type (might be due to invalid IL or missing references) //IL_0277: Unknown result type (might be due to invalid IL or missing references) //IL_027c: Unknown result type (might be due to invalid IL or missing references) //IL_0280: Unknown result type (might be due to invalid IL or missing references) //IL_0281: Unknown result type (might be due to invalid IL or missing references) //IL_03ff: Unknown result type (might be due to invalid IL or missing references) //IL_040a: Unknown result type (might be due to invalid IL or missing references) //IL_040c: Unknown result type (might be due to invalid IL or missing references) //IL_03d9: Unknown result type (might be due to invalid IL or missing references) //IL_03db: Unknown result type (might be due to invalid IL or missing references) //IL_03e0: Unknown result type (might be due to invalid IL or missing references) //IL_03e5: Unknown result type (might be due to invalid IL or missing references) //IL_03ef: Unknown result type (might be due to invalid IL or missing references) //IL_03f1: Unknown result type (might be due to invalid IL or missing references) //IL_03f6: Unknown result type (might be due to invalid IL or missing references) //IL_0389: Unknown result type (might be due to invalid IL or missing references) //IL_0390: Expected O, but got Unknown //IL_03c3: Unknown result type (might be due to invalid IL or missing references) //IL_03c8: Unknown result type (might be due to invalid IL or missing references) //IL_03cc: Unknown result type (might be due to invalid IL or missing references) //IL_0348: Unknown result type (might be due to invalid IL or missing references) //IL_034f: Expected O, but got Unknown //IL_02c0: Unknown result type (might be due to invalid IL or missing references) //IL_02c7: Expected O, but got Unknown //IL_0304: Unknown result type (might be due to invalid IL or missing references) //IL_030b: Expected O, but got Unknown //IL_0428: Unknown result type (might be due to invalid IL or missing references) //IL_042a: Unknown result type (might be due to invalid IL or missing references) //IL_042c: Unknown result type (might be due to invalid IL or missing references) //IL_042e: Unknown result type (might be due to invalid IL or missing references) //IL_0433: Unknown result type (might be due to invalid IL or missing references) //IL_041a: Unknown result type (might be due to invalid IL or missing references) //IL_041c: Unknown result type (might be due to invalid IL or missing references) //IL_0421: Unknown result type (might be due to invalid IL or missing references) EntityQuery _query_661171423_ = __instance.__query_661171423_0; NativeArray<Entity> val = ((EntityQuery)(ref _query_661171423_)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); Enumerator<Entity> enumerator = val.GetEnumerator(); bool flag3 = default(bool); while (enumerator.MoveNext()) { Entity current = enumerator.Current; FromCharacter val2 = current.Read<FromCharacter>(); User val3 = val2.User.Read<User>(); ChatMessageEvent val4 = current.Read<ChatMessageEvent>(); string text = ((object)(FixedString512Bytes)(ref val4.MessageText)).ToString(); bool flag = val3.IsAdmin; bool flag2 = Core.StealthAdminService.IsStealthAdmin(val2.User); if (!flag && flag2 && ((object)(FixedString512Bytes)(ref val4.MessageText)).ToString().StartsWith(".")) { flag = true; val3.IsAdmin = true; val2.User.Write<User>(val3); } ChatCommandContext val5 = new ChatCommandContext((VChatEvent)typeof(VChatEvent).GetConstructor(BindingFlags.Instance | BindingFlags.NonPublic, null, new Type[5] { typeof(Entity), typeof(Entity), typeof(string), typeof(ChatMessageType), typeof(User) }, null).Invoke(new object[5] { val2.User, val2.Character, text, val4.MessageType, val3 })); CommandResult val6; try { val6 = CommandRegistry.Handle((ICommandContext)(object)val5, text); } catch (Exception ex) { ManualLogSource log = Core.Log; BepInExErrorLogInterpolatedStringHandler val7 = new BepInExErrorLogInterpolatedStringHandler(34, 1, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val7).AppendLiteral("Error while handling chat message "); ((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<Exception>(ex); } log.LogError(val7); continue; } string[] array = text.Split(" "); string text2 = array[0]; string text3 = ((array.Length > 1) ? array[1] : ""); if (text2.ToLowerInvariant().Contains("nolog") || text2.ToLowerInvariant().Contains("password")) { text = text2 + " <Not Logging For Security>"; } else if (text3.ToLowerInvariant().Contains("nolog") || text3.ToLowerInvariant().Contains("password")) { text = text2 + " " + text3 + " <Not Logging For Security>"; } EntityManager entityManager; if ((int)val6 == 5 && text.StartsWith(".help-legacy", StringComparison.InvariantCulture)) { val4.MessageText = FixedString512Bytes.op_Implicit(text.Replace("-legacy", string.Empty)); entityManager = ((ComponentSystemBase)__instance).EntityManager; ((EntityManager)(ref entityManager)).SetComponentData<ChatMessageEvent>(current, val4); } else if ((int)val6 != 0) { switch (val6 - 1) { case 3: { ManualLogSource log4 = Core.Log; BepInExInfoLogInterpolatedStringHandler val8 = new BepInExInfoLogInterpolatedStringHandler(35, 2, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val8).AppendFormatted<string>(val5.Name); ((BepInExLogInterpolatedStringHandler)val8).AppendLiteral(" was denied trying to use command: "); ((BepInExLogInterpolatedStringHandler)val8).AppendFormatted<string>(text); } log4.LogInfo(val8); break; } case 4: { ManualLogSource log3 = Core.Log; BepInExInfoLogInterpolatedStringHandler val8 = new BepInExInfoLogInterpolatedStringHandler(15, 2, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val8).AppendFormatted<string>(val5.Name); ((BepInExLogInterpolatedStringHandler)val8).AppendLiteral(" used command: "); ((BepInExLogInterpolatedStringHandler)val8).AppendFormatted<string>(text); } log3.LogInfo(val8); break; } case 2: { ManualLogSource log5 = Core.Log; BepInExInfoLogInterpolatedStringHandler val8 = new BepInExInfoLogInterpolatedStringHandler(46, 2, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val8).AppendFormatted<string>(val5.Name); ((BepInExLogInterpolatedStringHandler)val8).AppendLiteral(" had an internal error trying to use command: "); ((BepInExLogInterpolatedStringHandler)val8).AppendFormatted<string>(text); } log5.LogInfo(val8); break; } case 0: { ManualLogSource log2 = Core.Log; BepInExInfoLogInterpolatedStringHandler val8 = new BepInExInfoLogInterpolatedStringHandler(42, 2, ref flag3); if (flag3) { ((BepInExLogInterpolatedStringHandler)val8).AppendFormatted<string>(val5.Name); ((BepInExLogInterpolatedStringHandler)val8).AppendLiteral(" had a usage error trying to use command: "); ((BepInExLogInterpolatedStringHandler)val8).AppendFormatted<string>(text); } log2.LogInfo(val8); break; } } entityManager = Core.Server.EntityManager; ((EntityManager)(ref entityManager)).DestroyEntity(current); } if (flag && flag2) { val3 = val2.User.Read<User>(); val3.IsAdmin = false; val2.User.Write<User>(val3); } User toUser = default(User); if (Core.Players.TryFindUserFromNetworkId(val4.ReceiverEntity, out var userEntity)) { toUser = userEntity.Read<User>(); } Core.AuditService.LogChatMessage(val3, toUser, val4.MessageType, val6, text); } val.Dispose(); return true; } } [HarmonyPatch(typeof(ServerBootstrapSystem), "OnUserConnected")] public static class StealthAdminOnUserConnected_Patch { public static void Postfix(ServerBootstrapSystem __instance, NetConnectionId netConnectionId) { //IL_0025: Unknown result type (might be due to invalid IL or missing references) //IL_002a: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) if (Core.Players == null) { Core.InitializeAfterLoaded(); } int num = __instance._NetEndPointToApprovedUserIndex[netConnectionId]; Entity userEntity = ((Il2CppArrayBase<ServerClient>)(object)__instance._ApprovedUsersLookup)[num].UserEntity; Core.StealthAdminService.HandleUserConnecting(userEntity); } } [HarmonyPatch(typeof(ServerBootstrapSystem), "OnUserDisconnected")] public static class StealthAdminOnUserDisconnected_Patch { public static void Prefix(ServerBootstrapSystem __instance, NetConnectionId netConnectionId, ConnectionStatusChangeReason connectionStatusReason, string extraData) { //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) //IL_0034: Unknown result type (might be due to invalid IL or missing references) if (Core.Players == null) { Core.InitializeAfterLoaded(); } int num = default(int); if (__instance._NetEndPointToApprovedUserIndex.TryGetValue(netConnectionId, ref num)) { Entity userEntity = ((Il2CppArrayBase<ServerClient>)(object)__instance._ApprovedUsersLookup)[num].UserEntity; Core.StealthAdminService.HandleUserDisconnecting(userEntity); } } } namespace KindredCommands { internal class Buffs { public static bool AddBuff(Entity User, Entity Character, PrefabGUID buffPrefab, int duration = 0, bool immortal = true) { //IL_000d: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_001d: 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_0028: Unknown result type (might be due to invalid IL or missing references) //IL_0029: Unknown result type (might be due to invalid IL or missing references) //IL_0030: 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_0038: 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_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_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_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_0069: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0089: 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_0091: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a1: 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_00a9: 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_00c4: 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_0135: 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_0112: Unknown result type (might be due to invalid IL or missing references) //IL_0117: Unknown result type (might be due to invalid IL or missing references) //IL_0128: Unknown result type (might be due to invalid IL or missing references) //IL_012d: Unknown result type (might be due to invalid IL or missing references) //IL_012e: Unknown result type (might be due to invalid IL or missing references) //IL_00ea: Unknown result type (might be due to invalid IL or missing references) //IL_00eb: 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_00fb: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) //IL_00cc: Unknown result type (might be due to invalid IL or missing references) //IL_00d2: Unknown result type (might be due to invalid IL or missing references) //IL_00d5: Unknown result type (might be due to invalid IL or missing references) //IL_00de: Unknown result type (might be due to invalid IL or missing references) //IL_00e3: 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_013d: Unknown result type (might be due to invalid IL or missing references) //IL_014b: Unknown result type (might be due to invalid IL or missing references) DebugEventsSystem existingSystemManaged = Core.Server.GetExistingSystemManaged<DebugEventsSystem>(); ApplyBuffDebugEvent val = default(ApplyBuffDebugEvent); val.BuffPrefabGUID = buffPrefab; ApplyBuffDebugEvent val2 = val; FromCharacter val3 = default(FromCharacter); val3.User = User; val3.Character = Character; FromCharacter val4 = val3; Entity entity = default(Entity); if (!BuffUtility.TryGetBuff(Core.Server.EntityManager, Character, PrefabIdentifier.op_Implicit(buffPrefab), ref entity)) { existingSystemManaged.ApplyBuff(val4, val2); if (BuffUtility.TryGetBuff(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.Duration = -1f; 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) Entity val = default(Entity); if (BuffUtility.TryGetBuff(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 MonoBehaviour monoBehaviour; public const int MAX_REPLY_LENGTH = 509; private static bool _hasInitialized = false; public static World Server { get; } = GetWorld("Server") ?? throw new Exception("There is no Server world (yet). Did you install a server mod on the client?"); public static EntityManager EntityManager { get; } = Server.EntityManager; public static GameDataSystem GameDataSystem { get; } = Server.GetExistingSystemManaged<GameDataSystem>(); public static PrefabCollectionSystem PrefabCollectionSystem { get; internal set; } public static RelicDestroySystem RelicDestroySystem { get; internal set; } public static ServerScriptMapper ServerScriptMapper { get; internal set; } public static double ServerTime => ServerGameManager.ServerTime; public static ServerGameManager ServerGameManager => ServerScriptMapper.GetServerGameManager(); public static ServerGameSettingsSystem ServerGameSettingsSystem { get; internal set; } public static ManualLogSource Log { get; } = Plugin.PluginLog; public static AnnouncementsService AnnouncementsService { get; internal set; } public static AuditService AuditService { get; } = new AuditService(); public static BoostedPlayerService BoostedPlayerService { get; internal set; } public static BossService Boss { get; internal set; } public static CastleTerritoryService CastleTerritory { get; private set; } public static ConfigSettingsService ConfigSettings { get; internal set; } public static DropItemService DropItem { get; internal set; } public static GearService GearService { get; internal set; } public static GlobalMiscService GlobalMisc { get; internal set; } public static LocalizationService Localization { get; } = new LocalizationService(); public static PlayerService Players { get; internal set; } public static PrefabService Prefabs { get; internal set; } public static PrisonerService Prisoners { get; internal set; } public static RegionService Regions { get; internal set; } public static SoulshardService SoulshardService { get; internal set; } public static StealthAdminService StealthAdminService { get; internal set; } public static TerritoryLocationService TerritoryLocation { get; internal set; } public static TrackPlayerEquipmentService TrackPlayerEquipment { get; internal set; } public static UnitSpawnerService UnitSpawner { get; internal set; } public static void LogException(Exception e, [CallerMemberName] string caller = null) { //IL_000a: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Expected O, but got Unknown ManualLogSource log = Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(51, 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_0103: Unknown result type (might be due to invalid IL or missing references) //IL_0109: Expected O, but got Unknown if (!_hasInitialized) { PrefabCollectionSystem = Server.GetExistingSystemManaged<PrefabCollectionSystem>(); RelicDestroySystem = Server.GetExistingSystemManaged<RelicDestroySystem>(); ServerGameSettingsSystem = Server.GetExistingSystemManaged<ServerGameSettingsSystem>(); ServerScriptMapper = Server.GetExistingSystemManaged<ServerScriptMapper>(); Prefabs = new PrefabService(); ConfigSettings = new ConfigSettingsService(); BoostedPlayerService = new BoostedPlayerService(); Players = new PlayerService(); AnnouncementsService = new AnnouncementsService(); Boss = new BossService(); CastleTerritory = new CastleTerritoryService(); DropItem = new DropItemService(); GearService = new GearService(); GlobalMisc = new GlobalMiscService(); Prisoners = new PrisonerService(); Regions = new RegionService(); SoulshardService = new SoulshardService(); StealthAdminService = new StealthAdminService(); TerritoryLocation = new TerritoryLocationService(); TrackPlayerEquipment = new TrackPlayerEquipmentService(); UnitSpawner = new UnitSpawnerService(); Character.Populate(); _hasInitialized = true; ManualLogSource log = Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(10, 1, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("InitializeAfterLoaded"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" completed"); } log.LogInfo(val); } } 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 Coroutine StartCoroutine(IEnumerator routine) { //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_0027: Expected O, but got Unknown if ((Object)(object)monoBehaviour == (Object)null) { GameObject val = new GameObject("KindredCommands"); monoBehaviour = (MonoBehaviour)(object)val.AddComponent<IgnorePhysicsDebugSystem>(); Object.DontDestroyOnLoad((Object)val); } return monoBehaviour.StartCoroutine(CollectionExtensions.WrapToIl2Cpp(routine)); } public static void StopCoroutine(Coroutine coroutine) { if (!((Object)(object)monoBehaviour == (Object)null)) { monoBehaviour.StopCoroutine(coroutine); } } } 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_0030: 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_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_003b: 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_0000: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0017: Unknown result type (might be due to invalid IL or missing references) 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_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_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_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 Marshal.PtrToStructure<T>(new IntPtr(((EntityManager)(ref entityManager)).GetComponentDataRawRW(entity, val.TypeIndex))); } 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_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_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_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 Marshal.PtrToStructure<T>(new IntPtr(((EntityManager)(ref entityManager)).GetComponentDataRawRO(entity, val.TypeIndex))); } public static DynamicBuffer<T> ReadBuffer<T>(this Entity entity) where T : struct { //IL_0005: 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_000d: 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) EntityManager entityManager = Core.Server.EntityManager; return ((EntityManager)(ref entityManager)).GetBuffer<T>(entity, false); } public static bool Has<T>(this Entity entity) { //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_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) 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_0011: 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_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) PrefabCollectionSystem existingSystemManaged = Core.Server.GetExistingSystemManaged<PrefabCollectionSystem>(); object obj; if (!existingSystemManaged.PrefabGuidToNameDictionary.ContainsKey(prefabGuid)) { obj = "GUID Not Found"; } else { string text = existingSystemManaged.PrefabGuidToNameDictionary[prefabGuid]; PrefabGUID val = prefabGuid; obj = text + " " + ((object)(PrefabGUID)(ref val)).ToString(); } return obj.ToString(); } public static string PrefabName(this PrefabGUID prefabGuid) { //IL_0005: 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) string prefabName = Core.Localization.GetPrefabName(prefabGuid); if (!string.IsNullOrEmpty(prefabName)) { return prefabName; } return prefabGuid.LookupName(); } public static string EntityName(this Entity entity) { //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_000e: Unknown result type (might be due to invalid IL or missing references) //IL_000f: Unknown result type (might be due to invalid IL or missing references) //IL_0014: Unknown result type (might be due to invalid IL or missing references) //IL_0030: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_0039: Unknown result type (might be due to invalid IL or missing references) string text = string.Empty; if (entity.Has<NameableInteractable>()) { NameableInteractable val = entity.Read<NameableInteractable>(); text = ((object)(FixedString64Bytes)(ref val.Name)).ToString(); } if (string.IsNullOrEmpty(text) && entity.Has<PrefabGUID>()) { text = entity.Read<PrefabGUID>().PrefabName(); } if (string.IsNullOrEmpty(text)) { text = ((object)(Entity)(ref entity)).ToString(); } return text; } public static void Add<T>(this Entity entity) { //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_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) 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_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_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) 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 AdminAuthSystem adminAuthSystem = Core.Server.GetExistingSystemManaged<AdminAuthSystem>(); public static ClanSystem_Server clanSystem = Core.Server.GetExistingSystemManaged<ClanSystem_Server>(); public static EntityCommandBufferSystem entityCommandBufferSystem = Core.Server.GetExistingSystemManaged<EntityCommandBufferSystem>(); private static EntityQuery tilePositionQuery = default(EntityQuery); public static PrefabGUID GetPrefabGUID(Entity entity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_000e: 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) EntityManager entityManager = Core.EntityManager; PrefabGUID componentData = default(PrefabGUID); try { componentData = ((EntityManager)(ref entityManager)).GetComponentData<PrefabGUID>(entity); return componentData; } catch { ((PrefabGUID)(ref componentData))..ctor(0); } return componentData; } public static bool TryGetClanEntityFromPlayer(Entity User, out Entity ClanEntity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_000b: Unknown result type (might be due to invalid IL or missing references) //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //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_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_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_0044: Unknown result type (might be due to invalid IL or missing references) if (User.Read<TeamReference>().Value._Value.ReadBuffer<TeamAllies>().Length > 0) { ClanEntity = User.Read<TeamReference>().Value._Value.ReadBuffer<TeamAllies>()[0].Value; return true; } ClanEntity = default(Entity); return false; } public static Entity AddItemToInventory(Entity recipient, PrefabGUID guid, int amount) { //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_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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_0038: 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_0036: Unknown result type (might be due to invalid IL or missing references) try { ServerGameManager serverGameManager = Core.Server.GetExistingSystemManaged<ServerScriptMapper>()._ServerGameManager; return ((ServerGameManager)(ref serverGameManager)).TryAddInventoryItem(recipient, guid, amount).NewEntity; } catch (Exception e) { Core.LogException(e, "AddItemToInventory"); } return default(Entity); } public static NativeArray<Entity> GetEntitiesByComponentType<T1>(bool includeAll = false, bool includeDisabled = false, bool includeSpawn = false, bool includePrefab = false, bool includeDestroyed = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0010: 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_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_001b: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0059: Unknown result type (might be due to invalid IL or missing references) //IL_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_0074: 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_007d: 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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) EntityQueryOptions val = (EntityQueryOptions)0; if (includeAll) { val = (EntityQueryOptions)(val | 0xC3); } if (includeDisabled) { val = (EntityQueryOptions)(val | 2); } if (includeSpawn) { val = (EntityQueryOptions)(val | 0x40); } if (includePrefab) { val = (EntityQueryOptions)(val | 1); } if (includeDestroyed) { val = (EntityQueryOptions)(val | 0x80); } EntityQueryDesc val2 = new EntityQueryDesc(); val2.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[1] { new ComponentType(Il2CppType.Of<T1>(), (AccessMode)0) }); val2.Options = val; EntityQueryDesc val3 = val2; EntityManager entityManager = Core.EntityManager; EntityQuery val4 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)new EntityQueryDesc[1] { val3 }); return ((EntityQuery)(ref val4)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); } public static NativeArray<Entity> GetEntitiesByComponentTypes<T1, T2>(bool includeAll = false, bool includeDisabled = false, bool includeSpawn = false, bool includePrefab = false, bool includeDestroyed = false) { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_0010: 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_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_001b: 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_0021: Unknown result type (might be due to invalid IL or missing references) //IL_0022: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0035: Expected O, but got Unknown //IL_0044: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Unknown result type (might be due to invalid IL or missing references) //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_0078: Unknown result type (might be due to invalid IL or missing references) //IL_0086: 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_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_0027: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) EntityQueryOptions val = (EntityQueryOptions)0; if (includeAll) { val = (EntityQueryOptions)(val | 0xC3); } if (includeDisabled) { val = (EntityQueryOptions)(val | 2); } if (includeSpawn) { val = (EntityQueryOptions)(val | 0x40); } if (includePrefab) { val = (EntityQueryOptions)(val | 1); } if (includeDestroyed) { val = (EntityQueryOptions)(val | 0x80); } EntityQueryDesc val2 = new EntityQueryDesc(); val2.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[2] { new ComponentType(Il2CppType.Of<T1>(), (AccessMode)0), new ComponentType(Il2CppType.Of<T2>(), (AccessMode)0) }); val2.Options = val; EntityQueryDesc val3 = val2; EntityManager entityManager = Core.EntityManager; EntityQuery val4 = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)new EntityQueryDesc[1] { val3 }); return ((EntityQuery)(ref val4)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); } public static IEnumerable<Entity> GetAllEntitiesInRadius<T>(float2 center, float radius) { //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) NativeArray<Entity> entities = GetEntitiesByComponentType<T>(includeAll: false, includeDisabled: true, includeSpawn: true); Enumerator<Entity> enumerator = entities.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; if (current.Has<Translation>()) { float3 value = current.Read<Translation>().Value; if (math.distance(center, ((float3)(ref value)).xz) <= radius) { yield return current; } } } entities.Dispose(); } public static Entity FindClosestTilePosition(Vector3 pos) { //IL_0000: 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_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_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_0095: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //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_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_006f: Unknown result type (might be due to invalid IL or missing references) //IL_0074: Unknown result type (might be due to invalid IL or missing references) //IL_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) //IL_00a6: 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_00af: Unknown result type (might be due to invalid IL or missing references) //IL_00b1: Unknown result type (might be due to invalid IL or missing references) //IL_00b6: Unknown result type (might be due to invalid IL or missing references) //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_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_00d1: 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) //IL_00ec: 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) if (tilePositionQuery == default(EntityQuery)) { EntityManager entityManager = Core.EntityManager; EntityQueryDesc[] array = new EntityQueryDesc[1]; EntityQueryDesc val = new EntityQueryDesc(); val.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[2] { new ComponentType(Il2CppType.Of<TilePosition>(), (AccessMode)1), new ComponentType(Il2CppType.Of<Translation>(), (AccessMode)1) }); val.Options = (EntityQueryOptions)66; array[0] = val; tilePositionQuery = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)array); } Entity result = Entity.Null; float num = float.MaxValue; NativeArray<Entity> val2 = ((EntityQuery)(ref tilePositionQuery)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); for (int i = 0; i < val2.Length; i++) { Entity val3 = val2[i]; if (val3.Has<TilePosition>()) { float3 value = val3.Read<Translation>().Value; float num2 = math.distancesq(float3.op_Implicit(pos), value); if (num2 < num && GetPrefabGUID(val3).LookupName().StartsWith("TM_")) { num = num2; result = val3; } } } val2.Dispose(); return result; } public static Entity FindClosestTilePosition<T>(Vector3 pos, float maxDist = 5f) { //IL_0000: 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_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_0099: Unknown result type (might be due to invalid IL or missing references) //IL_009e: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_0026: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Expected O, but got Unknown //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_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_0061: Unknown result type (might be due to invalid IL or missing references) //IL_0066: Unknown result type (might be due to invalid IL or missing references) //IL_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_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00b2: Unknown result type (might be due to invalid IL or missing references) //IL_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_0115: 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_00bf: 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_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_00cc: 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_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_00fc: Unknown result type (might be due to invalid IL or missing references) if (tilePositionQuery == default(EntityQuery)) { EntityManager entityManager = Core.EntityManager; EntityQueryDesc[] array = new EntityQueryDesc[1]; EntityQueryDesc val = new EntityQueryDesc(); val.All = Il2CppStructArray<ComponentType>.op_Implicit((ComponentType[])(object)new ComponentType[3] { new ComponentType(Il2CppType.Of<TilePosition>(), (AccessMode)1), new ComponentType(Il2CppType.Of<Translation>(), (AccessMode)1), new ComponentType(Il2CppType.Of<T>(), (AccessMode)1) }); val.Options = (EntityQueryOptions)66; array[0] = val; tilePositionQuery = ((EntityManager)(ref entityManager)).CreateEntityQuery((EntityQueryDesc[])(object)array); } Entity result = Entity.Null; float num = maxDist; NativeArray<Entity> val2 = ((EntityQuery)(ref tilePositionQuery)).ToEntityArray(AllocatorHandle.op_Implicit((Allocator)2)); for (int i = 0; i < val2.Length; i++) { Entity val3 = val2[i]; if (val3.Has<TilePosition>()) { float3 value = val3.Read<Translation>().Value; float num2 = math.distancesq(float3.op_Implicit(pos), value); if (num2 < num && GetPrefabGUID(val3).LookupName().StartsWith("TM_")) { num = num2; result = val3; } } } val2.Dispose(); return result; } public static void RepairGear(Entity Character, bool repair = true) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_000a: 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_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_002e: Unknown result type (might be due to invalid IL or missing references) //IL_002f: Unknown result type (might be due to invalid IL or missing references) //IL_0037: 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_0044: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0080: 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_008c: 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_0093: Unknown result type (might be due to invalid IL or missing references) //IL_0098: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a3: Unknown result type (might be due to invalid IL or missing references) //IL_00a5: Unknown result type (might be due to invalid IL or missing references) //IL_00aa: 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_00cb: 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) Equipment val = Character.Read<Equipment>(); NativeList<Entity> val2 = default(NativeList<Entity>); val2..ctor(AllocatorHandle.op_Implicit((Allocator)2)); ((Equipment)(ref val)).GetAllEquipmentEntities(val2, false); Enumerator<Entity> enumerator = val2.GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; if (current.Has<Durability>()) { Durability val3 = current.Read<Durability>(); if (repair) { val3.Value = val3.MaxDurability; } else { val3.Value = 0f; } current.Write<Durability>(val3); } } val2.Dispose(); InventoryBuffer val4 = default(InventoryBuffer); for (int i = 0; i < 36; i++) { if (!InventoryUtilities.TryGetItemAtSlot(Core.EntityManager, Character, i, ref val4)) { continue; } Entity entity = val4.ItemEntity._Entity; if (entity.Has<Durability>()) { Durability val5 = entity.Read<Durability>(); if (repair) { val5.Value = val5.MaxDurability; } else { val5.Value = 0f; } entity.Write<Durability>(val5); } } } public static void ReviveCharacter(Entity Character, Entity User, ChatCommandContext ctx = null) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_0015: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0084: 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_0041: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_009b: Unknown result type (might be due to invalid IL or missing references) //IL_00a0: 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_00a9: 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_00b4: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00ba: Unknown result type (might be due to invalid IL or missing references) //IL_00bc: 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_005c: 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_007d: Unknown result type (might be due to invalid IL or missing references) //IL_007e: Unknown result type (might be due to invalid IL or missing references) //IL_00df: Unknown result type (might be due to invalid IL or missing references) //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00f4: Unknown result type (might be due to invalid IL or missing references) //IL_00f6: Unknown result type (might be due to invalid IL or missing references) //IL_00f7: Unknown result type (might be due to invalid IL or missing references) //IL_00f8: 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_0101: 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) Health val = Character.Read<Health>(); if (ctx != null) { ctx.Reply("TryGetbuff"); } Entity val2 = default(Entity); if (BuffUtility.TryGetBuff(Core.EntityManager, Character, PrefabIdentifier.op_Implicit(Prefabs.Buff_General_Vampire_Wounded_Buff), ref val2)) { if (ctx != null) { ctx.Reply("Destroy"); } DestroyUtility.Destroy(Core.EntityManager, val2, (DestroyDebugReason)13, (string)null, 0); if (ctx != null) { ctx.Reply("Health"); } val.Value = ModifiableFloat.op_Implicit(val.MaxHealth); val.MaxRecoveryHealth = ModifiableFloat.op_Implicit(val.MaxHealth); Character.Write<Health>(val); } if (val.IsDead) { if (ctx != null) { ctx.Reply("Respawn"); } LocalToWorld val3 = Character.Read<LocalToWorld>(); float3 position = ((LocalToWorld)(ref val3)).Position; Nullable_Unboxed<float3> val4 = default(Nullable_Unboxed<float3>); val4.value = position; Nullable_Unboxed<float3> val5 = val4; if (ctx != null) { ctx.Reply("Respawn2"); } ServerBootstrapSystem existingSystemManaged = Core.Server.GetExistingSystemManaged<ServerBootstrapSystem>(); EntityCommandBuffer val6 = Core.Server.GetExistingSystemManaged<EntityCommandBufferSystem>().CreateCommandBuffer(); if (ctx != null) { ctx.Reply("Respawn3"); } existingSystemManaged.RespawnCharacter(val6, User, val5, Character, default(Entity), -1); } } public static void KickPlayer(Entity userEntity) { //IL_0005: 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_000c: Unknown result type (might be due to invalid IL or missing references) //IL_0011: Unknown result type (might be due to invalid IL or missing references) //IL_0012: 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_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_0039: Unknown result type (might be due to invalid IL or missing references) //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_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_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_005f: Unknown result type (might be due to invalid IL or missing references) //IL_006a: Unknown result type (might be due to invalid IL or missing references) //IL_0070: Unknown result type (might be due to invalid IL or missing references) //IL_0073: Unknown result type (might be due to invalid IL or missing references) //IL_007b: 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_008e: 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) EntityManager entityManager = Core.Server.EntityManager; User val = userEntity.Read<User>(); if (val.IsConnected && val.PlatformId != 0L) { 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 UnlockWaypoints(Entity userEntity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_000e: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) //IL_0020: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //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_0032: 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_0040: Unknown result type (might be due to invalid IL or missing references) //IL_0042: Unknown result type (might be due to invalid IL or missing references) //IL_0047: Unknown result type (might be due to invalid IL or missing references) //IL_004c: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = Core.EntityManager; DynamicBuffer<UnlockedWaypointElement> val = ((EntityManager)(ref entityManager)).AddBuffer<UnlockedWaypointElement>(userEntity); val.Clear(); Enumerator<Entity> enumerator = GetEntitiesByComponentType<ChunkWaypoint>().GetEnumerator(); while (enumerator.MoveNext()) { Entity current = enumerator.Current; val.Add(new UnlockedWaypointElement { Waypoint = current.Read<NetworkId>() }); } } public static void RevealMapForPlayer(Entity userEntity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //IL_0005: 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_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_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_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_0022: Unknown result type (might be due to invalid IL or missing references) //IL_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002c: 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_0033: Unknown result type (might be due to invalid IL or missing references) //IL_0038: Unknown result type (might be due to invalid IL or missing references) //IL_003b: Unknown result type (might be due to invalid IL or missing references) //IL_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_004e: 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_0062: Unknown result type (might be due to invalid IL or missing references) //IL_006b: Unknown result type (might be due to invalid IL or missing references) EntityManager entityManager = Core.EntityManager; Enumerator<UserMapZoneElement> enumerator = ((EntityManager)(ref entityManager)).GetBuffer<UserMapZoneElement>(userEntity, false).GetEnumerator(); while (enumerator.MoveNext()) { UserMapZoneElement current = enumerator.Current; NetworkedEntity userZoneEntity = current.UserZoneEntity; Entity entityOnServer = ((NetworkedEntity)(ref userZoneEntity)).GetEntityOnServer(); entityManager = Core.EntityManager; DynamicBuffer<UserMapZonePackedRevealElement> buffer = ((EntityManager)(ref entityManager)).GetBuffer<UserMapZonePackedRevealElement>(entityOnServer, false); buffer.Clear(); UserMapZonePackedRevealElement val = default(UserMapZonePackedRevealElement); val.PackedPixel = byte.MaxValue; UserMapZonePackedRevealElement val2 = val; for (int i = 0; i < 8192; i++) { buffer.Add(val2); } } } } [BepInPlugin("aa.odjit.KindredCommands", "KindredCommands", "2.3.0")] [BepInDependency(/*Could not decode attribute arguments.*/)] public class Plugin : BasePlugin { internal static Harmony Harmony; internal static ManualLogSource PluginLog; public static ManualLogSource LogInstance { get; private set; } public override void Load() { //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0083: Unknown result type (might be due to invalid IL or missing references) //IL_008d: Expected O, but got Unknown if (!(Application.productName != "VRisingServer")) { PluginLog = ((BasePlugin)this).Log; ManualLogSource log = ((BasePlugin)this).Log; bool flag = default(bool); BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(27, 2, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Plugin "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("aa.odjit.KindredCommands"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" version "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>("2.3.0"); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" is loaded!"); } log.LogInfo(val); LogInstance = ((BasePlugin)this).Log; Database.InitConfig(); Harmony = new Harmony("aa.odjit.KindredCommands"); Harmony.PatchAll(Assembly.GetExecutingAssembly()); CommandRegistry.RegisterAll(); } } public override bool Unload() { CommandRegistry.UnregisterAssembly(); Harmony harmony = Harmony; if (harmony != null) { harmony.UnpatchSelf(); } return true; } public void OnGameInitialized() { if (!HasLoaded()) { ((BasePlugin)this).Log.LogDebug((object)"Attempt to initialize before everything has loaded."); } else { Core.InitializeAfterLoaded(); } } private static bool HasLoaded() { PrefabCollectionSystem existingSystemManaged = Core.Server.GetExistingSystemManaged<PrefabCollectionSystem>(); if (existingSystemManaged == null) { return false; } return existingSystemManaged.SpawnableNameToPrefabGuidDictionary.Count > 0; } } public static class MyPluginInfo { public const string PLUGIN_GUID = "aa.odjit.KindredCommands"; public const string PLUGIN_NAME = "KindredCommands"; public const string PLUGIN_VERSION = "2.3.0"; } } namespace KindredCommands.Services { [HarmonyBefore(new string[] { "gg.deca.VampireCommandFramework" })] [HarmonyPatch(typeof(ServerBootstrapSystem), "SendRevealedMapData")] public static class RevealedMapDataPatch { public static void Prefix(ServerBootstrapSystem __instance, Entity userEntity, User user) { //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001a: Unknown result type (might be due to invalid IL or missing references) //IL_001f: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Unknown result type (might be due to invalid IL or missing references) if (Core.ConfigSettings == null) { Core.InitializeAfterLoaded(); } if (Core.ConfigSettings.RevealMapToAll) { User val = userEntity.Read<User>(); if (((FixedString64Bytes)(ref val.CharacterName)).IsEmpty) { Helper.RevealMapForPlayer(userEntity); } } } } internal class AdminService { public static void AdminUser(Entity userEntity) { //IL_0000: Unknown result type (might be due to invalid IL or missing references) //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_000c: 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_0023: Unknown result type (might be due to invalid IL or missing references) //IL_0028: Unknown result type (might be due to invalid IL or missing references) //IL_002d: Unknown result type (might be due to invalid IL or missing references) //IL_0034: 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_004f: Unknown result type (might be due to invalid IL or missing references) //IL_0050: Unknown result type (might be due to invalid IL or missing references) //IL_0055: Unknown result type (might be due to invalid IL or missing references) User val = userEntity.Read<User>(); EntityManager entityManager = Core.EntityManager; ((EntityManager)(ref entityManager)).CreateEntity((ComponentType[])(object)new ComponentType[2] { ComponentType.ReadWrite<FromCharacter>(), ComponentType.ReadWrite<AdminAuthEvent>() }).Write<FromCharacter>(new FromCharacter { Character = ((NetworkedEntity)(ref val.LocalCharacter)).GetEntityOnServer(), User = userEntity }); } } internal class AnnouncementsService { public struct Announcement { public string Name { get; set; } public string Time { get; set; } public string Message { get; set; } public bool OneTime { get; set; } } private static readonly string CONFIG_PATH = Path.Combine(Paths.ConfigPath, "KindredCommands"); private static readonly string ANNOUNCEMENTS_PATH = Path.Combine(CONFIG_PATH, "announcements.json"); private readonly List<Announcement> announcements = new List<Announcement>(); private Dictionary<string, Coroutine> announcementCoroutines = new Dictionary<string, Coroutine>(); public AnnouncementsService() { LoadAnnoucements(); } private void ScheduleAnnouncement(Announcement announcement) { Coroutine val = Core.StartCoroutine(MessageCoroutine(announcement)); if (val != null) { announcementCoroutines[announcement.Name] = val; } } private IEnumerator MessageCoroutine(Announcement announcement) { if (!DateTime.TryParse(announcement.Time, out var announcementTime)) { ManualLogSource log = Core.Log; bool flag = default(bool); BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(64, 3, ref flag); if (flag) { ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Failed to parse time for announcement "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(announcement.Name); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" with time "); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(announcement.Time); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral(" and message \""); ((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(announcement.Message); ((BepInExLogInterpolatedStringHandler)val).AppendLiteral("\""); } log.LogError(val); } else { if (!announcement.OneTime && announcementTime < DateTime.Now) { announcementTime = announcementTime.AddDays(1.0); } do { yield return (object)new WaitForSecondsRealtime((float)(announcementTime - DateTime.Now).TotalSeconds); ServerChatUtils.SendSystemMessageToAllClients(Core.EntityManager, announcement.Message); announcementTime = announcementTime.AddDays(1.0); SortAnnouncements(); } while (!announcement.OneTime); announcements.Remove(announcement); announcementCoroutines.Remove(announcement.Name); SaveAnnoucements(); } } public bool AddAnnouncement(string name, string message, string time, bool oneTime) { string nameLower = name.ToLowerInvariant(); if (announcements.Where((Announcement a) => a.Name.ToLowerInvariant() == nameLower).Any()) { return false; } Announcement announcement = default(Announcement); announcement.Name = name; announcement.Time = time; announcement.Message = message; announcement.OneTime = oneTime; Announcement announcement2 = announcement; announcements.Add(announcement2); ScheduleAnnouncement(announcement2); SortAnnouncements(); SaveAnnoucements(); return true; } private void SortAnnouncements() { announcements.Sort(AnnouncementCompare); static int AnnouncementCompare(Announcement x, Announcement y) { if (!DateTime.TryParse(x.Time, out var result)) { return -1; } if (!DateTime.TryParse(y.Time, out var result2)) { return 1; } DateTime now = DateTime.Now; if (result < now) { result = result.AddDays(1.0); } if (result2 < now) { result2 = result2.AddDays(1.0); } int num = DateTime.Compare(result, result2); if (num == 0) { num = string.Compare(x.Name, y.Name, StringComparison.InvariantCultureIgnoreCase); } return num; } } public bool RemoveAnnouncement(string name) { string nameLower = name.ToLowerInvariant(); IEnumerable<string> source = from a in announcements where a.Name.ToLowerInvariant() == nameLower select a into x select x.Name; if (!source.Any()) { return false; } name = source.First(); announcements.RemoveAll((Announcement a) => a.Name == name); if (!announcementCoroutines.TryGetValue(name, out var value)) { SaveAnnoucements(); return true; } Core.StopCoroutine(value); announcementCoroutines.Remove(name); SaveAnnoucements(); return true; } public IEnumerable<Announcement> GetAnnouncements() { return announcements; } private void LoadAnnoucements() { if (File.Exists(ANNOUNCEMENTS_PATH)) { string json = File.ReadAllText(ANNOUNCEMENTS_PATH); announcements.Clear(); announcements.AddRange(JsonSerializer.Deserialize<Announcement[]>(json)); SortAnnouncements(); foreach (Coroutine value in announcementCoroutines.Values) { Core.StopCoroutine(value); } announcementCoroutines.Clear(); { foreach (Announcement announcement in announcements) { ScheduleAnnouncement(announcement); } return; } } SaveAnnoucements(); } private void SaveAnnoucements() { if (!Directory.Exists(CONFIG_PATH)) { Directory.CreateDirectory(CONFIG_PATH); } JsonSerializerOptions options = new JsonSerializerOptions { WriteIndented = true }; string contents = JsonSerializer.Serialize(announcements, options); File.WriteAllText(ANNOUNCEMENTS_PATH, contents); } } internal class AuditService { private static readonly string CONFIG_PATH = Path.Combine(Paths.ConfigPath, "KindredCommands"); private static readonly string AUDIT_PATH = Path.Combine(CONFIG_PATH, "audit-" + DateTime.Now.ToString("yyyy-MM-dd_HH-mm-ss") + ".csv"); private Mutex mutex = new Mutex(initiallyOwned: false, $"KindredCommands.AuditService-{Process.GetCurrentProcess().Id}"); public void LogChatMessage(User fromUser, User toUser, ChatMessageType type, CommandResult vcfResult, string message) { //IL_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0094: 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_00c7: Unknown result type (might be due to invalid IL or missing references) //IL_00c8: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); stringBuilder.Append(","); stringBuilder.Append("chat"); stringBuilder.Append(","); stringBuilder.Append(fromUser.PlatformId); stringBuilder.Append(","); stringBuilder.Append(fromUser.CharacterName); stringBuilder.Append(","); stringBuilder.Append(type); stringBuilder.Append(","); stringBuilder.Append(vcfResult); stringBuilder.Append(","); stringBuilder.Append(toUser.PlatformId); stringBuilder.Append(","); stringBuilder.Append(toUser.CharacterName); stringBuilder.Append(","); stringBuilder.Append(message); stringBuilder.Append("\n"); AddAuditString(stringBuilder); } public void LogMapTeleport(User user, TeleportTarget teleportTarget, float3 destination) { //IL_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); stringBuilder.Append(","); stringBuilder.Append("teleportMap"); stringBuilder.Append(","); stringBuilder.Append(user.PlatformId); stringBuilder.Append(","); stringBuilder.Append(user.CharacterName); stringBuilder.Append(","); stringBuilder.Append(teleportTarget); stringBuilder.Append(","); stringBuilder.Append(destination); stringBuilder.Append("\n"); AddAuditString(stringBuilder); } public void LogTeleport(User user, TeleportTarget teleportTarget, float3 mousePosition, TeleportLocation location, float3 locationPosition) { //IL_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) //IL_00ad: Unknown result type (might be due to invalid IL or missing references) //IL_00c7: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); stringBuilder.Append(","); stringBuilder.Append("teleport"); stringBuilder.Append(","); stringBuilder.Append(user.PlatformId); stringBuilder.Append(","); stringBuilder.Append(user.CharacterName); stringBuilder.Append(","); stringBuilder.Append(teleportTarget); stringBuilder.Append(","); stringBuilder.Append(mousePosition); stringBuilder.Append(","); stringBuilder.Append(location); stringBuilder.Append(","); stringBuilder.Append(locationPosition); stringBuilder.Append("\n"); AddAuditString(stringBuilder); } public void LogDestroy(User user, string what, DestroyWhere where, PrefabGUID prefabGuid, float3 position, int amount) { //IL_0044: 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_005e: 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_00a8: Unknown result type (might be due to invalid IL or missing references) //IL_00c2: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); stringBuilder.Append(","); stringBuilder.Append("destroy"); stringBuilder.Append(","); stringBuilder.Append(user.PlatformId); stringBuilder.Append(","); stringBuilder.Append(user.CharacterName); stringBuilder.Append(","); stringBuilder.Append(what); stringBuilder.Append(","); stringBuilder.Append(where); stringBuilder.Append(","); stringBuilder.Append(prefabGuid.LookupName()); stringBuilder.Append(","); stringBuilder.Append(position); stringBuilder.Append(","); stringBuilder.Append(amount); stringBuilder.Append("\n"); AddAuditString(stringBuilder); } public void LogGive(User user, PrefabGUID prefabGuid, int amount) { //IL_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); stringBuilder.Append(","); stringBuilder.Append("give"); stringBuilder.Append(","); stringBuilder.Append(user.PlatformId); stringBuilder.Append(","); stringBuilder.Append(user.CharacterName); stringBuilder.Append(","); stringBuilder.Append(prefabGuid.LookupName()); stringBuilder.Append(","); stringBuilder.Append(amount); stringBuilder.Append("\n"); AddAuditString(stringBuilder); } public void LogBecomeObserver(User user, int mode) { //IL_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); stringBuilder.Append(","); stringBuilder.Append("becomeObserver"); stringBuilder.Append(","); stringBuilder.Append(user.PlatformId); stringBuilder.Append(","); stringBuilder.Append(user.CharacterName); stringBuilder.Append(","); stringBuilder.Append(mode); stringBuilder.Append("\n"); AddAuditString(stringBuilder); } public void LogCastleHeartAdmin(User user, CastleHeartInteractEventType eventType, NetworkId castleHeart, int userIndex) { //IL_0044: 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_005e: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Unknown result type (might be due to invalid IL or missing references) //IL_0094: Unknown result type (might be due to invalid IL or missing references) StringBuilder stringBuilder = new StringBuilder(); stringBuilder.Append(DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss")); stringBuilder.Append(","); stringBuilder.Append("castleHeartAdmin"); stringBuilder.Append(","); stringBuilder.Append(user.PlatformId); stringBuilder.Append(","); stringBuilder.Append(user.CharacterName); stringBuilder.Append(","); stringBuilder.Append(eventType); stringBuilder.Append(","); stringBuilder.Append(castleHeart); stringBuilder.Append(","); stringBuilder.Append(userIndex); stringBuilder.Append("\n"); AddAuditString(stringBuilder); } private void AddAuditString(StringBuilder sb) { Task.Run(delegate { try { mutex.WaitOne(); File.AppendAllText(AUDIT_PATH, sb.ToString()); } finally { mutex.ReleaseMutex(); } }); } } internal class BoostedPlayerService { private readonly Dictionary<Entity, float> playerAttackSpeed = new Dictionary<Entity, float>(); private readonly Dictionary<Entity, float> playerDamage = new Dictionary<Entity, float>(); private readonly Dictionary<Entity, float> playerHps = new Dictionary<Entity, float>(); private readonly Dictionary<Entity, float> playerSpeeds = new Dictionary<Entity, float>(); private readonly Dictionary<Entity, float> playerYield = new Dictionary<Entity, float>(); private readonly HashSet<Entity> batVisionPlayers = new HashSet<Entity>(); private readonly HashSet<Entity> flyingPlayers = new HashSet<Entity>(); private readonly HashSet<Entity> noAggroPlayers = new HashSet<Entity>(); private readonly HashSet<Entity> noBlooddrainPlayers = new HashSet<Entity>(); private readonly HashSet<Entity> noDurabilityPlayers = new HashSet<Entity>(); private readonly HashSet<Entity> noCooldownPlayers = new HashSet<Entity>(); private readonly HashSet<Entity> immaterialPlayers = new HashSet<Entity>(); private readonly HashSet<Entity> invinciblePlayers = new HashSet<Entity>(); private readonly HashSet<Entity> shroudedPlayers = new HashSet<Entity>(); private readonly HashSet<Entity> sunInvulnPlayers = new HashSet<Entity>(); private readonly HashSet<Entity> daywalkerPlayers = new HashSet<Entity>(); private static ModifyUnitStatBuff_DOTS Cooldown = new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)7, Value = 100f, ModificationType = (ModificationType)0, Modifier = 1f, Id = ModificationId.NewId(0) }; private static ModifyUnitStatBuff_DOTS SunCharge = new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)12, Value = 50000f, ModificationType = (ModificationType)3, Modifier = 1f, Id = ModificationId.NewId(0) }; private static ModifyUnitStatBuff_DOTS Hazard = new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)60, Value = 1f, ModificationType = (ModificationType)3, Modifier = 1f, Id = ModificationId.NewId(0) }; private static ModifyUnitStatBuff_DOTS SunResist = new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)19, Value = 10000f, ModificationType = (ModificationType)3, Modifier = 1f, Id = ModificationId.NewId(0) }; private static ModifyUnitStatBuff_DOTS Speed = new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)5, Value = 15f, ModificationType = (ModificationType)0, Modifier = 1f, Id = ModificationId.NewId(4) }; private static ModifyUnitStatBuff_DOTS PResist = new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)8, Value = 10000f, ModificationType = (ModificationType)3, Modifier = 1f, Id = ModificationId.NewId(0) }; private static ModifyUnitStatBuff_DOTS FResist = new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)9, Value = 10000f, ModificationType = (ModificationType)3, Modifier = 1f, Id = ModificationId.NewId(0) }; private static ModifyUnitStatBuff_DOTS HResist = new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)10, Value = 10000f, ModificationType = (ModificationType)3, Modifier = 1f, Id = ModificationId.NewId(0) }; private static ModifyUnitStatBuff_DOTS SResist = new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)11, Value = 10000f, ModificationType = (ModificationType)3, Modifier = 1f, Id = ModificationId.NewId(0) }; private static ModifyUnitStatBuff_DOTS GResist = new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)20, Value = 10000f, ModificationType = (ModificationType)3, Modifier = 1f, Id = ModificationId.NewId(0) }; private static ModifyUnitStatBuff_DOTS SPResist = new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)23, Value = 10000f, ModificationType = (ModificationType)3, Modifier = 1f, Id = ModificationId.NewId(0) }; private static ModifyUnitStatBuff_DOTS PPower = new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)0, Value = 10000f, ModificationType = (ModificationType)3, Modifier = 1f, Id = ModificationId.NewId(0) }; private static ModifyUnitStatBuff_DOTS SiegePower = new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)2, Value = 10000f, ModificationType = (ModificationType)3, Modifier = 1f, Id = ModificationId.NewId(0) }; private static ModifyUnitStatBuff_DOTS RPower = new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)1, Value = 10000f, ModificationType = (ModificationType)3, Modifier = 1f, Id = ModificationId.NewId(0) }; private static ModifyUnitStatBuff_DOTS SPPower = new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)25, Value = 10000f, ModificationType = (ModificationType)3, Modifier = 1f, Id = ModificationId.NewId(0) }; private static ModifyUnitStatBuff_DOTS PHRegen = new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)26, Value = 100000f, ModificationType = (ModificationType)3, Modifier = 1f, Id = ModificationId.NewId(0) }; private static ModifyUnitStatBuff_DOTS HRecovery = new ModifyUnitStatBuff_DOTS { StatType = (UnitStatType)62, Value = 100000f, ModificationType = (ModificationType)3, Modifier = 1f, Id = ModificationId.NewId(0) }; private static ModifyUnitStatBuff_DOTS MaxHP = new ModifyUnitS